1
This can format all PostgreSQL *.c and *.h files, but excludes *.y, and *.l
4
Get the list of typedef's included in pgindent by running this on the
7
/src/tools/find_typedef
9
and update the list in pgindent. This requires the binaries have debug
12
From the top directory, run:
14
find . -name '*.[ch]' -type f -print | egrep -v '\+\+|s_lock.h' | xargs -n100 pgindent
16
The stock BSD indent has two bugs. First, a comment after the word 'else'
17
causes the rest of the file to be ignored. Second, it silently ignores
18
typedefs after getting the first 100.
20
Both problems are worked-around in this script. We also include a patch
21
for the second bug in:
23
/src/tools/pgindent/indent.bsd.patch
25
Even with the workaround, installation of the patch produces better
26
output. You can get a patched BSD indent from ftp://ftp.postgresql.org/pub/dev.
28
GNU indent, version 2.2.6, has several problems, and is not recommended.
29
These bugs become pretty major when you are doing >400k lines of code.
30
If you don't believe me, take a directory and make a copy. Run pgindent
31
on the copy using GNU indent, and do a diff -r. You will see what I
32
mean. GNU indent does some things better, but mangles too.
35
---------------------------------------------------------------------------
37
For java, we use astyle, http://astyle.sourceforge.net/, with the
40
find . \( -name '*.java' -o -name '*.java.in' \) -print |
43
---------------------------------------------------------------------------
45
For cpp, we use astyle, http://astyle.sourceforge.net/, with the
48
find src/interfaces/libpq++ -name '*.[ch]' -print |
49
xargs -n100 pgcppindent