]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/uncrustify.sh
Merge remote-tracking branch 'origin/sev/waypointarrow'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / uncrustify.sh
1 fix_function_types() {
2         # Uncrustify handles QC function types (example:
3         #  void(void) func;
4         # ) wrong and removes the space between type and variable. Fix this by
5         # a simple sed on ")letter" which should normally not occur.
6         sed -e 's/)\([A-Za-z0-9]\)/) \1/g' "$@"
7 }
8
9 if [ -z "$UNCRUSTIFY_CONFIG" ]; then
10         UNCRUSTIFY_CONFIG=`git rev-parse --show-toplevel`/qcsrc/uncrustify.cfg
11 fi
12
13 case "$#" in
14         0)
15                 uncrustify --frag -c "$UNCRUSTIFY_CONFIG" |\
16                 fix_function_types
17                 ;;
18         *)
19                 uncrustify --replace --no-backup -c "$UNCRUSTIFY_CONFIG" "$@" &&\
20                 fix_function_types -i "$@"
21                 ;;
22 esac