pgindent.patch
text/x-patch
Filename: pgindent.patch
Type: text/x-patch
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: unified
| File | + | − |
|---|---|---|
| src/tools/pgindent/pgindent | 24 | 5 |
diff --git a/src/tools/pgindent/pgindent b/src/tools/pgindent/pgindent index 05f69ef..02f2b93 100755 --- a/src/tools/pgindent/pgindent +++ b/src/tools/pgindent/pgindent @@ -13,13 +13,32 @@ # # void x(struct xxc * a); -if [ "$#" -lt 2 ] -then echo "Usage: $(basename $0) typedefs file [...]" 1>&2 - exit 1 +# look for typedefs in the first argument, if there is a second argument and +# the first argument contains the string 'typedef' in its name, or in the +# environment setting PGTYPEDEFS, or in a hardcoded location, whichever +# matches first. + + +if [ $# -gt 1 ] +then + case `basename $0` in + *typedef*) + TYPDEFS=$1 + shift + ;; + *) + ;; + esac fi -TYPEDEFS="$1" -shift +test -z "$TYPEDEFS" && TYPEDEFS=$PGTYPEDEFS +test -z "$TYPEDEFS" && TYPEDEFS=/usr/local/etc/pgtypedefs.list + +if [ ! -f "$TYPEDEFS" ] +then + echo "Cannot find typedefs file '$TYPEDEFS'" + exit 1 +fi if [ -z "$INDENT" ] then