Better error reporting.
authorBruce Momjian
Fri, 5 Sep 1997 04:18:36 +0000 (04:18 +0000)
committerBruce Momjian
Fri, 5 Sep 1997 04:18:36 +0000 (04:18 +0000)
src/PGINDENT

index 149c45862cb11a3079674059a260bf61ccdf53a1..b8d33ed4e0cb429c5e6d17878a93ec2ab985171d 100644 (file)
@@ -1,5 +1,5 @@
 #!/bin/sh
-trap "rm -f /tmp/$$" 0 1 2 3 15
+trap "rm -f /tmp/$$ /tmp/$$a" 0 1 2 3 15
 entab /dev/null
 if [ "$?" -ne 0 ]
 then   echo "Go to the src/tools/entab directory and do a 'make' and 'make install'." >&2
@@ -16,9 +16,14 @@ for FILE
 do
    cat $FILE |
    sed 's;/\*  *---;/*---X_X;g' |
-   detab -t4 -qc |
+   detab -t4 -qc >/tmp/$$a
    indent -bad -bap -bbb -bc -bl -d0 -cdb -nce -cli1 -di16 -nfc1 \
-       -lp -nip -nbc -psl -di1 -i4 -l75 -st |
+       -lp -nip -nbc -psl -di1 -i4 -l75 >/tmp/$$ 2>&1
+   if [ "$?" -ne 0 -o -s /tmp/$$ ]
+   then    echo "$FILE"
+       cat /tmp/$$
+   fi
+   cat /tmp/$$a |
    detab -t8 -qc |
    entab -t4 -qc |
    sed 's;/\*---X_X;/* ---;g' >/tmp/$$ && cat /tmp/$$ >$FILE