summaryrefslogtreecommitdiff
path: root/indent.sh
blob: eb1504b26ea9b758b253d7650a820d6692b876d5 (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
(
OPTSTR=""
if [ "$1" == "-?" ]
then
	echo "Options Selected:"
	cat
else
	while read opt
	do
		OPTSTR="$OPTSTR `echo $opt | awk '{ print $1 }'`"
	done
	echo indent $OPTSTR "$@"
	indent $OPTSTR "$@"
fi
)<<EOPT
-bad 	#blank after declaration
-bap 	#blank after procedure
-bl  	#braces on next line
-bli0	#0 extra indent on braces
-cbi0	#0 extra indent on braces of case labels
-nss	#while (1); instead of while (1) ;
-npcs	#func(x) instead of func (x)
-ncs	#(int)x instead of (int) x
-nbs	#sizeof(f) instead of sizeof (f)
-saf	#for () instead of for()
-sai	#if () instead of if()
-saw	#while () instead of while()
-nprs	#((x)) instead of ( ( x ) )
-di16	#put declarations at col 16
-bc	#newline after each comma in a declaration
-nbfda	#no newlines in function declarations though
-npsl	#do not do void\nfunc()
-bls	#struct braces on next line
-i4	#basic indentation
-ci8	#broken line continues indented by 8
-lp	#hope this overrides, indents broken line to paren
-ts4	#set tabstop to 4
-ip0	#for old-style declarations
-l78    #set linewidth to 78
-nbbo	#break after bool ops
-hnl	#honor hand-broken lines
-ut	#use tabs
EOPT