mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
40 lines
1.4 KiB
Plaintext
40 lines
1.4 KiB
Plaintext
This can format all PostgreSQL *.c and *.h files, excluding libpq++,
|
|
*.y, and *.l files.
|
|
|
|
On 09/06/1997, from the top directory, I ran:
|
|
|
|
find . -name '*.[ch]' -type f -print | egrep -v '\+\+|s_lock.h' | xargs -n100 pgindent
|
|
|
|
The stock BSD indent has two bugs. First, a comment after the word 'else'
|
|
causes the rest of the file to be ignored. Second, it silently ignores
|
|
typedefs after getting the first 100.
|
|
|
|
Both problems are worked-around in this script. We also include a patch
|
|
for the second bug in:
|
|
|
|
/src/tools/pgindent/indent.bsd.patch
|
|
|
|
Even with the workaround, installation of the patch produces better
|
|
output.
|
|
|
|
GNU indent, version 2.2.6, has several problems, and is not recommended.
|
|
These bugs become pretty major when you are doing >400k lines of code.
|
|
If you don't believe me, take a directory and make a copy. Run pgindent
|
|
on the copy using GNU indent, and do a diff -r. You will see what I
|
|
mean. GNU indent does some things better, but mangles too.
|
|
|
|
We get the list of typedef's included in pgindent by running:
|
|
|
|
/src/tools/find_typedef
|
|
|
|
Make sure to do the pgsql/bin directory, and the src/interfaces/odbc
|
|
directory. Merge the output of these and remove duplicates.
|
|
|
|
---------------------------------------------------------------------------
|
|
|
|
For java, we use astyle, http://astyle.sourceforge.net/, with the
|
|
following options:
|
|
|
|
find . \( -name '*.java' -o -name '*.java.in' \) -print |
|
|
xargs -n100 pgjindent
|