~ubuntu-branches/ubuntu/lucid/postgresql-8.4/lucid-proposed

« back to all changes in this revision

Viewing changes to src/tools/pgindent/pgcppindent

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-03-20 12:00:13 UTC
  • Revision ID: james.westby@ubuntu.com-20090320120013-hogj7egc5mjncc5g
Tags: upstream-8.4~0cvs20090328
ImportĀ upstreamĀ versionĀ 8.4~0cvs20090328

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
 
 
3
# $PostgreSQL$
 
4
 
 
5
trap "rm -f /tmp/$$ /tmp/$$a" 0 1 2 3 15
 
6
entab </dev/null >/dev/null
 
7
if [ "$?" -ne 0 ]
 
8
then    echo "Go to the src/tools/entab directory and do a 'make' and 'make install'." >&2
 
9
        echo "This will put the 'entab' command in your path." >&2
 
10
        echo "Then run $0 again."
 
11
        exit 1
 
12
fi
 
13
astyle --version </dev/null >/dev/null 2>&1
 
14
if [ "$?" -eq 0 ]
 
15
then    echo "You do not appear to have 'astyle' installed on your system." >&2
 
16
        exit 1
 
17
fi
 
18
 
 
19
for FILE
 
20
do
 
21
        astyle --style=ansi -b -p -S < "$FILE" >/tmp/$$ 2>/tmp/$$a
 
22
        if [ "$?" -ne 0 -o -s /tmp/$$a ]
 
23
        then    echo "$FILE"
 
24
                cat /tmp/$$a
 
25
        fi
 
26
        cat /tmp/$$ |
 
27
        entab -t4 -qc |
 
28
        cat >/tmp/$$a && cat /tmp/$$a >"$FILE"
 
29
done