ROOT=`dirname $0`/..
all_c=`echo *.c` #`find . -name '*.c' -print |LC_ALL=C sort`
+if test "$all_c" = "*.c"
+then
+ echo "require at least one *.c input file"
+ exit 1
+fi
+
all_h=`echo *.h` #`find . -name '*.c' -print |LC_ALL=C sort`
+if test "$all_h" = "*.h"
+then
+ all_h=
+fi
+
std_h=`find $ROOT/cross/usr/include -type f -name '*.h' -print |LC_ALL=C sort`
+if test -z "$std_h"
+then
+ echo "require at least one standard library header file"
+ exit 1
+fi
if test -z "$1" || test "$1" = 0
then
rm -f `find $ROOT/cross/usr/include -name '*.h.usedby' -print`
rm -rf `find $ROOT/cross/usr/include -name '.xify' -print`
- rm -f a conflicts.temp oldprotos.txt oldprotos.temp xx*
+ rm -f a b conflicts.temp oldprotos.txt oldprotos.temp xx*
fi
if test -z "$1" || test "$1" = 1
sed -e 's/^\(#[ ]*\(else\|endif\)\)\([^0-9A-Za-z_].*\)\?/\1/' -i $i
+ rm -f xx*
+ csplit -b '%05d' -q $i '/^#[ ]*ifndef[ ]*lint$/' '{*}'
+ for j in xx*
+ do
+ if test $j != xx00000 && sed -ne '2p' $j |grep -q 'char[ ]*\(copyright[ ]*\[[ ]*\]\|\*[ ]*copyright\)[ ]*='
+ then
+ sed -e 's/^\(#[ ]*if\)ndef\([ ]*\)lint$/\1\2defined(DOCOPYRIGHT) \&\& !defined(lint)/' -i $j
+ fi
+ if test $j != xx00000 && sed -ne '2p' $j |grep -q 'char[ ]*\(sccsid[ ]*\[[ ]*\]\|\*[ ]*sccsid\)[ ]*='
+ then
+ sed -e 's/^\(#[ ]*if\)ndef\([ ]*\)lint$/\1\2defined(DOSCCS) \&\& !defined(lint)/' -i $j
+ else
+ sed -e 's/^.*char[ ]*\(sccsid[ ]*\[[ ]*\]\|\*[ ]*sccsid\)[ ]*=.*$/#if defined(DOSCCS) \&\& !defined(lint)\n&\n#endif/' -i $j
+ fi
+ done
+ cat xx* >$i
+
rm -f xx*
csplit -b '%05d' -q $i '/^[ ]*{[ ]*$/' '{*}'
for j in xx*
echo "group=$group"
$ROOT/cproto-4.6/cproto -i$ROOT/cross/usr/include -Dvax -t -H -s $i |sed -ne '2,$p' >$i.allprotos
+ if ! grep -v '^int main __P((' $i.allprotos
+ then
+ echo -n >$i.allprotos
+ fi
grep "^static " <$i.allprotos >a
if test -s a
echo "pattern0=$pattern0"
- if test -n "$pattern0"
+ if test -n "$pattern0" && test -n "$all_h_nocomm"
then
grep -H "^\\($pattern0\\)$" $all_h_nocomm |grep -v "^$i\.nocomm:" >a
if test -s a
echo "===stage 4==="
# checking header loops
- grep -H '^#include <[^>]*>' $all_h |\
- sed -e "s:^\(.*\)\:#include <\(.*\)>:\1 \2:" |\
- tsort >a
+ if test -n "$all_h"
+ then
+ grep -H '^#include <[^>]*>' $all_h |\
+ sed -e "s:^\(.*\)\:#include <\(.*\)>:\1 \2:" |\
+ tsort >a
+ fi
# removing useless extra header inclusions that are pulled in anyway
touch $ROOT/cross/usr/include/stdarg.h