aboutsummaryrefslogtreecommitdiff
path: root/src/PGINDENT
blob: 149c45862cb11a3079674059a260bf61ccdf53a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/sh
trap "rm -f /tmp/$$" 0 1 2 3 15
entab </dev/null >/dev/null
if [ "$?" -ne 0 ]
then	echo "Go to the src/tools/entab directory and do a 'make' and 'make install'." >&2
	echo "This will put the 'entab' command in your path." >&2
	echo "Then run $0 again."
	exit 1
fi
indent -st </dev/null >/dev/null
if [ "$?" -ne 0 ]
then	echo "You do not appear to have 'indent' installed on your system." >&2
	exit 1
fi
for FILE
do
	cat $FILE |
	sed 's;/\*  *---;/*---X_X;g' |
	detab -t4 -qc |
	indent -bad -bap -bbb -bc -bl -d0 -cdb -nce -cli1 -di16 -nfc1 \
		-lp -nip -nbc -psl -di1 -i4 -l75 -st |
	detab -t8 -qc |
	entab -t4 -qc |
	sed 's;/\*---X_X;/* ---;g' >/tmp/$$ && cat /tmp/$$ >$FILE
done