Pre-ansification changes for bin
authorNick Downing <downing.nick@gmail.com>
Tue, 24 Jan 2017 11:18:30 +0000 (22:18 +1100)
committerNick Downing <downing.nick@gmail.com>
Tue, 24 Jan 2017 15:34:33 +0000 (02:34 +1100)
23 files changed:
.gitignore
bin/conflicts.txt
bin/mail.c
bin/mv.c
bin/ps.c
bin/rcp.c
bin/strip.c
bin/tee.c
bin/wall.c
include/gen.h
include/stdio.h
lib/libc/ansify.sh
n.sh
scripts/ansify.sh
scripts/isvoid.sh [new file with mode: 0755]
scripts/make.sh
scripts/nonvoid.sh
sys/h/proc.h
sys/net/if_arp.h
xify/cc.c
xify/ld.c
xify/xify.c
xify/xify.sh

index 1fc5bbc..ab72966 100644 (file)
@@ -8,7 +8,54 @@
 *.usedby
 *.uses
 .xify
-bin/tp
+bin/ar
+bin/cat
+bin/cc
+bin/chgrp
+bin/chmod
+bin/cmp
+bin/cp
+bin/date
+bin/dd
+bin/df
+bin/du
+bin/echo
+bin/ed
+bin/grep
+bin/hostid
+bin/hostname
+bin/kill
+bin/ld
+bin/ln
+bin/login
+bin/ls
+bin/mail
+bin/mkdir
+bin/mt
+bin/nice
+bin/nm
+bin/od
+bin/pagesize
+bin/passwd
+bin/pr
+bin/pwd
+bin/rcp
+bin/rm
+bin/rmail
+bin/rmdir
+bin/size
+bin/strip
+bin/stty
+bin/su
+bin/sync
+bin/tar
+bin/tee
+bin/test
+bin/time
+bin/tp/tp
+bin/wall
+bin/who
+bin/write
 cproto-4.6/Makefile
 cproto-4.6/config.cache
 cproto-4.6/config.h
index 6a01765..7768bab 100644 (file)
@@ -1,5 +1,19 @@
 ar.c net.h
 ar.c sys/inode.h
 ar.c sys/select.h
+dd.c sys/ioctl.h
+dd.c vaxuba/psreg.h
+df.c sys/socketvar.h
+grep.c ttychars.h
+login.c sys/tty.h
+login.c vaxuba/npreg.h
+mail.c sys/tty.h
+mt.c vaxmba/htreg.h
+mt.c vaxmba/mtreg.h
+mt.c vaxuba/tmreg.h
+mt.c vaxuba/tsreg.h
+mt.c vaxuba/utreg.h
+od.c ctype.h
 od.c vaxif/if_ddnvar.h
 tar.c vfont.h
+tee.c stdio.h
index 63810db..124f1b9 100644 (file)
@@ -13,6 +13,7 @@ static char sccsid[] = "@(#)mail.c    4.25 (Berkeley) 5/1/85";
 #include <signal.h>
 #include <setjmp.h>
 #include <sysexits.h>
+#include <varargs.h>
 
 #define SENDMAIL       "/usr/lib/sendmail"
 
@@ -34,7 +35,8 @@ struct let {
 } let[MAXLET];
 int    nlet    = 0;
 char   lfil[50];
-long   iop, time();
+long   iop;
+long   time();
 char   *getenv();
 char   *index();
 char   lettmp[] = "/tmp/maXXXXX";
@@ -728,12 +730,16 @@ safefile(f)
        return (1);
 }
 
-panic(msg, a1, a2, a3)
+panic(msg, va_alist)
        char *msg;
+       va_dcl
 {
+       va_list argp;
 
        fprintf(stderr, "mail: ");
-       fprintf(stderr, msg, a1, a2, a3);
+       va_start(argp);
+       vfprintf(stderr, msg, argp);
+       va_end(argp);
        fprintf(stderr, "\n");
        done();
 }
index 5446f96..b4829fb 100644 (file)
--- a/bin/mv.c
+++ b/bin/mv.c
@@ -39,7 +39,7 @@ char  *dname();
 struct stat s1, s2;
 int    iflag = 0;      /* interactive mode */
 int    fflag = 0;      /* force overwriting */
-extern unsigned errno;
+extern int errno;
 
 main(argc, argv)
        register char *argv[];
@@ -250,13 +250,16 @@ cleanup:
        return (0);
 }
 
-/*VARARGS*/
-query(prompt, a1, a2)
-       char *a1;
+query(prompt, va_alist)
+       char *prompt;
+       va_dcl
 {
+       va_list argp;
        register int i, c;
 
-       fprintf(stderr, prompt, a1, a2);
+       va_start(argp);
+       vfprintf(stderr, prompt, argp);
+       va_end(argp);
        i = c = getchar();
        while (c != '\n' && c != EOF)
                c = getchar();
@@ -276,13 +279,16 @@ dname(name)
        return name;
 }
 
-/*VARARGS*/
-error(fmt, a1, a2)
+error(fmt, va_alist)
        char *fmt;
+       va_dcl
 {
+       va_list argp;
 
        fprintf(stderr, "mv: ");
-       fprintf(stderr, fmt, a1, a2);
+       va_start(argp);
+       vfprintf(stderr, fmt, argp);
+       va_end(argp);
        fprintf(stderr, "\n");
 }
 
index 82665a1..09f12ab 100644 (file)
--- a/bin/ps.c
+++ b/bin/ps.c
@@ -343,8 +343,8 @@ main(argc, argv)
        getkvars(argc, argv);
        uid = getuid();
        printhdr();
-       procp = getw(nl[X_PROC].n_value);
-       nproc = getw(nl[X_NPROC].n_value);
+       procp = _getw(nl[X_PROC].n_value);
+       nproc = _getw(nl[X_NPROC].n_value);
        savcom = (struct savcom *)calloc((unsigned) nproc, sizeof (*savcom));
        for (i=0; i<nproc; i += NPROC) {
                klseek(kmem, (long)procp, 0);
@@ -410,7 +410,7 @@ main(argc, argv)
        exit(npr == 0);
 }
 
-getw(loc)
+_getw(loc)
        unsigned long loc;
 {
        int word;
@@ -636,14 +636,14 @@ getkvars(argc, argv)
                exit(1);
        }
        if (uflg || vflg) {
-               ntext = getw(nl[X_NTEXT].n_value);
+               ntext = _getw(nl[X_NTEXT].n_value);
                text = (struct text *)
                        calloc((unsigned) ntext, sizeof (struct text));
                if (text == 0) {
                        fprintf(stderr, "no room for text table\n");
                        exit(1);
                }
-               atext = (struct text *)getw(nl[X_TEXT].n_value);
+               atext = (struct text *)_getw(nl[X_TEXT].n_value);
                klseek(kmem, (long)atext, 0);
                if (read(kmem, (char *)text, ntext * sizeof (struct text))
                    != ntext * sizeof (struct text)) {
@@ -651,8 +651,8 @@ getkvars(argc, argv)
                        exit(1);
                }
        }
-       dmmin = getw(nl[X_DMMIN].n_value);
-       dmmax = getw(nl[X_DMMAX].n_value);
+       dmmin = _getw(nl[X_DMMIN].n_value);
+       dmmax = _getw(nl[X_DMMAX].n_value);
 }
 
 /*
@@ -665,7 +665,7 @@ getvchans()
        if (nflg)
                return;
 
-#define addv(i)        addchan(&nl[i].n_un.n_name[1], getw(nl[i].n_value))
+#define addv(i)        addchan(&nl[i].n_un.n_name[1], _getw(nl[i].n_value))
        addv(X_INODE);
        addv(X_FILE);
        addv(X_PROC);
index b1c6f9d..2c27359 100644 (file)
--- a/bin/rcp.c
+++ b/bin/rcp.c
@@ -30,6 +30,7 @@ static char sccsid[] = "@(#)rcp.c     5.4 (Berkeley) 9/12/85";
 #include <ctype.h>
 #include <netdb.h>
 #include <errno.h>
+#include <varargs.h>
 
 int    rem;
 char   *colon(), *index(), *rindex();
@@ -693,16 +694,18 @@ allocbuf(bp, fd, blksize)
        return (bp);
 }
 
-/*VARARGS1*/
-error(fmt, a1, a2, a3, a4, a5)
+error(fmt, va_alist)
        char *fmt;
-       int a1, a2, a3, a4, a5;
+       va_dcl
 {
        char buf[BUFSIZ], *cp = buf;
+       va_list argp;
 
        errs++;
        *cp++ = 1;
-       (void) sprintf(cp, fmt, a1, a2, a3, a4, a5);
+       va_start(argp);
+       (void) vsprintf(cp, fmt, argp);
+       va_end(argp);
        (void) write(rem, buf, strlen(buf));
        if (iamremote == 0)
                (void) write(2, buf+1, strlen(buf+1));
index f8ccaf3..9928fe3 100644 (file)
@@ -66,7 +66,7 @@ strip(name)
        if (head.a_magic == ZMAGIC)
                size += pagesize - sizeof (head);
        if (ftruncate(f, size + sizeof (head)) < 0) {
-               fprintf("strip: "); perror(name);
+               fprintf(stderr, "strip: "); perror(name);
                status = 1;
                goto out;
        }
index 4b45242..6b4221d 100644 (file)
--- a/bin/tee.c
+++ b/bin/tee.c
@@ -72,7 +72,7 @@ char **argv;
                                r = 0;
                                if(w<=0) {
                                        stash(p);
-                                       exit(0);
+                                       _exit(0);
                                }
                        }
                        out[p++] = in[r++];
index 7dd2131..de6018a 100644 (file)
@@ -40,7 +40,8 @@ char  *strcpy();
 char   *strcat();
 void   *malloc();
 char   who[9] = "???";
-long   clock, time();
+long   clock;
+long   time();
 struct tm *localtime();
 struct tm *localclock;
 
index 991b438..7b38978 100644 (file)
@@ -36,8 +36,16 @@ struct vaxque {              /* queue format expected by VAX queue instructions */
 #endif
 #endif
 
+#ifndef NORETURN
+#ifdef __GNUC__
+#define NORETURN __attribute__ ((__noreturn__))
+#else
+#define NORETURN
+#endif
+#endif
+
 /* gen/abort.c */
-int abort __P((void));
+int abort __P((void)) NORETURN;
 
 /* gen/abs.c */
 int abs __P((int i));
index 743157b..0189eef 100644 (file)
@@ -80,6 +80,14 @@ extern       struct  _iobuf {
 #endif
 #endif
 
+#ifndef NORETURN
+#ifdef __GNUC__
+#define NORETURN __attribute__ ((__noreturn__))
+#else
+#define NORETURN
+#endif
+#endif
+
 /* stdio/clrerr.c */
 /*int clearerr __P((register FILE *iop));*/
 
@@ -90,7 +98,7 @@ int _doprnt __P((u_char *fmt0, va_list argp, register FILE *fp));
 int _doscan __P((FILE *iop, register char *fmt, register va_list argp));
 
 /* stdio/exit.c */
-int exit __P((int code));
+int exit __P((int code)) NORETURN;
 
 /* stdio/fdopen.c */
 FILE *fdopen __P((int fd, register char *mode));
index 9dcbdcb..754f9c5 100755 (executable)
@@ -4,7 +4,7 @@
 ROOT=../..
 
 #all_c=`echo *.c`
-#if test "$all_c" = "*.h"
+#if test "$all_c" = "*.c"
 #then
 #  all_c=
 #fi
@@ -55,7 +55,7 @@ then
 fi
 
 #all_c=`echo *.c`
-#if test "$all_c" = "*.h"
+#if test "$all_c" = "*.c"
 #then
 #  all_c=
 #fi
@@ -177,7 +177,7 @@ EOF
         ) >>$group.protos
       fi
 
-      protos="`sed -ne 's/^.*[^0-9A-Za-z_]\([A-Za-z_][0-9A-Za-z_]*\) __P((.*));$/\1/p' a`"
+      protos="`sed -ne 's/^.*[^0-9A-Za-z_]\([A-Za-z_][0-9A-Za-z_]*\) __P((.*))\\( NORETURN\\)\\?;$/\1/p' a`"
       echo "protos=$protos"
 
       pattern=
@@ -268,9 +268,9 @@ then
     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`"
+      protos="`sed -ne 's/^.*[^0-9A-Za-z_]\([A-Za-z_][0-9A-Za-z_]*\) __P((.*))\\( NORETURN\\)\\?;$/\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`"
+      protos="`sed -ne 's/^.*[^0-9A-Za-z_]\([A-Za-z_][0-9A-Za-z_]*\) __P((.*))\\( NORETURN\\)\\?;$/\1/p' $i.nocomm`"
     fi
     echo "protos=$protos"
 
diff --git a/n.sh b/n.sh
index a88b013..8537426 100755 (executable)
--- a/n.sh
+++ b/n.sh
@@ -1,6 +1,7 @@
 #!/bin/sh -e
 
 ROOT=`pwd`
+MAKE=$ROOT/scripts/make.sh
 
 rm -rf cross
 mkdir -p cross/bin
@@ -8,8 +9,8 @@ mkdir -p cross/lib
 mkdir -p cross/usr/include
 mkdir -p cross/usr/lib
 
-(cd xify && make clean && make && make DESTDIR=$ROOT/cross install)
-(cd include && make DESTDIR=$ROOT/cross SHARED=copies install)
+(cd xify && make clean && make && make install)
+(cd include && $MAKE SHARED=copies install)
 
 mkdir -p lib/libc/compat-4.1/profiled
 mkdir -p lib/libc/compat-sys5/profiled
@@ -24,11 +25,7 @@ mkdir -p lib/libc/net/profiled
 mkdir -p lib/libc/ns/profiled
 mkdir -p lib/libc/stdio/profiled
 mkdir -p lib/libc/sys/profiled
-(
-  cd lib/libc && \
-  make clean && \
-  make CC="${ROOT}/cross/bin/hostcc -Dvax" LD="${ROOT}/cross/bin/hostld" && \
-  make DESTDIR=$ROOT/cross install
-)
+(cd lib/libc && $MAKE clean && $MAKE && $MAKE install)
+(cd bin && $MAKE clean && $MAKE SUBDIR= NSTD= KMEM= && $MAKE SUBDIR= NSTD= KMEM= install)
 
-(cd test && make clean && make)
+#(cd test && make clean && make)
index 1f56bc6..14b2ab5 100755 (executable)
@@ -1,51 +1,78 @@
 #!/bin/sh
 
 ROOT=`dirname $0`/..
+#ROOT=../..
 
-all_c=`echo *.c` #`find . -name '*.c' -print |LC_ALL=C sort`
+all_c=`echo *.c`
 if test "$all_c" = "*.c"
 then
-  echo "require at least one *.c input file"
-  exit 1
-fi
-
-all_h=`echo *.h` #`find . -name '*.h' -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 |grep -v "^$ROOT/cross/usr/include/stand/" |LC_ALL=C sort`
-if test -z "$std_h"
-then
-  echo "require at least one standard library header file"
-  exit 1
+  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 #`find . -name '*.[ch].allprotos' -print`
-  rm -f *.[ch].nocomm #`find . -name '*.[ch].nocomm' -print`
-  rm -f *.[ch].oldprotos #`find . -name '*.[ch].oldprotos' -print`
-  rm -f *.[ch].protos #`find . -name '*.[ch].protos' -print`
-  rm -f *.[ch].protos.nocomm #`find . -name '*.[ch].protos.nocomm' -print`
-  rm -f *.[ch].usedby #`find . -name '*.[ch].usedby' -print`
-  rm -f *.[ch].uses #`find . -name '*.[ch].uses' -print`
-
+  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 -rf `find $ROOT/cross/usr/include -name '.xify' -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" = "*.c"
+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==="
@@ -107,11 +134,16 @@ then
     echo "i=$i"
 
     group=
+    #group=$ROOT/cross/usr/include/`dirname $i`.h
+    #touch $group
     if test -f groups.txt
     then
-      group=`sed -ne "s/^$i \\(.*\\)/\\1/p" groups.txt`
-      if test -n "$group"
+      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
@@ -145,7 +177,7 @@ EOF
         ) >>$group.protos
       fi
 
-      protos="`sed -ne 's/^.*[^0-9A-Za-z_]\([A-Za-z_][0-9A-Za-z_]*\) __P((.*));$/\1/p' a`"
+      protos="`sed -ne 's/^.*[^0-9A-Za-z_]\([A-Za-z_][0-9A-Za-z_]*\) __P((.*))\\( NORETURN\\)\\?;$/\1/p' a`"
       echo "protos=$protos"
 
       pattern=
@@ -170,6 +202,14 @@ EOF
   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==="
@@ -228,9 +268,9 @@ then
     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`"
+      protos="`sed -ne 's/^.*[^0-9A-Za-z_]\([A-Za-z_][0-9A-Za-z_]*\) __P((.*))\\( NORETURN\\)\\?;$/\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`"
+      protos="`sed -ne 's/^.*[^0-9A-Za-z_]\([A-Za-z_][0-9A-Za-z_]*\) __P((.*))\\( NORETURN\\)\\?;$/\1/p' $i.nocomm`"
     fi
     echo "protos=$protos"
 
@@ -284,7 +324,7 @@ then
 
     echo "pattern0=$pattern0"
 
-    if test -n "$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
@@ -463,12 +503,12 @@ then
 #endif
 
 EOF
-          cat $i.protos
-          if test -f xx01
-          then
-            echo
-            cat xx01
-          fi
+        fi
+        cat $i.protos
+        if test -f xx01
+        then
+          echo
+          cat xx01
         fi
       ) >$i
     fi
@@ -488,6 +528,7 @@ EOF
       echo "pattern=$pattern"
 
       sed -e "s:^#[     ]*include[      ]*\\(<\\($pattern\\)>\\|\"\\($pattern\\)\"\\):\\/\\*&\\*\\/:" -i $i
+      #sed -e "s:^#[    ]*include[      ]*<\\($pattern\\)>:\\/\\*&\\*\\/:" -i $i
     fi
 
     (
@@ -522,6 +563,7 @@ EOF
       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'`_
@@ -534,14 +576,18 @@ EOF
 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
+        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
@@ -551,6 +597,10 @@ EOF
 #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
 
@@ -587,6 +637,7 @@ then
     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
@@ -597,6 +648,7 @@ then
         ;;
       *.h)
         k=`echo $j |sed -e "s:^$ROOT/cross/usr/include/::"`
+        echo "k=$k"
         echo "$h $k" >>a
         pattern="$pattern$prefix$k"
         prefix='\|'
@@ -606,9 +658,43 @@ then
     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/:.*//'`
+      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
diff --git a/scripts/isvoid.sh b/scripts/isvoid.sh
new file mode 100755 (executable)
index 0000000..4fcad8c
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+ROOT=`dirname $0`/..
+$ROOT/scripts/errfunc.sh |grep "‘return’ with a value, in function returning void" |sed -e 's/:.*//' |sort |uniq |sed -e 's/.*/s\/^void &\\( __P(\\)\\?(\/int &\\1(\//'
index 65c5f84..8a18c77 100755 (executable)
@@ -1,3 +1,7 @@
 #!/bin/sh
-ROOT=`pwd`/`dirname $0`/..
+ROOT=`dirname $0`/..
+if false # check whether ROOT is relative somehow
+then
+  ROOT=`pwd`/$ROOT
+fi
 make CC="$ROOT/cross/bin/hostcc -Dvax" LD="$ROOT/cross/bin/hostld" DESTDIR="$ROOT/cross" $@
index 6b08cf9..df25055 100755 (executable)
@@ -1,3 +1,3 @@
 #!/bin/sh
 ROOT=`dirname $0`/..
-$ROOT/scripts/errfunc.sh |grep "control reaches end of non-void function\|‘return’ with no value, in function returning non-void" |sed -e 's/:.*//' |sort |uniq |sed -e 's/.*/s\/^int &\\((\\| __P((\\)\/void &\\1\//'
+$ROOT/scripts/errfunc.sh |grep "control reaches end of non-void function\|‘return’ with no value, in function returning non-void" |sed -e 's/:.*//' |sort |uniq |sed -e 's/.*/s\/^int &\\( __P(\\)\\?(\/void &\\1(\//'
index 5415f48..75d7d84 100644 (file)
@@ -138,6 +138,14 @@ int        whichqs;                /* bit mask summarizing non-empty qs's */
 #endif
 #endif
 
+#ifndef NORETURN
+#ifdef __GNUC__
+#define NORETURN __attribute__ ((__noreturn__))
+#else
+#define NORETURN
+#endif
+#endif
+
 /* gen/setegid.c */
 int setegid __P((int egid));
 
@@ -157,7 +165,7 @@ int setruid __P((int ruid));
 int setuid __P((int uid));
 
 /* sys/_exit.c */
-void _exit __P((int s));
+void _exit __P((int s)) NORETURN;
 
 /* sys/brk.c */
 void *brk __P((void *a));
index efa09b9..06f7227 100644 (file)
@@ -35,10 +35,10 @@ struct      arphdr {
  * The remaining fields are variable in size,
  * according to the sizes above.
  */
-/*     u_char  ar_sha[];       /* sender hardware address */
-/*     u_char  ar_spa[];       /* sender protocol address */
-/*     u_char  ar_tha[];       /* target hardware address */
-/*     u_char  ar_tpa[];       /* target protocol address */
+/*     u_char  ar_sha[];*/     /* sender hardware address */
+/*     u_char  ar_spa[];*/     /* sender protocol address */
+/*     u_char  ar_tha[];*/     /* target hardware address */
+/*     u_char  ar_tpa[];*/     /* target protocol address */
 };
 
 /*
index 82b4f2d..8f4050f 100644 (file)
--- a/xify/cc.c
+++ b/xify/cc.c
@@ -387,7 +387,7 @@ int main(argc, argv) int argc; char **argv; {
                if (exflag)
                        av[na++] = "-E";
                else if (sflag)
-                       av[na++] = "-s";
+                       av[na++] = "-S";
                else
                        av[na++] = "-c";
                av[na++] = clist[i];
@@ -757,6 +757,16 @@ int callsys(/*f,*/ v) /*char *f;*/ char **v; {
        }
        while (t != wait(&status))
                ;
+#if 1
+       if (WIFSIGNALED(status) /*&& WTERMSIG(status) != SIGALRM*/) {
+               if (WTERMSIG(status) != SIGINT) {
+                       printf("Fatal error in %s\n", /*f*/v[0]);
+                       eflag = 8;
+               }
+               dexit();
+       }
+       return (WEXITSTATUS(status));
+#else
        if ((t=(status&0377)) != 0 && t!=14) {
                if (t!=2) {
                        printf("Fatal error in %s\n", /*f*/v[0]);
@@ -765,6 +775,7 @@ int callsys(/*f,*/ v) /*char *f;*/ char **v; {
                dexit();
        }
        return ((status>>8) & 0377);
+#endif
 }
 
 int nodup(l, os) char **l; char *os; {
index a0b380d..6cc85f7 100644 (file)
--- a/xify/ld.c
+++ b/xify/ld.c
@@ -60,7 +60,7 @@ static char sccsid[] = "@(#)ld.c      5.4 (Berkeley) 11/26/85";
  * data, and bss segments from the sum of the sizes of the modules which
  * were required.  It has computed, for each ``common'' symbol, the
  * maximum size of any reference to it, and these symbols are then assigned
- * storage locations after their sizes are appropriately _rounded.
+ * storage locations after their sizes are appropriately rounded.
  * The loader now knows all sizes for the eventual output file, and
  * can determine the final locations of external symbols before it
  * begins a second pass.
@@ -798,8 +798,12 @@ void endload(argc, argv) int argc; char **argv; {
                        ap[--i]='-';
 #ifdef XIFY
                        filname = ap + i;
-                       xify_library(filname + 2);
-                       av[na++] = strspl("-lx_", filname + 2);
+                       if (strncmp(filname + 2, "nox_", 4) == 0)
+                               av[na++] = strspl("-l", filname + 6);
+                       else {
+                               xify_library(filname + 2);
+                               av[na++] = strspl("-lx_", filname + 2);
+                       }
 #else
 
                        load2arg(&ap[i]);
@@ -821,7 +825,7 @@ void xify_library(in_name) char *in_name; {
        int i, j;
        struct stat statbuf;
 
-       for (int i = 0; i < ndir; ++i) {
+       for (i = 0; i < ndir; ++i) {
                j = strlen(dirs[i]) - 5; /* remove ".xify" */
                bcopy(dirs[i], in_path, j);
                strcpy(in_path + j, "lib");
@@ -902,6 +906,16 @@ int callsys(/*f,*/ v) /*char *f;*/ char **v; {
        }
        while (t != wait(&status))
                ;
+#if 1
+       if (WIFSIGNALED(status) /*&& WTERMSIG(status) != SIGALRM*/) {
+               if (WTERMSIG(status) != SIGINT) {
+                       printf("Fatal error in %s\n", /*f*/v[0]);
+                       /*eflag*/delarg = 8;
+               }
+               /*dexit*/delexit();
+       }
+       return (WEXITSTATUS(status));
+#else
        if ((t=(status&0377)) != 0 && t!=14) {
                if (t!=2) {
                        printf("Fatal error in %s\n", /*f*/v[0]);
@@ -910,6 +924,7 @@ int callsys(/*f,*/ v) /*char *f;*/ char **v; {
                /*dexit*/delexit();
        }
        return ((status>>8) & 0377);
+#endif
 }
 #else
 /*
index 57d7291..947028a 100644 (file)
@@ -247,11 +247,14 @@ int main() {
           (l != 8 || memcmp(p, "va_start", 8) != 0) &&
           (l != 4 || memcmp(p, "void", 4) != 0) &&
           (l != 5 || memcmp(p, "while", 5) != 0) &&
-          (l < 10 || memcmp(p, "__builtin_", 10) != 0) &&
-          (l != 3 || memcmp(p, "__P", 3) != 0) &&
           (l != 8 || memcmp(p, "__FILE__", 8) != 0) &&
+          (l != 8 || memcmp(p, "__GNUC__", 8) != 0) &&
           (l != 8 || memcmp(p, "__LINE__", 8) != 0) &&
-          (l != 8 || memcmp(p, "__STDC__", 8) != 0)
+          (l != 3 || memcmp(p, "__P", 3) != 0) &&
+          (l != 8 || memcmp(p, "__STDC__", 8) != 0) &&
+          (l != 13 || memcmp(p, "__attribute__", 13) != 0) &&
+          (l < 10 || memcmp(p, "__builtin_", 10) != 0) &&
+          (l != 12 || memcmp(p, "__noreturn__", 12) != 0)
         )
           fwrite("x_", 2, 1, stdout);
       }
index 3b733ef..a2b33a4 100755 (executable)
@@ -22,5 +22,5 @@ typedef uint32_t x_unsigned_long;
 
 #endif
 EOF
-  "`dirname "$0"`/xifyfilt" <$1 2>$3 |sed -e 's/\(extern\|register\|static\) x_int x_\(datum\|off_t\|time_t\|u_int\|u_short\|u_long\)/\1 x_\2/g; s/va_arg(x_argp, x_\(unsigned_\)\?\(short\|int\|long\))/_va_arg_\1\2(x_argp)/g'
+  "`dirname "$0"`/xifyfilt" <$1 2>$3 |sed -e 's/\(extern\|register\|static\) x_int x_\(caddr_t\|datum\|off_t\|time_t\|u_int\|u_short\|u_long\)/\1 x_\2/g; s/va_arg(x_argp, x_\(unsigned_\)\?\(short\|int\|long\))/_va_arg_\1\2(x_argp)/g'
 ) >$2