Commit 149ac7d4 authored by Bruce Momjian's avatar Bruce Momjian

Replace pgindent shell script with Perl script. Update perltidy

instructions to perltidy Perl files that lack Perl file extensions.

pgindent Perl coding by Andrew Dunstan, restructured by me.
parent 46394325
src/tools/pgindent/README
pgindent pgindent
======== ========
...@@ -26,9 +24,7 @@ This can format all PostgreSQL *.c and *.h files, but excludes *.y, and ...@@ -26,9 +24,7 @@ This can format all PostgreSQL *.c and *.h files, but excludes *.y, and
6) Run pgindent: 6) Run pgindent:
find . -name '*.[ch]' -type f -print | \ pgindent
egrep -v -f src/tools/pgindent/exclude_file_patterns | \
xargs -n100 src/tools/pgindent/pgindent src/tools/pgindent/typedefs.list
7) Remove any files that generate errors and restore their original 7) Remove any files that generate errors and restore their original
versions. versions.
...@@ -46,7 +42,14 @@ This can format all PostgreSQL *.c and *.h files, but excludes *.y, and ...@@ -46,7 +42,14 @@ This can format all PostgreSQL *.c and *.h files, but excludes *.y, and
9) Indent the Perl code: 9) Indent the Perl code:
find . -name \*.pl -o -name \*.pm | (
find . -name \*.pl -o -name \*.pm
find . -type f -exec file {} \; |
egrep -i ':.*perl[0-9]*\>' |
cut -d: -f1
) |
sort -u |
xargs perltidy --profile=src/tools/pgindent/perltidyrc xargs perltidy --profile=src/tools/pgindent/perltidyrc
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
......
This diff is collapsed.
pgindent will indent .c and .h files according to the coding standards of
the PostgreSQL project. It needs several things to run, and tries to locate
or build them if possible. They can also be specified via command line switches
or the environment.
In its simplest form, if all the required objects are installed, simply run
it without any parameters at the top of the source tree you want to process.
pgindent
If you don't have all the requirements installed, pgindent will fetch and build
them for you, if you're in a PostgreSQL source tree:
pgindent --build
If your indent program is not installed in your path, you can specify it
by setting the environment variable INDENT, or PGINDENT, or by giving the
command line option --indent:
pgindent --indent=/opt/extras/bsdindent
Similarly, the entab program can be specified using the PGENTAB environment
variable, or using the --entab command line option.
pgindent also needs a file containing a list of typedefs. This can be
specified using the PGTYPEDEFS environment variable, or via the command line
--typedefs option. If neither is used, it will look for it within the
current source tree, or in /usr/local/etc/typedefs.list.
If you want to indent a source tree other than the current working directory,
you can specify it via the --code-base command line option.
We don't want to indent certain files in the PostgreSQL source. pgindent
will honor a file containing a list of patterns of files to avoid. This
file can be specified using the --excludes command line option. If indenting
a PostgreSQL source tree, this option isn't necessary, as it will find the file
src/tools/pgindent/exclude_file_patterns.
Any non-option arguments are taken as the names of files to be indented. In this
case only these files will be changed, and nothing else will be touched. If the
first non-option argument is not a .c or .h file, it is treated as the name
of a typedefs file for legacy reasons, but this use is deprecated - use the
--typedefs option instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment