1 FILES=`find client common menu server warpzonelib -name \*.c -o -name \*.h -o -name \*.qc -o -name \*.qh`
8 printf "%-40s = %-8s # %s\n" "$KEY" "$VAL" "$COMMENT"
13 verybestscore=2147483647
17 secondbestscore=2147483647
23 for choice in "$VAL" "$@"; do
32 if [ x"$choice" = x"force" ]; then
35 if [ x"$choice" = x"ignore" ]; then
38 if [ x"$choice" = x"false" ]; then
41 if [ x"$choice" = x"0" ]; then
44 if [ x"$MODE" = x"initialize" ]; then
45 if [ x"$choice" = x"ignore" ]; then
53 printf "%s = %s\n" "$KEY" "$choice"
54 } > uncrustify.cfg.test
55 uncrustify -c uncrustify.cfg.test --replace --no-backup $FILES >/dev/null 2>&1
57 git diff --numstat > diffstat.tmp
58 while read -r add del rest; do
59 if [ x"$add" != x"-" ]; then
60 score=$(($score + $add))
62 if [ x"$del" != x"-" ]; then
63 score=$(($score + $del))
66 git reset --hard >/dev/null 2>&1
68 echo >&2 "$KEY = $choice: $score"
69 if [ x"$choice" != x"ignore" ]; then
70 if [ $score -lt $bestscore ]; then
71 secondbestscore=$bestscore
72 secondbestchoice=$bestchoice
75 elif [ $score -lt $secondbestscore ]; then
76 secondbestscore=$score
77 secondbestchoice=$choice
80 if [ $score -lt $verybestscore ]; then
82 verybestchoice=$choice
84 if [ $score -gt $worstscore ]; then
89 if [ -z "$bestchoice" ]; then
90 echo "# WARNING: No best choice identified"
91 elif [ $verybestscore -ge $worstscore ]; then
92 echo "# WARNING: Code doesn't seem to use this feature - delete from the config?"
100 elif [ $bestscore -ge $worstscore ]; then
101 echo "# WARNING: Indifferent... please decide manually."
102 elif [ $bestscore -ge $secondbestscore ]; then
103 echo "# WARNING: Best is not unique ($bestchoice $secondbestchoice)"
104 elif [ $bestscore -gt $verybestscore ]; then
105 echo "# NOTE: is $(($bestscore - $verybestscore)) worse than $verybestchoice"
111 while read -r LINE; do
131 printf "%s\n" "$LINE" | while read KEY EQ VAL DELIM COMMENT; do
133 [ x"$EQ" != x"=" ] || \
134 [ x"$DELIM" != x"#" ]; then
141 indent_columns|*tab*)
145 decide 0 1 2 3 4 indent_columns
151 printf "# WARNING: unsupported %s\n" "$COMMENT"
155 printf "# ERROR: invalid characters %s\n" "$COMMENT"
159 decide `echo "$COMMENT" | tr / ' '`
163 printf "# ERROR: only once choice %s\n" "$COMMENT"
168 done < uncrustify.cfg