home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
vsiftp.vmssoftware.com
/
VSIPUBLIC@vsiftp.vmssoftware.com.tar
/
FREEWARE
/
FREEWARE40.ZIP
/
pine
/
c-client
/
unansi
< prev
next >
Wrap
Text File
|
1994-01-09
|
728b
|
40 lines
#!/bin/sh
#
# convert ansi-C to old-vanilla-C if it conforms to coding conventions:
# all function definitions and declaractions must be of the form
# stuff (...);
# or stuff (...)
#
# another quickie by:
# Corey Satten, corey@cac.washington.edu, 12/8/89
TMP=/tmp/unansi$$
trap "rm -f $TMP; exit 0" 0 1 2 13 15
for f in $*; do
sed '
/^#/b
: joinl
/ $/s/ *$//;
/ $/s/ *$//;
/^\([^ ()][^()]*\)(.*,$/ {
N
s/\n/ /
b joinl
}
/^\([^ ()][^()]*\)(.*);$/s//\1 ();/
/^\([^ ()][^()]*\)([ ]*)$/b
/^\([^ ()][^()]*\)(.*)$/ {
h
: loop
s/\([(,]\)[^,)][^,)]*[ *]\([a-zA-Z_][a-zA-Z_]*\)[][ ]*\([,)]\)/\1\2\3/g
t loop
p
g
s/^.*(\(.*\))$/ \1;/
s/,/;\
\ /g
}
' $f > $TMP && mv $TMP $f
done