|
1 | 1 | #!/bin/sh |
2 | | -# |
3 | | -# This can format all PostgreSQL *.c and *.h files, |
4 | | -# excluding libpq++, *.y, and *.l files. |
5 | | -# |
6 | | -# On 09/06/1997, from the top directory, I ran: |
7 | | -# |
8 | | -# find . -name '*.[ch]' -type f -print | grep -v '++' | xargs -n100 pgindent |
9 | | -# |
10 | | -# The stock BSD indent has two bugs. First, a comment after the word 'else' |
11 | | -# causes the rest of the file to be ignored. Second, it silently ignores |
12 | | -# typedefs after getting the first 100. |
13 | | -# |
14 | | -# Both problems are worked-around in this script. |
15 | | -# We also include a patch for the second bug in: |
16 | | -#/src/tools/pgindent/indent.bsd.patch |
17 | | -# Even with the workaround, installation of the patch produces better output. |
18 | | -# |
19 | | -# GNU indent has many bugs, and it not recommended. See the description |
20 | | -# below. |
21 | | -# |
22 | | -# We get the list of typedef's from /src/tools/find_typedef |
23 | | -# |
24 | 2 |
|
25 | 3 | trap"rm -f /tmp/$$ /tmp/$$a" 0 1 2 3 15 |
26 | 4 | entab</dev/null>/dev/null |
|
38 | 16 | indent -version -npro</dev/null>/dev/null2>&1 |
39 | 17 | if ["$?"-eq 0 ] |
40 | 18 | thenecho"You appear to have GNU indent rather than BSD indent.">&2 |
41 | | -echo"Be warned, it has some small bugs, GNU indent version 1.9.1.">&2 |
42 | | -echo"These bugs become pretty major when you are doing >200k lines of code.">&2 |
43 | | -echo"If you don't believe me, take a directory and make a copy.">&2 |
44 | | -echo"Run pgindent on the copy using GNU indent, and do a diff -r.">&2 |
45 | | -echo"You will see what I mean." |
46 | | -echo"GNU indent does some things better, but mangles too.">&2 |
| 19 | +echo"See the pgindent/README file for a description of its problems.">&2 |
47 | 20 | EXTRA_OPTS="-ncdb -bli0 -npcs -cli4" |
48 | 21 | elseecho"Hope you installed /src/tools/pgindent/indent.bsd.patch.">&2 |
49 | 22 | EXTRA_OPTS="-bbb -cli1" |
|