Skip to content

Commit d88ff48

Browse files
committed
Added pgindent/README file.
1 parent b3b0f20 commit d88ff48

File tree

2 files changed

+30
-28
lines changed

2 files changed

+30
-28
lines changed

src/tools/pgindent.dir/README

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
This can format all PostgreSQL *.c and *.h files, excluding libpq++,
2+
*.y, and *.l files.
3+
4+
On 09/06/1997, from the top directory, I ran:
5+
6+
find . -name '*.[ch]' -type f -print | grep -v '++' | xargs -n100 pgindent
7+
8+
The stock BSD indent has two bugs. First, a comment after the word 'else'
9+
causes the rest of the file to be ignored. Second, it silently ignores
10+
typedefs after getting the first 100.
11+
12+
Both problems are worked-around in this script. We also include a patch
13+
for the second bug in:
14+
15+
/src/tools/pgindent/indent.bsd.patch
16+
17+
Even with the workaround, installation of the patch produces better
18+
output.
19+
20+
GNU indent, version 1.9.1, has several bugs, and is not recommended.
21+
These bugs become pretty major when you are doing >200k lines of code.
22+
If you don't believe me, take a directory and make a copy. Run pgindent
23+
on the copy using GNU indent, and do a diff -r. You will see what I
24+
mean. GNU indent does some things better, but mangles too.
25+
26+
We get the list of typedef's included in pgindent by running:
27+
28+
/src/tools/find_typedef
29+

src/tools/pgindent.dir/pgindent

+1-28
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,4 @@
11
#!/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-
#
242

253
trap "rm -f /tmp/$$ /tmp/$$a" 0 1 2 3 15
264
entab </dev/null >/dev/null
@@ -38,12 +16,7 @@ fi
3816
indent -version -npro </dev/null >/dev/null 2>&1
3917
if [ "$?" -eq 0 ]
4018
then echo "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
4720
EXTRA_OPTS="-ncdb -bli0 -npcs -cli4"
4821
else echo "Hope you installed /src/tools/pgindent/indent.bsd.patch." >&2
4922
EXTRA_OPTS="-bbb -cli1"

0 commit comments

Comments
 (0)