Pre-ansification changes for lib/libc
authorNick Downing <downing.nick@gmail.com>
Tue, 24 Jan 2017 08:05:22 +0000 (19:05 +1100)
committerNick Downing <downing.nick@gmail.com>
Tue, 24 Jan 2017 10:38:03 +0000 (21:38 +1100)
28 files changed:
.gitignore
lib/libc/ansify.sh [new file with mode: 0755]
lib/libc/compat-4.1/Makefile
lib/libc/compat-sys5/Makefile
lib/libc/gen/Makefile
lib/libc/gen/calloc.c
lib/libc/gen/execvp.c
lib/libc/inet/Makefile
lib/libc/n.sh [deleted file]
lib/libc/net/Makefile
lib/libc/net/hosttable/Makefile
lib/libc/net/named/Makefile
lib/libc/ns/Makefile
lib/libc/o.sh [deleted file]
lib/libc/p.sh [deleted file]
lib/libc/q.sh [deleted file]
lib/libc/r.sh [deleted file]
lib/libc/s.sh [deleted file]
lib/libc/stdio/Makefile
lib/libc/sys/Makefile
lib/libc/vax/compat-4.1/Makefile
lib/libc/vax/csu/Makefile
lib/libc/vax/gen/Makefile
lib/libc/vax/net/Makefile
lib/libc/vax/stdio/Makefile
lib/libc/vax/sys/Makefile
scripts/ansify.sh
scripts/fixmake.sh

index f9e6d4c..1fc5bbc 100644 (file)
@@ -1,10 +1,10 @@
 *.a
+*.allprotos
 *.nocomm
 *.o
 *.oldprotos
 *.protos
 *.protos.nocomm
-*.temp.c
 *.usedby
 *.uses
 .xify
diff --git a/lib/libc/ansify.sh b/lib/libc/ansify.sh
new file mode 100755 (executable)
index 0000000..9dcbdcb
--- /dev/null
@@ -0,0 +1,700 @@
+#!/bin/sh
+
+#ROOT=`dirname $0`/..
+ROOT=../..
+
+#all_c=`echo *.c`
+#if test "$all_c" = "*.h"
+#then
+#  all_c=
+#fi
+#all_c=`find . -type f -name '*.c' -print |sed -e 's:^\./::' |LC_ALL=C sort`
+all_c=`find . -type f -name '*.c' -print |sed -e 's:^\./::' |grep -v '^vax/' |LC_ALL=C sort`
+
+if test -z "$1" || test $1 -eq 0
+then
+  echo "===stage 0==="
+
+  #rm -f *.[ch].allprotos
+  #rm -f *.[ch].nocomm
+  #rm -f *.[ch].oldprotos
+  #rm -f *.[ch].protos
+  #rm -f *.[ch].protos.nocomm
+  #rm -f *.[ch].usedby
+  #rm -f *.[ch].uses
+  #rm -rf .xify
+  rm -f `find . -name '*.[ch].allprotos' -print`
+  rm -f `find . -name '*.[ch].nocomm' -print`
+  rm -f `find . -name '*.[ch].oldprotos' -print`
+  rm -f `find . -name '*.[ch].protos' -print`
+  rm -f `find . -name '*.[ch].protos.nocomm' -print`
+  rm -f `find . -name '*.[ch].usedby' -print`
+  rm -f `find . -name '*.[ch].uses' -print`
+  rm -rf `find . -name .xify -print`
+
+  rm -f `find $ROOT/cross/usr/include -name '*.h.allprotos' -print`
+  rm -f `find $ROOT/cross/usr/include -name '*.h.nocomm' -print`
+  rm -f `find $ROOT/cross/usr/include -name '*.h.oldprotos' -print`
+  rm -f `find $ROOT/cross/usr/include -name '*.h.protos' -print`
+  rm -f `find $ROOT/cross/usr/include -name '*.h.protos.nocomm' -print`
+  rm -f `find $ROOT/cross/usr/include -name '*.h.usedby' -print`
+  rm -f `find $ROOT/cross/usr/include -name '*.h.uses' -print`
+  rm -rf `find $ROOT/cross/usr/include -name .xify -print`
+
+  rm -f a b conflicts.temp oldprotos.txt oldprotos.temp xx*
+
+  if test "$1" = 000
+  then
+    #git checkout *.c *.h
+    rm -rf $ROOT/include $ROOT/sys
+    git checkout $ROOT/include $ROOT/sys $all_c
+    rm -rf $ROOT/cross/usr/include
+    mkdir -p $ROOT/cross/usr/include
+    (cd $ROOT/include && ../scripts/make.sh SHARED=copies install)
+  fi
+fi
+
+#all_c=`echo *.c`
+#if test "$all_c" = "*.h"
+#then
+#  all_c=
+#fi
+#all_c=`find . -type f -name '*.c' -print |sed -e 's:^\./::' |LC_ALL=C sort`
+all_c=`find . -type f -name '*.c' -print |sed -e 's:^\./::' |grep -v '^vax/' |LC_ALL=C sort`
+
+#all_h=`echo *.h`
+#if test "$all_h" = "*.h"
+#then
+#  all_h=
+#fi
+#all_h=`find . -type f -name '*.h' -print |sed -e 's:^\./::' |LC_ALL=C sort`
+all_h=`find $ROOT/cross/usr/include -type f -name '*.h' -print |LC_ALL=C sort`
+
+#std_h=`find $ROOT/cross/usr/include -type f -name '*.h' -print |grep -v "^$ROOT/cross/usr/include/stand/" |LC_ALL=C sort`
+std_h=
+
+if test -z "$1" || test $1 -eq 1
+then
+  echo "===stage 1==="
+  for i in $all_c $all_h
+  do
+    echo "i=$i"
+
+    grep -H '^[A-Za-z_][0-9A-Za-z_]*[^0-9A-Za-z_][^;]*[A-Za-z_][0-9A-Za-z_]*[   ]*([    ]*)[    ]*\(,[^;]*\)\?;' $i >>oldprotos.txt
+    sed -e 's/^[A-Za-z_][0-9A-Za-z_]*[^0-9A-Za-z_][^;]*[A-Za-z_][0-9A-Za-z_]*[  ]*([    ]*)[    ]*\(,[^;]*\)\?;/\/\*&\*\//' -i $i
+
+    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*
+    do
+      :
+    done
+    for k in xx*
+    do
+      if test $k != xx00000
+      then
+        sed -ne '2,$p' -i $k
+      fi
+      if test $k != $j
+      then
+        sed -e '$s/$/ {/' -i $k
+      fi
+    done
+    cat xx* >$i
+  done
+
+  grep '\.h:' oldprotos.txt >oldprotos.temp
+
+  sed -e 's/^[A-Za-z_].*__P.*;$/\/\*AAA&\*\//' -i $std_h
+  mv $ROOT/cross/usr/include/varargs.h $ROOT/cross/usr/include/varargs.h.save
+  echo "#define va_list char *" >$ROOT/cross/usr/include/varargs.h
+  echo "#define va_list char *" >$ROOT/cross/usr/include/stdarg.h
+  for i in $all_c
+  do
+    echo "i=$i"
+
+    #group=
+    group=$ROOT/cross/usr/include/`dirname $i`.h
+    touch $group
+    if test -f groups.txt
+    then
+      j=`sed -ne "s:^$i \\(.*\\):\\1:p" groups.txt`
+      if test -n "$j"
+      then
+        j=$ROOT/cross/usr/include/$j
+        echo $j >>$group.uses
+        group=$j
+        touch $group
+      fi
+    fi
+    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 -qv '^int main __P((' $i.allprotos
+    then
+      echo -n >$i.allprotos
+    fi
+
+    grep "^static " <$i.allprotos >a
+    if test -s a
+    then
+      mv a $i.protos
+    fi
+    grep -v "^static " <$i.allprotos >a
+    if test -s a
+    then
+      if test -z "$group"
+      then
+        cp $i.allprotos $i.protos
+      else
+        (
+          cat <<EOF
+
+/* $i */
+EOF
+          cat a
+        ) >>$group.protos
+      fi
+
+      protos="`sed -ne 's/^.*[^0-9A-Za-z_]\([A-Za-z_][0-9A-Za-z_]*\) __P((.*));$/\1/p' a`"
+      echo "protos=$protos"
+
+      pattern=
+      prefix=
+      for j in $protos
+      do
+        pattern="$pattern$prefix$j"
+        prefix='\|'
+      done
+      echo "pattern=$pattern"
+
+      grep "[^0-9A-Za-z_]\\($pattern\\)[        ]*(" oldprotos.temp >a
+      if test -s a
+      then
+        mv a $i.oldprotos
+        grep -v "^$group:" $i.oldprotos
+      fi
+    fi
+  done
+  rm $ROOT/cross/usr/include/stdarg.h
+  mv $ROOT/cross/usr/include/varargs.h.save $ROOT/cross/usr/include/varargs.h
+  sed -e 's/^\/\*AAA\(.*\)\*\/$/\1/' -i $std_h
+fi
+
+#all_h=`echo *.h`
+#if test "$all_h" = "*.h"
+#then
+#  all_h=
+#fi
+#all_h=`find . -type f -name '*.h' -print |sed -e 's:^\./::' |LC_ALL=C sort`
+all_h=`find $ROOT/cross/usr/include -type f -name '*.h' -print |LC_ALL=C sort`
+
+if test -z "$1" || test $1 -eq 2
+then
+  echo "===stage 2==="
+  all_c_nocomm=
+  all_c_protos_nocomm=
+  for i in $all_c
+  do
+    $ROOT/scripts/nocomment <$i |$ROOT/scripts/nostring >$i.nocomm
+    all_c_nocomm="$all_c_nocomm $i.nocomm"
+    if test -f $i.protos
+    then
+      $ROOT/scripts/nocomment <$i.protos |$ROOT/scripts/nostring >$i.protos.nocomm
+      all_c_protos_nocomm="$all_c_protos_nocomm $i.protos.nocomm"
+    fi
+  done
+
+  all_h_nocomm=
+  all_h_protos_nocomm=
+  for i in $all_h
+  do
+    $ROOT/scripts/nocomment <$i |$ROOT/scripts/nostring >$i.nocomm
+    all_h_nocomm="$all_h_nocomm $i.nocomm"
+    if test -f $i.protos
+    then
+      $ROOT/scripts/nocomment <$i.protos |$ROOT/scripts/nostring >$i.protos.nocomm
+      all_h_protos_nocomm="$all_h_protos_nocomm $i.protos.nocomm"
+    fi
+  done
+
+  for i in $std_h
+  do
+    $ROOT/scripts/nocomment <$i |$ROOT/scripts/nostring >$i.nocomm
+  done
+
+  if test -f conflicts.txt
+  then
+    sed -e 's/^/:/;s/ /::/g;s/$/:/' <conflicts.txt >conflicts.temp
+  else
+    touch conflicts.temp
+  fi
+
+  for i in $all_h $std_h
+  do
+    echo "i=$i"
+    h=`echo $i |sed -e "s:^$ROOT/cross/usr/include/::"`
+    echo "h=$h"
+
+    macros="`sed -ne 's/^#[     ]*define[       ]\+\([A-Za-z_][0-9A-Za-z_]*\).*/\1/p' $i.nocomm |grep -v '^\(NULL\|__P\)$'`"
+    echo "macros=$macros"
+    typedefs="`sed -ne 's/^\(.*[^0-9A-Za-z_]\)\?typedef[^0-9A-Za-z_]\(.*[^0-9A-Za-z_]\)\?\([A-Za-z_][0-9A-Za-z_]*\)[    ]*\(\[[         0-9]*\][        ]*\)\?;.*/\3/p' $i.nocomm; sed -ne 's/^}[       ]*\([A-Za-z_][0-9A-Za-z_]*\)[   ]*;.*/\1/p' $i.nocomm`"
+    echo "typedefs=$typedefs"
+    structs="`sed -ne 's/^\(.*[^0-9A-Za-z_]\)\?struct[  ]\+\([A-Za-z_][0-9A-Za-z_]*\)[  ]*{.*/\2/p' $i.nocomm`"
+    echo "structs=$structs"
+    unions="`sed -ne 's/^\(.*[^0-9A-Za-z_]\)\?union[    ]\+\([A-Za-z_][0-9A-Za-z_]*\)[  ]*{.*/\2/p' $i.nocomm`"
+    echo "unions=$unions"
+    if test -f $i.protos.nocomm
+    then
+      protos="`sed -ne 's/^.*[^0-9A-Za-z_]\([A-Za-z_][0-9A-Za-z_]*\) __P((.*));$/\1/p' $i.nocomm $i.protos.nocomm`"
+    else
+      protos="`sed -ne 's/^.*[^0-9A-Za-z_]\([A-Za-z_][0-9A-Za-z_]*\) __P((.*));$/\1/p' $i.nocomm`"
+    fi
+    echo "protos=$protos"
+
+    rm -f $i.usedby
+
+    prefix0=
+    pattern0=
+
+    pattern1=
+    prefix1=
+    for j in $macros
+    do
+      pattern1="$pattern1$prefix1$j"
+      prefix1='\|'
+    done
+    for j in $typedefs
+    do
+      pattern1="$pattern1$prefix1$j"
+      prefix1='\|'
+    done
+    for j in $structs
+    do
+      pattern1="$pattern1${prefix1}struct[      ]\\+$j"
+      prefix1='\|'
+    done
+    for j in $unions
+    do
+      pattern1="$pattern1${prefix1}union[       ]\\+$j"
+      prefix1='\|'
+    done
+    echo "pattern1=$pattern1"
+    if test -n "$pattern1"
+    then
+      pattern0="$pattern0$prefix0\\(.*[^0-9A-Za-z_]\\)\\?\\($pattern1\\)\\([^0-9A-Za-z_].*\\)\\?"
+      prefix0='\|'
+    fi
+
+    pattern1=
+    prefix1=
+    for j in $protos
+    do
+      pattern1="$pattern1$prefix1$j"
+      prefix1='\|'
+    done
+    echo "pattern1=$pattern1"
+    if test -n "$pattern1"
+    then
+      pattern0="$pattern0$prefix0\\(.*[^0-9A-Za-z_]\\)\\?\\($pattern1\\)[       ]*(.*"
+      prefix0='\|'
+    fi
+
+    echo "pattern0=$pattern0"
+
+    if test -n "$pattern0" && test -n "$all_c_nocomm$all_c_protos_nocomm$all_h_protos_nocomm"
+    then
+      grep -H "^\\($pattern0\\)$" $all_c_nocomm $all_c_protos_nocomm $all_h_protos_nocomm |grep -v "^$i\.protos.nocomm:" >a
+      if test -s a
+      then
+        cat a >>$i.usedby
+        for j in `sed -e 's/\.protos\.nocomm:.*//; s/\.nocomm:.*//' <a |sort |uniq`
+        do
+          echo "j=$j"
+          k=`echo $j |sed -e "s:^$ROOT/cross/usr/include/::"`
+          echo "k=$k"
+          if ! grep -q ":$h:.*:$k\\|:$k:.*:$h:" conflicts.temp
+          then
+            echo $i >>$j.uses
+          fi
+        done
+      fi
+    fi
+
+    pattern0=
+    prefix0=
+
+    pattern1=
+    prefix1=
+    for j in $macros
+    do
+      pattern1="$pattern1$prefix1$j"
+      prefix1='\|'
+    done
+    for j in $typedefs
+    do
+      pattern1="$pattern1$prefix1$j"
+      prefix1='\|'
+    done
+    echo "pattern1=$pattern1"
+    if test -n "$pattern1"
+    then
+      pattern0="$pattern0$prefix0\\(.*[^0-9A-Za-z_]\\)\\?\\($pattern1\\)\\([^0-9A-Za-z_].*\\)\\?"
+      prefix0='\|'
+    fi
+
+    pattern1=
+    prefix1=
+    for j in $structs
+    do
+      pattern1="$pattern1${prefix1}struct[      ]\\+$j"
+      prefix1='\|'
+    done
+    for j in $unions
+    do
+      pattern1="$pattern1${prefix1}union[       ]\\+$j"
+      prefix1='\|'
+    done
+    echo "pattern1=$pattern1"
+    if test -n "$pattern1"
+    then
+      pattern0="$pattern0$prefix0\\(.*[^0-9A-Za-z_]\\)\\?\\($pattern1\\)\\([^   *0-9A-Za-z_].*\\|[      ]\\+\\([^*].*\\)\\?\\)\\?"
+      prefix0='\|'
+    fi
+
+    pattern1=
+    prefix1=
+    for j in $protos
+    do
+      pattern1="$pattern1$prefix1$j"
+      prefix1='\|'
+    done
+    echo "pattern1=$pattern1"
+    if test -n "$pattern1"
+    then
+      pattern0="$pattern0$prefix0\\(.*[^0-9A-Za-z_]\\)\\?\\($pattern1\\)[       ]*(.*"
+      prefix0='\|'
+    fi
+
+    echo "pattern0=$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
+      then
+        cat a >>$i.usedby
+        for j in `sed -e 's/\.nocomm:.*//' <a |sort |uniq`
+        do
+          echo "j=$j"
+          k=`echo $j |sed -e "s:^$ROOT/cross/usr/include/::"`
+          echo "k=$k"
+          if ! grep -q ":$h:.*:$k\\|:$k:.*:$h:" conflicts.temp
+          then
+            echo $i >>$j.uses
+          fi
+        done
+      fi
+    fi
+  done
+fi
+
+if test -z "$1" || test $1 -eq 3
+then
+  echo "===stage 3==="
+
+  for i in $all_h
+  do
+    echo "i=$i"
+    rm -f xx*
+    csplit -b '%05d' -q $i '/^#/' '{*}'
+    if test -f xx00001 && ! $ROOT/scripts/nocomment <xx00000 |grep -q '[^       ]'
+    then
+      for j in xx*
+      do
+        :
+      done
+      echo "j=$j"
+      define="`sed -ne 's/^#[   ]*ifndef[       ]\+\([A-Za-z_][0-9A-Za-z_]*\).*/\1/p' xx00001`"
+      echo "define=$define"
+      if test -n "$define" && grep -q '^#[      ]*endif$' $j && ! grep -v "^#" $j |$ROOT/scripts/nocomment |grep -q '[^         ]'
+      then
+        sed -e "s/^#[   ]*ifndef[       ]\\+$define/\\/\\*&\\*\\//" -i xx00001
+        sed -e "s/^\\(#[        ]*define[       ]\\+$define\\)[         ]*$/\\/\\*\1\\*\\//" -i xx00002
+        sed -e 's/^#[   ]*endif$/\/\*&\*\//' -i $j
+        cat xx* >a
+        iflevel=0
+        for j in `sed -ne 's/^#[        ]*\(if\|ifdef\|ifndef\)[^0-9A-Za-z_].*/1/p; s/^#[       ]*endif$/-1/p' a`
+        do
+          iflevel=`expr $iflevel + $j`
+          if test $iflevel -lt 0
+          then
+            break
+          fi
+        done
+        echo "iflevel=$iflevel"
+        if test $iflevel -eq 0
+        then
+          mv a $i
+        fi
+      fi
+    fi
+  done
+
+  for i in $all_c $all_h
+  do
+    echo "i=$i"
+    rm -f xx*
+    csplit -b '%05d' -q $i '/^#[        ]*include[^0-9A-Za-z_]/' '{*}'
+    for j in xx*
+    do
+      sed -e 's/^#[     ]*include[      ]*\(<[^>]*>\|"[^"]*"\)/\/\*&\*\//' -i $j
+      if grep -v "^#[   ]*include[^0-9A-Za-z_]" $j |sed -e '/^#[        ]*if.*SCCS\|lint/,/^#[  ]*endif/s/.*//' |$ROOT/scripts/nocomment |grep -q '[^   ]'
+      then
+        break
+      fi
+    done
+    cat xx* >$i
+  done
+
+  for i in $all_c
+  do
+    echo "i=$i"
+
+    if test -s $i.protos
+    then
+      pattern="`sed -ne '1{s/\*/\\\*/g; s/ __P((.*));/(/p}' $i.allprotos`"
+      echo "pattern=$pattern"
+      rm -f xx*
+      csplit -q $i "/^$pattern/"
+      (
+        cat xx00
+        if test `wc -l <$i.protos` -ge `wc -l <$i.allprotos`
+        then
+          cat <<EOF
+#ifndef __P
+#ifdef __STDC__
+#define __P(args) args
+#else
+#define __P(args) ()
+#endif
+#endif
+
+EOF
+        fi
+        cat $i.protos
+        if test -f xx01
+        then
+          echo
+          cat xx01
+        fi
+      ) >$i
+    fi
+
+    rm -f a
+    if test -s $i.uses
+    then
+      LC_ALL=C sort <$i.uses |uniq >a
+
+      pattern=
+      prefix=
+      for j in `sed -e "s:^$ROOT/cross/usr/include/::" a`
+      do
+        pattern="$pattern$prefix$j"
+        prefix='\|'
+      done
+      echo "pattern=$pattern"
+
+      #sed -e "s:^#[    ]*include[      ]*\\(<\\($pattern\\)>\\|\"\\($pattern\\)\"\\):\\/\\*&\\*\\/:" -i $i
+      sed -e "s:^#[     ]*include[      ]*<\\($pattern\\)>:\\/\\*&\\*\\/:" -i $i
+    fi
+
+    (
+      if test -s a
+      then
+        sed -e "s:.*:#include \"&\":; s:\"$ROOT/cross/usr/include/\\(.*\\)\":<\\1>:; s:^#include <varargs.h>$:#ifdef __STDC__\\n#include <stdarg.h>\\n#define _va_start(argp, arg) va_start(argp, arg)\\n#else\\n#include <varargs.h>\\n#define _va_start(argp, arg) va_start(argp)\\n#endif:" a
+        echo
+      fi
+      sed -e 's/\([^0-9A-Za-z_]\)va_start(argp);/\1_va_start(argp, fmt);/' $i
+    ) |$ROOT/scripts/newline >b
+    mv b $i
+  done
+
+  for i in $all_h
+  do
+    echo "i=$i"
+    h=`echo $i |sed -e "s:^$ROOT/cross/usr/include/::"`
+    echo "h=$h"
+
+    rm -f a
+    if test -s $i.uses
+    then
+      LC_ALL=C sort <$i.uses |uniq >a
+
+      pattern=
+      prefix=
+      for j in `sed -e "s:^$ROOT/cross/usr/include/::" a`
+      do
+        pattern="$pattern$prefix$j"
+        prefix='\|'
+      done
+      echo "pattern=$pattern"
+
+      #sed -e "s:^#[    ]*include[      ]*\\(<\\($pattern\\)>\\|\"\\($pattern\\)\"\\):\\/\\*&\\*\\/:" -i $i
+      sed -e "s:^#[     ]*include[      ]*<\\($pattern\\)>:\\/\\*&\\*\\/:" -i $i
+    fi
+
+    name=_`echo $h |tr '.\-/abcdefghijklmnopqrstuvwxyz' '___ABCDEFGHIJKLMNOPQRSTUVWXYZ'`_
+    echo "name=$name"
+    (
+      cat <<EOF
+#ifndef $name
+#define $name
+
+EOF
+      if test -s a
+      then
+        sed -e "s:.*:#include \"&\":; s:\"$ROOT/cross/usr/include/\\(.*\\)\":<\\1>:; s:^#include <varargs.h>$:#ifdef __STDC__\\n#include <stdarg.h>\\n#endif:" a
+        echo
+      fi
+      cat $i
+      if test -s $i.protos
+      then
+        echo
+        if echo $h |grep -q '^\(net\|netimp\|netinet\|netns\|sys\|vax\|vaxif\|vaxmba\|vaxuba\)/'
+        then
+          echo "#ifndef KERNEL"
+        fi
+        cat <<EOF
+#ifndef __P
+#ifdef __STDC__
+#define __P(args) args
+#else
+#define __P(args) ()
+#endif
+#endif
+EOF
+        cat $i.protos
+        if echo $h |grep -q '^\(net\|netimp\|netinet\|netns\|sys\|vax\|vaxif\|vaxmba\|vaxuba\)/'
+        then
+          echo "#endif"
+        fi
+      fi
+      cat <<EOF
+
+#endif
+EOF
+    ) |$ROOT/scripts/newline >b
+    mv b $i
+  done
+fi
+
+if test -z "$1" || test $1 -eq 4
+then
+  echo "===stage 4==="
+
+  # checking header loops
+  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
+  rm -f a
+  for i in $all_h $std_h
+  do
+    echo "i=$i"
+    h=`echo $i |sed -e "s:^$ROOT/cross/usr/include/::"`
+    echo "h=$h"
+
+    pattern=
+    prefix=
+    cp $i temp.c
+    for j in `cpp -nostdinc -I$ROOT/cross/usr/include -Dvax -DNCMD=1 -DNRSP=1 -M temp.c`
+    do
+      echo "j=$j"
+      case $j in
+      $ROOT/cross/usr/include/stdarg.h)
+        # system header files are not supposed to define stdarg.h, even if
+        # (like vfprintf etc) they have va_list paramters, it is silly and
+        # we ignore this restriction, but clients shouldn't rely on this
+        # (anyway, the above cpp command defines __STDC__ so we do not pick
+        # up any dependency on varargs.h, hence let's keep it symmetrical)
+        ;;
+      *.h)
+        k=`echo $j |sed -e "s:^$ROOT/cross/usr/include/::"`
+        echo "k=$k"
+        echo "$h $k" >>a
+        pattern="$pattern$prefix$k"
+        prefix='\|'
+        ;;
+      esac
+    done
+    echo "pattern=$pattern"
+    if test -n "$pattern"
+    then
+      #sed -e "s:^#include \\(<\\($pattern\\)>\\|\"\\($pattern\\)\"\\)$:/\\*& $h\\*/:" -i `grep -H "^#include \\(<$h>\\|\"$h\"\\)$" $all_c $all_h |sed -e 's/:.*//'`
+      sed -e "s:^#include <\\($pattern\\)>$:/\\*& $h\\*/:" -i `grep -H "^#include <$h>$" $all_c $all_h |sed -e 's/:.*//'`
+    fi
+  done
+  rm -f $ROOT/cross/usr/include/stdarg.h temp.c
+  tsort <a >b
+fi
+
+if test -z "$1" || test $1 -eq 5
+then
+  echo "===stage 5==="
+  for i in . arpa protocols
+  do
+    echo "i=$i"
+    for j in $ROOT/include/$i/*.h
+    do
+      echo "j=$j"
+      cp $ROOT/cross/usr/include/$i/`basename $j` $ROOT/include/$i
+    done
+  done
+  for i in compat-4.1 compat-sys5 gen inet net ns stdio sys
+  do
+    echo "i=$i"
+    cp $ROOT/cross/usr/include/$i.h $ROOT/include
+  done
+  for i in net netimp netinet netns vax vaxif vaxmba vaxuba
+  do
+    echo "i=$i"
+    for j in $ROOT/sys/$i/*.h
+    do
+      echo "j=$j"
+      cp $ROOT/cross/usr/include/$i/`basename $j` $ROOT/sys/$i
+    done
+  done
+  for i in $ROOT/sys/h/*.h
+  do
+    echo "i=$i"
+    cp $ROOT/cross/usr/include/sys/`basename $i` $ROOT/sys/h
+  done
+fi
index 4080fd5..0a244d8 100644 (file)
@@ -1,3 +1,4 @@
+LD=ld
 #
 # Copyright (c) 1980 Regents of the University of California.
 # All rights reserved.  The Berkeley software License Agreement
@@ -19,10 +20,10 @@ TAGSFILE=tags
 
 .c.o:
        ${CC} -p ${CFLAGS} -c $*.c
-       -ld -X -r $*.o
+       -${LD} -X -r $*.o
        mv a.out profiled/$*.o
        ${CC} ${CFLAGS} -c $*.c
-       -ld -x -r $*.o
+       -${LD} -x -r $*.o
        mv a.out $*.o
 
 compat-4.1lib compat-4.1lib_p: ${OBJS}
@@ -42,7 +43,7 @@ clean:
 
 depend:
        for i in ${SRCS}; do \
-           cc -M ${CFLAGS} $$i | awk ' { if ($$1 != prev) \
+           ${CC} -M ${CFLAGS} $$i | awk ' { if ($$1 != prev) \
                { if (rec != "") print rec; rec = $$0; prev = $$1; } \
                else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
                else rec = rec " " $$2 } } \
index 4af68bc..149250d 100644 (file)
@@ -1,3 +1,4 @@
+LD=ld
 #      Makefile        1.5     85/09/05
 #
 CFLAGS=        -O ${DEFS}
@@ -11,10 +12,10 @@ TAGSFILE=tags
 
 .c.o:
        ${CC} -p ${CFLAGS} -c $*.c
-       -ld -X -r $*.o
+       -${LD} -X -r $*.o
        mv a.out profiled/$*.o
        ${CC} ${CFLAGS} -c $*.c
-       -ld -x -r $*.o
+       -${LD} -x -r $*.o
        mv a.out $*.o
 
 compat-sys5lib compat-sys5lib_p: ${OBJS}
@@ -34,7 +35,7 @@ clean:
 
 depend:
        for i in ${SRCS}; do \
-           cc -M ${CFLAGS} $$i | awk ' { if ($$1 != prev) \
+           ${CC} -M ${CFLAGS} $$i | awk ' { if ($$1 != prev) \
                { if (rec != "") print rec; rec = $$0; prev = $$1; } \
                else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
                else rec = rec " " $$2 } } \
index 9415798..0c34b49 100644 (file)
@@ -1,3 +1,4 @@
+LD=ld
 #
 # Copyright (c) 1980 Regents of the University of California.
 # All rights reserved.  The Berkeley software License Agreement
@@ -37,10 +38,10 @@ TAGSFILE=tags
 
 .c.o:
        ${CC} -p ${CFLAGS} -c $*.c
-       -ld -X -r $*.o
+       -${LD} -X -r $*.o
        mv a.out profiled/$*.o
        ${CC} ${CFLAGS} -c $*.c
-       -ld -x -r $*.o
+       -${LD} -x -r $*.o
        mv a.out $*.o
 
 genlib genlib_p: ${OBJS}
@@ -50,7 +51,7 @@ genlib genlib_p: ${OBJS}
        @ar cru genlib ${OBJS}
 
 errlst.o: errlst.c
-       cc -S ${DEFS} errlst.c
+       ${CC} -S ${DEFS} errlst.c
        ed - <:errfix errlst.s
        as -o errlst.o errlst.s
        cp errlst.o profiled/errlst.o
@@ -67,7 +68,7 @@ clean:
 
 depend:
        for i in ${SRCS}; do \
-           cc -M ${CFLAGS} $$i | awk ' { if ($$1 != prev) \
+           ${CC} -M ${CFLAGS} $$i | awk ' { if ($$1 != prev) \
                { if (rec != "") print rec; rec = $$0; prev = $$1; } \
                else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
                else rec = rec " " $$2 } } \
index 5c5ac2a..54dee02 100644 (file)
@@ -18,10 +18,8 @@ calloc(num, size)
        return (p);
 }
 
-cfree(p, num, size)
+cfree(p)
        void *p;
-       unsigned num;
-       unsigned size;
 {
        free(p);
 }
index fdd4d69..4dd18fb 100644 (file)
@@ -7,16 +7,24 @@ static char sccsid[] = "@(#)execvp.c  5.2 (Berkeley) 3/9/86";
  *     execvp(name, argv)      (like execv, but does path search)
  */
 #include <errno.h>
+#include <varargs.h>
 #define        NULL    0
 
 static char shell[] =  "/bin/sh";
 char   *execat(), *getenv();
 extern errno;
 
-execlp(name, argv)
-char *name, *argv;
+execlp(name, va_alist)
+char *name;
+va_dcl
 {
-       return(execvp(name, &argv));
+       va_list argp;
+       int res;
+
+       va_start(argp);
+       res = execvp(name, (char **)argp);
+       va_end(argp);
+       return res;
 }
 
 execvp(name, argv)
index 34fc6d8..7944801 100644 (file)
@@ -1,3 +1,4 @@
+LD=ld
 #
 # Copyright (c) 1980 Regents of the University of California.
 # All rights reserved.  The Berkeley software License Agreement
@@ -17,10 +18,10 @@ TAGSFILE=tags
 
 .c.o:
        ${CC} -p -c ${CFLAGS} $*.c
-       -ld -X -r $*.o
+       -${LD} -X -r $*.o
        mv a.out profiled/$*.o
        ${CC} ${CFLAGS} -c $*.c
-       -ld -x -r $*.o
+       -${LD} -x -r $*.o
        mv a.out $*.o
 
 inetlib inetlib_p: ${OBJS}
@@ -41,7 +42,7 @@ clean:
 
 depend:
        for i in ${SRCS}; do \
-           cc -M ${CFLAGS} $$i | awk ' { if ($$1 != prev) \
+           ${CC} -M ${CFLAGS} $$i | awk ' { if ($$1 != prev) \
                { if (rec != "") print rec; rec = $$0; prev = $$1; } \
                else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
                else rec = rec " " $$2 } } \
diff --git a/lib/libc/n.sh b/lib/libc/n.sh
deleted file mode 100755 (executable)
index de0ebc6..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/sh
-
-ROOT=../..
-
-all_c=
-while read i
-do
-  set $i
-  all_c="$all_c $1"
-done <groups.txt
-
-rm -f `find . -name '*.c.nocomm' -print`
-rm -f `find . -name '*.c.oldprotos' -print`
-rm -f `find . -name '*.c.protos' -print`
-rm -f `find . -name '*.c.protos.nocomm' -print`
-rm -f `find . -name '*.c.usedby' -print`
-rm -f `find . -name '*.c.uses' -print`
-
-rm -f $all_c
-git checkout $all_c
-
-rm -rf $ROOT/include
-git checkout $ROOT/include
-
-rm -rf $ROOT/sys
-git checkout $ROOT/sys
-
-rm -rf $ROOT/cross/usr/include
-mkdir $ROOT/cross/usr/include
-(cd ../../include && make DESTDIR=`pwd`/../cross SHARED=copies install)
index def2b5c..8c86576 100644 (file)
@@ -1,3 +1,4 @@
+LD=ld
 #
 # Copyright (c) 1983 Regents of the University of California.
 # All rights reserved.  The Berkeley software License Agreement
@@ -22,10 +23,10 @@ TAGSFILE=tags
 
 .c.o:
        ${CC} -p -c ${CFLAGS} $*.c
-       -ld -X -r $*.o
+       -${LD} -X -r $*.o
        mv a.out profiled/$*.o
        ${CC} ${CFLAGS} -c $*.c
-       -ld -x -r $*.o
+       -${LD} -x -r $*.o
        mv a.out $*.o
 
 netlib netlib_p: ${OBJS}
@@ -46,7 +47,7 @@ clean:
 
 depend:
        for i in ${SRCS}; do \
-           cc -M ${CFLAGS} $$i | awk ' { if ($$1 != prev) \
+           ${CC} -M ${CFLAGS} $$i | awk ' { if ($$1 != prev) \
                { if (rec != "") print rec; rec = $$0; prev = $$1; } \
                else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
                else rec = rec " " $$2 } } \
index 5d9aad6..5da04ac 100644 (file)
@@ -1,3 +1,4 @@
+LD=ld
 
 #
 # Copyright (c) 1983 Regents of the University of California.
@@ -13,10 +14,10 @@ CFLAGS=     -O ${DEFS}
 
 .c.o: 
        ${CC} -p -c ${CFLAGS} $*.c
-       -ld -X -r $*.o
+       -${LD} -X -r $*.o
        mv a.out profiled/$*.o
        ${CC} ${CFLAGS} -c $*.c
-       -ld -x -r $*.o
+       -${LD} -x -r $*.o
        mv a.out $*.o
 
 hostlib hostlib_p: ${OBJS} 
@@ -37,7 +38,7 @@ clean:
 
 depend:
        for i in ${SRCS}; do \
-           cc -M ${CFLAGS} $$i | awk ' { if ($$1 != prev) \
+           ${CC} -M ${CFLAGS} $$i | awk ' { if ($$1 != prev) \
                { if (rec != "") print rec; rec = $$0; prev = $$1; } \
                else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
                else rec = rec " " $$2 } } \
index 6958409..b5df22e 100644 (file)
@@ -1,3 +1,4 @@
+LD=ld
 #
 # Copyright (c) 1983 Regents of the University of California.
 # All rights reserved.  The Berkeley software License Agreement
@@ -16,10 +17,10 @@ DESTDIR=
 
 .c.o:
        ${CC} -p -c ${CFLAGS} $*.c
-       -ld -X -r $*.o
+       -${LD} -X -r $*.o
        mv a.out profiled/$*.o
        ${CC} ${CFLAGS} -c $*.c
-       -ld -x -r $*.o
+       -${LD} -x -r $*.o
        mv a.out $*.o
 
 hostlib hostlib_p: ${OBJS} 
@@ -40,7 +41,7 @@ clean:
 
 depend:
        for i in ${SRCS}; do \
-           cc -M ${CFLAGS} $$i | awk ' { if ($$1 != prev) \
+           ${CC} -M ${CFLAGS} $$i | awk ' { if ($$1 != prev) \
                { if (rec != "") print rec; rec = $$0; prev = $$1; } \
                else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
                else rec = rec " " $$2 } } \
index d28ab05..46f6e0c 100644 (file)
@@ -1,3 +1,4 @@
+LD=ld
 #
 # Copyright (c) 1980 Regents of the University of California.
 # All rights reserved.  The Berkeley software License Agreement
@@ -13,10 +14,10 @@ TAGSFILE=tags
 
 .c.o:
        ${CC} -p -c ${CFLAGS} $*.c
-       -ld -X -r $*.o
+       -${LD} -X -r $*.o
        mv a.out profiled/$*.o
        ${CC} ${CFLAGS} -c $*.c
-       -ld -x -r $*.o
+       -${LD} -x -r $*.o
        mv a.out $*.o
 
 nslib nslib_p: ${OBJS}
@@ -37,7 +38,7 @@ clean:
 
 depend:
        for i in ${SRCS}; do \
-           cc -M ${CFLAGS} $$i | awk ' { if ($$1 != prev) \
+           ${CC} -M ${CFLAGS} $$i | awk ' { if ($$1 != prev) \
                { if (rec != "") print rec; rec = $$0; prev = $$1; } \
                else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
                else rec = rec " " $$2 } } \
diff --git a/lib/libc/o.sh b/lib/libc/o.sh
deleted file mode 100755 (executable)
index 0c490b5..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-#!/bin/sh
-
-ROOT=../..
-
-all_c=
-while read i
-do
-  set $i
-  all_c="$all_c $1"
-done <groups.txt
-all_h=`find $ROOT/cross/usr/include -type f -name '*.h' -print |LC_ALL=C sort`
-
-rm -f oldprotos.txt
-
-for i in $all_c $all_h
-do
-  echo "i=$i"
-
-  grep -H '^[A-Za-z_][0-9A-Za-z_]*[^0-9A-Za-z_][^;]*[A-Za-z_][0-9A-Za-z_]*[     ]*([    ]*)[    ]*\(,[^;]*\)\?;' $i >>oldprotos.txt
-  sed -e 's/^[A-Za-z_][0-9A-Za-z_]*[^0-9A-Za-z_][^;]*[A-Za-z_][0-9A-Za-z_]*[    ]*([    ]*)[    ]*\(,[^;]*\)\?;/\/\*&\*\//' -i $i
-
-  sed -e 's/^\(#[       ]*\(else\|endif\)\)\([^0-9A-Za-z_].*\)\?/\1/' -i $i
-
-  rm -f xx*
-  csplit -b '%05d' -q $i '/^[   ]*{[    ]*$/' '{*}'
-  for j in xx*
-  do
-    :
-  done
-  for k in xx*
-  do
-    if test $k != xx00000
-    then
-      sed -ne '2,$p' -i $k
-    fi
-    if test $k != $j
-    then
-      sed -e '$s/$/ {/' -i $k
-    fi
-  done
-  cat xx* >$i
-done
-
-grep '\.h:' oldprotos.txt >oldprotos.temp
-
-while read i
-do
-  set $i
-  i=$1
-  echo "i=$i"
-  group=$ROOT/cross/usr/include/`dirname $i`.h
-  echo "group=$group"
-  touch $group
-  if test $# -gt 1
-  then
-    echo "$2" >>$group.uses
-    group=$ROOT/cross/usr/include/$2
-    echo "group=$group"
-    touch $group
-  fi
-  $ROOT/cproto-4.6/cproto -i$ROOT/cross/usr/include -Dvax -t -H -s $i |sed -ne '2,$p' >$i.protos
-  grep -v "^static " <$i.protos >a
-  if test -s a
-  then
-    (
-      cat <<EOF
-
-/* $i */
-EOF
-      cat a
-    ) >>$group.protos
-
-    protos="`sed -ne 's/^.*[^0-9A-Za-z_]\([A-Za-z_][0-9A-Za-z_]*\) __P((.*));$/\1/p' a`"
-    echo "protos=$protos"
-
-    pattern=
-    prefix=
-    for j in $protos
-    do
-      pattern="$pattern$prefix$j"
-      prefix='\|'
-    done
-    echo "pattern=$pattern"
-
-    grep "[^0-9A-Za-z_]\\($pattern\\)[  ]*(" oldprotos.temp >$i.oldprotos
-    grep -v "^$group:" $i.oldprotos
-  fi
-done <groups.txt
diff --git a/lib/libc/p.sh b/lib/libc/p.sh
deleted file mode 100755 (executable)
index 7b3c8c5..0000000
+++ /dev/null
@@ -1,206 +0,0 @@
-#!/bin/sh
-
-ROOT=../..
-
-all_c=
-while read i
-do
-  set $i
-  all_c="$all_c $1"
-done <groups.txt
-all_h=`find $ROOT/cross/usr/include -type f -name '*.h' -print |LC_ALL=C sort`
-
-all_c_nocomm=
-all_c_protos_nocomm=
-for i in $all_c
-do
-  $ROOT/scripts/nocomment <$i |$ROOT/scripts/nostring >$i.nocomm
-  all_c_nocomm="$all_c_nocomm $i.nocomm"
-  if test -f $i.protos
-  then
-    $ROOT/scripts/nocomment <$i.protos |$ROOT/scripts/nostring >$i.protos.nocomm
-    all_c_protos_nocomm="$all_c_protos_nocomm $i.protos.nocomm"
-  fi
-done
-
-all_h_nocomm=
-all_h_protos_nocomm=
-for i in $all_h
-do
-  $ROOT/scripts/nocomment <$i |$ROOT/scripts/nostring >$i.nocomm
-  all_h_nocomm="$all_h_nocomm $i.nocomm"
-  if test -f $i.protos
-  then
-    $ROOT/scripts/nocomment <$i.protos |$ROOT/scripts/nostring >$i.protos.nocomm
-    all_h_protos_nocomm="$all_h_protos_nocomm $i.protos.nocomm"
-  fi
-done
-
-sed -e 's/^/:/;s/ /::/g;s/$/:/' <conflicts.txt >conflicts.temp
-
-for i in $all_h
-do
-  echo "i=$i"
-  h=`echo $i |sed -e "s:^$ROOT/cross/usr/include/::"`
-  echo "h=$h"
-
-  macros="`sed -ne 's/^#[       ]*define[       ]\+\([A-Za-z_][0-9A-Za-z_]*\).*/\1/p' $i.nocomm |grep -v '^\(NULL\)$'`"
-  echo "macros=$macros"
-  typedefs="`sed -ne 's/^\(.*[^0-9A-Za-z_]\)\?typedef[^0-9A-Za-z_]\(.*[^0-9A-Za-z_]\)\?\([A-Za-z_][0-9A-Za-z_]*\)[      ]*\(\[[         0-9]*\][        ]*\)\?;.*/\3/p' $i.nocomm; sed -ne 's/^}[       ]*\([A-Za-z_][0-9A-Za-z_]*\)[   ]*;.*/\1/p' $i.nocomm`"
-  echo "typedefs=$typedefs"
-  structs="`sed -ne 's/^\(.*[^0-9A-Za-z_]\)\?struct[    ]\+\([A-Za-z_][0-9A-Za-z_]*\)[  ]*{.*/\2/p' $i.nocomm`"
-  echo "structs=$structs"
-  unions="`sed -ne 's/^\(.*[^0-9A-Za-z_]\)\?union[      ]\+\([A-Za-z_][0-9A-Za-z_]*\)[  ]*{.*/\2/p' $i.nocomm`"
-  echo "unions=$unions"
-  protos=
-  if test -f $i.protos.nocomm
-  then
-    protos="`sed -ne 's/^.*[^0-9A-Za-z_]\([A-Za-z_][0-9A-Za-z_]*\) __P((.*));$/\1/p' $i.protos`"
-  fi
-  echo "protos=$protos"
-
-  rm -f $i.usedby
-
-  prefix0=
-  pattern0=
-
-  pattern1=
-  prefix1=
-  for j in $macros
-  do
-    pattern1="$pattern1$prefix1$j"
-    prefix1='\|'
-  done
-  for j in $typedefs
-  do
-    pattern1="$pattern1$prefix1$j"
-    prefix1='\|'
-  done
-  for j in $structs
-  do
-    pattern1="$pattern1${prefix1}struct[        ]\\+$j"
-    prefix1='\|'
-  done
-  for j in $unions
-  do
-    pattern1="$pattern1${prefix1}union[         ]\\+$j"
-    prefix1='\|'
-  done
-  echo "pattern1=$pattern1"
-  if test -n "$pattern1"
-  then
-    pattern0="$pattern0$prefix0\\(.*[^0-9A-Za-z_]\\)\\?\\($pattern1\\)\\([^0-9A-Za-z_].*\\)\\?"
-    prefix0='\|'
-  fi
-
-  pattern1=
-  prefix1=
-  for j in $protos
-  do
-    pattern1="$pattern1$prefix1$j"
-    prefix1='\|'
-  done
-  echo "pattern1=$pattern1"
-  if test -n "$pattern1"
-  then
-    pattern0="$pattern0$prefix0\\(.*[^0-9A-Za-z_]\\)\\?\\($pattern1\\)[         ]*(.*"
-    prefix0='\|'
-  fi
-
-  echo "pattern0=$pattern0"
-  if test -n "$pattern0"
-  then
-    grep -H "^\\($pattern0\\)$" $all_c_nocomm $all_c_protos_nocomm $all_h_protos_nocomm |grep -v "^$i\.protos.nocomm:" >a
-    if test -s a
-    then
-      cat a >>$i.usedby
-      for j in `sed -e 's/\.protos\.nocomm:.*//; s/\.nocomm:.*//' <a |sort |uniq`
-      do
-        echo "j=$j"
-        k=`echo $j |sed -e "s:^$ROOT/cross/usr/include/::"`
-        echo "k=$k"
-        if ! grep -q ":$h:.*:$k\\|:$k:.*:$h:" conflicts.temp
-        then
-          echo $h >>$j.uses
-        fi
-      done
-    fi
-  fi
-
-  pattern0=
-  prefix0=
-
-  pattern1=
-  prefix1=
-  for j in $macros
-  do
-    pattern1="$pattern1$prefix1$j"
-    prefix1='\|'
-  done
-  for j in $typedefs
-  do
-    pattern1="$pattern1$prefix1$j"
-    prefix1='\|'
-  done
-  echo "pattern1=$pattern1"
-  if test -n "$pattern1"
-  then
-    pattern0="$pattern0$prefix0\\(.*[^0-9A-Za-z_]\\)\\?\\($pattern1\\)\\([^0-9A-Za-z_].*\\)\\?"
-    prefix0='\|'
-  fi
-
-  pattern1=
-  prefix1=
-  for j in $structs
-  do
-    pattern1="$pattern1${prefix1}struct[        ]\\+$j"
-    prefix1='\|'
-  done
-  for j in $unions
-  do
-    pattern1="$pattern1${prefix1}union[         ]\\+$j"
-    prefix1='\|'
-  done
-  echo "pattern1=$pattern1"
-  if test -n "$pattern1"
-  then
-    pattern0="$pattern0$prefix0\\(.*[^0-9A-Za-z_]\\)\\?\\($pattern1\\)\\([^     *0-9A-Za-z_].*\\|[      ]\\+\\([^*].*\\)\\?\\)\\?"
-    prefix0='\|'
-  fi
-
-  pattern1=
-  prefix1=
-  for j in $protos
-  do
-    pattern1="$pattern1$prefix1$j"
-    prefix1='\|'
-  done
-  echo "pattern1=$pattern1"
-  if test -n "$pattern1"
-  then
-    pattern0="$pattern0$prefix0\\(.*[^0-9A-Za-z_]\\)\\?\\($pattern1\\)[         ]*(.*"
-    prefix0='\|'
-  fi
-
-  echo "pattern0=$pattern0"
-
-  if test -n "$pattern0"
-  then
-    grep -H "^\\($pattern0\\)$" $all_h_nocomm |grep -v "^$i\.nocomm:" >a
-    if test -s a
-    then
-      cat a >>$i.usedby
-      for j in `sed -e 's/\.nocomm:.*//' <a |sort |uniq`
-      do
-        echo "j=$j"
-        k=`echo $j |sed -e "s:^$ROOT/cross/usr/include/::"`
-        echo "k=$k"
-        if ! grep -q ":$h:.*:$k\\|:$k:.*:$h:" conflicts.temp
-        then
-          echo $h >>$j.uses
-        fi
-      done
-    fi
-  fi
-done
diff --git a/lib/libc/q.sh b/lib/libc/q.sh
deleted file mode 100755 (executable)
index 7f262f9..0000000
+++ /dev/null
@@ -1,176 +0,0 @@
-#!/bin/sh
-
-ROOT=../..
-
-all_c=
-while read i
-do
-  set $i
-  all_c="$all_c $1"
-done <groups.txt
-all_h=`find $ROOT/cross/usr/include -type f -name '*.h' -print |LC_ALL=C sort`
-
-for i in $all_h
-do
-  echo "i=$i"
-  rm -f xx*
-  csplit -b '%05d' -q $i '/^#/' '{*}'
-  if test -f xx00001 && ! $ROOT/scripts/nocomment <xx00000 |grep -q '[^         ]'
-  then
-    for j in xx*
-    do
-      :
-    done
-    echo "j=$j"
-    define="`sed -ne 's/^#[     ]*ifndef[       ]\+\([A-Za-z_][0-9A-Za-z_]*\).*/\1/p' xx00001`"
-    echo "define=$define"
-    if test -n "$define" && grep -q '^#[        ]*endif$' $j && ! grep -v "^#" $j |$ROOT/scripts/nocomment |grep -q '[^         ]'
-    then
-      sed -e "s/^#[     ]*ifndef[       ]\\+$define/\\/\\*&\\*\\//" -i xx00001
-      sed -e "s/^\\(#[  ]*define[       ]\\+$define\\)[         ]*$/\\/\\*\1\\*\\//" -i xx00002
-      sed -e 's/^#[     ]*endif$/\/\*&\*\//' -i $j
-      cat xx* >a
-      iflevel=0
-      for j in `sed -ne 's/^#[  ]*\(if\|ifdef\|ifndef\)[^0-9A-Za-z_].*/1/p; s/^#[       ]*endif$/-1/p' a`
-      do
-        iflevel=`expr $iflevel + $j`
-        if test $iflevel -lt 0
-        then
-          break
-        fi
-      done
-      echo "iflevel=$iflevel"
-      if test $iflevel -eq 0
-      then
-        mv a $i
-      fi
-    fi
-  fi
-done
-
-for i in $all_c $all_h
-do
-  echo "i=$i"
-  rm -f xx*
-  csplit -b '%05d' -q $i '/^#[  ]*include[^0-9A-Za-z_]/' '{*}'
-  for j in xx*
-  do
-    sed -e 's/^#[       ]*include[      ]*\(<[^>]*>\|"[^"]*"\)/\/\*&\*\//' -i $j
-    if grep -v "^#[     ]*include[^0-9A-Za-z_]" $j |sed -e '/^#[        ]*if.*SCCS/,/^#[        ]*endif/s/.*//' |$ROOT/scripts/nocomment |grep -q '[^   ]'
-    then
-      break
-    fi
-  done 
-  cat xx* >$i
-done
-
-for i in $all_c
-do
-  echo "i=$i"
-
-  if test -s $i.protos && grep '^static ' $i.protos >a
-  then
-    pattern="`sed -ne '1{s/\*/\\\*/g; s/ __P((.*));/(/p}' $i.protos`"
-    echo "pattern=$pattern"
-    rm -f xx*
-    csplit -q $i "/^$pattern/"
-    if test -f xx01
-    then
-      (
-        echo
-        cat xx01
-      ) >>a
-    fi
-    cat xx00 a >$i
-  fi
-
-  rm -f a
-  if test -s $i.uses
-  then
-    LC_ALL=C sort <$i.uses |uniq >a
-
-    pattern=
-    prefix=
-    for j in `cat a`
-    do
-      pattern="$pattern$prefix$j"
-      prefix='\|'
-    done
-    echo "pattern=$pattern"
-
-    sed -e "s:^#[       ]*include[      ]*\\(<\\($pattern\\)>\\|\"\\($pattern\\)\"\\):\\/\\*&\\*\\/:" -i $i
-  fi
-  
-  (
-    if test -s a
-    then
-      sed -e 's/.*/#include <&>/; s/^#include <varargs.h>$/#ifdef __STDC__\n#include <stdarg.h>\n#define _va_start(argp, arg) va_start(argp, arg)\n#else\n#include <varargs.h>\n#define _va_start(argp, arg) va_start(argp)\n#endif/' a
-      echo
-    fi
-    sed -e 's/\([^0-9A-Za-z_]\)va_start(argp);/\1_va_start(argp, fmt);/' $i
-  ) |$ROOT/scripts/newline >b
-  mv b $i
-done
-
-for i in $all_h
-do
-  echo "i=$i"
-  h=`echo $i |sed -e "s:^$ROOT/cross/usr/include/::"`
-  echo "h=$h"
-
-  rm -f a
-  if test -s $i.uses
-  then
-    LC_ALL=C sort <$i.uses |uniq >a
-
-    pattern=
-    prefix=
-    for j in `cat a`
-    do
-      pattern="$pattern$prefix$j"
-      prefix='\|'
-    done
-    echo "pattern=$pattern"
-
-    sed -e "s:^#[       ]*include[      ]*\\(<\\($pattern\\)>\\|\"\\($pattern\\)\"\\):\\/\\*&\\*\\/:" -i $i
-  fi
-
-  name=_`echo $h |tr '.\-/abcdefghijklmnopqrstuvwxyz' '___ABCDEFGHIJKLMNOPQRSTUVWXYZ'`_
-  echo "name=$name"
-  (
-    cat <<EOF
-#ifndef $name
-#define $name
-
-EOF
-    if test -s a
-    then
-      sed -e 's/.*/#include <&>/; s/^#include <varargs.h>$/#ifdef __STDC__\n#include <stdarg.h>\n#endif/' a
-      echo
-    fi
-    cat $i
-    if test -s $i.protos
-    then
-      cat <<EOF
-
-#ifndef KERNEL
-#ifndef __P
-#ifdef __STDC__
-#define __P(args) args
-#else
-#define __P(args) ()
-#endif
-#endif
-EOF
-      cat $i.protos
-      cat <<EOF
-#endif
-EOF
-    fi
-    cat <<EOF
-
-#endif
-EOF
-  ) |$ROOT/scripts/newline >b
-  mv b $i
-done
diff --git a/lib/libc/r.sh b/lib/libc/r.sh
deleted file mode 100755 (executable)
index 2916f8e..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/bin/sh
-
-ROOT=../..
-
-all_c=
-while read i
-do
-  set $i
-  all_c="$all_c $1"
-done <groups.txt
-all_h=`find $ROOT/cross/usr/include -type f -name '*.h' -print |LC_ALL=C sort`
-
-# checking header loops
-grep -H '^#include <[^>]*>' $all_h |\
-sed -e "s:^$ROOT/cross/usr/include/\(.*\)\:#include <\(.*\)>:\1 \2:" |\
-tsort >a
-
-# removing useless extra header inclusions that are pulled in anyway
-touch $ROOT/cross/usr/include/stdarg.h
-rm -f a
-for i in $all_h
-do
-  echo "i=$i"
-  h=`echo $i |sed -e "s:^$ROOT/cross/usr/include/::"`
-  echo "h=$h"
-
-  pattern=
-  prefix=
-  cp $i temp.c
-  for j in `cpp -nostdinc -I$ROOT/cross/usr/include -Dvax -DNCMD=1 -DNRSP=1 -M temp.c`
-  do
-    case $j in
-    $ROOT/cross/usr/include/stdarg.h)
-      # system header files are not supposed to define stdarg.h, even if
-      # (like vfprintf etc) they have va_list paramters, it is silly and
-      # we ignore this restriction, but clients shouldn't rely on this
-      # (anyway, the above cpp command defines __STDC__ so we do not pick
-      # up any dependency on varargs.h, hence let's keep it symmetrical)
-      ;;
-    $ROOT/cross/usr/include/*.h)
-      k=`echo $j |sed -e "s:^$ROOT/cross/usr/include/::"`
-      echo "$h $k" >>a
-      pattern="$pattern$prefix$k"
-      prefix='\|'
-      ;;
-    esac
-  done
-  echo "pattern=$pattern"
-  if test -n "$pattern"
-  then
-    sed -e "s:^#include <\\($pattern\\)>$:/\\*& $h\\*/:" -i `grep -H "^#include <$h>$" $all_c $all_h |sed -e 's/:.*//'`
-  fi
-done
-rm -f $ROOT/cross/usr/include/stdarg.h temp.c 
-tsort <a >b
-
-#rm -rf ../libx_c.post
-#cp -r ../libx_c ../libx_c.post
-#patch --strip 1 <post.patch
diff --git a/lib/libc/s.sh b/lib/libc/s.sh
deleted file mode 100755 (executable)
index 27c2aad..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/sh
-
-ROOT=../..
-
-for i in . arpa protocols
-do
-  echo "i=$i"
-  for j in $ROOT/include/$i/*.h
-  do
-    echo "j=$j"
-    cp $ROOT/cross/usr/include/$i/`basename $j` $ROOT/include/$i
-  done
-done
-for i in compat-4.1 compat-sys5 gen inet net ns stdio sys
-do
-  echo "i=$i"
-  cp $ROOT/cross/usr/include/$i.h $ROOT/include
-done
-for i in net netimp netinet netns vax vaxif vaxmba vaxuba
-do
-  echo "i=$i"
-  for j in $ROOT/sys/$i/*.h
-  do
-    echo "j=$j"
-    cp $ROOT/cross/usr/include/$i/`basename $j` $ROOT/sys/$i
-  done
-done
-for i in $ROOT/sys/h/*.h
-do
-  echo "i=$i"
-  cp $ROOT/cross/usr/include/sys/`basename $i` $ROOT/sys/h
-done
index 331b111..31ba5f7 100644 (file)
@@ -1,3 +1,4 @@
+LD=ld
 #
 # Copyright (c) 1980 Regents of the University of California.
 # All rights reserved.  The Berkeley software License Agreement
@@ -22,10 +23,10 @@ TAGSFILE=tags
 
 .c.o:
        ${CC} -p ${CFLAGS} -c $*.c
-       -ld -X -r $*.o
+       -${LD} -X -r $*.o
        mv a.out profiled/$*.o
        ${CC} ${CFLAGS} -c $*.c
-       -ld -x -r $*.o
+       -${LD} -x -r $*.o
        mv a.out $*.o
 
 stdiolib stdiolib_p: ${OBJS}
@@ -45,7 +46,7 @@ clean:
 
 depend:
        for i in ${SRCS}; do \
-           cc -M ${CFLAGS} $$i | awk ' { if ($$1 != prev) \
+           ${CC} -M ${CFLAGS} $$i | awk ' { if ($$1 != prev) \
                { if (rec != "") print rec; rec = $$0; prev = $$1; } \
                else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
                else rec = rec " " $$2 } } \
index c61a4ae..4a47521 100644 (file)
@@ -1,3 +1,4 @@
+LD=ld
 #
 # Copyright (c) 1980 Regents of the University of California.
 # All rights reserved.  The Berkeley software License Agreement
@@ -45,10 +46,10 @@ TAGSFILE=tags
 
 .c.o:
        ${CC} -p -c ${CFLAGS} $*.c
-       -ld -X -r $*.o
+       -${LD} -X -r $*.o
        mv a.out profiled/$*.o
        ${CC} ${CFLAGS} -c $*.c
-       -ld -x -r $*.o
+       -${LD} -x -r $*.o
        mv a.out $*.o
 
 syslib syslib_p: ${OBJS}
@@ -69,7 +70,7 @@ clean:
 
 depend:
        for i in ${SRCS}; do \
-           cc -M ${CFLAGS} $$i | awk ' { if ($$1 != prev) \
+           ${CC} -M ${CFLAGS} $$i | awk ' { if ($$1 != prev) \
                { if (rec != "") print rec; rec = $$0; prev = $$1; } \
                else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
                else rec = rec " " $$2 } } \
index 7fe0c12..e5d6f3c 100644 (file)
@@ -1,3 +1,4 @@
+LD=ld
 #
 # Copyright (c) 1980 Regents of the University of California.
 # All rights reserved.  The Berkeley software License Agreement
@@ -12,10 +13,10 @@ TAGSFILE=tags
 
 .c.o:
        /lib/cpp -E ${CFLAGS} -DPROF $*.c | ${AS} -o $*.o
-       -ld -X -r $*.o
+       -${LD} -X -r $*.o
        mv a.out profiled/$*.o
        /lib/cpp -E ${CFLAGS} $*.c | ${AS} -o $*.o
-       -ld -x -r $*.o
+       -${LD} -x -r $*.o
        mv a.out $*.o
 
 compat-4.1lib compat-4.1lib_p: ${OBJS}
@@ -32,7 +33,7 @@ clean:
 
 depend:
        for i in ${SRCS}; do \
-           cc -M ${CFLAGS} $$i | awk ' { if ($$1 != prev) \
+           ${CC} -M ${CFLAGS} $$i | awk ' { if ($$1 != prev) \
                { if (rec != "") print rec; rec = $$0; prev = $$1; } \
                else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
                else rec = rec " " $$2 } } \
@@ -49,7 +50,3 @@ depend:
 
 # DO NOT DELETE THIS LINE -- make depend uses it
 
-reset.o: reset.c ./DEFS.h
-# DEPENDENCIES MUST END AT END OF FILE
-# IF YOU PUT STUFF HERE IT WILL GO AWAY
-# see make depend above
index c12f180..4e3fd80 100644 (file)
@@ -1,3 +1,4 @@
+LD=ld
 #
 # Copyright (c) 1980 Regents of the University of California.
 # All rights reserved.  The Berkeley software License Agreement
@@ -22,37 +23,37 @@ install: ${OBJS}
        mv gcrt0.o ${DESTDIR}/usr/lib/gcrt0.o
 
 crt0.o:        crt0.c
-       cc -S ${DFLAGS} -DCRT0 crt0.c
+       ${CC} -S ${DFLAGS} -DCRT0 crt0.c
        /lib/cpp crt0.s > x.s
        as -o x.o x.s
-       ld -x -r -o crt0.o x.o
+       ${LD} -x -r -o crt0.o x.o
        rm -f x.s x.o crt0.s
 
 moncrt0.o: crt0.c
-       cc -S ${DFLAGS} -DMCRT0 crt0.c
+       ${CC} -S ${DFLAGS} -DMCRT0 crt0.c
        /lib/cpp crt0.s > x.s
        as -o x.o x.s
-       ld -x -r -o moncrt0.o x.o
+       ${LD} -x -r -o moncrt0.o x.o
        rm -f x.s x.o crt0.s
 
 gcrt0.o: moncrt0.o gmon.o
-       ld -x -r -o gcrt0.o moncrt0.o gmon.o
+       ${LD} -x -r -o gcrt0.o moncrt0.o gmon.o
 
 mcrt0.o: moncrt0.o mon.o
-       ld -x -r -o mcrt0.o moncrt0.o mon.o
+       ${LD} -x -r -o mcrt0.o moncrt0.o mon.o
 
 mon.o: mon.c mon.ex
-       cc -S ${DEFS} ${DFLAGS} mon.c
+       ${CC} -S ${DEFS} ${DFLAGS} mon.c
        ex - mon.s < mon.ex
        as -o x.o mon.s
-       ld -x -r -o mon.o x.o
+       ${LD} -x -r -o mon.o x.o
        rm -f x.o mon.s
 
 gmon.o: gmon.c gmon.h gmon.ex
-       cc -S ${DEFS} ${DFLAGS} gmon.c
+       ${CC} -S ${DEFS} ${DFLAGS} gmon.c
        ex - gmon.s < gmon.ex
        as -o x.o gmon.s
-       ld -x -r -o gmon.o x.o
+       ${LD} -x -r -o gmon.o x.o
        rm -f x.o gmon.s
 
 tags:  
@@ -71,7 +72,7 @@ lint: crt0.c
 
 depend:
        for i in ${SRCS}; do \
-           cc -M ${DEFS} ${DFLAGS} $$i | awk ' { if ($$1 != prev) \
+           ${CC} -M ${DEFS} ${DFLAGS} $$i | awk ' { if ($$1 != prev) \
                { if (rec != "") print rec; rec = $$0; prev = $$1; } \
                else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
                else rec = rec " " $$2 } } \
@@ -88,9 +89,3 @@ depend:
 
 # DO NOT DELETE THIS LINE -- make depend uses it
 
-crt0.o: crt0.c
-mon.o: mon.c
-gmon.o: gmon.c ./gmon.h
-# DEPENDENCIES MUST END AT END OF FILE
-# IF YOU PUT STUFF HERE IT WILL GO AWAY
-# see make depend above
index d76ebb9..bd1584a 100644 (file)
@@ -1,3 +1,4 @@
+LD=ld
 #      Makefile        4.13    86/01/09
 #
 SRCS=  _setjmp.s abs.s alloca.s atof.s bcmp.s bcopy.s bzero.s disktab.c \
@@ -13,18 +14,18 @@ TAGSFILE=tags
 
 .s.o:
        /lib/cpp -E ${DEFS} -DPROF $*.s | ${AS} -o $*.o
-       -ld -X -r $*.o
+       -${LD} -X -r $*.o
        mv a.out profiled/$*.o
        /lib/cpp -E ${DEFS} $*.s | ${AS} -o $*.o
-       -ld -x -r $*.o
+       -${LD} -x -r $*.o
        mv a.out $*.o
 
 .c.o:
-       cc -p -c ${CFLAGS} $*.c
-       -ld -X -r $*.o
+       ${CC} -p -c ${CFLAGS} $*.c
+       -${LD} -X -r $*.o
        mv a.out profiled/$*.o
-       cc -c ${CFLAGS} $*.c
-       -ld -x -r $*.o
+       ${CC} -c ${CFLAGS} $*.c
+       -${LD} -x -r $*.o
        mv a.out $*.o
 
 genlib genlib_p: ${OBJS}
@@ -45,7 +46,7 @@ clean:
 
 depend:
        for i in ${SRCS}; do \
-           cc -M ${CFLAGS} $$i | awk ' { if ($$1 != prev) \
+           ${CC} -M ${CFLAGS} $$i | awk ' { if ($$1 != prev) \
                { if (rec != "") print rec; rec = $$0; prev = $$1; } \
                else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
                else rec = rec " " $$2 } } \
@@ -62,36 +63,3 @@ depend:
 
 # DO NOT DELETE THIS LINE -- make depend uses it
 
-_setjmp.o: _setjmp.s ./DEFS.h
-abs.o: abs.s ./DEFS.h
-alloca.o: alloca.s ./DEFS.h
-atof.o: atof.s ./DEFS.h
-bcmp.o: bcmp.s ./DEFS.h
-bcopy.o: bcopy.s ./DEFS.h
-bzero.o: bzero.s ./DEFS.h
-disktab.o: disktab.c /usr/include/disktab.h /usr/include/stdio.h
-disktab.o: /usr/include/ctype.h
-ecvt.o: ecvt.c
-fabs.o: fabs.s ./DEFS.h
-ffs.o: ffs.s ./DEFS.h
-frexp.o: frexp.s ./DEFS.h
-index.o: index.s ./DEFS.h
-insque.o: insque.s ./DEFS.h
-ldexp.o: ldexp.s ./DEFS.h /usr/include/errno.h
-modf.o: modf.s ./DEFS.h
-nargs.o: nargs.s ./DEFS.h
-remque.o: remque.s ./DEFS.h
-rindex.o: rindex.s ./DEFS.h
-setjmp.o: setjmp.s ./DEFS.h /usr/include/vax/machparam.h
-strcat.o: strcat.s ./DEFS.h
-strcmp.o: strcmp.s ./DEFS.h
-strcpy.o: strcpy.s ./DEFS.h
-strlen.o: strlen.s ./DEFS.h
-strncat.o: strncat.s ./DEFS.h
-strncmp.o: strncmp.s ./DEFS.h
-strncpy.o: strncpy.s ./DEFS.h
-udiv.o: udiv.s ./DEFS.h ./DEFS.h
-urem.o: urem.s ./DEFS.h ./DEFS.h
-# DEPENDENCIES MUST END AT END OF FILE
-# IF YOU PUT STUFF HERE IT WILL GO AWAY
-# see make depend above
index d63b813..6993f16 100644 (file)
@@ -1,3 +1,4 @@
+LD=ld
 #
 # Copyright (c) 1983 Regents of the University of California.
 # All rights reserved.  The Berkeley software License Agreement
@@ -12,10 +13,10 @@ TAGSFILE=tags
 
 .c.o:
        /lib/cpp -E ${CFLAGS} -DPROF $*.c | ${AS} -o $*.o
-       -ld -x -r $*.o
+       -${LD} -x -r $*.o
        mv a.out profiled/$*.o
        /lib/cpp -E ${CFLAGS} $*.c | ${AS} -o $*.o
-       -ld -x -r $*.o
+       -${LD} -x -r $*.o
        mv a.out $*.o
 
 netlib netlib_p: ${OBJS}
@@ -36,7 +37,7 @@ clean:
 
 depend:
        for i in ${SRCS}; do \
-           cc -M ${CFLAGS} $$i | awk ' { if ($$1 != prev) \
+           ${CC} -M ${CFLAGS} $$i | awk ' { if ($$1 != prev) \
                { if (rec != "") print rec; rec = $$0; prev = $$1; } \
                else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
                else rec = rec " " $$2 } } \
@@ -53,10 +54,3 @@ depend:
 
 # DO NOT DELETE THIS LINE -- make depend uses it
 
-htonl.o: htonl.c ./DEFS.h
-htons.o: htons.c ./DEFS.h
-ntohl.o: ntohl.c ./DEFS.h
-ntohs.o: ntohs.c ./DEFS.h
-# DEPENDENCIES MUST END AT END OF FILE
-# IF YOU PUT STUFF HERE IT WILL GO AWAY
-# see make depend above
index 04c58b9..09cf8e6 100644 (file)
@@ -1,3 +1,4 @@
+LD=ld
 #
 # Copyright (c) 1980 Regents of the University of California.
 # All rights reserved.  The Berkeley software License Agreement
@@ -13,11 +14,11 @@ SRCS=       doprnt.c fputs.c fgets.c puts.c gets.c
 TAGSFILE=tags
 
 .c.o:
-       cc -E -DPROF ${CFLAGS} $*.c | as -o $*.o
-       -ld -x -r $*.o
+       ${CC} -E -DPROF ${CFLAGS} $*.c | as -o $*.o
+       -${LD} -x -r $*.o
        mv a.out profiled/$*.o
-       cc -E ${CFLAGS} $*.c | as -o $*.o
-       -ld -x -r $*.o
+       ${CC} -E ${CFLAGS} $*.c | as -o $*.o
+       -${LD} -x -r $*.o
        mv a.out $*.o
 
 stdiolib stdiolib_p: ${OBJS}
@@ -33,7 +34,7 @@ clean:
 
 depend:
        for i in ${SRCS}; do \
-           cc -M ${CFLAGS} $$i | awk ' { if ($$1 != prev) \
+           ${CC} -M ${CFLAGS} $$i | awk ' { if ($$1 != prev) \
                { if (rec != "") print rec; rec = $$0; prev = $$1; } \
                else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
                else rec = rec " " $$2 } } \
@@ -50,11 +51,3 @@ depend:
 
 # DO NOT DELETE THIS LINE -- make depend uses it
 
-doprnt.o: doprnt.c ../gen/DEFS.h
-fputs.o: fputs.c ../gen/DEFS.h
-fgets.o: fgets.c ../gen/DEFS.h
-puts.o: puts.c ../gen/DEFS.h
-gets.o: gets.c ../gen/DEFS.h
-# DEPENDENCIES MUST END AT END OF FILE
-# IF YOU PUT STUFF HERE IT WILL GO AWAY
-# see make depend above
index cbf667b..f6fb1d0 100644 (file)
@@ -1,3 +1,4 @@
+LD=ld
 #
 # Copyright (c) 1980 Regents of the University of California.
 # All rights reserved.  The Berkeley software License Agreement
@@ -74,10 +75,10 @@ TAGSFILE=tags
 
 .c.o:
        /lib/cpp -E ${DEFS} -DPROF $*.c | ${AS} -o $*.o
-       -ld -x -r $*.o
+       -${LD} -x -r $*.o
        mv a.out profiled/$*.o
        /lib/cpp -E ${DEFS} $*.c | ${AS} -o $*.o
-       -ld -x -r $*.o
+       -${LD} -x -r $*.o
        mv a.out $*.o
 
 syslib syslib_p: ${OBJS}
@@ -93,7 +94,7 @@ clean:
 
 depend:
        for i in ${SRCS}; do \
-           cc -M ${DEFS} $$i | awk ' { if ($$1 != prev) \
+           ${CC} -M ${DEFS} $$i | awk ' { if ($$1 != prev) \
                { if (rec != "") print rec; rec = $$0; prev = $$1; } \
                else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
                else rec = rec " " $$2 } } \
@@ -110,123 +111,3 @@ depend:
 
 # DO NOT DELETE THIS LINE -- make depend uses it
 
-Ovfork.o: Ovfork.c
-Ovadvise.o: Ovadvise.c ./SYS.h /usr/include/syscall.h
-accept.o: accept.c ./SYS.h /usr/include/syscall.h
-access.o: access.c ./SYS.h /usr/include/syscall.h
-acct.o: acct.c ./SYS.h /usr/include/syscall.h
-adjtime.o: adjtime.c ./SYS.h /usr/include/syscall.h
-bind.o: bind.c ./SYS.h /usr/include/syscall.h
-brk.o: brk.c ./SYS.h /usr/include/syscall.h
-cerror.o: cerror.c ./SYS.h /usr/include/syscall.h
-chdir.o: chdir.c ./SYS.h /usr/include/syscall.h
-chmod.o: chmod.c ./SYS.h /usr/include/syscall.h
-chown.o: chown.c ./SYS.h /usr/include/syscall.h
-chroot.o: chroot.c ./SYS.h /usr/include/syscall.h
-close.o: close.c ./SYS.h /usr/include/syscall.h
-connect.o: connect.c ./SYS.h /usr/include/syscall.h
-creat.o: creat.c ./SYS.h /usr/include/syscall.h
-dup.o: dup.c ./SYS.h /usr/include/syscall.h
-dup2.o: dup2.c ./SYS.h /usr/include/syscall.h
-execl.o: execl.c ./SYS.h /usr/include/syscall.h
-execle.o: execle.c ./SYS.h /usr/include/syscall.h
-exect.o: exect.c ./SYS.h /usr/include/syscall.h /usr/include/machine/psl.h
-execv.o: execv.c ./SYS.h /usr/include/syscall.h
-execve.o: execve.c ./SYS.h /usr/include/syscall.h
-_exit.o: _exit.c ./SYS.h /usr/include/syscall.h
-fchmod.o: fchmod.c ./SYS.h /usr/include/syscall.h
-fchown.o: fchown.c ./SYS.h /usr/include/syscall.h
-fcntl.o: fcntl.c ./SYS.h /usr/include/syscall.h
-flock.o: flock.c ./SYS.h /usr/include/syscall.h
-fork.o: fork.c ./SYS.h /usr/include/syscall.h
-fstat.o: fstat.c ./SYS.h /usr/include/syscall.h
-fsync.o: fsync.c ./SYS.h /usr/include/syscall.h
-ftruncate.o: ftruncate.c ./SYS.h /usr/include/syscall.h
-getdtablesize.o: getdtablesize.c ./SYS.h /usr/include/syscall.h
-getegid.o: getegid.c ./SYS.h /usr/include/syscall.h
-geteuid.o: geteuid.c ./SYS.h /usr/include/syscall.h
-getgid.o: getgid.c ./SYS.h /usr/include/syscall.h
-getgroups.o: getgroups.c ./SYS.h /usr/include/syscall.h
-gethostid.o: gethostid.c ./SYS.h /usr/include/syscall.h
-gethostname.o: gethostname.c ./SYS.h /usr/include/syscall.h
-getitimer.o: getitimer.c ./SYS.h /usr/include/syscall.h
-getrlimit.o: getrlimit.c ./SYS.h /usr/include/syscall.h
-getpagesize.o: getpagesize.c ./SYS.h /usr/include/syscall.h
-getpeername.o: getpeername.c ./SYS.h /usr/include/syscall.h
-getpgrp.o: getpgrp.c ./SYS.h /usr/include/syscall.h
-getpid.o: getpid.c ./SYS.h /usr/include/syscall.h
-getppid.o: getppid.c ./SYS.h /usr/include/syscall.h
-getpriority.o: getpriority.c ./SYS.h /usr/include/syscall.h
-getrusage.o: getrusage.c ./SYS.h /usr/include/syscall.h
-getsockname.o: getsockname.c ./SYS.h /usr/include/syscall.h
-getsockopt.o: getsockopt.c ./SYS.h /usr/include/syscall.h
-gettimeofday.o: gettimeofday.c ./SYS.h /usr/include/syscall.h
-getuid.o: getuid.c ./SYS.h /usr/include/syscall.h
-ioctl.o: ioctl.c ./SYS.h /usr/include/syscall.h
-kill.o: kill.c ./SYS.h /usr/include/syscall.h
-killpg.o: killpg.c ./SYS.h /usr/include/syscall.h
-link.o: link.c ./SYS.h /usr/include/syscall.h
-listen.o: listen.c ./SYS.h /usr/include/syscall.h
-lseek.o: lseek.c ./SYS.h /usr/include/syscall.h
-lstat.o: lstat.c ./SYS.h /usr/include/syscall.h
-mkdir.o: mkdir.c ./SYS.h /usr/include/syscall.h
-mknod.o: mknod.c ./SYS.h /usr/include/syscall.h
-mount.o: mount.c ./SYS.h /usr/include/syscall.h
-open.o: open.c ./SYS.h /usr/include/syscall.h
-pipe.o: pipe.c ./SYS.h /usr/include/syscall.h
-profil.o: profil.c ./SYS.h /usr/include/syscall.h
-ptrace.o: ptrace.c ./SYS.h /usr/include/syscall.h
-quota.o: quota.c ./SYS.h /usr/include/syscall.h
-read.o: read.c ./SYS.h /usr/include/syscall.h
-readlink.o: readlink.c ./SYS.h /usr/include/syscall.h
-readv.o: readv.c ./SYS.h /usr/include/syscall.h
-reboot.o: reboot.c ./SYS.h /usr/include/syscall.h
-recv.o: recv.c ./SYS.h /usr/include/syscall.h
-recvfrom.o: recvfrom.c ./SYS.h /usr/include/syscall.h
-recvmsg.o: recvmsg.c ./SYS.h /usr/include/syscall.h
-rename.o: rename.c ./SYS.h /usr/include/syscall.h
-rmdir.o: rmdir.c ./SYS.h /usr/include/syscall.h
-sbrk.o: sbrk.c ./SYS.h /usr/include/syscall.h
-select.o: select.c ./SYS.h /usr/include/syscall.h
-send.o: send.c ./SYS.h /usr/include/syscall.h
-sendmsg.o: sendmsg.c ./SYS.h /usr/include/syscall.h
-sendto.o: sendto.c ./SYS.h /usr/include/syscall.h
-setregid.o: setregid.c ./SYS.h /usr/include/syscall.h
-setgroups.o: setgroups.c ./SYS.h /usr/include/syscall.h
-sethostid.o: sethostid.c ./SYS.h /usr/include/syscall.h
-sethostname.o: sethostname.c ./SYS.h /usr/include/syscall.h
-setitimer.o: setitimer.c ./SYS.h /usr/include/syscall.h
-setquota.o: setquota.c ./SYS.h /usr/include/syscall.h
-setrlimit.o: setrlimit.c ./SYS.h /usr/include/syscall.h
-setpgrp.o: setpgrp.c ./SYS.h /usr/include/syscall.h
-setpriority.o: setpriority.c ./SYS.h /usr/include/syscall.h
-setsockopt.o: setsockopt.c ./SYS.h /usr/include/syscall.h
-settimeofday.o: settimeofday.c ./SYS.h /usr/include/syscall.h
-setreuid.o: setreuid.c ./SYS.h /usr/include/syscall.h
-shutdown.o: shutdown.c ./SYS.h /usr/include/syscall.h
-sigblock.o: sigblock.c ./SYS.h /usr/include/syscall.h
-sigpause.o: sigpause.c ./SYS.h /usr/include/syscall.h
-sigreturn.o: sigreturn.c ./SYS.h /usr/include/syscall.h
-sigsetmask.o: sigsetmask.c ./SYS.h /usr/include/syscall.h
-sigstack.o: sigstack.c ./SYS.h /usr/include/syscall.h
-sigvec.o: sigvec.c ./SYS.h /usr/include/syscall.h
-socket.o: socket.c ./SYS.h /usr/include/syscall.h
-socketpair.o: socketpair.c ./SYS.h /usr/include/syscall.h
-stat.o: stat.c ./SYS.h /usr/include/syscall.h
-swapon.o: swapon.c ./SYS.h /usr/include/syscall.h
-symlink.o: symlink.c ./SYS.h /usr/include/syscall.h
-sync.o: sync.c ./SYS.h /usr/include/syscall.h
-syscall.o: syscall.c ./SYS.h /usr/include/syscall.h
-truncate.o: truncate.c ./SYS.h /usr/include/syscall.h
-umask.o: umask.c ./SYS.h /usr/include/syscall.h
-umount.o: umount.c ./SYS.h /usr/include/syscall.h
-unlink.o: unlink.c ./SYS.h /usr/include/syscall.h
-utimes.o: utimes.c ./SYS.h /usr/include/syscall.h
-vhangup.o: vhangup.c ./SYS.h /usr/include/syscall.h
-wait.o: wait.c ./SYS.h /usr/include/syscall.h
-wait3.o: wait3.c ./SYS.h /usr/include/syscall.h
-write.o: write.c ./SYS.h /usr/include/syscall.h
-writev.o: writev.c ./SYS.h /usr/include/syscall.h
-# DEPENDENCIES MUST END AT END OF FILE
-# IF YOU PUT STUFF HERE IT WILL GO AWAY
-# see make depend above
index 39805af..1f56bc6 100755 (executable)
@@ -9,7 +9,7 @@ then
   exit 1
 fi
 
-all_h=`echo *.h` #`find . -name '*.c' -print |LC_ALL=C sort`
+all_h=`echo *.h` #`find . -name '*.h' -print |LC_ALL=C sort`
 if test "$all_h" = "*.h"
 then
   all_h=
index 775cfb4..41a7652 100755 (executable)
@@ -1,13 +1,16 @@
 #!/bin/sh
 
-f=Makefile
-if test $# -ge 1
+if test $# -lt 1
 then
-  f=$1
+  set Makefile
 fi
 
-sed -e 's/     \(-\)\?cc /     \1${CC} /; s/   \(-\)\?ld /     \1${LD} /; s/\([         ]\)cc -M /\1${CC} -M /g; /^# DO NOT DELETE THIS LINE -- make depend uses it$/{N; q}' -i $f
-if grep -q '\${LD}' $f && ! grep -q '^LD[       ]*=' $f
-then
-  sed -e '1iLD=ld' -i $f
-fi
+while test $# -ge 1
+do
+  sed -e 's/   \(-\)\?cc /     \1${CC} /; s/   \(-\)\?ld /     \1${LD} /; s/\([         ]\)cc -M /\1${CC} -M /g; /^# DO NOT DELETE THIS LINE -- make depend uses it$/{N; q}' -i $1
+  if grep -q '\${LD}' $1 && ! grep -q '^LD[     ]*=' $1
+  then
+    sed -e '1iLD=ld' -i $1
+  fi
+  shift
+done