]> granicus.if.org Git - postgresql/blob - src/tools/pgindent/pgjindent
libpq needs pgsleep on win32 because of the changes to port/open.c.
[postgresql] / src / tools / pgindent / pgjindent
1 #!/bin/sh
2
3 # $PostgreSQL: pgsql/src/tools/pgindent/pgjindent,v 1.3 2006/03/11 04:38:42 momjian Exp $
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=java -b -p -j -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