File: modify-headers

package info (click to toggle)
gstep-extensions 0.8.5.990905-2
  • links: PTS
  • area: main
  • in suites: potato
  • size: 592 kB
  • ctags: 429
  • sloc: objc: 2,819; sh: 1,836; ansic: 860; makefile: 209; lex: 194
file content (20 lines) | stat: -rwxr-xr-x 508 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh

if [ $# = 0 ]; then
	echo "usage: `basename $0` files"
	exit 1
fi

for f in $@; do
	echo $f
	bfile=`basename $f .h`
	(prot=__`echo $bfile`__
	echo "#ifndef $prot"
	echo "#define $prot"
	echo
	cat $f
	echo
	echo "#endif /* $prot */"
	) | sed -e 's^import^include^g' -e 's^<foundation^<Foundation^g' -e '/objc-class\.h/s^.*^^g' -e '/@class/,/;/s/<[a-zA-Z, ]*>//g' -e 's^NSException	\*exception^NSException \*localException^g' -e 's^exception = nil^localException = nil^g' >$f.new
	mv $f.new $f
done