]> granicus.if.org Git - postgresql/blob - src/tools/pgindent/pgcppindent
Run pg_upgrade and pg_resetxlog with restricted token on Windows
[postgresql] / src / tools / pgindent / pgcppindent
1 #!/bin/sh
2
3 # src/tools/pgindent/pgcppindent
4
5 trap "rm -f /tmp/$$ /tmp/$$a" 0 1 2 3 15
6 entab </dev/null >/dev/null
7 if [ "$?" -ne 0 ]
8 then    echo "Go to the src/tools/entab directory and do a 'make' and 'make install'." >&2
9         echo "This will put the 'entab' command in your path." >&2
10         echo "Then run $0 again."
11         exit 1
12 fi
13 astyle --version </dev/null >/dev/null 2>&1
14 if [ "$?" -eq 0 ]
15 then    echo "You do not appear to have 'astyle' installed on your system." >&2
16         exit 1
17 fi
18
19 for FILE
20 do
21         astyle --style=ansi -b -p -S < "$FILE" >/tmp/$$ 2>/tmp/$$a
22         if [ "$?" -ne 0 -o -s /tmp/$$a ]
23         then    echo "$FILE"
24                 cat /tmp/$$a
25         fi
26         cat /tmp/$$ |
27         entab -t4 -qc |
28         cat >/tmp/$$a && cat /tmp/$$a >"$FILE"
29 done