Pre-ansification changes for bin
authorNick Downing <downing.nick@gmail.com>
Tue, 24 Jan 2017 02:34:04 +0000 (13:34 +1100)
committerNick Downing <downing.nick@gmail.com>
Tue, 24 Jan 2017 04:35:27 +0000 (15:35 +1100)
30 files changed:
bin/Makefile
bin/ar.c
bin/cat.c
bin/chgrp.c
bin/chmod.c
bin/conflicts.txt [new file with mode: 0644]
bin/date.c
bin/du.c
bin/ed.c
bin/ld.c
bin/login.c
bin/ls.c
bin/mv.c
bin/nm.c
bin/od.c
bin/passwd.c
bin/pr.c
bin/ps.c
bin/rcp.c
bin/rm.c
bin/tar.c
bin/tee.c
bin/wall.c
include/gen.h
lib/libc/gen/calloc.c
lib/libc/net/Makefile
scripts/ansify.sh
scripts/nocomment.c
scripts/nostring.c
xify/xify.c

index 723165d..6dc6cb7 100644 (file)
@@ -87,7 +87,7 @@ clean:
 
 depend: expr.c
        for i in ${BINS}; do \
-           cc -M ${INCPATH} $$i.c | sed 's/\.o//' | \
+           ${CC} -M ${INCPATH} $$i.c | sed 's/\.o//' | \
            awk ' { if ($$1 != prev) \
                { if (rec != "") print rec; rec = $$0; prev = $$1; } \
                else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
@@ -106,169 +106,10 @@ depend: expr.c
 # Files listed in ${NSTD} have explicit make lines given below.
 
 expr: expr.o
-       cc ${CFLAGS} -o expr expr.o
+       ${CC} ${CFLAGS} -o expr expr.o
 
 ps:
-       cc ${CFLAGS} -o ps ps.c -lm
+       ${CC} ${CFLAGS} -o ps ps.c -lm
 
 # DO NOT DELETE THIS LINE -- make depend uses it
 
-ar: ar.c /usr/include/sys/param.h /usr/include/machine/machparam.h
-ar: /usr/include/signal.h /usr/include/sys/types.h /usr/include/sys/stat.h
-ar: /usr/include/sys/time.h /usr/include/time.h /usr/include/stdio.h
-ar: /usr/include/ar.h
-cat: cat.c /usr/include/stdio.h /usr/include/sys/types.h
-cat: /usr/include/sys/stat.h
-cc: cc.c /usr/include/sys/param.h /usr/include/machine/machparam.h
-cc: /usr/include/signal.h /usr/include/sys/types.h /usr/include/stdio.h
-cc: /usr/include/ctype.h /usr/include/signal.h /usr/include/sys/dir.h
-chgrp: chgrp.c /usr/include/stdio.h /usr/include/ctype.h
-chgrp: /usr/include/sys/types.h /usr/include/sys/stat.h /usr/include/grp.h
-chgrp: /usr/include/pwd.h /usr/include/sys/dir.h
-chmod: chmod.c /usr/include/stdio.h /usr/include/sys/types.h
-chmod: /usr/include/sys/stat.h /usr/include/sys/dir.h
-cmp: cmp.c /usr/include/stdio.h /usr/include/ctype.h
-date: date.c /usr/include/sys/param.h /usr/include/machine/machparam.h
-date: /usr/include/signal.h /usr/include/sys/types.h /usr/include/stdio.h
-date: /usr/include/sys/time.h /usr/include/time.h /usr/include/sys/file.h
-date: /usr/include/errno.h /usr/include/syslog.h /usr/include/utmp.h
-date: /usr/include/sys/socket.h /usr/include/netinet/in.h /usr/include/netdb.h
-date: /usr/include/protocols/timed.h
-dd: dd.c /usr/include/stdio.h /usr/include/signal.h
-du: du.c /usr/include/stdio.h /usr/include/sys/param.h
-du: /usr/include/machine/machparam.h /usr/include/signal.h
-du: /usr/include/sys/types.h /usr/include/sys/stat.h /usr/include/sys/dir.h
-echo: echo.c /usr/include/stdio.h
-ed: ed.c /usr/include/signal.h /usr/include/sgtty.h /usr/include/sys/ioctl.h
-ed: /usr/include/sys/ttychars.h /usr/include/sys/ttydev.h /usr/include/setjmp.h
-grep: grep.c /usr/include/stdio.h /usr/include/ctype.h
-hostid: hostid.c /usr/include/sys/types.h /usr/include/stdio.h
-hostid: /usr/include/ctype.h /usr/include/netdb.h
-hostname: hostname.c /usr/include/stdio.h
-kill: kill.c /usr/include/signal.h /usr/include/ctype.h
-ld: ld.c /usr/include/sys/param.h /usr/include/machine/machparam.h
-ld: /usr/include/signal.h /usr/include/sys/types.h /usr/include/signal.h
-ld: /usr/include/stdio.h /usr/include/ctype.h /usr/include/ar.h
-ld: /usr/include/a.out.h /usr/include/sys/exec.h /usr/include/ranlib.h
-ld: /usr/include/sys/stat.h /usr/include/sys/file.h
-ln: ln.c /usr/include/stdio.h /usr/include/sys/types.h /usr/include/sys/stat.h
-ln: /usr/include/errno.h
-ls: ls.c /usr/include/sys/param.h /usr/include/machine/machparam.h
-ls: /usr/include/signal.h /usr/include/sys/types.h /usr/include/sys/stat.h
-ls: /usr/include/sys/dir.h /usr/include/stdio.h /usr/include/sgtty.h
-ls: /usr/include/sys/ioctl.h /usr/include/sys/ttychars.h
-ls: /usr/include/sys/ttydev.h /usr/include/pwd.h /usr/include/grp.h
-ls: /usr/include/utmp.h
-mkdir: mkdir.c /usr/include/stdio.h
-mt: mt.c /usr/include/stdio.h /usr/include/ctype.h /usr/include/sys/types.h
-mt: /usr/include/sys/mtio.h /usr/include/sys/ioctl.h
-mt: /usr/include/sys/ttychars.h /usr/include/sys/ttydev.h
-mt: /usr/include/vaxmba/mtreg.h /usr/include/vaxmba/htreg.h
-mt: /usr/include/vaxuba/utreg.h /usr/include/vaxuba/tmreg.h
-mt: /usr/include/vaxuba/tsreg.h
-nice: nice.c /usr/include/stdio.h /usr/include/sys/time.h /usr/include/time.h
-nice: /usr/include/sys/resource.h
-nm: nm.c /usr/include/sys/types.h /usr/include/ar.h /usr/include/stdio.h
-nm: /usr/include/ctype.h /usr/include/a.out.h /usr/include/sys/exec.h
-nm: /usr/include/stab.h /usr/include/sys/stat.h
-od: od.c /usr/include/stdio.h /usr/include/sys/types.h /usr/include/sys/stat.h
-pagesize: pagesize.c
-pr: pr.c /usr/include/stdio.h /usr/include/signal.h /usr/include/sys/types.h
-pr: /usr/include/sys/stat.h
-pwd: pwd.c /usr/include/stdio.h /usr/include/sys/param.h
-pwd: /usr/include/machine/machparam.h /usr/include/signal.h
-pwd: /usr/include/sys/types.h
-rm: rm.c /usr/include/stdio.h /usr/include/sys/param.h
-rm: /usr/include/machine/machparam.h /usr/include/signal.h
-rm: /usr/include/sys/types.h /usr/include/sys/stat.h /usr/include/sys/dir.h
-rm: /usr/include/sys/file.h
-rmail: rmail.c /usr/include/stdio.h /usr/include/sysexits.h
-rmdir: rmdir.c /usr/include/stdio.h
-size: size.c /usr/include/stdio.h /usr/include/a.out.h /usr/include/sys/exec.h
-stty: stty.c /usr/include/stdio.h /usr/include/sys/ioctl.h
-stty: /usr/include/sys/ttychars.h /usr/include/sys/ttydev.h
-sync: sync.c
-tar: tar.c /usr/include/stdio.h /usr/include/sys/param.h
-tar: /usr/include/machine/machparam.h /usr/include/signal.h
-tar: /usr/include/sys/types.h /usr/include/sys/stat.h /usr/include/sys/dir.h
-tar: /usr/include/sys/ioctl.h /usr/include/sys/ttychars.h
-tar: /usr/include/sys/ttydev.h /usr/include/sys/mtio.h /usr/include/sys/time.h
-tar: /usr/include/time.h /usr/include/signal.h /usr/include/errno.h
-tar: /usr/include/fcntl.h
-tee: tee.c /usr/include/signal.h /usr/include/sys/types.h
-tee: /usr/include/sys/stat.h /usr/include/errno.h
-test: test.c /usr/include/stdio.h /usr/include/sys/types.h
-test: /usr/include/sys/stat.h
-time: time.c /usr/include/stdio.h /usr/include/signal.h
-time: /usr/include/sys/types.h /usr/include/sys/time.h /usr/include/time.h
-time: /usr/include/sys/resource.h
-who: who.c /usr/include/stdio.h /usr/include/utmp.h /usr/include/pwd.h
-who: /usr/include/ctype.h
-expr: expr.c /usr/include/stdio.h
-login: login.c /usr/include/sys/param.h /usr/include/machine/machparam.h
-login: /usr/include/signal.h /usr/include/sys/types.h /usr/include/sys/quota.h
-login: /usr/include/sys/stat.h /usr/include/sys/time.h /usr/include/time.h
-login: /usr/include/sys/resource.h /usr/include/sys/file.h /usr/include/sgtty.h
-login: /usr/include/sys/ioctl.h /usr/include/sys/ttychars.h
-login: /usr/include/sys/ttydev.h /usr/include/utmp.h /usr/include/signal.h
-login: /usr/include/pwd.h /usr/include/stdio.h /usr/include/lastlog.h
-login: /usr/include/errno.h /usr/include/ttyent.h /usr/include/syslog.h
-login: /usr/include/grp.h
-mail: mail.c /usr/include/sys/types.h /usr/include/sys/stat.h
-mail: /usr/include/sys/file.h /usr/include/ctype.h /usr/include/stdio.h
-mail: /usr/include/pwd.h /usr/include/utmp.h /usr/include/signal.h
-mail: /usr/include/setjmp.h /usr/include/sysexits.h /usr/include/sys/socket.h
-mail: /usr/include/netinet/in.h /usr/include/netdb.h
-passwd: passwd.c /usr/include/sys/types.h /usr/include/sys/file.h
-passwd: /usr/include/sys/time.h /usr/include/time.h /usr/include/sys/resource.h
-passwd: /usr/include/stdio.h /usr/include/signal.h /usr/include/pwd.h
-passwd: /usr/include/ndbm.h /usr/include/errno.h /usr/include/strings.h
-passwd: /usr/include/ctype.h
-rcp: rcp.c /usr/include/sys/param.h /usr/include/machine/machparam.h
-rcp: /usr/include/signal.h /usr/include/sys/types.h /usr/include/sys/stat.h
-rcp: /usr/include/sys/time.h /usr/include/time.h /usr/include/sys/ioctl.h
-rcp: /usr/include/sys/ttychars.h /usr/include/sys/ttydev.h
-rcp: /usr/include/netinet/in.h /usr/include/stdio.h /usr/include/signal.h
-rcp: /usr/include/pwd.h /usr/include/ctype.h /usr/include/netdb.h
-rcp: /usr/include/errno.h /usr/include/sys/dir.h
-su: su.c /usr/include/stdio.h /usr/include/pwd.h /usr/include/grp.h
-su: /usr/include/syslog.h /usr/include/sys/types.h /usr/include/sys/time.h
-su: /usr/include/time.h /usr/include/sys/resource.h
-df: df.c /usr/include/sys/param.h /usr/include/machine/machparam.h
-df: /usr/include/signal.h /usr/include/sys/types.h /usr/include/sys/fs.h
-df: /usr/include/sys/stat.h /usr/include/errno.h /usr/include/stdio.h
-df: /usr/include/fstab.h /usr/include/mtab.h
-ps: ps.c /usr/include/stdio.h /usr/include/ctype.h /usr/include/a.out.h
-ps: /usr/include/sys/exec.h /usr/include/pwd.h /usr/include/sys/param.h
-ps: /usr/include/machine/machparam.h /usr/include/signal.h
-ps: /usr/include/sys/types.h /usr/include/sys/ioctl.h
-ps: /usr/include/sys/ttychars.h /usr/include/sys/ttydev.h
-ps: /usr/include/sys/tty.h /usr/include/sys/ttychars.h
-ps: /usr/include/sys/ttydev.h /usr/include/sys/dir.h /usr/include/sys/user.h
-ps: /usr/include/machine/pcb.h /usr/include/sys/dmap.h /usr/include/sys/time.h
-ps: /usr/include/time.h /usr/include/sys/resource.h /usr/include/sys/namei.h
-ps: /usr/include/sys/uio.h /usr/include/errno.h /usr/include/sys/proc.h
-ps: /usr/include/machine/pte.h /usr/include/sys/vm.h /usr/include/sys/vmparam.h
-ps: /usr/include/machine/vmparam.h /usr/include/sys/vmmac.h
-ps: /usr/include/sys/vmmeter.h /usr/include/sys/vmsystm.h
-ps: /usr/include/sys/text.h /usr/include/sys/stat.h /usr/include/sys/mbuf.h
-ps: /usr/include/math.h /usr/include/errno.h /usr/include/utmp.h
-wall: wall.c /usr/include/stdio.h /usr/include/utmp.h /usr/include/errno.h
-wall: /usr/include/signal.h /usr/include/sys/time.h /usr/include/time.h
-wall: /usr/include/fcntl.h /usr/include/sys/types.h /usr/include/sys/stat.h
-write: write.c /usr/include/stdio.h /usr/include/ctype.h
-write: /usr/include/sys/types.h /usr/include/sys/stat.h /usr/include/signal.h
-write: /usr/include/utmp.h /usr/include/sys/time.h /usr/include/time.h
-cp: cp.c /usr/include/stdio.h /usr/include/sys/param.h
-cp: /usr/include/machine/machparam.h /usr/include/signal.h
-cp: /usr/include/sys/types.h /usr/include/sys/stat.h /usr/include/sys/dir.h
-cp: /usr/include/sys/time.h /usr/include/time.h
-mv: mv.c /usr/include/sys/param.h /usr/include/machine/machparam.h
-mv: /usr/include/signal.h /usr/include/sys/types.h /usr/include/sys/stat.h
-mv: /usr/include/sys/time.h /usr/include/time.h /usr/include/stdio.h
-mv: /usr/include/sys/dir.h /usr/include/errno.h /usr/include/signal.h
-strip: strip.c /usr/include/a.out.h /usr/include/sys/exec.h
-strip: /usr/include/signal.h /usr/include/stdio.h /usr/include/sys/file.h
-# DEPENDENCIES MUST END AT END OF FILE
-# IF YOU PUT STUFF HERE IT WILL GO AWAY
-# see make depend above
index e794f20..fc0be87 100644 (file)
--- a/bin/ar.c
+++ b/bin/ar.c
@@ -74,7 +74,7 @@ int   tf2;
 int    qf;
 int    bastate;
 char   buf[MAXBSIZE];
-int    truncate;                       /* ok to truncate argument filenames */
+int    _truncate;                      /* ok to _truncate argument filenames */
 
 char   *trim();
 char   *mktemp();
@@ -327,7 +327,7 @@ qcmd()
                fprintf(stderr, "ar: abi not allowed with q\n");
                done(1);
        }
-       truncate++;
+       _truncate++;
        getqf();
        for(i=0; signum[i]; i++)
                signal(signum[i], SIG_IGN);
@@ -455,7 +455,7 @@ cleanup()
 {
        register i, f;
 
-       truncate++;
+       _truncate++;
        for(i=0; i<namc; i++) {
                file = namv[i];
                if(file == 0)
@@ -706,7 +706,7 @@ char *s;
         * names.  Need an exit status convention...
         * Need yet another new archive format...
         */
-       if (truncate && strlen(p2) > sizeof(arbuf.ar_name) - 1) {
+       if (_truncate && strlen(p2) > sizeof(arbuf.ar_name) - 1) {
                fprintf(stderr, "ar: filename %s truncated to ", p2);
                *(p2 + sizeof(arbuf.ar_name) - 1) = '\0';
                fprintf(stderr, "%s\n", p2);
index a0c4435..5f668f1 100644 (file)
--- a/bin/cat.c
+++ b/bin/cat.c
@@ -178,7 +178,7 @@ register int fd;
        register int    buffsize, n, nwritten, offset;
        register char   *buff;
        struct stat     statbuff;
-       char            *malloc();
+       void            *malloc();
 
 #ifndef        OPTSIZE
        if (obsize)
index 46385df..4dce5df 100644 (file)
@@ -19,9 +19,12 @@ static char sccsid[] = "@(#)chgrp.c  5.7 (Berkeley) 6/4/86";
 #include <grp.h>
 #include <pwd.h>
 #include <sys/dir.h>
+#include <varargs.h>
 
-struct group *gr, *getgrnam(), *getgrgid();
-struct passwd *getpwuid(), *pwd;
+struct group *gr;
+struct group *getgrnam(), *getgrgid();
+struct passwd *getpwuid();
+struct passwd *pwd;
 struct stat stbuf;
 int    gid, uid;
 int    status;
@@ -120,7 +123,7 @@ chownr(dir, uid, gid)
 {
        register DIR *dirp;
        register struct direct *dp;
-       register struct stat st;
+       struct stat st;
        char savedir[1024];
        int ecode;
 
@@ -170,25 +173,42 @@ chownr(dir, uid, gid)
        return (ecode);
 }
 
-error(fmt, a)
-       char *fmt, *a;
+verror(fmt, argp)
+       char *fmt;
+       va_list argp;
 {
-
        if (!fflag) {
                fprintf(stderr, "chgrp: ");
-               fprintf(stderr, fmt, a);
+               vfprintf(stderr, fmt, argp);
                putc('\n', stderr);
        }
        return (!fflag);
 }
 
-fatal(status, fmt, a)
+error(fmt, va_alist)
+       char *fmt;
+       va_dcl
+{
+       va_list argp;
+       int res;
+
+       va_start(argp);
+       res = verror(fmt, argp);
+       va_end(argp);
+       return res;
+}
+
+fatal(status, fmt, va_alist)
        int status;
-       char *fmt, *a;
+       char *fmt;
+       va_dcl
 {
+       va_list argp;
 
        fflag = 0;
-       (void) error(fmt, a);
+       va_start(argp);
+       (void) verror(fmt, argp);
+       va_end(argp);
        exit(status);
 }
 
index d8f2005..8c5280d 100644 (file)
@@ -18,6 +18,7 @@ static char sccsid[] = "@(#)chmod.c   5.5 (Berkeley) 5/22/86";
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/dir.h>
+#include <varargs.h>
 
 char   *modestring, *ms;
 int    um;
@@ -86,7 +87,7 @@ chmodr(dir, mode)
 {
        register DIR *dirp;
        register struct direct *dp;
-       register struct stat st;
+       struct stat st;
        char savedir[1024];
        int ecode;
 
@@ -133,25 +134,42 @@ chmodr(dir, mode)
        return (ecode);
 }
 
-error(fmt, a)
-       char *fmt, *a;
+verror(fmt, argp)
+       char *fmt;
+       va_list argp;
 {
-
        if (!fflag) {
                fprintf(stderr, "chmod: ");
-               fprintf(stderr, fmt, a);
+               vfprintf(stderr, fmt, argp);
                putc('\n', stderr);
        }
        return (!fflag);
 }
 
-fatal(status, fmt, a)
+error(fmt, va_alist)
+       char *fmt;
+       va_dcl
+{
+       va_list argp;
+       int res;
+
+       va_start(argp);
+       res = verror(fmt, argp);
+       va_end(argp);
+       return res;
+}
+
+fatal(status, fmt, va_alist)
        int status;
-       char *fmt, *a;
+       char *fmt;
+       va_dcl
 {
+       va_list argp;
 
        fflag = 0;
-       (void) error(fmt, a);
+       va_start(argp);
+       (void) verror(fmt, argp);
+       va_end(argp);
        exit(status);
 }
 
@@ -174,7 +192,7 @@ newmode(nm)
 
        ms = modestring;
        savem = nm;
-       m = abs();
+       m = _abs();
        if (*ms == '\0')
                return (m);
        do {
@@ -200,7 +218,7 @@ newmode(nm)
        return (nm);
 }
 
-abs()
+_abs()
 {
        register c, i;
 
diff --git a/bin/conflicts.txt b/bin/conflicts.txt
new file mode 100644 (file)
index 0000000..6a01765
--- /dev/null
@@ -0,0 +1,5 @@
+ar.c net.h
+ar.c sys/inode.h
+ar.c sys/select.h
+od.c vaxif/if_ddnvar.h
+tar.c vfont.h
index a850aba..9f24231 100644 (file)
@@ -49,7 +49,8 @@ char  *asctime();
 struct tm *localtime();
 struct tm *gmtime();
 char   *strcpy(), *strncpy();
-char   *username, *getlogin();
+char   *username;
+char   *getlogin();
 long   time();
 uid_t  getuid();
 
index a333d49..126b157 100644 (file)
--- a/bin/du.c
+++ b/bin/du.c
@@ -20,7 +20,7 @@ struct {
 int    mlx;
 
 long   descend();
-char   *index(), *rindex(), *strcpy(), *sprintf();
+char   *index(), *rindex(), *strcpy();
 
 #define        kb(n)   (howmany(dbtob(n), 1024))
 
index 68a5a95..5c2f5c4 100644 (file)
--- a/bin/ed.c
+++ b/bin/ed.c
@@ -99,7 +99,7 @@ char  *getline();
 char   *getblock();
 char   *place();
 char   *mktemp();
-char   *malloc();
+void   *malloc();
 char   *realloc();
 jmp_buf        savej;
 
index 38a5ce6..95edb47 100644 (file)
--- a/bin/ld.c
+++ b/bin/ld.c
@@ -343,7 +343,7 @@ int pagesize;
 char   get();
 int    delexit();
 char   *savestr();
-char   *malloc();
+void   *malloc();
 
 main(argc, argv)
 char **argv;
index 9b994da..c9deb1b 100644 (file)
@@ -68,7 +68,8 @@ int   timeout = 60;
 char   term[64];
 
 struct passwd *pwd;
-char   *strcat(), *rindex(), *index(), *malloc(), *realloc();
+char   *strcat(), *rindex(), *index();
+void   *malloc(), *realloc();
 int    timedout();
 char   *ttyname();
 char   *crypt();
index cecc1fe..62b0d62 100644 (file)
--- a/bin/ls.c
+++ b/bin/ls.c
@@ -68,8 +68,8 @@ char  *fmtentry();
 char   *getname(), *getgroup();
 
 char   *ctime();
-char   *malloc(), *calloc(), *realloc();
-char   *sprintf(), *strcpy(), *strcat();
+void   *malloc(), *calloc(), *realloc();
+char   *strcpy(), *strcat();
 
 main(argc, argv)
        int argc;
index 70592f3..5446f96 100644 (file)
--- a/bin/mv.c
+++ b/bin/mv.c
@@ -35,7 +35,6 @@ static char sccsid[] = "@(#)mv.c      5.3 (Berkeley) 5/15/86";
 #define        ISDEV(st) \
        (((st).st_mode&S_IFMT) == S_IFCHR || ((st).st_mode&S_IFMT) == S_IFBLK)
 
-char   *sprintf();
 char   *dname();
 struct stat s1, s2;
 int    iflag = 0;      /* interactive mode */
index 3350373..2d92722 100644 (file)
--- a/bin/nm.c
+++ b/bin/nm.c
@@ -27,7 +27,7 @@ union {
 FILE   *fi;
 off_t  off;
 off_t  ftell();
-char   *malloc();
+void   *malloc();
 char   *realloc();
 char   *strp;
 char   *stab();
index b8e1d02..c803456 100644 (file)
--- a/bin/od.c
+++ b/bin/od.c
@@ -697,10 +697,10 @@ static char       _icv_buf[MAXINTLENGTH+1];
 static long    _mask = 0x7fffffff;
 
 char *
-icvt (value, radix, signed, ndigits)
+icvt (value, radix, _signed, ndigits)
 long   value;
 int    radix;
-int    signed;
+int    _signed;
 int    ndigits;
 {
        register long   val = value;
@@ -720,7 +720,7 @@ int ndigits;
                goto done; /*return(b);*/
        }
 
-       if (signed && (sign = (val < 0)))       /* signed conversion */
+       if (_signed && (sign = (val < 0)))      /* signed conversion */
        {
                /*
                 * It is necessary to do the first divide
@@ -776,7 +776,7 @@ done:
                *--b = '-';
 
        tmp1 = ndigits - (&_icv_buf[MAXINTLENGTH] - b);
-       tmp2 = signed? ' ':'0';
+       tmp2 = _signed? ' ':'0';
        while (tmp1 > 0)
        {
                *--b = tmp2;
index c15475b..5a87b2f 100644 (file)
@@ -46,7 +46,7 @@ char  *getlogin();
 char   *getfingerinfo();
 char   *getloginshell();
 char   *getnewpasswd();
-char   *malloc();
+void   *malloc();
 char   *getusershell();
 extern int errno;
 
index 654718f..ef441dd 100644 (file)
--- a/bin/pr.c
+++ b/bin/pr.c
@@ -168,7 +168,6 @@ print(fp, argp)
 char *fp;
 char **argp;
 {
-       extern char *sprintf();
        struct stat sbuf;
        register sncol;
        register char *sheader;
index e45d0b3..82665a1 100644 (file)
--- a/bin/ps.c
+++ b/bin/ps.c
@@ -162,9 +162,13 @@ int        aflg, cflg, eflg, gflg, kflg, lflg, nflg, sflg,
 int    nchans;                         /* total # of wait channels */
 char   *tptr;
 char   *gettty(), *getcmd(), *getname(), *savestr(), *state();
-char   *rindex(), *calloc(), *sbrk(), *strcpy(), *strcat(), *strncat();
-char   *strncpy(), *index(), *ttyname(), mytty[MAXPATHLEN+1];
-char   *malloc(), *getchan();
+char   *rindex();
+void   *calloc(), *sbrk();
+char   *strcpy(), *strcat(), *strncat();
+char   *strncpy(), *index(), *ttyname();
+char   mytty[MAXPATHLEN+1];
+void   *malloc();
+char   *getchan();
 long   lseek();
 off_t  vtophys();
 double pcpu(), pmem();
index a1770c1..b1c6f9d 100644 (file)
--- a/bin/rcp.c
+++ b/bin/rcp.c
@@ -32,7 +32,9 @@ static char sccsid[] = "@(#)rcp.c     5.4 (Berkeley) 9/12/85";
 #include <errno.h>
 
 int    rem;
-char   *colon(), *index(), *rindex(), *malloc(), *strcpy(), *sprintf();
+char   *colon(), *index(), *rindex();
+void   *malloc();
+char   *strcpy();
 int    errs;
 int    lostconn();
 int    errno;
index 509bd03..6aef1dd 100644 (file)
--- a/bin/rm.c
+++ b/bin/rm.c
@@ -16,7 +16,8 @@ int   rflg;           /* -r recurse */
 
 int    errcode;        /* true if errors occured */
 
-char   *strcpy(), *malloc(), *realloc();
+char   *strcpy();
+void   *malloc(), *realloc();
 
 main(argc, argv)
        char *argv[];
index 6edef83..8f018db 100644 (file)
--- a/bin/tar.c
+++ b/bin/tar.c
@@ -103,11 +103,10 @@ FILE      *tfile;
 char   tname[] = "/tmp/tarXXXXXX";
 char   *usefile;
 char   magtape[] = "/dev/rmt8";
-char   *malloc();
+void   *malloc();
 long   time();
 off_t  lseek();
 char   *mktemp();
-char   *sprintf();
 char   *strcat();
 char   *strcpy();
 char   *rindex();
index c31a375..4b45242 100644 (file)
--- a/bin/tee.c
+++ b/bin/tee.c
@@ -26,7 +26,7 @@ long  lseek();
 main(argc,argv)
 char **argv;
 {
-       int register r,w,p;
+       register r,w,p;
        struct stat buf;
        while(argc>1&&argv[1][0]=='-') {
                switch(argv[1][1]) {
index b8b740a..7dd2131 100644 (file)
@@ -38,7 +38,7 @@ int   msize,sline;
 struct utmp *utmp;
 char   *strcpy();
 char   *strcat();
-char   *malloc();
+void   *malloc();
 char   who[9] = "???";
 long   clock, time();
 struct tm *localtime();
index 71f8c8f..f4dc4e5 100644 (file)
@@ -51,7 +51,7 @@ long atol __P((register char *p));
 
 /* gen/calloc.c */
 void *calloc __P((register unsigned num, register unsigned size));
-int cfree __P((void *p, unsigned num, unsigned size));
+int cfree __P((void *p/*, unsigned num, unsigned size*/));
 
 /* gen/crypt.c */
 int setkey __P((char *key));
index 387227c..a3965ab 100644 (file)
@@ -18,6 +18,6 @@ void *calloc(num, size) register unsigned num; register unsigned size; {
        return (p);
 }
 
-int cfree(p, num, size) void *p; unsigned num; unsigned size; {
+int cfree(p/*, num, size*/) void *p; /*unsigned num; unsigned size;*/ {
        free(p);
 }
index d776d8b..fa47f58 100644 (file)
@@ -6,17 +6,15 @@ LD=ld
 #
 #      @(#)Makefile    5.13 (Berkeley) 3/18/86
 #
-SRCS=  getnetbyaddr.c getnetent.c getnetbyname.c \
-       getproto.c getprotoent.c getprotoname.c \
-       getservent.c getservbyport.c getservbyname.c \
-       rcmd.c rexec.c ruserpass.c \
-       res_comp.c res_debug.c res_init.c res_mkquery.c res_send.c
+SRCS=  getnetbyaddr.c getnetbyname.c getnetent.c getproto.c getprotoent.c \
+       getprotoname.c getservbyname.c getservbyport.c getservent.c htonl.c \
+       htons.c ntohl.c ntohs.c rcmd.c res_comp.c res_debug.c res_init.c \
+       res_mkquery.c res_send.c rexec.c ruserpass.c
 
-OBJS=  getnetbyaddr.o getnetent.o getnetbyname.o \
-       getproto.o getprotoent.o getprotoname.o \
-       getservent.o getservbyport.o getservbyname.o \
-       rcmd.o rexec.o ruserpass.o \
-       res_comp.o res_debug.o res_init.o res_mkquery.o res_send.o
+OBJS=  getnetbyaddr.o getnetbyname.o getnetent.o getproto.o getprotoent.o \
+       getprotoname.o getservbyname.o getservbyport.o getservent.o htonl.o \
+       htons.o ntohl.o ntohs.o rcmd.o res_comp.o res_debug.o res_init.o \
+       res_mkquery.o res_send.o rexec.o ruserpass.o
 
 CFLAGS=        -O ${DEFS}
 TAGSFILE=tags
index b42103b..39805af 100755 (executable)
@@ -15,14 +15,14 @@ then
   all_h=
 fi
 
-std_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`
 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
+if test -z "$1" || test $1 -eq 0
 then
   echo "===stage 0==="
 
@@ -39,9 +39,14 @@ then
   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
+  fi
 fi
 
-if test -z "$1" || test "$1" = 1
+if test -z "$1" || test $1 -eq 1
 then
   echo "===stage 1==="
  
@@ -94,7 +99,9 @@ then
   grep '\.h:' oldprotos.txt >oldprotos.temp
 
   sed -e 's/^[A-Za-z_].*__P.*;$/\/\*AAA&\*\//' -i $std_h
-  touch $ROOT/cross/usr/include/stdarg.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"
@@ -111,7 +118,7 @@ then
     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
+    if ! grep -qv '^int main __P((' $i.allprotos
     then
       echo -n >$i.allprotos
     fi
@@ -158,11 +165,12 @@ EOF
       fi
     fi
   done
-  sed -e 's/^\/\*AAA\(.*\)\*\/$/\1/' -i $std_h
   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
 
-if test -z "$1" || test "$1" = 2
+if test -z "$1" || test $1 -eq 2
 then
   echo "===stage 2==="
  
@@ -373,7 +381,7 @@ then
   done
 fi
 
-if test -z "$1" || test "$1" = 3
+if test -z "$1" || test $1 -eq 3
 then
   echo "===stage 3==="
 
@@ -553,7 +561,7 @@ EOF
   done
 fi
 
-if test -z "$1" || test "$1" = 4
+if test -z "$1" || test $1 -eq 4
 then
   echo "===stage 4==="
 
index 21aa3ea..7db3e72 100644 (file)
@@ -15,7 +15,7 @@ loop:
             if (c == '/')
               goto loop;
             if (c == EOF)
-              exit(0);
+              exit(1);
           }
         }
       }
index 7ae4feb..cecd2b6 100644 (file)
@@ -7,11 +7,13 @@ int main() {
   while ((c = getchar()) != EOF) {
     if (c == '\'' || c == '"') {
       do {
-        d = getchar();
-        if (d == '\\')
+        while ((d = getchar()) == '\\') {
           d = getchar();
+          if (d == EOF)
+            exit(1);
+        }
         if (d == EOF)
-          exit(0);
+          exit(1);
       } while (d != c);
     }
     else
index 5902683..57d7291 100644 (file)
@@ -66,6 +66,7 @@ int main() {
             }
             else
               l += m;
+            ++l;
           }
         }
       }
@@ -294,12 +295,20 @@ int main() {
       }
       else if (p[l] == '\'' || p[l] == '"') {
         e = p[l++];
-        while (p[l]) {
-          if (p[l++] == e)
-            break;
-          if (p[l - 1] == '\\' && p[l])
+        while (p[l] != e) {
+          if (p[l] == '\\')
+            ++l;
+          if (p[l] == 0) {
+            fwrite(p, l, 1, stdout);
+            if (fgets(buf, sizeof(buf), stdin) == 0)
+              return 0;
+            p = buf;
+            l = 0;
+          }
+          else
             ++l;
         }
+        ++l;
       }
       else if (p[l] == '/' && p[l + 1] == '*') {
         l += 2;