goto commence
      /u/linda/bin/Kcc -- synopsis
      /u/linda/bin/Kcc [-I directory-or-indirect-file]... [-Dsymbol] ... file.c
      shell variables
              a       root part of file.c
              b       a string of flags to be passed to m4
              c       flags for the C compiler
              d       temporary -- the first part of a C flag
              e       the directory where mk_include lives
              f       file.o
              g       status returned by the C compiler
: commence
:       'Strip off m4+ include flags'
= b ""
while ."$1" = ".-I"
      = b "$b $1"
      shift
      = b "$b $1"
      shift
end
:       'Strip off C compiler preprocessor defines'
= c ""
while "$1"
      expr substr $1 1 2 | = d
      if "$d" != "-D" break
      = c "$c $1"
      shift
end
= e "/guard/kr/emulator"
expr substr $1 1 "(" length $1 - 1 ")" | = a
= f $ao
cp $* $$.$$
if ! { grep "#incl" $$.$$ } goto m4loop
sh /guard/bin/mak.ksos2 $$.$$
: m4loop
$e/bin/mk_include -l $$.$$ | \
$e/bin/m4+ $b -I /usr/include \
-I $e/include \
-I /guard/guard/global \
-I /guard/kip/source - > $$.c
if ! { grep "#incl" $$.c } goto Compile
mv $$.c $$.$$
sh /guard/bin/mak.ksos2 $$.$$
goto m4loop
: Compile
/bin/cc -t0 -c -O $c $$.c
= g $r
rm $$.$$
mv $$.o $f
rm $$.c
exit $g
