]> git.gag.com Git - fw/openocd/blob - tools/uncrustify1.sh
cmsis-dap: print vendor and product id on open failure
[fw/openocd] / tools / uncrustify1.sh
1 #!/bin/sh
2 # Run the beautifier "Uncrustify" on a single file.
3 # Because the file "uncrustify.cfg" only exists in the top level of the project
4 # you should run this script from there so this script can find your uncrustify.cfg file.
5
6
7 UNCRUSTIFYTMP=/tmp/uncrustify.tmp
8
9
10 if [ ! -f uncrustify.cfg ]; then
11     echo "unable to find uncrustify.cfg, aborting"
12     exit 1
13 fi
14
15 UNCRUSTIFYBIN=`which uncrustify`
16
17 if [ "$UNCRUSTIFYBIN" = "" ]; then
18     echo "you must specify uncrustify in your PATH, I cannot find it"
19     exit 2
20 fi
21
22 if [ $# -lt 1 ]; then
23     echo "Usage $0 <filename .c or .h>"
24     exit 3
25 fi
26
27 uncrustify -c uncrustify.cfg <$1 >$UNCRUSTIFYTMP
28
29 # you can comment this out while tuning the uncrustify.cfg file:
30 mv $UNCRUSTIFYTMP $1