Make a post-patching scheme, use it to add ANSI C compatibility for signals etc
authorNick Downing <downing.nick@gmail.com>
Thu, 19 Jan 2017 09:05:19 +0000 (20:05 +1100)
committerNick Downing <downing.nick@gmail.com>
Thu, 19 Jan 2017 09:05:19 +0000 (20:05 +1100)
83 files changed:
.gitignore
lib/libstdc/a.out.h
lib/libstdc/compat-4.1/times.c
lib/libstdc/compat-sys5/memccpy.c
lib/libstdc/compat-sys5/memchr.c
lib/libstdc/compat-sys5/memcmp.c
lib/libstdc/compat-sys5/memcpy.c
lib/libstdc/compat-sys5/memset.c
lib/libstdc/gen.h
lib/libstdc/gen/bcmp.c
lib/libstdc/gen/bcopy.c
lib/libstdc/gen/bzero.c
lib/libstdc/gen/calloc.c
lib/libstdc/gen/getpass.c
lib/libstdc/gen/getpwnamuid.c
lib/libstdc/gen/getusershell.c
lib/libstdc/gen/malloc.c
lib/libstdc/gen/ndbm.c
lib/libstdc/gen/nlist.c
lib/libstdc/gen/perror.c
lib/libstdc/gen/signal.c
lib/libstdc/gen/sleep.c
lib/libstdc/gen/system.c
lib/libstdc/gen/usleep.c
lib/libstdc/groups.txt
lib/libstdc/memory.h
lib/libstdc/mkpatch.sh [deleted file]
lib/libstdc/mkpostpatch.sh [new file with mode: 0755]
lib/libstdc/mkprepatch.sh [new file with mode: 0755]
lib/libstdc/n.sh
lib/libstdc/ndbm.h
lib/libstdc/net/named/gethostnamadr.c
lib/libstdc/net/rcmd.c
lib/libstdc/net/res_debug.c
lib/libstdc/net/res_mkquery.c
lib/libstdc/net/res_send.c
lib/libstdc/net/rexec.c
lib/libstdc/nlist.h [deleted file]
lib/libstdc/ns/ns_addr.c
lib/libstdc/oldprotos.txt
lib/libstdc/p.sh
lib/libstdc/post.patch [new file with mode: 0644]
lib/libstdc/pre.patch [moved from lib/libstdc/libstdc.patch with 52% similarity]
lib/libstdc/r.sh
lib/libstdc/s.sh
lib/libstdc/stdio.h
lib/libstdc/stdio/doprnt.c
lib/libstdc/stdio/findiop.c
lib/libstdc/stdio/fread.c
lib/libstdc/stdio/fwrite.c
lib/libstdc/stdio/setbuffer.c
lib/libstdc/sys/exec.h
lib/libstdc/sys/execl.c
lib/libstdc/sys/execle.c
lib/libstdc/sys/file.h
lib/libstdc/sys/ioctl.c
lib/libstdc/sys/ioctl.h
lib/libstdc/sys/open.c
lib/libstdc/sys/read.c
lib/libstdc/sys/recv.c
lib/libstdc/sys/recvfrom.c
lib/libstdc/sys/send.c
lib/libstdc/sys/sendto.c
lib/libstdc/sys/signal.h
lib/libstdc/sys/socket.h
lib/libstdc/sys/vopen.c [new file with mode: 0644]
lib/libstdc/sys/wait.c
lib/libstdc/sys/wait.h
lib/libstdc/sys/write.c
x_include/sys/x_exec.h
x_include/sys/x_file.h
x_include/sys/x_ioctl.h
x_include/sys/x_signal.h
x_include/sys/x_socket.h
x_include/sys/x_wait.h
x_include/x_a.out.h
x_include/x_gen.h
x_include/x_memory.h
x_include/x_ndbm.h
x_include/x_nlist.h [changed from file to symlink]
x_include/x_stdio.h
xify/xify.c
xify/xify.sh

index bdac0b9..16f0dd2 100644 (file)
@@ -15,9 +15,12 @@ cproto-4.6/cproto
 cproto-4.6/lex.yy.c
 cproto-4.6/stamp-h
 cproto-4.6/y.tab.c
+lib/libstdc.pre
+lib/libstdc.post
 lib/libstdc/*.temp
 lib/libstdc/xx*
-lib/libstdc.orig
+lib/libstdc/pre.patch.bak
+lib/libstdc/post.patch.bak
 xify/newline
 xify/nocomment
 xify/nostring
index f083632..ba00e67 100644 (file)
@@ -44,6 +44,46 @@ unsigned int r_symbolnum:24, /* local symbol ordinal */
                :4;             /* nothing, yet */
 };
 
-#include <nlist.h>
+/*
+ * Format of a symbol table entry; this file is included by <a.out.h>
+ * and should be used if you aren't interested the a.out header
+ * or relocation information.
+ */
+struct nlist {
+       union {
+               char    *n_name;        /* for use when in-core */
+               long    n_strx;         /* index into file string table */
+       } n_un;
+unsigned char  n_type;         /* type flag, i.e. N_TEXT etc; see below */
+       char    n_other;        /* unused */
+       short   n_desc;         /* see <stab.h> */
+unsigned long  n_value;        /* value of this symbol (or sdb offset) */
+};
+#define        n_hash  n_desc          /* used internally by ld */
+
+/*
+ * Simple values for n_type.
+ */
+#define        N_UNDF  0x0             /* undefined */
+#define        N_ABS   0x2             /* absolute */
+#define        N_TEXT  0x4             /* text */
+#define        N_DATA  0x6             /* data */
+#define        N_BSS   0x8             /* bss */
+#define        N_COMM  0x12            /* common (internal to ld) */
+#define        N_FN    0x1f            /* file name symbol */
+
+#define        N_EXT   01              /* external bit, or'ed in */
+#define        N_TYPE  0x1e            /* mask for all the type bits */
+
+/*
+ * Sdb entries have some of the N_STAB bits set.
+ * These are given in <stab.h>
+ */
+#define        N_STAB  0xe0            /* if any of these bits set, a SDB entry */
+
+/*
+ * Format for namelist values.
+ */
+#define        N_FORMAT        "%08x"
 
 #endif
index 78d89ed..69f95b2 100644 (file)
@@ -14,16 +14,18 @@ static char sccsid[] = "@(#)times.c 5.2 (Berkeley) 3/9/86";
 
 /*#include <sys/time.h>*/
 /*#include <sys/resource.h>*/
+/*#include <sys/times.h>*/
 
 /*
  * Backwards compatible times.
  */
-struct tms {
-       int     tms_utime;              /* user time */
-       int     tms_stime;              /* system time */
-       int     tms_cutime;             /* user time, children */
-       int     tms_cstime;             /* system time, children */
-};
+/* we now get this from sys/times.h to avoid duplication */
+/*struct tms {*/
+/*     int     tms_utime;*/            /* user time */
+/*     int     tms_stime;*/            /* system time */
+/*     int     tms_cutime;*/           /* user time, children */
+/*     int     tms_cstime;*/           /* system time, children */
+/*};*/
 
 static scale60 __P((register struct timeval *tvp));
 
index 58b0918..46437e0 100644 (file)
 static char sccsid[] = "@(#)memccpy.c  5.2 (Berkeley) 86/03/09";
 #endif
 
-char *memccpy(t, f, c, n) register char *t; register char *f; register c; register n; {
+char *memccpy(_t, _f, c, n) void *_t; void *_f; register c; register n; {
+#define t (*(char **)&_t)
+#define f (*(char **)&_f)
        while (--n >= 0)
                if ((*t++ = *f++) == c)
                        return (t);
        return (0);
+#undef t
+#undef f
 }
index cfdc891..5f81202 100644 (file)
 static char sccsid[] = "@(#)memchr.c   5.2 (Berkeley) 86/03/09";
 #endif
 
-char *memchr(s, c, n) register char *s; register c; register n; {
+void *memchr(_s, c, n) void *_s; register c; register n; {
+#define s (*(char **)&_s)
        while (--n >= 0)
                if (*s++ == c)
                        return (--s);
        return (0);
+#undef s
 }
index 337e270..7f88d7f 100644 (file)
 static char sccsid[] = "@(#)memcmp.c   5.2 (Berkeley) 86/03/09";
 #endif
 
-int memcmp(s1, s2, n) register char *s1; register char *s2; register n; {
+int memcmp(_s1, _s2, n) void *_s1; void *_s2; register n; {
+#define s1 (*(char **)&_s1)
+#define s2 (*(char **)&_s2)
        while (--n >= 0)
                if (*s1++ != *s2++)
                        return (*--s1 - *--s2);
        return (0);
+#undef s1
+#undef s2
 }
index 5c196c4..5ba956e 100644 (file)
 static char sccsid[] = "@(#)memcpy.c   5.2 (Berkeley) 86/03/09";
 #endif
 
-char *memcpy(t, f, n) register char *t; register char *f; register n; {
+void *memcpy(_t, _f, n) void *_t; void *_f; register n; {
+#define t (*(char **)&_t)
+#define f (*(char **)&_f)
        register char *p = t;
 
        while (--n >= 0)
                *t++ = *f++;
 
        return (p);
+#undef t
+#undef f
 }
index 2726efe..4024a8c 100644 (file)
 static char sccsid[] = "@(#)memset.c   5.2 (Berkeley) 86/03/09";
 #endif
 
-char *memset(s, c, n) register char *s; register c; register n; {
+void *memset(_s, c, n) void *_s; register c; register n; {
+#define s (*(char **)&_s)
        register char *p = s;
 
        while (--n >= 0)
                *s++ = c;
 
        return (p);
+#undef s
 }
index 65a4bd6..99a454a 100644 (file)
@@ -50,17 +50,17 @@ int atoi __P((register char *p));
 long atol __P((register char *p));
 
 /* gen/bcmp.c */
-int bcmp __P((register char *b1, register char *b2, register int length));
+int bcmp __P((void *_b1, void *_b2, register int length));
 
 /* gen/bcopy.c */
-int bcopy __P((register char *src, register char *dst, register int length));
+int bcopy __P((void *_src, void *_dst, register int length));
 
 /* gen/bzero.c */
-int bzero __P((register char *b, register int length));
+int bzero __P((void *_b, register int length));
 
 /* gen/calloc.c */
-char *calloc __P((register unsigned num, register unsigned size));
-int cfree __P((char *p, unsigned num, unsigned size));
+void *calloc __P((register unsigned num, register unsigned size));
+int cfree __P((void *p, unsigned num, unsigned size));
 
 /* gen/crypt.c */
 int setkey __P((char *key));
@@ -95,10 +95,10 @@ int setusershell __P((void));
 int insque __P((register struct vaxque *e, register struct vaxque *prev));
 
 /* gen/malloc.c */
-char *malloc __P((unsigned nbytes));
+void *malloc __P((unsigned nbytes));
 void morecore __P((int bucket));
-void free __P((char *cp));
-char *realloc __P((char *cp, unsigned nbytes));
+void free __P((void *cp));
+void *realloc __P((void *cp, unsigned nbytes));
 void mstats __P((char *s));
 
 /* gen/mkstemp.c */
index a70579b..03f55f2 100644 (file)
@@ -13,8 +13,9 @@ static char sccsid[] = "@(#)bcmp.c    5.1 (Berkeley) 1/27/87";
 /*
  * bcmp -- vax cmpc3 instruction
  */
-int bcmp(b1, b2, length) register char *b1; register char *b2; register int length; {
-
+int bcmp(_b1, _b2, length) void *_b1; void *_b2; register int length; {
+#define b1 (*(char **)&_b1)
+#define b2 (*(char **)&_b2)
        if (length == 0)
                return (0);
        do
@@ -22,4 +23,6 @@ int bcmp(b1, b2, length) register char *b1; register char *b2; register int leng
                        break;
        while (--length);
        return(length);
+#undef b1
+#undef b2
 }
index 58d290f..b6d1e46 100644 (file)
@@ -14,7 +14,9 @@ static char sccsid[] = "@(#)bcopy.c   5.1 (Berkeley) 1/27/87";
 /*
  * bcopy -- vax movc3 instruction
  */
-int bcopy(src, dst, length) register char *src; register char *dst; register int length; {
+int bcopy(_src, _dst, length) void *_src; void *_dst; register int length; {
+#define src (*(char **)&_src)
+#define dst (*(char **)&_dst)
        if (length && src != dst)
                if ((u_int)dst < (u_int)src)
                        if (((int)src | (int)dst | length) & 3)
@@ -24,7 +26,7 @@ int bcopy(src, dst, length) register char *src; register char *dst; register int
                        else {
                                length >>= 2;
                                do      /* copy by longs */
-                                       *((long *)dst)++ = *((long *)src)++;
+                                       *(*(long **)&dst)++ = *(*(long **)&src)++;
                                while (--length);
                        }
                else {                  /* copy backwards */
@@ -37,9 +39,11 @@ int bcopy(src, dst, length) register char *src; register char *dst; register int
                        else {
                                length >>= 2;
                                do      /* copy by shorts */
-                                       *--((long *)dst) = *--((long *)src);
+                                       *--(*(long **)&dst) = *--(*(long **)&src);
                                while (--length);
                        }
                }
        return(0);
+#undef src
+#undef dst
 }
index 01dc1dd..ebe4d09 100644 (file)
@@ -13,11 +13,12 @@ static char sccsid[] = "@(#)bzero.c 5.1 (Berkeley) 1/27/87";
 /*
  * bzero -- vax movc5 instruction
  */
-int bzero(b, length) register char *b; register int length; {
-
+int bzero(_b, length) void *_b; register int length; {
+#define b (*(char **)&_b)
        if (length)
                do
                        *b++ = '\0';
                while (--length);
        return(length);
+#undef b
 }
index 2b5b2b7..ead51f7 100644 (file)
@@ -7,9 +7,9 @@ static char sccsid[] = "@(#)calloc.c    5.2 (Berkeley) 3/9/86";
 /*
  * Calloc - allocate and clear memory block
  */
-char *calloc(num, size) register unsigned num; register unsigned size; {
-       extern char *malloc();
-       register char *p;
+void *calloc(num, size) register unsigned num; register unsigned size; {
+       extern void *malloc();
+       register void *p;
 
        size *= num;
        if (p = malloc(size))
@@ -17,6 +17,6 @@ char *calloc(num, size) register unsigned num; register unsigned size; {
        return (p);
 }
 
-int cfree(p, num, size) char *p; unsigned num; unsigned size; {
+int cfree(p, num, size) void *p; unsigned num; unsigned size; {
        free(p);
 }
index 74fdf56..6b6e317 100644 (file)
@@ -19,8 +19,8 @@ char *getpass(prompt) char *prompt; {
        register c;
        FILE *fi;
        static char pbuf[9];
-       int (*signal())();
-       int (*sig)();
+       void (*signal())();
+       void (*sig) __P((int sig));
 
        if ((fi = fdopen(open("/dev/tty", 2), "r")) == NULL)
                fi = stdin;
index 40f5028..8d28dc8 100644 (file)
@@ -44,19 +44,37 @@ static struct passwd *fetchpw(key) datum key; {
         cp = key.dptr;
        tp = line;
 
+#ifdef __STDC__
+#define        EXPAND(e)       passwd.pw_ ## e = tp; while (*tp++ = *cp++);
+#else
 #define        EXPAND(e)       passwd.pw_/**/e = tp; while (*tp++ = *cp++);
+#endif
+#ifdef X_
+/* without this adjustment it tries to access x_passwd.x_pw_x_name etc */
+       EXPAND(nox_name);
+       EXPAND(nox_passwd);
+#else
        EXPAND(name);
        EXPAND(passwd);
+#endif
        bcopy(cp, (char *)&passwd.pw_uid, sizeof (int));
        cp += sizeof (int);
        bcopy(cp, (char *)&passwd.pw_gid, sizeof (int));
        cp += sizeof (int);
        bcopy(cp, (char *)&passwd.pw_quota, sizeof (int));
        cp += sizeof (int);
+#ifdef X_
+/* without this adjustment it tries to access x_passwd.x_pw_x_name etc */
+       EXPAND(nox_comment);
+       EXPAND(nox_gecos);
+       EXPAND(nox_dir);
+       EXPAND(nox_shell);
+#else
        EXPAND(comment);
        EXPAND(gecos);
        EXPAND(dir);
        EXPAND(shell);
+#endif
         return (&passwd);
 }
 
index 7ef22da..5b7803e 100644 (file)
@@ -68,7 +68,7 @@ static char **initshells() {
        register char **sp, *cp;
        register FILE *fp;
        struct stat statb;
-       extern char *malloc(), *calloc();
+       extern void *malloc(), *calloc();
 
        if (shells != NULL)
                free((char *)shells);
@@ -82,7 +82,7 @@ static char **initshells() {
                (void)fclose(fp);
                return(okshells);
        }
-       if ((strings = malloc((unsigned)statb.st_size)) == NULL) {
+       if ((strings = (char *)malloc((unsigned)statb.st_size)) == NULL) {
                (void)fclose(fp);
                return(okshells);
        }
index 185d4f5..ca73ef2 100644 (file)
@@ -88,9 +88,6 @@ static        u_int nmalloc[NBUCKETS];
 #if defined(DEBUG) || defined(RCHECK)
 #define        ASSERT(p)   if (!(p)) botch("p")
 /*#include <stdio.h>*/
-static void botch __P((char *s));
-static findbucket __P((union overhead *freep, int srchlen));
-
 static void botch(s) char *s; {
        fprintf(stderr, "\r\nassertion botched: %s\r\n", s);
        (void) fflush(stderr);          /* just in case user buffered it */
@@ -100,7 +97,9 @@ static void botch(s) char *s; {
 #define        ASSERT(p)
 #endif
 
-char *malloc(nbytes) unsigned nbytes; {
+static findbucket __P((union overhead *freep, int srchlen));
+
+void *malloc(nbytes) unsigned nbytes; {
        register union overhead *op;
        register int bucket;
        register unsigned amt, n;
@@ -221,7 +220,7 @@ void morecore(bucket) int bucket; {
        }
 }
 
-void free(cp) char *cp; {
+void free(cp) void *cp; {
        register int size;
        register union overhead *op;
 
@@ -260,7 +259,7 @@ void free(cp) char *cp; {
  */
 int realloc_srchlen = 4;       /* 4 should be plenty, -1 =>'s whole list */
 
-char *realloc(cp, nbytes) char *cp; unsigned nbytes; {
+void *realloc(cp, nbytes) void *cp; unsigned nbytes; {
        register u_int onb, i;
        union overhead *op;
        char *res;
index 02cead3..0891709 100644 (file)
@@ -6,6 +6,13 @@
 #include <sys/file.h>
 #include <sys/param.h>
 #include <sys/stat.h>
+#ifdef __STDC__
+#include <stdarg.h>
+#define _va_start(argp, arg) va_start(argp, arg)
+#else
+#include <varargs.h>
+#define _va_start(argp, arg) va_start(argp)
+#endif
 
 /*
  * Copyright (c) 1983 Regents of the University of California.
@@ -23,6 +30,7 @@ static char sccsid[] = "@(#)ndbm.c    5.3 (Berkeley) 3/9/86";
 /*#include <stdio.h>*/
 /*#include <errno.h>*/
 /*#include <ndbm.h>*/
+/*#include <varargs.h>*/
 
 #define BYTESIZ 8
 #undef setbit
@@ -32,6 +40,7 @@ static char sccsid[] = "@(#)ndbm.c    5.3 (Berkeley) 3/9/86";
 /*static  long dcalchash();*/
 extern  int errno;
 
+#ifdef __STDC__
 static dbm_access __P((register DBM *db, long hash));
 static getbit __P((register DBM *db));
 static setbit __P((register DBM *db));
@@ -43,7 +52,12 @@ static delitem __P((char buf[PBLKSIZ], int n));
 static additem __P((char buf[PBLKSIZ], datum item, datum item1));
 static chkblk __P((char buf[PBLKSIZ]));
 
-DBM *dbm_open(file, flags, mode) char *file; int flags; int mode; {
+DBM *dbm_open(char *file, int flags, ...)
+#else
+DBM *dbm_open(file, flags, va_alist) char *file; int flags; va_dcl
+#endif
+{
+       va_list argp;
        struct stat statb;
        register DBM *db;
 
@@ -56,12 +70,16 @@ DBM *dbm_open(file, flags, mode) char *file; int flags; int mode; {
                flags = (flags & ~03) | O_RDWR;
        strcpy(db->dbm_pagbuf, file);
        strcat(db->dbm_pagbuf, ".pag");
-       db->dbm_pagf = open(db->dbm_pagbuf, flags, mode);
+       _va_start(argp, flags);
+       db->dbm_pagf = vopen(db->dbm_pagbuf, flags, argp);
+       va_end(argp);
        if (db->dbm_pagf < 0)
                goto bad;
        strcpy(db->dbm_pagbuf, file);
        strcat(db->dbm_pagbuf, ".dir");
-       db->dbm_dirf = open(db->dbm_pagbuf, flags, mode);
+       _va_start(argp, flags);
+       db->dbm_dirf = vopen(db->dbm_pagbuf, flags, argp);
+       va_end(argp);
        if (db->dbm_dirf < 0)
                goto bad1;
        fstat(db->dbm_dirf, &statb);
index 4fd1be3..78048be 100644 (file)
@@ -1,5 +1,4 @@
 #include <a.out.h>
-#include <nlist.h>
 #include <stdio.h>
 #include <strings.h>
 #include <sys/exec.h>
index 7a2d1d4..68e22ca 100644 (file)
@@ -21,7 +21,7 @@ static char sccsid[] = "@(#)perror.c  5.2 (Berkeley) 3/9/86";
 
 int    errno;
 int    sys_nerr;
-char   *sys_errlist[];
+extern char    *sys_errlist[];
 int perror(s) char *s; {
        struct iovec iov[4];
        register struct iovec *v = iov;
index a8a3d42..b633adc 100644 (file)
@@ -15,12 +15,12 @@ static char sccsid[] = "@(#)signal.c        5.2 (Berkeley) 3/9/86";
  */
 /*#include <signal.h>*/
 
-int (*signal(s, a))() int s; int (*a)(); {
+void (*signal(s, a)) __P((int sig)) int s; void (*a) __P((int sig)); {
        struct sigvec osv, sv;
        static int mask[NSIG];
        static int flags[NSIG];
 
-       sv.sv_handler = a;
+       sv.sv_handler = (void (*) __P((int sig, int code, struct sigcontext *scp)))a;
        sv.sv_mask = mask[s];
        sv.sv_flags = flags[s];
        if (sigvec(s, &sv, &osv) < 0)
@@ -31,5 +31,5 @@ int (*signal(s, a))() int s; int (*a)(); {
                if (sigvec(s, &sv, 0) < 0)
                        return (BADSIG);
        }
-       return (osv.sv_handler);
+       return ((void (*) __P((int sig)))osv.sv_handler);
 }
index a9ad9d9..5f56799 100644 (file)
@@ -15,14 +15,15 @@ static char sccsid[] = "@(#)sleep.c 5.2 (Berkeley) 3/9/86";
 /*#include <signal.h>*/
 
 #define        setvec(vec, a) \
-       vec.sv_handler = a; vec.sv_mask = vec.sv_onstack = 0
+       vec.sv_handler = (void (*) __P((int sig, int code, struct sigcontext *scp)))a; vec.sv_mask = vec.sv_onstack = 0
 
 static int ringring;
 
 static void sleepx __P((void));
 
 void sleep(n) unsigned n; {
-       int sleepx(), omask;
+       void sleepx();
+       int omask;
        struct itimerval itv, oitv;
        register struct itimerval *itp = &itv;
        struct sigvec vec, ovec;
index f138762..6a7be0b 100644 (file)
@@ -11,7 +11,7 @@ static char sccsid[] = "@(#)system.c  5.2 (Berkeley) 3/9/86";
 
 int system(s) char *s; {
        int status, pid, w;
-       register int (*istat)(), (*qstat)();
+       register void (*istat) __P((int sig)), (*qstat) __P((int sig));
 
        if ((pid = vfork()) == 0) {
                execl("/bin/sh", "sh", "-c", s, 0);
index e397535..eafb631 100644 (file)
@@ -18,14 +18,15 @@ static char sccsid[] = "@(#)usleep.c        5.2 (Berkeley) 3/9/86";
 #define TICK   10000           /* system clock resolution in microseconds */
 
 #define        setvec(vec, a) \
-       vec.sv_handler = a; vec.sv_mask = vec.sv_onstack = 0
+       vec.sv_handler = (void (*) __P((int sig, int code, struct sigcontext *scp)))a; vec.sv_mask = vec.sv_onstack = 0
 
 static int ringring;
 
 static void sleepx __P((void));
 
 void usleep(n) unsigned n; {
-       int sleepx(), omask;
+       void sleepx();
+       int omask;
        struct itimerval itv, oitv;
        register struct itimerval *itp = &itv;
        struct sigvec vec, ovec;
index 520f891..84f40d2 100644 (file)
@@ -296,6 +296,7 @@ sys/unlink.c sys/file.h
 sys/utimes.c sys/time.h
 sys/vfork.c sys/proc.h
 sys/vhangup.c
+sys/vopen.c sys/file.h
 sys/wait3.c sys/wait.h
 sys/wait.c sys/wait.h
 sys/write.c sys/file.h
index 28f973b..391cd52 100644 (file)
 #endif
 
 /* compat-sys5/memccpy.c */
-char *memccpy __P((register char *t, register char *f, register c, register n));
+char *memccpy __P((void *_t, void *_f, register c, register n));
 
 /* compat-sys5/memchr.c */
-char *memchr __P((register char *s, register c, register n));
+void *memchr __P((void *_s, register c, register n));
 
 /* compat-sys5/memcmp.c */
-int memcmp __P((register char *s1, register char *s2, register n));
+int memcmp __P((void *_s1, void *_s2, register n));
 
 /* compat-sys5/memcpy.c */
-char *memcpy __P((register char *t, register char *f, register n));
+void *memcpy __P((void *_t, void *_f, register n));
 
 /* compat-sys5/memset.c */
-char *memset __P((register char *s, register c, register n));
+void *memset __P((void *_s, register c, register n));
 #endif
 
 #endif
diff --git a/lib/libstdc/mkpatch.sh b/lib/libstdc/mkpatch.sh
deleted file mode 100755 (executable)
index 8fddadd..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-(cd ..; diff --unified --recursive --new-file libstdc.orig libstdc) >a
-mv libstdc.patch libstdc.patch.bak
-mv a libstdc.patch
-wc -l libstdc.patch libstdc.patch.bak
diff --git a/lib/libstdc/mkpostpatch.sh b/lib/libstdc/mkpostpatch.sh
new file mode 100755 (executable)
index 0000000..20221c5
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+rm -f ../libstdc.post/post.patch ../libstdc.post/post.patch.bak post.patch.bak
+mv post.patch ../post.patch.bak
+(cd ..; diff --unified --recursive --new-file --exclude=*.o --exclude=x libstdc.post libstdc >post.patch)
+mv ../post.patch.bak ../post.patch .
+wc -l post.patch post.patch.bak
diff --git a/lib/libstdc/mkprepatch.sh b/lib/libstdc/mkprepatch.sh
new file mode 100755 (executable)
index 0000000..4c3ff09
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+rm -f ../libstdc.pre/pre.patch ../libstdc.pre/pre.patch.bak pre.patch.bak
+mv pre.patch ../pre.patch.bak
+(cd ..; diff --unified --recursive --new-file --exclude=*.o --exclude=x libstdc.pre libstdc >pre.patch)
+mv ../pre.patch.bak ../pre.patch .
+wc -l pre.patch pre.patch.bak
index 314ad04..ef81ca7 100755 (executable)
@@ -69,7 +69,6 @@ do
     fi
   fi
 done
-sed -e 's/fork/vfork/g' <sys/fork.c >sys/vfork.c
 
 find vax -name Makefile -print |\
 while read i
@@ -141,6 +140,6 @@ do
   cat xx* >$i
 done
 
-rm -rf ../libstdc.orig
-cp -r ../libstdc ../libstdc.orig
-patch --strip 1 <libstdc.patch
+rm -rf ../libstdc.pre
+cp -r ../libstdc ../libstdc.pre
+patch --strip 1 <pre.patch
index 22c50f3..c45aa3a 100644 (file)
@@ -74,7 +74,7 @@ typedef struct {
 #endif
 
 /* gen/ndbm.c */
-DBM *dbm_open __P((char *file, int flags, int mode));
+DBM *dbm_open __P((char *file, int flags, ...));
 void dbm_close __P((DBM *db));
 long dbm_forder __P((register DBM *db, datum key));
 datum dbm_fetch __P((register DBM *db, datum key));
index fe1b225..43bbd74 100644 (file)
@@ -210,6 +210,7 @@ static struct hostent *getanswer(msg, msglen, iquery) char *msg; int msglen; int
                        }
                }
 
+/* XXX should be: bp = (bp + sizeof(align) - 1) & ~sizeof(align) ??? */
                bp += ((u_long)bp % sizeof(align));
 
                if (bp + n >= &hostbuf[sizeof(hostbuf)]) {
index 32daf13..c0c5ee5 100644 (file)
@@ -74,7 +74,7 @@ int rcmd(ahost, rport, locuser, remuser, cmd, fd2p) char **ahost; int rport; cha
                sin.sin_family = hp->h_addrtype;
                bcopy(hp->h_addr_list[0], (caddr_t)&sin.sin_addr, hp->h_length);
                sin.sin_port = rport;
-               if (connect(s, (caddr_t)&sin, sizeof (sin), 0) >= 0)
+               if (connect(s, (struct sockaddr *)&sin, sizeof (sin)/*, 0*/) >= 0)
                        break;
                (void) close(s);
                if (errno == EADDRINUSE) {
@@ -122,7 +122,7 @@ int rcmd(ahost, rport, locuser, remuser, cmd, fd2p) char **ahost; int rport; cha
                        (void) close(s2);
                        goto bad;
                }
-               s3 = accept(s2, &from, &len, 0);
+               s3 = accept(s2, (struct sockaddr *)&from, &len/*, 0*/);
                (void) close(s2);
                if (s3 < 0) {
                        perror("accept");
@@ -175,7 +175,7 @@ int rresvport(alport) int *alport; {
                return (-1);
        for (;;) {
                sin.sin_port = htons((u_short)*alport);
-               if (bind(s, (caddr_t)&sin, sizeof (sin)) >= 0)
+               if (bind(s, (struct sockaddr *)&sin, sizeof (sin)) >= 0)
                        return (s);
                if (errno != EADDRINUSE) {
                        (void) close(s);
index 36d6386..0b136b0 100644 (file)
@@ -323,7 +323,9 @@ char *p_rr(cp, msg, file) char *cp; char *msg; FILE *file; {
 }
 
 static char nbuf[20];
+/* we have taken the portable sprintf() from 4.3tahoe */
 /*extern       char *sprintf();*/
+/*extern       int sprintf();*/
 
 /*
  * Return a string for the type
@@ -377,7 +379,10 @@ char *p_type(type) int type; {
        case T_GID:
                return("GID");
        default:
-               return (sprintf(nbuf, "%d", type));
+/* we have taken the portable sprintf() from 4.3tahoe */
+               /*return (sprintf(nbuf, "%d", type));*/
+               sprintf(nbuf, "%d", type);
+               return nbuf;
        }
 }
 
@@ -392,6 +397,9 @@ char *p_class(class) int class; {
        case C_ANY:             /* matches any class */
                return("ANY");
        default:
-               return (sprintf(nbuf, "%d", class));
+/* we have taken the portable sprintf() from 4.3tahoe */
+               /*return (sprintf(nbuf, "%d", class));*/
+               sprintf(nbuf, "%d", class);
+               return nbuf;
        }
 }
index 01ecb96..69c8612 100644 (file)
@@ -22,7 +22,9 @@ static char sccsid[] = "@(#)res_mkquery.c     6.3 (Berkeley) 3/17/86";
 /*#include <arpa/nameser.h>*/
 /*#include <resolv.h>*/
 
+/* we have taken the portable sprintf() from 4.3tahoe */
 /*extern       char *sprintf();*/
+/*extern       int sprintf();*/
 
 /*
  * Form all types of queries.
@@ -70,7 +72,9 @@ int res_mkquery(op, dname, class, type, data, datalen, newrr, buf, buflen) int o
                        if (res_init() == -1)
                                return(-1);
                if (_res.defdname[0] != '\0')
-                       dname = sprintf(dnbuf, "%s.%s", dname, _res.defdname);
+/* we have taken the portable sprintf() from 4.3tahoe */
+                       /*dname = sprintf(dnbuf, "%s.%s", dname, _res.defdname);*/
+                       sprintf(dname = dnbuf, "%s.%s", dname, _res.defdname);
        }
        /*
         * perform opcode specific processing
index 8ca652d..16a9341 100644 (file)
@@ -91,7 +91,7 @@ int res_send(buf, buflen, answer, anslen) char *buf; int buflen; char *answer; i
 #endif
                                        continue;
                                }
-                               if (connect(s, &(_res.nsaddr_list[ns]),
+                               if (connect(s, (struct sockaddr *)&(_res.nsaddr_list[ns]),
                                   sizeof(struct sockaddr)) < 0) {
                                        terrno = errno;
 #ifdef DEBUG
@@ -165,7 +165,7 @@ int res_send(buf, buflen, answer, anslen) char *buf; int buflen; char *answer; i
                        if (s < 0)
                                s = socket(AF_INET, SOCK_DGRAM, 0);
 #if    BSD >= 43
-                       if (connect(s, &_res.nsaddr_list[ns],
+                       if (connect(s, (struct sockaddr *)&_res.nsaddr_list[ns],
                            sizeof(struct sockaddr)) < 0 ||
                            send(s, buf, buflen, 0) != buflen) {
 #ifdef DEBUG
index a6a05c4..a5f73e1 100644 (file)
@@ -57,7 +57,7 @@ retry:
        sin.sin_family = hp->h_addrtype;
        sin.sin_port = rport;
        bcopy(hp->h_addr, (caddr_t)&sin.sin_addr, hp->h_length);
-       if (connect(s, &sin, sizeof(sin)) < 0) {
+       if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
                if (errno == ECONNREFUSED && timo <= 16) {
                        (void) close(s);
                        sleep(timo);
@@ -91,7 +91,7 @@ retry:
                (void) sprintf(num, "%d", port);
                (void) write(s, num, strlen(num)+1);
                { int len = sizeof (from);
-                 s3 = accept(s2, &from, &len, 0);
+                 s3 = accept(s2, (struct sockaddr *)&from, &len/*, 0*/);
                  close(s2);
                  if (s3 < 0) {
                        perror("accept");
diff --git a/lib/libstdc/nlist.h b/lib/libstdc/nlist.h
deleted file mode 100644 (file)
index 45645fd..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-#ifndef _NLIST_H_
-#define _NLIST_H_
-
-/*
- * Copyright (c) 1980 Regents of the University of California.
- * All rights reserved.  The Berkeley software License Agreement
- * specifies the terms and conditions for redistribution.
- *
- *     @(#)nlist.h     5.1 (Berkeley) 5/30/85
- */
-
-/*
- * Format of a symbol table entry; this file is included by <a.out.h>
- * and should be used if you aren't interested the a.out header
- * or relocation information.
- */
-struct nlist {
-       char    *n_name;        /* for use when in-core */
-       unsigned char n_type;   /* type flag, i.e. N_TEXT etc; see below */
-       char    n_other;        /* unused */
-       short   n_desc;         /* see <stab.h> */
-       unsigned long n_value;  /* value of this symbol (or sdb offset) */
-};
-#define        n_hash  n_desc          /* used internally by ld */
-
-/*
- * Simple values for n_type.
- */
-#define        N_UNDF  0x0             /* undefined */
-#define        N_ABS   0x2             /* absolute */
-#define        N_TEXT  0x4             /* text */
-#define        N_DATA  0x6             /* data */
-#define        N_BSS   0x8             /* bss */
-#define        N_COMM  0x12            /* common (internal to ld) */
-#define        N_FN    0x1f            /* file name symbol */
-
-#define        N_EXT   01              /* external bit, or'ed in */
-#define        N_TYPE  0x1e            /* mask for all the type bits */
-
-/*
- * Sdb entries have some of the N_STAB bits set.
- * These are given in <stab.h>
- */
-#define        N_STAB  0xe0            /* if any of these bits set, a SDB entry */
-
-/*
- * Format for namelist values.
- */
-#define        N_FORMAT        "%08x"
-
-#ifndef KERNEL
-#ifndef __P
-#ifdef __STDC__
-#define __P(args) args
-#else
-#define __P(args) ()
-#endif
-#endif
-
-/* gen/nlist.c */
-int nlist __P((char *name, struct nlist *list));
-#endif
-
-#endif
index 330b55b..f8ad363 100644 (file)
@@ -61,7 +61,7 @@ struct ns_addr ns_addr(name) char *name; {
        socketname = index(hostname, separator);
        if (socketname) {
                *socketname++ = 0;
-               Field(socketname, &addr.x_port, 2);
+               Field(socketname, (char *)&addr.x_port, 2);
        }
 
        Field(hostname, addr.x_host.c_host, 6);
index 9c0c1f8..f0c3453 100644 (file)
@@ -26,7 +26,7 @@ stdio/flsbuf.c:char   *malloc();
 stdio/fseek.c:long lseek();
 stdio/doscan.c:static char *_getccl();
 stdio/ftell.c:long     lseek();
-stdio/findiop.c:extern char    *calloc();
+stdio/findiop.c:extern void    *calloc();
 stdio/popen.c:extern   char *malloc();
 stdio/filbuf.c:char    *malloc();
 compat-4.1/tell.c:long lseek();
@@ -42,7 +42,7 @@ memory.h:extern char *memcpy();
 memory.h:extern char *memset();
 net/res_debug.c:extern char *p_cdname(), *p_rr(), *p_type(), *p_class();
 net/res_debug.c:extern char *inet_ntoa();
-net/res_debug.c:extern char *sprintf();
+net/res_debug.c:extern int sprintf();
 net/getnetent.c:static char *any();
 net/rexec.c:char       *index(), *sprintf();
 net/rexec.c:char       *getpass(), *getlogin();
@@ -56,7 +56,7 @@ net/ruserpass.c:char *nbs8decrypt(), *nbs8encrypt();
 net/getprotoent.c:static char *any();
 net/hosttable/gethostent.c:static char *any();
 net/named/gethostnamadr.c:static char *any();
-net/res_mkquery.c:extern       char *sprintf();
+net/res_mkquery.c:extern       int sprintf();
 net/getservent.c:static char *any();
 vaxmba/mbavar.h:extern Xmba0int(), Xmba1int(), Xmba2int(), Xmba3int();
 vax/inline/inline.h:char *newline(), *copyline(), *doreplaceon();
index 88850b1..5c75cd9 100755 (executable)
@@ -13,11 +13,12 @@ done
 
 grep '\.h:' oldprotos.txt >oldprotos.temp
 
-rm -f machine frame.h errno.h fcntl.h signal.h syslog.h
+rm -f machine frame.h errno.h fcntl.h nlist.h signal.h syslog.h
 ln -s vax machine
 ln -s machine/frame.h frame.h
 ln -s sys/errno.h errno.h
 ln -s sys/file.h fcntl.h
+ln -s a.out.h nlist.h
 ln -s sys/signal.h signal.h
 ln -s sys/syslog.h syslog.h
 
@@ -65,4 +66,4 @@ EOF
   fi
 done <groups.txt
 
-rm -f errno.h fcntl.h frame.h machine signal.h syslog.h
+rm -f machine frame.h errno.h fcntl.h nlist.h signal.h syslog.h
diff --git a/lib/libstdc/post.patch b/lib/libstdc/post.patch
new file mode 100644 (file)
index 0000000..572a7dc
--- /dev/null
@@ -0,0 +1,244 @@
+diff --unified --recursive --new-file '--exclude=*.o' '--exclude=x' libstdc.post/gen/getpass.c libstdc/gen/getpass.c
+--- libstdc.post/gen/getpass.c 2017-01-19 18:06:10.766147943 +1100
++++ libstdc/gen/getpass.c      2017-01-19 19:52:29.473745954 +1100
+@@ -19,8 +19,8 @@
+       register c;
+       FILE *fi;
+       static char pbuf[9];
+-      int (*signal())();
+-      int (*sig)();
++      void (*signal())();
++      void (*sig) __P((int sig));
+       if ((fi = fdopen(open("/dev/tty", 2), "r")) == NULL)
+               fi = stdin;
+diff --unified --recursive --new-file '--exclude=*.o' '--exclude=x' libstdc.post/gen/getpwnamuid.c libstdc/gen/getpwnamuid.c
+--- libstdc.post/gen/getpwnamuid.c     2017-01-19 18:06:10.766147943 +1100
++++ libstdc/gen/getpwnamuid.c  2017-01-19 19:33:39.576148388 +1100
+@@ -44,19 +44,37 @@
+         cp = key.dptr;
+       tp = line;
++#ifdef __STDC__
++#define       EXPAND(e)       passwd.pw_ ## e = tp; while (*tp++ = *cp++);
++#else
+ #define       EXPAND(e)       passwd.pw_/**/e = tp; while (*tp++ = *cp++);
++#endif
++#ifdef X_
++/* without this adjustment it tries to access x_passwd.x_pw_x_name etc */
++      EXPAND(nox_name);
++      EXPAND(nox_passwd);
++#else
+       EXPAND(name);
+       EXPAND(passwd);
++#endif
+       bcopy(cp, (char *)&passwd.pw_uid, sizeof (int));
+       cp += sizeof (int);
+       bcopy(cp, (char *)&passwd.pw_gid, sizeof (int));
+       cp += sizeof (int);
+       bcopy(cp, (char *)&passwd.pw_quota, sizeof (int));
+       cp += sizeof (int);
++#ifdef X_
++/* without this adjustment it tries to access x_passwd.x_pw_x_name etc */
++      EXPAND(nox_comment);
++      EXPAND(nox_gecos);
++      EXPAND(nox_dir);
++      EXPAND(nox_shell);
++#else
+       EXPAND(comment);
+       EXPAND(gecos);
+       EXPAND(dir);
+       EXPAND(shell);
++#endif
+         return (&passwd);
+ }
+diff --unified --recursive --new-file '--exclude=*.o' '--exclude=x' libstdc.post/gen/malloc.c libstdc/gen/malloc.c
+--- libstdc.post/gen/malloc.c  2017-01-19 18:06:10.766147943 +1100
++++ libstdc/gen/malloc.c       2017-01-19 19:50:11.021555474 +1100
+@@ -88,9 +88,6 @@
+ #if defined(DEBUG) || defined(RCHECK)
+ #define       ASSERT(p)   if (!(p)) botch("p")
+ /*#include <stdio.h>*/
+-static void botch __P((char *s));
+-static findbucket __P((union overhead *freep, int srchlen));
+-
+ static void botch(s) char *s; {
+       fprintf(stderr, "\r\nassertion botched: %s\r\n", s);
+       (void) fflush(stderr);          /* just in case user buffered it */
+@@ -100,6 +97,8 @@
+ #define       ASSERT(p)
+ #endif
++static findbucket __P((union overhead *freep, int srchlen));
++
+ void *malloc(nbytes) unsigned nbytes; {
+       register union overhead *op;
+       register int bucket;
+diff --unified --recursive --new-file '--exclude=*.o' '--exclude=x' libstdc.post/gen/ndbm.c libstdc/gen/ndbm.c
+--- libstdc.post/gen/ndbm.c    2017-01-19 18:06:10.766147943 +1100
++++ libstdc/gen/ndbm.c 2017-01-19 19:01:05.945769610 +1100
+@@ -70,14 +70,14 @@
+               flags = (flags & ~03) | O_RDWR;
+       strcpy(db->dbm_pagbuf, file);
+       strcat(db->dbm_pagbuf, ".pag");
+-      _va_start(argp, fmt);
++      _va_start(argp, flags);
+       db->dbm_pagf = vopen(db->dbm_pagbuf, flags, argp);
+       va_end(argp);
+       if (db->dbm_pagf < 0)
+               goto bad;
+       strcpy(db->dbm_pagbuf, file);
+       strcat(db->dbm_pagbuf, ".dir");
+-      _va_start(argp, fmt);
++      _va_start(argp, flags);
+       db->dbm_dirf = vopen(db->dbm_pagbuf, flags, argp);
+       va_end(argp);
+       if (db->dbm_dirf < 0)
+diff --unified --recursive --new-file '--exclude=*.o' '--exclude=x' libstdc.post/gen/signal.c libstdc/gen/signal.c
+--- libstdc.post/gen/signal.c  2017-01-19 18:06:10.766147943 +1100
++++ libstdc/gen/signal.c       2017-01-19 19:57:04.134157518 +1100
+@@ -15,12 +15,12 @@
+  */
+ /*#include <signal.h>*/
+-int (*signal(s, a))() int s; int (*a)(); {
++void (*signal(s, a)) __P((int sig)) int s; void (*a) __P((int sig)); {
+       struct sigvec osv, sv;
+       static int mask[NSIG];
+       static int flags[NSIG];
+-      sv.sv_handler = a;
++      sv.sv_handler = (void (*) __P((int sig, int code, struct sigcontext *scp)))a;
+       sv.sv_mask = mask[s];
+       sv.sv_flags = flags[s];
+       if (sigvec(s, &sv, &osv) < 0)
+@@ -31,5 +31,5 @@
+               if (sigvec(s, &sv, 0) < 0)
+                       return (BADSIG);
+       }
+-      return (osv.sv_handler);
++      return ((void (*) __P((int sig)))osv.sv_handler);
+ }
+diff --unified --recursive --new-file '--exclude=*.o' '--exclude=x' libstdc.post/gen/sleep.c libstdc/gen/sleep.c
+--- libstdc.post/gen/sleep.c   2017-01-19 18:06:10.766147943 +1100
++++ libstdc/gen/sleep.c        2017-01-19 19:59:30.182439248 +1100
+@@ -15,7 +15,7 @@
+ /*#include <signal.h>*/
+ #define       setvec(vec, a) \
+-      vec.sv_handler = a; vec.sv_mask = vec.sv_onstack = 0
++      vec.sv_handler = (void (*) __P((int sig, int code, struct sigcontext *scp)))a; vec.sv_mask = vec.sv_onstack = 0
+ static int ringring;
+diff --unified --recursive --new-file '--exclude=*.o' '--exclude=x' libstdc.post/gen/system.c libstdc/gen/system.c
+--- libstdc.post/gen/system.c  2017-01-19 18:06:10.766147943 +1100
++++ libstdc/gen/system.c       2017-01-19 19:54:32.589914213 +1100
+@@ -11,7 +11,7 @@
+ int system(s) char *s; {
+       int status, pid, w;
+-      register int (*istat)(), (*qstat)();
++      register void (*istat) __P((int sig)), (*qstat) __P((int sig));
+       if ((pid = vfork()) == 0) {
+               execl("/bin/sh", "sh", "-c", s, 0);
+diff --unified --recursive --new-file '--exclude=*.o' '--exclude=x' libstdc.post/gen/usleep.c libstdc/gen/usleep.c
+--- libstdc.post/gen/usleep.c  2017-01-19 18:06:10.766147943 +1100
++++ libstdc/gen/usleep.c       2017-01-19 19:59:53.198483240 +1100
+@@ -18,7 +18,7 @@
+ #define TICK  10000           /* system clock resolution in microseconds */
+ #define       setvec(vec, a) \
+-      vec.sv_handler = a; vec.sv_mask = vec.sv_onstack = 0
++      vec.sv_handler = (void (*) __P((int sig, int code, struct sigcontext *scp)))a; vec.sv_mask = vec.sv_onstack = 0
+ static int ringring;
+diff --unified --recursive --new-file '--exclude=*.o' '--exclude=x' libstdc.post/sys/signal.h libstdc/sys/signal.h
+--- libstdc.post/sys/signal.h  2017-01-19 18:06:10.750147931 +1100
++++ libstdc/sys/signal.h       2017-01-19 19:58:50.938363964 +1100
+@@ -9,7 +9,7 @@
+  *    @(#)signal.h    7.1 (Berkeley) 6/4/86
+  */
+-#ifndef       NSIG
++/*#ifndef     NSIG*/
+ #define NSIG  32
+ #define       SIGHUP  1       /* hangup */
+@@ -60,14 +60,25 @@
+ #define SIGUSR2 31    /* user defined signal 2 */
+ #ifndef KERNEL
+-int   (*signal())();
++/*void        (*signal())();*/
+ #endif
+ /*
+  * Signal vector "template" used in sigvec call.
+  */
++
++#ifndef __P
++#ifdef __STDC__
++#define __P(args) args
++#else
++#define __P(args) ()
++#endif
++#endif
++
++struct        sigcontext; /* forward reference for sv_handler below (in ANSI case) */
++
+ struct        sigvec {
+-      int     (*sv_handler)();        /* signal handler */
++      void    (*sv_handler) __P((int sig, int code, struct sigcontext *scp)); /* signal handler */
+       int     sv_mask;                /* signal mask to apply */
+       int     sv_flags;               /* see signal options below */
+ };
+@@ -100,15 +111,15 @@
+       int     sc_ps;                  /* psl to restore */
+ };
+-#define       BADSIG          (int (*)())-1
+-#define       SIG_DFL         (int (*)())0
+-#define       SIG_IGN         (int (*)())1
++#define       BADSIG          (void (*) __P((int sig)))-1
++#define       SIG_DFL         (void (*) __P((int sig)))0
++#define       SIG_IGN         (void (*) __P((int sig)))1
+ #ifdef KERNEL
+-#define       SIG_CATCH       (int (*)())2
+-#define       SIG_HOLD        (int (*)())3
+-#endif
++#define       SIG_CATCH       (void (*) __P((int sig)))2
++#define       SIG_HOLD        (void (*) __P((int sig)))3
+ #endif
++/*#endif*/
+ /*
+  * Macro for converting signal number to a mask suitable for
+@@ -117,14 +128,6 @@
+ #define sigmask(m)    (1 << ((m)-1))
+ #ifndef KERNEL
+-#ifndef __P
+-#ifdef __STDC__
+-#define __P(args) args
+-#else
+-#define __P(args) ()
+-#endif
+-#endif
+-
+ /* gen/psignal.c */
+ int psignal __P((unsigned sig, char *s));
+@@ -132,7 +135,7 @@
+ int siginterrupt __P((int sig, int flag));
+ /* gen/signal.c */
+-int (*signal __P((int s, int (*a)(void)))) __P((void));
++void (*signal __P((int s, void (*a)(int sig)))) __P((int sig));
+ /* sys/kill.c */
+ int kill __P((int p, int s));
similarity index 52%
rename from lib/libstdc/libstdc.patch
rename to lib/libstdc/pre.patch
index 9387a68..b74778d 100644 (file)
@@ -1,55 +1,6 @@
-diff --unified --recursive --new-file libstdc.orig/a.out.h libstdc/a.out.h
---- libstdc.orig/a.out.h       2017-01-19 15:17:46.190529992 +1100
-+++ libstdc/a.out.h    2017-01-19 15:17:46.198529987 +1100
-@@ -39,44 +39,4 @@
-               :4;             /* nothing, yet */
- };
--/*
-- * Format of a symbol table entry; this file is included by <a.out.h>
-- * and should be used if you aren't interested the a.out header
-- * or relocation information.
-- */
--struct        nlist {
--      union {
--              char    *n_name;        /* for use when in-core */
--              long    n_strx;         /* index into file string table */
--      } n_un;
--unsigned char n_type;         /* type flag, i.e. N_TEXT etc; see below */
--      char    n_other;        /* unused */
--      short   n_desc;         /* see <stab.h> */
--unsigned long n_value;        /* value of this symbol (or sdb offset) */
--};
--#define       n_hash  n_desc          /* used internally by ld */
--
--/*
-- * Simple values for n_type.
-- */
--#define       N_UNDF  0x0             /* undefined */
--#define       N_ABS   0x2             /* absolute */
--#define       N_TEXT  0x4             /* text */
--#define       N_DATA  0x6             /* data */
--#define       N_BSS   0x8             /* bss */
--#define       N_COMM  0x12            /* common (internal to ld) */
--#define       N_FN    0x1f            /* file name symbol */
--
--#define       N_EXT   01              /* external bit, or'ed in */
--#define       N_TYPE  0x1e            /* mask for all the type bits */
--
--/*
-- * Sdb entries have some of the N_STAB bits set.
-- * These are given in <stab.h>
-- */
--#define       N_STAB  0xe0            /* if any of these bits set, a SDB entry */
--
--/*
-- * Format for namelist values.
-- */
--#define       N_FORMAT        "%08x"
-+#include <nlist.h>
-diff --unified --recursive --new-file libstdc.orig/compat-4.1/ftime.c libstdc/compat-4.1/ftime.c
---- libstdc.orig/compat-4.1/ftime.c    2017-01-19 15:17:46.190529992 +1100
-+++ libstdc/compat-4.1/ftime.c 2017-01-19 15:19:31.050463867 +1100
+diff --unified --recursive --new-file libstdc.pre/compat-4.1/ftime.c libstdc/compat-4.1/ftime.c
+--- libstdc.pre/compat-4.1/ftime.c     2017-01-19 18:01:22.225941066 +1100
++++ libstdc/compat-4.1/ftime.c 2017-01-19 18:01:22.237941075 +1100
 @@ -10,18 +10,20 @@
  
  #include <sys/types.h>
@@ -77,9 +28,9 @@ diff --unified --recursive --new-file libstdc.orig/compat-4.1/ftime.c libstdc/co
  
  ftime(tp)
        register struct timeb *tp; {
-diff --unified --recursive --new-file libstdc.orig/compat-4.1/gtty.c libstdc/compat-4.1/gtty.c
---- libstdc.orig/compat-4.1/gtty.c     2017-01-19 15:17:46.190529992 +1100
-+++ libstdc/compat-4.1/gtty.c  2017-01-19 15:17:46.198529987 +1100
+diff --unified --recursive --new-file libstdc.pre/compat-4.1/gtty.c libstdc/compat-4.1/gtty.c
+--- libstdc.pre/compat-4.1/gtty.c      2017-01-19 18:01:22.225941066 +1100
++++ libstdc/compat-4.1/gtty.c  2017-01-19 18:01:22.237941075 +1100
 @@ -15,7 +15,7 @@
  #include <sgtty.h>
  
@@ -89,9 +40,9 @@ diff --unified --recursive --new-file libstdc.orig/compat-4.1/gtty.c libstdc/com
  
        return(ioctl(fd, TIOCGETP, ap));
  }
-diff --unified --recursive --new-file libstdc.orig/compat-4.1/stty.c libstdc/compat-4.1/stty.c
---- libstdc.orig/compat-4.1/stty.c     2017-01-19 15:17:46.190529992 +1100
-+++ libstdc/compat-4.1/stty.c  2017-01-19 15:17:46.198529987 +1100
+diff --unified --recursive --new-file libstdc.pre/compat-4.1/stty.c libstdc/compat-4.1/stty.c
+--- libstdc.pre/compat-4.1/stty.c      2017-01-19 18:01:22.225941066 +1100
++++ libstdc/compat-4.1/stty.c  2017-01-19 18:01:22.237941075 +1100
 @@ -15,7 +15,7 @@
  #include <sgtty.h>
  
@@ -101,9 +52,37 @@ diff --unified --recursive --new-file libstdc.orig/compat-4.1/stty.c libstdc/com
  
        return(ioctl(fd, TIOCSETP, ap));
  }
-diff --unified --recursive --new-file libstdc.orig/compat-4.1/vtimes.c libstdc/compat-4.1/vtimes.c
---- libstdc.orig/compat-4.1/vtimes.c   2017-01-19 15:17:46.190529992 +1100
-+++ libstdc/compat-4.1/vtimes.c        2017-01-19 15:17:46.198529987 +1100
+diff --unified --recursive --new-file libstdc.pre/compat-4.1/times.c libstdc/compat-4.1/times.c
+--- libstdc.pre/compat-4.1/times.c     2017-01-19 18:01:22.225941066 +1100
++++ libstdc/compat-4.1/times.c 2017-01-19 18:01:22.237941075 +1100
+@@ -10,16 +10,18 @@
+ #include <sys/time.h>
+ #include <sys/resource.h>
++#include <sys/times.h>
+ /*
+  * Backwards compatible times.
+  */
+-struct tms {
+-      int     tms_utime;              /* user time */
+-      int     tms_stime;              /* system time */
+-      int     tms_cutime;             /* user time, children */
+-      int     tms_cstime;             /* system time, children */
+-};
++/* we now get this from sys/times.h to avoid duplication */
++/*struct tms {*/
++/*    int     tms_utime;*/            /* user time */
++/*    int     tms_stime;*/            /* system time */
++/*    int     tms_cutime;*/           /* user time, children */
++/*    int     tms_cstime;*/           /* system time, children */
++/*};*/
+ times(tmsp)
+       register struct tms *tmsp; {
+diff --unified --recursive --new-file libstdc.pre/compat-4.1/vtimes.c libstdc/compat-4.1/vtimes.c
+--- libstdc.pre/compat-4.1/vtimes.c    2017-01-19 18:01:22.225941066 +1100
++++ libstdc/compat-4.1/vtimes.c        2017-01-19 18:01:22.237941075 +1100
 @@ -10,23 +10,25 @@
  
  #include <sys/time.h>
@@ -142,8 +121,119 @@ diff --unified --recursive --new-file libstdc.orig/compat-4.1/vtimes.c libstdc/c
  
  vtimes(par, chi)
        register struct vtimes *par, *chi; {
-diff --unified --recursive --new-file libstdc.orig/fcntl.h libstdc/fcntl.h
---- libstdc.orig/fcntl.h       2017-01-19 15:17:46.190529992 +1100
+diff --unified --recursive --new-file libstdc.pre/compat-sys5/memccpy.c libstdc/compat-sys5/memccpy.c
+--- libstdc.pre/compat-sys5/memccpy.c  2017-01-19 18:01:22.233941072 +1100
++++ libstdc/compat-sys5/memccpy.c      2017-01-19 18:01:22.237941075 +1100
+@@ -13,11 +13,15 @@
+ #endif
+ char *
+-memccpy(t, f, c, n)
+-      register char *t, *f;
++memccpy(_t, _f, c, n)
++      void *_t, *_f;
+       register c, n; {
++#define t (*(char **)&_t)
++#define f (*(char **)&_f)
+       while (--n >= 0)
+               if ((*t++ = *f++) == c)
+                       return (t);
+       return (0);
++#undef t
++#undef f
+ }
+diff --unified --recursive --new-file libstdc.pre/compat-sys5/memchr.c libstdc/compat-sys5/memchr.c
+--- libstdc.pre/compat-sys5/memchr.c   2017-01-19 18:01:22.233941072 +1100
++++ libstdc/compat-sys5/memchr.c       2017-01-19 18:01:22.237941075 +1100
+@@ -12,12 +12,14 @@
+ static char sccsid[] = "@(#)memchr.c  5.2 (Berkeley) 86/03/09";
+ #endif
+-char *
+-memchr(s, c, n)
+-      register char *s;
++void *
++memchr(_s, c, n)
++      void *_s;
+       register c, n; {
++#define s (*(char **)&_s)
+       while (--n >= 0)
+               if (*s++ == c)
+                       return (--s);
+       return (0);
++#undef s
+ }
+diff --unified --recursive --new-file libstdc.pre/compat-sys5/memcmp.c libstdc/compat-sys5/memcmp.c
+--- libstdc.pre/compat-sys5/memcmp.c   2017-01-19 18:01:22.233941072 +1100
++++ libstdc/compat-sys5/memcmp.c       2017-01-19 18:01:22.237941075 +1100
+@@ -12,11 +12,15 @@
+ static char sccsid[] = "@(#)memcmp.c  5.2 (Berkeley) 86/03/09";
+ #endif
+-memcmp(s1, s2, n)
+-      register char *s1, *s2;
++memcmp(_s1, _s2, n)
++      void *_s1, *_s2;
+       register n; {
++#define s1 (*(char **)&_s1)
++#define s2 (*(char **)&_s2)
+       while (--n >= 0)
+               if (*s1++ != *s2++)
+                       return (*--s1 - *--s2);
+       return (0);
++#undef s1
++#undef s2
+ }
+diff --unified --recursive --new-file libstdc.pre/compat-sys5/memcpy.c libstdc/compat-sys5/memcpy.c
+--- libstdc.pre/compat-sys5/memcpy.c   2017-01-19 18:01:22.233941072 +1100
++++ libstdc/compat-sys5/memcpy.c       2017-01-19 18:01:22.237941075 +1100
+@@ -12,14 +12,18 @@
+ static char sccsid[] = "@(#)memcpy.c  5.2 (Berkeley) 86/03/09";
+ #endif
+-char *
+-memcpy(t, f, n)
+-      register char *t, *f;
++void *
++memcpy(_t, _f, n)
++      void *_t, *_f;
+       register n; {
++#define t (*(char **)&_t)
++#define f (*(char **)&_f)
+       register char *p = t;
+       while (--n >= 0)
+               *t++ = *f++;
+       return (p);
++#undef t
++#undef f
+ }
+diff --unified --recursive --new-file libstdc.pre/compat-sys5/memset.c libstdc/compat-sys5/memset.c
+--- libstdc.pre/compat-sys5/memset.c   2017-01-19 18:01:22.233941072 +1100
++++ libstdc/compat-sys5/memset.c       2017-01-19 18:01:22.237941075 +1100
+@@ -12,14 +12,16 @@
+ static char sccsid[] = "@(#)memset.c  5.2 (Berkeley) 86/03/09";
+ #endif
+-char *
+-memset(s, c, n)
+-      register char *s;
++void *
++memset(_s, c, n)
++      void *_s;
+       register c, n; {
++#define s (*(char **)&_s)
+       register char *p = s;
+       while (--n >= 0)
+               *s++ = c;
+       return (p);
++#undef s
+ }
+diff --unified --recursive --new-file libstdc.pre/fcntl.h libstdc/fcntl.h
+--- libstdc.pre/fcntl.h        2017-01-19 18:01:22.225941066 +1100
 +++ libstdc/fcntl.h    1970-01-01 10:00:00.000000000 +1000
 @@ -1,40 +0,0 @@
 -/*
@@ -186,9 +276,121 @@ diff --unified --recursive --new-file libstdc.orig/fcntl.h libstdc/fcntl.h
 -#define       FTRUNC          02000           /* truncate to zero length */
 -#define       FEXCL           04000           /* error if already created */
 -#endif
-diff --unified --recursive --new-file libstdc.orig/gen/fakcu.c libstdc/gen/fakcu.c
---- libstdc.orig/gen/fakcu.c   2017-01-19 15:17:46.198529987 +1100
-+++ libstdc/gen/fakcu.c        2017-01-19 15:21:02.578410269 +1100
+diff --unified --recursive --new-file libstdc.pre/gen/bcmp.c libstdc/gen/bcmp.c
+--- libstdc.pre/gen/bcmp.c     2017-01-19 18:01:22.233941072 +1100
++++ libstdc/gen/bcmp.c 2017-01-19 18:01:22.237941075 +1100
+@@ -11,10 +11,11 @@
+ /*
+  * bcmp -- vax cmpc3 instruction
+  */
+-bcmp(b1, b2, length)
+-      register char *b1, *b2;
++bcmp(_b1, _b2, length)
++      void *_b1, *_b2;
+       register int length; {
+-
++#define b1 (*(char **)&_b1)
++#define b2 (*(char **)&_b2)
+       if (length == 0)
+               return (0);
+       do
+@@ -22,4 +23,6 @@
+                       break;
+       while (--length);
+       return(length);
++#undef b1
++#undef b2
+ }
+diff --unified --recursive --new-file libstdc.pre/gen/bcopy.c libstdc/gen/bcopy.c
+--- libstdc.pre/gen/bcopy.c    2017-01-19 18:01:22.233941072 +1100
++++ libstdc/gen/bcopy.c        2017-01-19 18:01:22.237941075 +1100
+@@ -11,9 +11,11 @@
+ /*
+  * bcopy -- vax movc3 instruction
+  */
+-bcopy(src, dst, length)
+-      register char *src, *dst;
++bcopy(_src, _dst, length)
++      void *_src, *_dst;
+       register int length; {
++#define src (*(char **)&_src)
++#define dst (*(char **)&_dst)
+       if (length && src != dst)
+               if ((u_int)dst < (u_int)src)
+                       if (((int)src | (int)dst | length) & 3)
+@@ -23,7 +25,7 @@
+                       else {
+                               length >>= 2;
+                               do      /* copy by longs */
+-                                      *((long *)dst)++ = *((long *)src)++;
++                                      *(*(long **)&dst)++ = *(*(long **)&src)++;
+                               while (--length);
+                       }
+               else {                  /* copy backwards */
+@@ -36,9 +38,11 @@
+                       else {
+                               length >>= 2;
+                               do      /* copy by shorts */
+-                                      *--((long *)dst) = *--((long *)src);
++                                      *--(*(long **)&dst) = *--(*(long **)&src);
+                               while (--length);
+                       }
+               }
+       return(0);
++#undef src
++#undef dst
+ }
+diff --unified --recursive --new-file libstdc.pre/gen/bzero.c libstdc/gen/bzero.c
+--- libstdc.pre/gen/bzero.c    2017-01-19 18:01:22.233941072 +1100
++++ libstdc/gen/bzero.c        2017-01-19 18:01:22.237941075 +1100
+@@ -11,13 +11,14 @@
+ /*
+  * bzero -- vax movc5 instruction
+  */
+-bzero(b, length)
+-      register char *b;
++bzero(_b, length)
++      void *_b;
+       register int length; {
+-
++#define b (*(char **)&_b)
+       if (length)
+               do
+                       *b++ = '\0';
+               while (--length);
+       return(length);
++#undef b
+ }
+diff --unified --recursive --new-file libstdc.pre/gen/calloc.c libstdc/gen/calloc.c
+--- libstdc.pre/gen/calloc.c   2017-01-19 18:01:22.233941072 +1100
++++ libstdc/gen/calloc.c       2017-01-19 18:01:22.237941075 +1100
+@@ -5,11 +5,11 @@
+ /*
+  * Calloc - allocate and clear memory block
+  */
+-char *
++void *
+ calloc(num, size)
+       register unsigned num, size; {
+-      extern char *malloc();
+-      register char *p;
++      extern void *malloc();
++      register void *p;
+       size *= num;
+       if (p = malloc(size))
+@@ -18,7 +18,7 @@
+ }
+ cfree(p, num, size)
+-      char *p;
++      void *p;
+       unsigned num;
+       unsigned size; {
+       free(p);
+diff --unified --recursive --new-file libstdc.pre/gen/fakcu.c libstdc/gen/fakcu.c
+--- libstdc.pre/gen/fakcu.c    2017-01-19 18:01:22.233941072 +1100
++++ libstdc/gen/fakcu.c        2017-01-19 18:01:22.237941075 +1100
 @@ -6,5 +6,6 @@
   * Null cleanup routine to resolve reference in exit() 
   * if not using stdio.
@@ -196,9 +398,30 @@ diff --unified --recursive --new-file libstdc.orig/gen/fakcu.c libstdc/gen/fakcu
 +void
  _cleanup() {
  }
-diff --unified --recursive --new-file libstdc.orig/gen/insque.c libstdc/gen/insque.c
---- libstdc.orig/gen/insque.c  2017-01-19 15:17:46.194529989 +1100
-+++ libstdc/gen/insque.c       2017-01-19 15:17:46.198529987 +1100
+diff --unified --recursive --new-file libstdc.pre/gen/getusershell.c libstdc/gen/getusershell.c
+--- libstdc.pre/gen/getusershell.c     2017-01-19 18:01:22.233941072 +1100
++++ libstdc/gen/getusershell.c 2017-01-19 18:01:22.237941075 +1100
+@@ -62,7 +62,7 @@
+       register char **sp, *cp;
+       register FILE *fp;
+       struct stat statb;
+-      extern char *malloc(), *calloc();
++      extern void *malloc(), *calloc();
+       if (shells != NULL)
+               free((char *)shells);
+@@ -76,7 +76,7 @@
+               (void)fclose(fp);
+               return(okshells);
+       }
+-      if ((strings = malloc((unsigned)statb.st_size)) == NULL) {
++      if ((strings = (char *)malloc((unsigned)statb.st_size)) == NULL) {
+               (void)fclose(fp);
+               return(okshells);
+       }
+diff --unified --recursive --new-file libstdc.pre/gen/insque.c libstdc/gen/insque.c
+--- libstdc.pre/gen/insque.c   2017-01-19 18:01:22.233941072 +1100
++++ libstdc/gen/insque.c       2017-01-19 18:01:22.237941075 +1100
 @@ -8,16 +8,19 @@
  static char sccsid[] = "@(#)insque.c  5.1 (Berkeley) 1/27/87";
  #endif
@@ -223,8 +446,8 @@ diff --unified --recursive --new-file libstdc.orig/gen/insque.c libstdc/gen/insq
  
  insque(e, prev)
        register struct vaxque *e, *prev; {
-diff --unified --recursive --new-file libstdc.orig/gen/isatty.c libstdc/gen/isatty.c
---- libstdc.orig/gen/isatty.c  2017-01-19 15:17:46.194529989 +1100
+diff --unified --recursive --new-file libstdc.pre/gen/isatty.c libstdc/gen/isatty.c
+--- libstdc.pre/gen/isatty.c   2017-01-19 18:01:22.233941072 +1100
 +++ libstdc/gen/isatty.c       1970-01-01 10:00:00.000000000 +1000
 @@ -1,17 +0,0 @@
 -#if defined(LIBC_SCCS) && !defined(lint)
@@ -244,9 +467,9 @@ diff --unified --recursive --new-file libstdc.orig/gen/isatty.c libstdc/gen/isat
 -              return(0);
 -      return(1);
 -}
-diff --unified --recursive --new-file libstdc.orig/gen/malloc.c libstdc/gen/malloc.c
---- libstdc.orig/gen/malloc.c  2017-01-19 15:17:46.198529987 +1100
-+++ libstdc/gen/malloc.c       2017-01-19 15:19:41.562457507 +1100
+diff --unified --recursive --new-file libstdc.pre/gen/malloc.c libstdc/gen/malloc.c
+--- libstdc.pre/gen/malloc.c   2017-01-19 18:01:22.233941072 +1100
++++ libstdc/gen/malloc.c       2017-01-19 18:01:22.237941075 +1100
 @@ -82,7 +82,7 @@
  #if defined(DEBUG) || defined(RCHECK)
  #define       ASSERT(p)   if (!(p)) botch("p")
@@ -256,6 +479,15 @@ diff --unified --recursive --new-file libstdc.orig/gen/malloc.c libstdc/gen/mall
  botch(s)
        char *s; {
        fprintf(stderr, "\r\nassertion botched: %s\r\n", s);
+@@ -93,7 +93,7 @@
+ #define       ASSERT(p)
+ #endif
+-char *
++void *
+ malloc(nbytes)
+       unsigned nbytes; {
+       register union overhead *op;
 @@ -177,6 +177,7 @@
  /*
   * Allocate more memory to the indicated bucket.
@@ -264,14 +496,29 @@ diff --unified --recursive --new-file libstdc.orig/gen/malloc.c libstdc/gen/mall
  morecore(bucket)
        int bucket; {
        register union overhead *op;
-@@ -217,6 +218,7 @@
+@@ -217,8 +218,9 @@
        }
  }
  
 +void
  free(cp)
-       char *cp; {
+-      char *cp; {
++      void *cp; {
        register int size;
+       register union overhead *op;
+@@ -257,9 +259,9 @@
+  */
+ int realloc_srchlen = 4;      /* 4 should be plenty, -1 =>'s whole list */
+-char *
++void *
+ realloc(cp, nbytes)
+-      char *cp; 
++      void *cp; 
+       unsigned nbytes; {
+       register u_int onb, i;
+       union overhead *op;
 @@ -352,6 +354,7 @@
   * for each size category, the second showing the number of mallocs -
   * frees for each size category.
@@ -280,8 +527,64 @@ diff --unified --recursive --new-file libstdc.orig/gen/malloc.c libstdc/gen/mall
  mstats(s)
        char *s; {
        register int i, j;
-diff --unified --recursive --new-file libstdc.orig/gen/popen.c libstdc/gen/popen.c
---- libstdc.orig/gen/popen.c   2017-01-19 15:17:46.198529987 +1100
+diff --unified --recursive --new-file libstdc.pre/gen/ndbm.c libstdc/gen/ndbm.c
+--- libstdc.pre/gen/ndbm.c     2017-01-19 18:01:22.233941072 +1100
++++ libstdc/gen/ndbm.c 2017-01-19 18:01:22.237941075 +1100
+@@ -14,6 +14,7 @@
+ #include <stdio.h>
+ #include <errno.h>
+ #include <ndbm.h>
++#include <varargs.h>
+ #define BYTESIZ 8
+ #undef setbit
+@@ -24,9 +25,11 @@
+ extern  int errno;
+ DBM *
+-dbm_open(file, flags, mode)
++dbm_open(file, flags, va_alist)
+       char *file;
+-      int flags, mode; {
++      int flags;
++      va_dcl {
++      va_list argp;
+       struct stat statb;
+       register DBM *db;
+@@ -39,12 +42,16 @@
+               flags = (flags & ~03) | O_RDWR;
+       strcpy(db->dbm_pagbuf, file);
+       strcat(db->dbm_pagbuf, ".pag");
+-      db->dbm_pagf = open(db->dbm_pagbuf, flags, mode);
++      va_start(argp);
++      db->dbm_pagf = vopen(db->dbm_pagbuf, flags, argp);
++      va_end(argp);
+       if (db->dbm_pagf < 0)
+               goto bad;
+       strcpy(db->dbm_pagbuf, file);
+       strcat(db->dbm_pagbuf, ".dir");
+-      db->dbm_dirf = open(db->dbm_pagbuf, flags, mode);
++      va_start(argp);
++      db->dbm_dirf = vopen(db->dbm_pagbuf, flags, argp);
++      va_end(argp);
+       if (db->dbm_dirf < 0)
+               goto bad1;
+       fstat(db->dbm_dirf, &statb);
+diff --unified --recursive --new-file libstdc.pre/gen/perror.c libstdc/gen/perror.c
+--- libstdc.pre/gen/perror.c   2017-01-19 18:01:22.233941072 +1100
++++ libstdc/gen/perror.c       2017-01-19 18:01:22.237941075 +1100
+@@ -17,7 +17,7 @@
+ int   errno;
+ int   sys_nerr;
+-char  *sys_errlist[];
++extern char   *sys_errlist[];
+ perror(s)
+       char *s; {
+       struct iovec iov[4];
+diff --unified --recursive --new-file libstdc.pre/gen/popen.c libstdc/gen/popen.c
+--- libstdc.pre/gen/popen.c    2017-01-19 18:01:22.233941072 +1100
 +++ libstdc/gen/popen.c        1970-01-01 10:00:00.000000000 +1000
 @@ -1,77 +0,0 @@
 -/*
@@ -361,9 +664,9 @@ diff --unified --recursive --new-file libstdc.orig/gen/popen.c libstdc/gen/popen
 -      (void) sigsetmask(omask);
 -      return (pid == -1 ? -1 : status);
 -}
-diff --unified --recursive --new-file libstdc.orig/gen/qsort.c libstdc/gen/qsort.c
---- libstdc.orig/gen/qsort.c   2017-01-19 15:17:46.198529987 +1100
-+++ libstdc/gen/qsort.c        2017-01-19 15:17:46.198529987 +1100
+diff --unified --recursive --new-file libstdc.pre/gen/qsort.c libstdc/gen/qsort.c
+--- libstdc.pre/gen/qsort.c    2017-01-19 18:01:22.233941072 +1100
++++ libstdc/gen/qsort.c        2017-01-19 18:01:22.237941075 +1100
 @@ -32,6 +32,7 @@
   * It's not...
   */
@@ -381,9 +684,9 @@ diff --unified --recursive --new-file libstdc.orig/gen/qsort.c libstdc/gen/qsort
  qst(base, max)
        char *base, *max; {
        register char c, *i, *j, *jj;
-diff --unified --recursive --new-file libstdc.orig/gen/random.c libstdc/gen/random.c
---- libstdc.orig/gen/random.c  2017-01-19 15:17:46.198529987 +1100
-+++ libstdc/gen/random.c       2017-01-19 15:17:46.198529987 +1100
+diff --unified --recursive --new-file libstdc.pre/gen/random.c libstdc/gen/random.c
+--- libstdc.pre/gen/random.c   2017-01-19 18:01:22.233941072 +1100
++++ libstdc/gen/random.c       2017-01-19 18:01:22.237941075 +1100
 @@ -222,7 +222,7 @@
        if(  n  <  BREAK_1  )  {
            if(  n  <  BREAK_0  )  {
@@ -393,9 +696,9 @@ diff --unified --recursive --new-file libstdc.orig/gen/random.c libstdc/gen/rand
            }
            rand_type = TYPE_0;
            rand_deg = DEG_0;
-diff --unified --recursive --new-file libstdc.orig/gen/regex.c libstdc/gen/regex.c
---- libstdc.orig/gen/regex.c   2017-01-19 15:17:46.198529987 +1100
-+++ libstdc/gen/regex.c        2017-01-19 15:17:46.198529987 +1100
+diff --unified --recursive --new-file libstdc.pre/gen/regex.c libstdc/gen/regex.c
+--- libstdc.pre/gen/regex.c    2017-01-19 18:01:22.233941072 +1100
++++ libstdc/gen/regex.c        2017-01-19 18:01:22.237941075 +1100
 @@ -8,8 +8,6 @@
  static char sccsid[] = "@(#)regex.c   5.2 (Berkeley) 3/9/86";
  #endif
@@ -405,9 +708,9 @@ diff --unified --recursive --new-file libstdc.orig/gen/regex.c libstdc/gen/regex
  /*
   * routines to do regular expression matching
   *
-diff --unified --recursive --new-file libstdc.orig/gen/remque.c libstdc/gen/remque.c
---- libstdc.orig/gen/remque.c  2017-01-19 15:17:46.198529987 +1100
-+++ libstdc/gen/remque.c       2017-01-19 15:17:46.202529984 +1100
+diff --unified --recursive --new-file libstdc.pre/gen/remque.c libstdc/gen/remque.c
+--- libstdc.pre/gen/remque.c   2017-01-19 18:01:22.233941072 +1100
++++ libstdc/gen/remque.c       2017-01-19 18:01:22.237941075 +1100
 @@ -8,16 +8,19 @@
  static char sccsid[] = "@(#)remque.c  5.1 (Berkeley) 1/27/87";
  #endif
@@ -432,18 +735,23 @@ diff --unified --recursive --new-file libstdc.orig/gen/remque.c libstdc/gen/remq
  
  remque(e)
        register struct vaxque *e; {
-diff --unified --recursive --new-file libstdc.orig/gen/sleep.c libstdc/gen/sleep.c
---- libstdc.orig/gen/sleep.c   2017-01-19 15:17:46.198529987 +1100
-+++ libstdc/gen/sleep.c        2017-01-19 15:17:46.202529984 +1100
-@@ -16,6 +16,7 @@
+diff --unified --recursive --new-file libstdc.pre/gen/sleep.c libstdc/gen/sleep.c
+--- libstdc.pre/gen/sleep.c    2017-01-19 18:01:22.233941072 +1100
++++ libstdc/gen/sleep.c        2017-01-19 18:01:22.237941075 +1100
+@@ -16,9 +16,11 @@
  
  static int ringring;
  
 +void
  sleep(n)
        unsigned n; {
-       int sleepx(), omask;
-@@ -57,8 +58,7 @@
+-      int sleepx(), omask;
++      void sleepx();
++      int omask;
+       struct itimerval itv, oitv;
+       register struct itimerval *itp = &itv;
+       struct sigvec vec, ovec;
+@@ -57,8 +59,7 @@
        (void) setitimer(ITIMER_REAL, &oitv, (struct itimerval *)0);
  }
  
@@ -453,9 +761,9 @@ diff --unified --recursive --new-file libstdc.orig/gen/sleep.c libstdc/gen/sleep
 -
        ringring = 1;
  }
-diff --unified --recursive --new-file libstdc.orig/gen/syslog.c libstdc/gen/syslog.c
---- libstdc.orig/gen/syslog.c  2017-01-19 15:17:46.198529987 +1100
-+++ libstdc/gen/syslog.c       2017-01-19 15:17:46.202529984 +1100
+diff --unified --recursive --new-file libstdc.pre/gen/syslog.c libstdc/gen/syslog.c
+--- libstdc.pre/gen/syslog.c   2017-01-19 18:01:22.233941072 +1100
++++ libstdc/gen/syslog.c       2017-01-19 18:01:22.237941075 +1100
 @@ -54,6 +54,7 @@
  extern        int errno, sys_nerr;
  extern        char *sys_errlist[];
@@ -482,18 +790,23 @@ diff --unified --recursive --new-file libstdc.orig/gen/syslog.c libstdc/gen/sysl
        (void) close(LogFile);
        LogFile = -1;
  }
-diff --unified --recursive --new-file libstdc.orig/gen/usleep.c libstdc/gen/usleep.c
---- libstdc.orig/gen/usleep.c  2017-01-19 15:17:46.194529989 +1100
-+++ libstdc/gen/usleep.c       2017-01-19 15:17:46.202529984 +1100
-@@ -19,6 +19,7 @@
+diff --unified --recursive --new-file libstdc.pre/gen/usleep.c libstdc/gen/usleep.c
+--- libstdc.pre/gen/usleep.c   2017-01-19 18:01:22.233941072 +1100
++++ libstdc/gen/usleep.c       2017-01-19 18:01:22.241941078 +1100
+@@ -19,9 +19,11 @@
  
  static int ringring;
  
 +void
  usleep(n)
        unsigned n; {
-       int sleepx(), omask;
-@@ -60,8 +61,7 @@
+-      int sleepx(), omask;
++      void sleepx();
++      int omask;
+       struct itimerval itv, oitv;
+       register struct itimerval *itp = &itv;
+       struct sigvec vec, ovec;
+@@ -60,8 +62,7 @@
        (void) setitimer(ITIMER_REAL, &oitv, (struct itimerval *)0);
  }
  
@@ -503,18 +816,164 @@ diff --unified --recursive --new-file libstdc.orig/gen/usleep.c libstdc/gen/usle
 -
        ringring = 1;
  }
-diff --unified --recursive --new-file libstdc.orig/gen.h libstdc/gen.h
---- libstdc.orig/gen.h 1970-01-01 10:00:00.000000000 +1000
-+++ libstdc/gen.h      2017-01-19 15:17:46.202529984 +1100
+diff --unified --recursive --new-file libstdc.pre/gen.h libstdc/gen.h
+--- libstdc.pre/gen.h  1970-01-01 10:00:00.000000000 +1000
++++ libstdc/gen.h      2017-01-19 18:01:22.241941078 +1100
 @@ -0,0 +1,5 @@
 +/* formerly duplicated in gen/insque.c and gen/remque.c */
 +struct vaxque {               /* queue format expected by VAX queue instructions */
 +      struct vaxque   *vq_next;
 +      struct vaxque   *vq_prev;
 +};
-diff --unified --recursive --new-file libstdc.orig/net/ruserpass.c libstdc/net/ruserpass.c
---- libstdc.orig/net/ruserpass.c       2017-01-19 15:17:46.190529992 +1100
-+++ libstdc/net/ruserpass.c    2017-01-19 15:17:46.202529984 +1100
+diff --unified --recursive --new-file libstdc.pre/net/named/gethostnamadr.c libstdc/net/named/gethostnamadr.c
+--- libstdc.pre/net/named/gethostnamadr.c      2017-01-19 18:01:22.225941066 +1100
++++ libstdc/net/named/gethostnamadr.c  2017-01-19 18:01:22.241941078 +1100
+@@ -197,6 +197,7 @@
+                       }
+               }
++/* XXX should be: bp = (bp + sizeof(align) - 1) & ~sizeof(align) ??? */
+               bp += ((u_long)bp % sizeof(align));
+               if (bp + n >= &hostbuf[sizeof(hostbuf)]) {
+diff --unified --recursive --new-file libstdc.pre/net/rcmd.c libstdc/net/rcmd.c
+--- libstdc.pre/net/rcmd.c     2017-01-19 18:01:22.225941066 +1100
++++ libstdc/net/rcmd.c 2017-01-19 18:01:22.241941078 +1100
+@@ -58,7 +58,7 @@
+               sin.sin_family = hp->h_addrtype;
+               bcopy(hp->h_addr_list[0], (caddr_t)&sin.sin_addr, hp->h_length);
+               sin.sin_port = rport;
+-              if (connect(s, (caddr_t)&sin, sizeof (sin), 0) >= 0)
++              if (connect(s, (struct sockaddr *)&sin, sizeof (sin)/*, 0*/) >= 0)
+                       break;
+               (void) close(s);
+               if (errno == EADDRINUSE) {
+@@ -106,7 +106,7 @@
+                       (void) close(s2);
+                       goto bad;
+               }
+-              s3 = accept(s2, &from, &len, 0);
++              s3 = accept(s2, (struct sockaddr *)&from, &len/*, 0*/);
+               (void) close(s2);
+               if (s3 < 0) {
+                       perror("accept");
+@@ -160,7 +160,7 @@
+               return (-1);
+       for (;;) {
+               sin.sin_port = htons((u_short)*alport);
+-              if (bind(s, (caddr_t)&sin, sizeof (sin)) >= 0)
++              if (bind(s, (struct sockaddr *)&sin, sizeof (sin)) >= 0)
+                       return (s);
+               if (errno != EADDRINUSE) {
+                       (void) close(s);
+diff --unified --recursive --new-file libstdc.pre/net/res_debug.c libstdc/net/res_debug.c
+--- libstdc.pre/net/res_debug.c        2017-01-19 18:01:22.225941066 +1100
++++ libstdc/net/res_debug.c    2017-01-19 18:01:22.241941078 +1100
+@@ -324,7 +324,9 @@
+ }
+ static        char nbuf[20];
+-extern        char *sprintf();
++/* we have taken the portable sprintf() from 4.3tahoe */
++/*extern      char *sprintf();*/
++extern        int sprintf();
+ /*
+  * Return a string for the type
+@@ -380,7 +382,10 @@
+       case T_GID:
+               return("GID");
+       default:
+-              return (sprintf(nbuf, "%d", type));
++/* we have taken the portable sprintf() from 4.3tahoe */
++              /*return (sprintf(nbuf, "%d", type));*/
++              sprintf(nbuf, "%d", type);
++              return nbuf;
+       }
+ }
+@@ -397,6 +402,9 @@
+       case C_ANY:             /* matches any class */
+               return("ANY");
+       default:
+-              return (sprintf(nbuf, "%d", class));
++/* we have taken the portable sprintf() from 4.3tahoe */
++              /*return (sprintf(nbuf, "%d", class));*/
++              sprintf(nbuf, "%d", class);
++              return nbuf;
+       }
+ }
+diff --unified --recursive --new-file libstdc.pre/net/res_mkquery.c libstdc/net/res_mkquery.c
+--- libstdc.pre/net/res_mkquery.c      2017-01-19 18:01:22.225941066 +1100
++++ libstdc/net/res_mkquery.c  2017-01-19 18:01:22.241941078 +1100
+@@ -14,7 +14,10 @@
+ #include <arpa/nameser.h>
+ #include <resolv.h>
+-extern        char *sprintf();
++/* we have taken the portable sprintf() from 4.3tahoe */
++/*extern      char *sprintf();*/
++extern        int sprintf();
++
+ /*
+  * Form all types of queries.
+@@ -70,7 +73,9 @@
+                       if (res_init() == -1)
+                               return(-1);
+               if (_res.defdname[0] != '\0')
+-                      dname = sprintf(dnbuf, "%s.%s", dname, _res.defdname);
++/* we have taken the portable sprintf() from 4.3tahoe */
++                      /*dname = sprintf(dnbuf, "%s.%s", dname, _res.defdname);*/
++                      sprintf(dname = dnbuf, "%s.%s", dname, _res.defdname);
+       }
+       /*
+        * perform opcode specific processing
+diff --unified --recursive --new-file libstdc.pre/net/res_send.c libstdc/net/res_send.c
+--- libstdc.pre/net/res_send.c 2017-01-19 18:01:22.225941066 +1100
++++ libstdc/net/res_send.c     2017-01-19 18:01:22.241941078 +1100
+@@ -82,7 +82,7 @@
+ #endif
+                                       continue;
+                               }
+-                              if (connect(s, &(_res.nsaddr_list[ns]),
++                              if (connect(s, (struct sockaddr *)&(_res.nsaddr_list[ns]),
+                                  sizeof(struct sockaddr)) < 0) {
+                                       terrno = errno;
+ #ifdef DEBUG
+@@ -156,7 +156,7 @@
+                       if (s < 0)
+                               s = socket(AF_INET, SOCK_DGRAM, 0);
+ #if   BSD >= 43
+-                      if (connect(s, &_res.nsaddr_list[ns],
++                      if (connect(s, (struct sockaddr *)&_res.nsaddr_list[ns],
+                           sizeof(struct sockaddr)) < 0 ||
+                           send(s, buf, buflen, 0) != buflen) {
+ #ifdef DEBUG
+diff --unified --recursive --new-file libstdc.pre/net/rexec.c libstdc/net/rexec.c
+--- libstdc.pre/net/rexec.c    2017-01-19 18:01:22.225941066 +1100
++++ libstdc/net/rexec.c        2017-01-19 18:01:22.241941078 +1100
+@@ -49,7 +49,7 @@
+       sin.sin_family = hp->h_addrtype;
+       sin.sin_port = rport;
+       bcopy(hp->h_addr, (caddr_t)&sin.sin_addr, hp->h_length);
+-      if (connect(s, &sin, sizeof(sin)) < 0) {
++      if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
+               if (errno == ECONNREFUSED && timo <= 16) {
+                       (void) close(s);
+                       sleep(timo);
+@@ -83,7 +83,7 @@
+               (void) sprintf(num, "%d", port);
+               (void) write(s, num, strlen(num)+1);
+               { int len = sizeof (from);
+-                s3 = accept(s2, &from, &len, 0);
++                s3 = accept(s2, (struct sockaddr *)&from, &len/*, 0*/);
+                 close(s2);
+                 if (s3 < 0) {
+                       perror("accept");
+diff --unified --recursive --new-file libstdc.pre/net/ruserpass.c libstdc/net/ruserpass.c
+--- libstdc.pre/net/ruserpass.c        2017-01-19 18:01:22.225941066 +1100
++++ libstdc/net/ruserpass.c    2017-01-19 18:01:22.241941078 +1100
 @@ -19,6 +19,7 @@
  struct        utmp *getutmp();
  static        FILE *cfile;
@@ -594,9 +1053,9 @@ diff --unified --recursive --new-file libstdc.orig/net/ruserpass.c libstdc/net/r
  mkpwclear(sencpasswd,mch,spasswd)
        char mch, *spasswd, *sencpasswd; {
        register char *skey;
-diff --unified --recursive --new-file libstdc.orig/net.h libstdc/net.h
---- libstdc.orig/net.h 1970-01-01 10:00:00.000000000 +1000
-+++ libstdc/net.h      2017-01-19 15:17:46.202529984 +1100
+diff --unified --recursive --new-file libstdc.pre/net.h libstdc/net.h
+--- libstdc.pre/net.h  1970-01-01 10:00:00.000000000 +1000
++++ libstdc/net.h      2017-01-19 18:01:22.241941078 +1100
 @@ -0,0 +1,16 @@
 +/* formerly duplicated in netinet/in.h and netns/ns.h */
 +/* confuses cproto which thinks #define names are types or type modifiers */
@@ -614,9 +1073,9 @@ diff --unified --recursive --new-file libstdc.orig/net.h libstdc/net.h
 +u_short       ntohs(), htons();
 +u_long        ntohl(), htonl();
 +/*#endif*/
-diff --unified --recursive --new-file libstdc.orig/netinet/in.h libstdc/netinet/in.h
---- libstdc.orig/netinet/in.h  2017-01-19 15:17:46.194529989 +1100
-+++ libstdc/netinet/in.h       2017-01-19 15:17:46.202529984 +1100
+diff --unified --recursive --new-file libstdc.pre/netinet/in.h libstdc/netinet/in.h
+--- libstdc.pre/netinet/in.h   2017-01-19 18:01:22.233941072 +1100
++++ libstdc/netinet/in.h       2017-01-19 18:01:22.241941078 +1100
 @@ -90,20 +90,21 @@
   */
  #define       IP_OPTIONS      1               /* set/get IP per-packet options */
@@ -649,9 +1108,9 @@ diff --unified --recursive --new-file libstdc.orig/netinet/in.h libstdc/netinet/
  
  #ifdef KERNEL
  extern        struct domain inetdomain;
-diff --unified --recursive --new-file libstdc.orig/netinet/ip.h libstdc/netinet/ip.h
---- libstdc.orig/netinet/ip.h  2017-01-19 15:17:46.194529989 +1100
-+++ libstdc/netinet/ip.h       2017-01-19 15:17:46.202529984 +1100
+diff --unified --recursive --new-file libstdc.pre/netinet/ip.h libstdc/netinet/ip.h
+--- libstdc.pre/netinet/ip.h   2017-01-19 18:01:22.233941072 +1100
++++ libstdc/netinet/ip.h       2017-01-19 18:01:22.241941078 +1100
 @@ -81,7 +81,7 @@
                        struct in_addr ipt_addr;
                        n_long ipt_time;
@@ -661,9 +1120,9 @@ diff --unified --recursive --new-file libstdc.orig/netinet/ip.h libstdc/netinet/
  };
  
  /* flag bits for ipt_flg */
-diff --unified --recursive --new-file libstdc.orig/netinet/tcp.h libstdc/netinet/tcp.h
---- libstdc.orig/netinet/tcp.h 2017-01-19 15:17:46.194529989 +1100
-+++ libstdc/netinet/tcp.h      2017-01-19 15:17:46.202529984 +1100
+diff --unified --recursive --new-file libstdc.pre/netinet/tcp.h libstdc/netinet/tcp.h
+--- libstdc.pre/netinet/tcp.h  2017-01-19 18:01:22.233941072 +1100
++++ libstdc/netinet/tcp.h      2017-01-19 18:01:22.241941078 +1100
 @@ -44,7 +44,9 @@
  #ifdef        lint
  #define       TCP_MSS 536
@@ -675,9 +1134,9 @@ diff --unified --recursive --new-file libstdc.orig/netinet/tcp.h libstdc/netinet
  #endif
  
  /*
-diff --unified --recursive --new-file libstdc.orig/netns/ns.h libstdc/netns/ns.h
---- libstdc.orig/netns/ns.h    2017-01-19 15:17:46.194529989 +1100
-+++ libstdc/netns/ns.h 2017-01-19 15:17:46.202529984 +1100
+diff --unified --recursive --new-file libstdc.pre/netns/ns.h libstdc/netns/ns.h
+--- libstdc.pre/netns/ns.h     2017-01-19 18:01:22.233941072 +1100
++++ libstdc/netns/ns.h 2017-01-19 18:01:22.241941078 +1100
 @@ -103,20 +103,21 @@
  #define ns_nullhost(x) (((x).x_host.s_host[0]==0) && \
        ((x).x_host.s_host[1]==0) && ((x).x_host.s_host[2]==0))
@@ -710,9 +1169,68 @@ diff --unified --recursive --new-file libstdc.orig/netns/ns.h libstdc/netns/ns.h
  
  #ifdef KERNEL
  extern struct domain nsdomain;
-diff --unified --recursive --new-file libstdc.orig/ns/ns_addr.c libstdc/ns/ns_addr.c
---- libstdc.orig/ns/ns_addr.c  2017-01-19 15:17:46.190529992 +1100
-+++ libstdc/ns/ns_addr.c       2017-01-19 15:17:46.202529984 +1100
+diff --unified --recursive --new-file libstdc.pre/nlist.h libstdc/nlist.h
+--- libstdc.pre/nlist.h        2017-01-19 18:01:22.225941066 +1100
++++ libstdc/nlist.h    1970-01-01 10:00:00.000000000 +1000
+@@ -1,46 +0,0 @@
+-/*
+- * Copyright (c) 1980 Regents of the University of California.
+- * All rights reserved.  The Berkeley software License Agreement
+- * specifies the terms and conditions for redistribution.
+- *
+- *    @(#)nlist.h     5.1 (Berkeley) 5/30/85
+- */
+-
+-/*
+- * Format of a symbol table entry; this file is included by <a.out.h>
+- * and should be used if you aren't interested the a.out header
+- * or relocation information.
+- */
+-struct        nlist {
+-      char    *n_name;        /* for use when in-core */
+-      unsigned char n_type;   /* type flag, i.e. N_TEXT etc; see below */
+-      char    n_other;        /* unused */
+-      short   n_desc;         /* see <stab.h> */
+-      unsigned long n_value;  /* value of this symbol (or sdb offset) */
+-};
+-#define       n_hash  n_desc          /* used internally by ld */
+-
+-/*
+- * Simple values for n_type.
+- */
+-#define       N_UNDF  0x0             /* undefined */
+-#define       N_ABS   0x2             /* absolute */
+-#define       N_TEXT  0x4             /* text */
+-#define       N_DATA  0x6             /* data */
+-#define       N_BSS   0x8             /* bss */
+-#define       N_COMM  0x12            /* common (internal to ld) */
+-#define       N_FN    0x1f            /* file name symbol */
+-
+-#define       N_EXT   01              /* external bit, or'ed in */
+-#define       N_TYPE  0x1e            /* mask for all the type bits */
+-
+-/*
+- * Sdb entries have some of the N_STAB bits set.
+- * These are given in <stab.h>
+- */
+-#define       N_STAB  0xe0            /* if any of these bits set, a SDB entry */
+-
+-/*
+- * Format for namelist values.
+- */
+-#define       N_FORMAT        "%08x"
+diff --unified --recursive --new-file libstdc.pre/ns/ns_addr.c libstdc/ns/ns_addr.c
+--- libstdc.pre/ns/ns_addr.c   2017-01-19 18:01:22.225941066 +1100
++++ libstdc/ns/ns_addr.c       2017-01-19 18:01:22.241941078 +1100
+@@ -54,7 +54,7 @@
+       socketname = index(hostname, separator);
+       if (socketname) {
+               *socketname++ = 0;
+-              Field(socketname, &addr.x_port, 2);
++              Field(socketname, (char *)&addr.x_port, 2);
+       }
+       Field(hostname, addr.x_host.c_host, 6);
 @@ -62,7 +62,7 @@
        return (addr);
  }
@@ -722,9 +1240,25 @@ diff --unified --recursive --new-file libstdc.orig/ns/ns_addr.c libstdc/ns/ns_ad
  Field(buf, out, len)
  char *buf;
  u_char *out;
-diff --unified --recursive --new-file libstdc.orig/stdio/doscan.c libstdc/stdio/doscan.c
---- libstdc.orig/stdio/doscan.c        2017-01-19 15:17:46.190529992 +1100
-+++ libstdc/stdio/doscan.c     2017-01-19 15:17:46.202529984 +1100
+diff --unified --recursive --new-file libstdc.pre/stdio/doprnt.c libstdc/stdio/doprnt.c
+--- libstdc.pre/stdio/doprnt.c 2017-01-19 18:01:22.225941066 +1100
++++ libstdc/stdio/doprnt.c     2017-01-19 18:01:22.241941078 +1100
+@@ -271,9 +271,10 @@
+                                * NUL in the first `prec' characters, and
+                                * strlen() will go further.
+                                */
+-                              char *p, *memchr();
++                              char *p;
++                              void *memchr();
+-                              if (p = memchr(t, 0, prec)) {
++                              if (p = (char *)memchr(t, 0, prec)) {
+                                       size = p - t;
+                                       if (size > prec)
+                                               size = prec;
+diff --unified --recursive --new-file libstdc.pre/stdio/doscan.c libstdc/stdio/doscan.c
+--- libstdc.pre/stdio/doscan.c 2017-01-19 18:01:22.225941066 +1100
++++ libstdc/stdio/doscan.c     2017-01-19 18:01:22.241941078 +1100
 @@ -3,7 +3,8 @@
  #endif
  
@@ -804,10 +1338,24 @@ diff --unified --recursive --new-file libstdc.orig/stdio/doscan.c libstdc/stdio/
                break;
        }
        return(1);
-diff --unified --recursive --new-file libstdc.orig/stdio/findiop.c libstdc/stdio/findiop.c
---- libstdc.orig/stdio/findiop.c       2017-01-19 15:17:46.190529992 +1100
-+++ libstdc/stdio/findiop.c    2017-01-19 15:17:46.202529984 +1100
-@@ -89,6 +89,7 @@
+diff --unified --recursive --new-file libstdc.pre/stdio/findiop.c libstdc/stdio/findiop.c
+--- libstdc.pre/stdio/findiop.c        2017-01-19 18:01:22.225941066 +1100
++++ libstdc/stdio/findiop.c    2017-01-19 18:01:22.241941078 +1100
+@@ -23,7 +23,7 @@
+       { 0, NULL, NULL, 0, _IOWRT|_IONBF,      2 },    /* stderr */
+ };
+-extern        char    *calloc();
++extern        void    *calloc();
+ static        char sbuf[NSTATIC];
+ char  *_smallbuf = sbuf;
+@@ -85,10 +85,11 @@
+       for (fp = _iob, iov = iobglue; fp < &_iob[NSTATIC]; /* void */)
+               *iov++ = fp++;
+-      _smallbuf = calloc(nfiles, sizeof(*_smallbuf));
++      _smallbuf = (char *)calloc(nfiles, sizeof(*_smallbuf));
        return (1);
  }
  
@@ -831,9 +1379,9 @@ diff --unified --recursive --new-file libstdc.orig/stdio/findiop.c libstdc/stdio
  _cleanup() {
        extern int fclose();
  
-diff --unified --recursive --new-file libstdc.orig/stdio/fprintf.c libstdc/stdio/fprintf.c
---- libstdc.orig/stdio/fprintf.c       2017-01-19 15:17:46.190529992 +1100
-+++ libstdc/stdio/fprintf.c    2017-01-19 15:17:46.202529984 +1100
+diff --unified --recursive --new-file libstdc.pre/stdio/fprintf.c libstdc/stdio/fprintf.c
+--- libstdc.pre/stdio/fprintf.c        2017-01-19 18:01:22.225941066 +1100
++++ libstdc/stdio/fprintf.c    2017-01-19 18:01:22.241941078 +1100
 @@ -1,31 +1,48 @@
  /*
   * Copyright (c) 1980 Regents of the University of California.
@@ -893,9 +1441,55 @@ diff --unified --recursive --new-file libstdc.orig/stdio/fprintf.c libstdc/stdio
 +      va_end(argp);
 +      return(ferror(iop) ? EOF : len);
  }
-diff --unified --recursive --new-file libstdc.orig/stdio/popen.c libstdc/stdio/popen.c
---- libstdc.orig/stdio/popen.c 1970-01-01 10:00:00.000000000 +1000
-+++ libstdc/stdio/popen.c      2017-01-19 15:17:46.202529984 +1100
+diff --unified --recursive --new-file libstdc.pre/stdio/fread.c libstdc/stdio/fread.c
+--- libstdc.pre/stdio/fread.c  2017-01-19 18:01:22.225941066 +1100
++++ libstdc/stdio/fread.c      2017-01-19 18:01:22.241941078 +1100
+@@ -10,10 +10,11 @@
+ #include      <stdio.h>
+-fread(ptr, size, count, iop)
+-      register char *ptr;
++fread(_ptr, size, count, iop)
++      void *_ptr;
+       unsigned size, count;
+       register FILE *iop; {
++#define ptr (*(char **)&_ptr)
+       register int s;
+       int c;
+@@ -42,4 +43,5 @@
+               }
+       }
+       return (size != 0 ? count - ((s + size - 1) / size) : 0);
++#undef ptr
+ }
+diff --unified --recursive --new-file libstdc.pre/stdio/fwrite.c libstdc/stdio/fwrite.c
+--- libstdc.pre/stdio/fwrite.c 2017-01-19 18:01:22.225941066 +1100
++++ libstdc/stdio/fwrite.c     2017-01-19 18:01:22.241941078 +1100
+@@ -10,10 +10,11 @@
+ #include      <stdio.h>
+-fwrite(ptr, size, count, iop)
+-      register char *ptr;
++fwrite(_ptr, size, count, iop)
++      void *_ptr;
+       unsigned size, count;
+       register FILE *iop; {
++#define ptr (*(char **)&_ptr)
+       register int s;
+       s = size * count;
+@@ -45,4 +46,5 @@
+               }
+       }
+       return (size != 0 ? count - ((s + size - 1) / size) : 0);
++#undef ptr
+ }
+diff --unified --recursive --new-file libstdc.pre/stdio/popen.c libstdc/stdio/popen.c
+--- libstdc.pre/stdio/popen.c  1970-01-01 10:00:00.000000000 +1000
++++ libstdc/stdio/popen.c      2017-01-19 18:01:22.241941078 +1100
 @@ -0,0 +1,77 @@
 +/*
 + * Copyright (c) 1980 Regents of the University of California.
@@ -974,9 +1568,9 @@ diff --unified --recursive --new-file libstdc.orig/stdio/popen.c libstdc/stdio/p
 +      (void) sigsetmask(omask);
 +      return (pid == -1 ? -1 : status);
 +}
-diff --unified --recursive --new-file libstdc.orig/stdio/printf.c libstdc/stdio/printf.c
---- libstdc.orig/stdio/printf.c        2017-01-19 15:17:46.190529992 +1100
-+++ libstdc/stdio/printf.c     2017-01-19 15:17:46.202529984 +1100
+diff --unified --recursive --new-file libstdc.pre/stdio/printf.c libstdc/stdio/printf.c
+--- libstdc.pre/stdio/printf.c 2017-01-19 18:01:22.225941066 +1100
++++ libstdc/stdio/printf.c     2017-01-19 18:01:22.241941078 +1100
 @@ -1,11 +1,35 @@
 +/*
 + * Copyright (c) 1987 Regents of the University of California.
@@ -1019,9 +1613,9 @@ diff --unified --recursive --new-file libstdc.orig/stdio/printf.c libstdc/stdio/
 +      va_end(argp);
 +      return(ferror(stdout) ? EOF : len);
  }
-diff --unified --recursive --new-file libstdc.orig/stdio/scanf.c libstdc/stdio/scanf.c
---- libstdc.orig/stdio/scanf.c 2017-01-19 15:17:46.190529992 +1100
-+++ libstdc/stdio/scanf.c      2017-01-19 15:17:46.202529984 +1100
+diff --unified --recursive --new-file libstdc.pre/stdio/scanf.c libstdc/stdio/scanf.c
+--- libstdc.pre/stdio/scanf.c  2017-01-19 18:01:22.225941066 +1100
++++ libstdc/stdio/scanf.c      2017-01-19 18:01:22.241941078 +1100
 @@ -2,29 +2,50 @@
  static char sccsid[] = "@(#)scanf.c   5.2 (Berkeley) 3/9/86";
  #endif
@@ -1083,9 +1677,26 @@ diff --unified --recursive --new-file libstdc.orig/stdio/scanf.c libstdc/stdio/s
 +      va_end(argp);
 +      return len;
  }
-diff --unified --recursive --new-file libstdc.orig/stdio/sprintf.c libstdc/stdio/sprintf.c
---- libstdc.orig/stdio/sprintf.c       2017-01-19 15:17:46.190529992 +1100
-+++ libstdc/stdio/sprintf.c    2017-01-19 15:17:46.202529984 +1100
+diff --unified --recursive --new-file libstdc.pre/stdio/setbuffer.c libstdc/stdio/setbuffer.c
+--- libstdc.pre/stdio/setbuffer.c      2017-01-19 18:01:22.225941066 +1100
++++ libstdc/stdio/setbuffer.c  2017-01-19 18:01:22.241941078 +1100
+@@ -33,11 +33,11 @@
+ setlinebuf(iop)
+       register FILE *iop; {
+       char *buf;
+-      extern char *malloc();
++      extern void *malloc();
+       fflush(iop);
+       setbuffer(iop, NULL, 0);
+-      buf = malloc(BUFSIZ);
++      buf = (char *)malloc(BUFSIZ);
+       if (buf != NULL) {
+               setbuffer(iop, buf, BUFSIZ);
+               iop->_flag |= _IOLBF|_IOMYBUF;
+diff --unified --recursive --new-file libstdc.pre/stdio/sprintf.c libstdc/stdio/sprintf.c
+--- libstdc.pre/stdio/sprintf.c        2017-01-19 18:01:22.225941066 +1100
++++ libstdc/stdio/sprintf.c    2017-01-19 18:01:22.241941078 +1100
 @@ -1,17 +1,40 @@
 +/*
 + * Copyright (c) 1987 Regents of the University of California.
@@ -1134,9 +1745,9 @@ diff --unified --recursive --new-file libstdc.orig/stdio/sprintf.c libstdc/stdio
 +      va_end(argp);
 +      return(len);
  }
-diff --unified --recursive --new-file libstdc.orig/stdio/vfprintf.c libstdc/stdio/vfprintf.c
---- libstdc.orig/stdio/vfprintf.c      1970-01-01 10:00:00.000000000 +1000
-+++ libstdc/stdio/vfprintf.c   2017-01-19 15:17:46.202529984 +1100
+diff --unified --recursive --new-file libstdc.pre/stdio/vfprintf.c libstdc/stdio/vfprintf.c
+--- libstdc.pre/stdio/vfprintf.c       1970-01-01 10:00:00.000000000 +1000
++++ libstdc/stdio/vfprintf.c   2017-01-19 18:01:22.241941078 +1100
 @@ -0,0 +1,46 @@
 +/*
 + * Copyright (c) 1988 Regents of the University of California.
@@ -1184,9 +1795,9 @@ diff --unified --recursive --new-file libstdc.orig/stdio/vfprintf.c libstdc/stdi
 +
 +      return (ferror(iop) ? EOF : len);
 +}
-diff --unified --recursive --new-file libstdc.orig/stdio/vprintf.c libstdc/stdio/vprintf.c
---- libstdc.orig/stdio/vprintf.c       1970-01-01 10:00:00.000000000 +1000
-+++ libstdc/stdio/vprintf.c    2017-01-19 15:17:46.202529984 +1100
+diff --unified --recursive --new-file libstdc.pre/stdio/vprintf.c libstdc/stdio/vprintf.c
+--- libstdc.pre/stdio/vprintf.c        1970-01-01 10:00:00.000000000 +1000
++++ libstdc/stdio/vprintf.c    2017-01-19 18:01:22.241941078 +1100
 @@ -0,0 +1,33 @@
 +/*
 + * Copyright (c) 1988 Regents of the University of California.
@@ -1221,9 +1832,9 @@ diff --unified --recursive --new-file libstdc.orig/stdio/vprintf.c libstdc/stdio
 +      len = _doprnt(fmt, argp, stdout);
 +      return (ferror(stdout) ? EOF : len);
 +}
-diff --unified --recursive --new-file libstdc.orig/stdio/vsprintf.c libstdc/stdio/vsprintf.c
---- libstdc.orig/stdio/vsprintf.c      1970-01-01 10:00:00.000000000 +1000
-+++ libstdc/stdio/vsprintf.c   2017-01-19 15:17:46.202529984 +1100
+diff --unified --recursive --new-file libstdc.pre/stdio/vsprintf.c libstdc/stdio/vsprintf.c
+--- libstdc.pre/stdio/vsprintf.c       1970-01-01 10:00:00.000000000 +1000
++++ libstdc/stdio/vsprintf.c   2017-01-19 18:01:22.241941078 +1100
 @@ -0,0 +1,38 @@
 +/*
 + * Copyright (c) 1988 Regents of the University of California.
@@ -1263,9 +1874,9 @@ diff --unified --recursive --new-file libstdc.orig/stdio/vsprintf.c libstdc/stdi
 +      *f._ptr = 0;
 +      return (len);
 +}
-diff --unified --recursive --new-file libstdc.orig/stdio.h libstdc/stdio.h
---- libstdc.orig/stdio.h       2017-01-19 15:17:46.190529992 +1100
-+++ libstdc/stdio.h    2017-01-19 15:17:46.202529984 +1100
+diff --unified --recursive --new-file libstdc.pre/stdio.h libstdc/stdio.h
+--- libstdc.pre/stdio.h        2017-01-19 18:01:22.229941069 +1100
++++ libstdc/stdio.h    2017-01-19 18:01:22.241941078 +1100
 @@ -59,7 +59,7 @@
  long  ftell();
  char  *fgets();
@@ -1275,9 +1886,9 @@ diff --unified --recursive --new-file libstdc.orig/stdio.h libstdc/stdio.h
  char  *sprintf();             /* too painful to do right */
  #endif
  # endif
-diff --unified --recursive --new-file libstdc.orig/sys/dir.h libstdc/sys/dir.h
---- libstdc.orig/sys/dir.h     2017-01-19 15:17:46.194529989 +1100
-+++ libstdc/sys/dir.h  2017-01-19 15:17:46.202529984 +1100
+diff --unified --recursive --new-file libstdc.pre/sys/dir.h libstdc/sys/dir.h
+--- libstdc.pre/sys/dir.h      2017-01-19 18:01:22.233941072 +1100
++++ libstdc/sys/dir.h  2017-01-19 18:01:22.241941078 +1100
 @@ -32,9 +32,9 @@
   * dp->d_ino set to 0.
   */
@@ -1291,9 +1902,35 @@ diff --unified --recursive --new-file libstdc.orig/sys/dir.h libstdc/sys/dir.h
  #define DIRBLKSIZ     DEV_BSIZE
  #define       MAXNAMLEN       255
  
-diff --unified --recursive --new-file libstdc.orig/sys/isatty.c libstdc/sys/isatty.c
---- libstdc.orig/sys/isatty.c  1970-01-01 10:00:00.000000000 +1000
-+++ libstdc/sys/isatty.c       2017-01-19 15:17:46.202529984 +1100
+diff --unified --recursive --new-file libstdc.pre/sys/execl.c libstdc/sys/execl.c
+--- libstdc.pre/sys/execl.c    2017-01-19 18:01:22.233941072 +1100
++++ libstdc/sys/execl.c        2017-01-19 18:01:22.241941078 +1100
+@@ -1,3 +1,4 @@
+-void execl(f, a) char *f, *a; {
++#include <varargs.h>
++void execl(f, va_alist) char *f; va_dcl {
+   abort();
+ }
+diff --unified --recursive --new-file libstdc.pre/sys/execle.c libstdc/sys/execle.c
+--- libstdc.pre/sys/execle.c   2017-01-19 18:01:22.229941069 +1100
++++ libstdc/sys/execle.c       2017-01-19 18:01:22.241941078 +1100
+@@ -1,3 +1,4 @@
+-void execle(f, a) char *f, *a; {
++#include <varargs.h>
++void execle(f, va_alist) char *f; va_dcl {
+   abort();
+ }
+diff --unified --recursive --new-file libstdc.pre/sys/ioctl.c libstdc/sys/ioctl.c
+--- libstdc.pre/sys/ioctl.c    2017-01-19 18:01:22.229941069 +1100
++++ libstdc/sys/ioctl.c        2017-01-19 18:01:22.241941078 +1100
+@@ -1,3 +1,3 @@
+-int ioctl(d, r, p) u_long r; char *p; {
++int ioctl(d, r, p) u_long r; void *p; {
+   abort();
+ }
+diff --unified --recursive --new-file libstdc.pre/sys/isatty.c libstdc/sys/isatty.c
+--- libstdc.pre/sys/isatty.c   1970-01-01 10:00:00.000000000 +1000
++++ libstdc/sys/isatty.c       2017-01-19 18:01:22.241941078 +1100
 @@ -0,0 +1,17 @@
 +#if defined(LIBC_SCCS) && !defined(lint)
 +static char sccsid[] = "@(#)isatty.c  5.2 (Berkeley) 3/9/86";
@@ -1312,9 +1949,18 @@ diff --unified --recursive --new-file libstdc.orig/sys/isatty.c libstdc/sys/isat
 +              return(0);
 +      return(1);
 +}
-diff --unified --recursive --new-file libstdc.orig/sys/param.h libstdc/sys/param.h
---- libstdc.orig/sys/param.h   2017-01-19 15:17:46.190529992 +1100
-+++ libstdc/sys/param.h        2017-01-19 15:17:46.202529984 +1100
+diff --unified --recursive --new-file libstdc.pre/sys/open.c libstdc/sys/open.c
+--- libstdc.pre/sys/open.c     2017-01-19 18:01:22.229941069 +1100
++++ libstdc/sys/open.c 2017-01-19 18:01:22.241941078 +1100
+@@ -1,3 +1,4 @@
+-int open(f, m, stuff) char *f; {
++#include <varargs.h>
++int open(f, m, va_alist) char *f; va_dcl {
+   abort();
+ }
+diff --unified --recursive --new-file libstdc.pre/sys/param.h libstdc/sys/param.h
+--- libstdc.pre/sys/param.h    2017-01-19 18:01:22.229941069 +1100
++++ libstdc/sys/param.h        2017-01-19 18:01:22.241941078 +1100
 @@ -53,15 +53,16 @@
  /*
   * Signals
@@ -1360,9 +2006,9 @@ diff --unified --recursive --new-file libstdc.orig/sys/param.h libstdc/sys/param
 +
 +/* moved this from sys/types.h */
 +#define       NBBY    8               /* number of bits in a byte */
-diff --unified --recursive --new-file libstdc.orig/sys/proc.h libstdc/sys/proc.h
---- libstdc.orig/sys/proc.h    2017-01-19 15:17:46.194529989 +1100
-+++ libstdc/sys/proc.h 2017-01-19 15:17:46.202529984 +1100
+diff --unified --recursive --new-file libstdc.pre/sys/proc.h libstdc/sys/proc.h
+--- libstdc.pre/sys/proc.h     2017-01-19 18:01:22.229941069 +1100
++++ libstdc/sys/proc.h 2017-01-19 18:01:22.245941081 +1100
 @@ -117,3 +117,8 @@
  #define       SSEL    0x0400000       /* selecting; wakeup/waiting danger */
  #define       SLOGIN  0x0800000       /* a login process (legit child of init) */
@@ -1372,9 +2018,33 @@ diff --unified --recursive --new-file libstdc.orig/sys/proc.h libstdc/sys/proc.h
 +#define       ISSIG(p) \
 +      ((p)->p_sig && ((p)->p_flag&STRC || \
 +       ((p)->p_sig &~ ((p)->p_sigignore | (p)->p_sigmask))) && issig())
-diff --unified --recursive --new-file libstdc.orig/sys/select.h libstdc/sys/select.h
---- libstdc.orig/sys/select.h  1970-01-01 10:00:00.000000000 +1000
-+++ libstdc/sys/select.h       2017-01-19 15:17:46.202529984 +1100
+diff --unified --recursive --new-file libstdc.pre/sys/read.c libstdc/sys/read.c
+--- libstdc.pre/sys/read.c     2017-01-19 18:01:22.229941069 +1100
++++ libstdc/sys/read.c 2017-01-19 18:01:22.245941081 +1100
+@@ -1,3 +1,3 @@
+-int read(f, b, l) char *b; {
++int read(f, b, l) void *b; {
+   abort();
+ }
+diff --unified --recursive --new-file libstdc.pre/sys/recv.c libstdc/sys/recv.c
+--- libstdc.pre/sys/recv.c     2017-01-19 18:01:22.229941069 +1100
++++ libstdc/sys/recv.c 2017-01-19 18:01:22.245941081 +1100
+@@ -1,3 +1,3 @@
+-int recv(s, b, l, f) char *b; {
++int recv(s, b, l, f) void *b; {
+   abort();
+ }
+diff --unified --recursive --new-file libstdc.pre/sys/recvfrom.c libstdc/sys/recvfrom.c
+--- libstdc.pre/sys/recvfrom.c 2017-01-19 18:01:22.229941069 +1100
++++ libstdc/sys/recvfrom.c     2017-01-19 18:01:22.245941081 +1100
+@@ -1,3 +1,3 @@
+-int recvfrom(s, b, l, f, fr, fl) char *b; struct sockaddr *fr; int *fl; {
++int recvfrom(s, b, l, f, fr, fl) void *b; struct sockaddr *fr; int *fl; {
+   abort();
+ }
+diff --unified --recursive --new-file libstdc.pre/sys/select.h libstdc/sys/select.h
+--- libstdc.pre/sys/select.h   1970-01-01 10:00:00.000000000 +1000
++++ libstdc/sys/select.h       2017-01-19 18:01:22.245941081 +1100
 @@ -0,0 +1,28 @@
 +#include <sys/param.h>
 +
@@ -1404,9 +2074,25 @@ diff --unified --recursive --new-file libstdc.orig/sys/select.h libstdc/sys/sele
 +#define       FD_CLR(n, p)    ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
 +#define       FD_ISSET(n, p)  ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
 +#define FD_ZERO(p)    bzero((char *)(p), sizeof(*(p)))
-diff --unified --recursive --new-file libstdc.orig/sys/tty.h libstdc/sys/tty.h
---- libstdc.orig/sys/tty.h     2017-01-19 15:17:46.190529992 +1100
-+++ libstdc/sys/tty.h  2017-01-19 15:17:46.202529984 +1100
+diff --unified --recursive --new-file libstdc.pre/sys/send.c libstdc/sys/send.c
+--- libstdc.pre/sys/send.c     2017-01-19 18:01:22.229941069 +1100
++++ libstdc/sys/send.c 2017-01-19 18:01:22.245941081 +1100
+@@ -1,3 +1,3 @@
+-int send(s, m, l, f) char *m; {
++int send(s, m, l, f) void *m; {
+   abort();
+ }
+diff --unified --recursive --new-file libstdc.pre/sys/sendto.c libstdc/sys/sendto.c
+--- libstdc.pre/sys/sendto.c   2017-01-19 18:01:22.229941069 +1100
++++ libstdc/sys/sendto.c       2017-01-19 18:01:22.245941081 +1100
+@@ -1,3 +1,3 @@
+-int sendto(s, m, l, f, t, tl) char *m; struct sockaddr *t; {
++int sendto(s, m, l, f, t, tl) void *m; struct sockaddr *t; {
+   abort();
+ }
+diff --unified --recursive --new-file libstdc.pre/sys/tty.h libstdc/sys/tty.h
+--- libstdc.pre/sys/tty.h      2017-01-19 18:01:22.229941069 +1100
++++ libstdc/sys/tty.h  2017-01-19 18:01:22.245941081 +1100
 @@ -70,20 +70,22 @@
        struct  ttychars t_chars;       /* tty */
        struct  winsize t_winsize;      /* window size */
@@ -1444,9 +2130,9 @@ diff --unified --recursive --new-file libstdc.orig/sys/tty.h libstdc/sys/tty.h
  };
  
  #define       TTIPRI  28
-diff --unified --recursive --new-file libstdc.orig/sys/types.h libstdc/sys/types.h
---- libstdc.orig/sys/types.h   2017-01-19 15:17:46.194529989 +1100
-+++ libstdc/sys/types.h        2017-01-19 15:17:46.202529984 +1100
+diff --unified --recursive --new-file libstdc.pre/sys/types.h libstdc/sys/types.h
+--- libstdc.pre/sys/types.h    2017-01-19 18:01:22.229941069 +1100
++++ libstdc/sys/types.h        2017-01-19 18:01:22.245941081 +1100
 @@ -45,30 +45,32 @@
  typedef       u_short uid_t;
  typedef       u_short gid_t;
@@ -1496,9 +2182,16 @@ diff --unified --recursive --new-file libstdc.orig/sys/types.h libstdc/sys/types
 +/*#define FD_ZERO(p)  bzero((char *)(p), sizeof(*(p)))*/
  
  #endif
-diff --unified --recursive --new-file libstdc.orig/sys/vmmac.h libstdc/sys/vmmac.h
---- libstdc.orig/sys/vmmac.h   2017-01-19 15:17:46.194529989 +1100
-+++ libstdc/sys/vmmac.h        2017-01-19 15:17:46.202529984 +1100
+diff --unified --recursive --new-file libstdc.pre/sys/vfork.c libstdc/sys/vfork.c
+--- libstdc.pre/sys/vfork.c    1970-01-01 10:00:00.000000000 +1000
++++ libstdc/sys/vfork.c        2017-01-19 18:01:22.245941081 +1100
+@@ -0,0 +1,3 @@
++int vfork() {
++  abort();
++}
+diff --unified --recursive --new-file libstdc.pre/sys/vmmac.h libstdc/sys/vmmac.h
+--- libstdc.pre/sys/vmmac.h    2017-01-19 18:01:22.229941069 +1100
++++ libstdc/sys/vmmac.h        2017-01-19 18:01:22.245941081 +1100
 @@ -157,3 +157,10 @@
        } \
        c->c_lock = 0; \
@@ -1510,9 +2203,33 @@ diff --unified --recursive --new-file libstdc.orig/sys/vmmac.h libstdc/sys/vmmac
 +/* moved this from sys/vmmac.h to avoid a circular dependency */
 +#define       mapin(pte, v, pfnum, count, prot) \
 +      (*(int *)(pte) = (pfnum) | (prot), mtpr(TBIS, ptob(v)))
-diff --unified --recursive --new-file libstdc.orig/vax/vmparam.h libstdc/vax/vmparam.h
---- libstdc.orig/vax/vmparam.h 2017-01-19 15:17:46.194529989 +1100
-+++ libstdc/vax/vmparam.h      2017-01-19 15:17:46.202529984 +1100
+diff --unified --recursive --new-file libstdc.pre/sys/vopen.c libstdc/sys/vopen.c
+--- libstdc.pre/sys/vopen.c    1970-01-01 10:00:00.000000000 +1000
++++ libstdc/sys/vopen.c        2017-01-19 18:01:22.245941081 +1100
+@@ -0,0 +1,4 @@
++#include <varargs.h>
++int vopen(f, m, argp) char *f; va_list argp; {
++  abort();
++}
+diff --unified --recursive --new-file libstdc.pre/sys/wait.c libstdc/sys/wait.c
+--- libstdc.pre/sys/wait.c     2017-01-19 18:01:22.229941069 +1100
++++ libstdc/sys/wait.c 2017-01-19 18:01:22.245941081 +1100
+@@ -1,3 +1,3 @@
+-int wait(s) union wait *s; {
++int wait(s) int *s; {
+   abort();
+ }
+diff --unified --recursive --new-file libstdc.pre/sys/write.c libstdc/sys/write.c
+--- libstdc.pre/sys/write.c    2017-01-19 18:01:22.229941069 +1100
++++ libstdc/sys/write.c        2017-01-19 18:01:22.245941081 +1100
+@@ -1,3 +1,3 @@
+-int write(f, b, l) char *b; {
++int write(f, b, l) void *b; {
+   abort();
+ }
+diff --unified --recursive --new-file libstdc.pre/vax/vmparam.h libstdc/vax/vmparam.h
+--- libstdc.pre/vax/vmparam.h  2017-01-19 18:01:22.233941072 +1100
++++ libstdc/vax/vmparam.h      2017-01-19 18:01:22.245941081 +1100
 @@ -156,5 +156,6 @@
  /*
   * BEWARE THIS DEFINITION WORKS ONLY WITH COUNT OF 1
index f4d9b2a..9ac8cc0 100755 (executable)
@@ -171,3 +171,7 @@ do
   ) |../../xify/newline >b
   mv b $i
 done
+
+rm -rf ../libstdc.post
+cp -r ../libstdc ../libstdc.post
+patch --strip 1 <post.patch
index 44de0e2..14b6852 100755 (executable)
@@ -13,6 +13,7 @@ cp ../../xify/stdarg.h ../../xify/x_.h ../../x_include
   ln -s machine/x_frame.h x_frame.h
   ln -s sys/x_errno.h x_errno.h
   ln -s sys/x_file.h x_fcntl.h
+  ln -s x_a.out.h x_nlist.h
   ln -s sys/x_signal.h x_signal.h
   ln -s sys/x_syslog.h x_syslog.h
 )
index 3d0b6f2..76125b9 100644 (file)
@@ -130,7 +130,7 @@ int fputc __P((int c, register FILE *fp));
 int fputs __P((register char *s, register FILE *iop));
 
 /* stdio/fread.c */
-int fread __P((register char *ptr, unsigned size, unsigned count, register FILE *iop));
+int fread __P((void *_ptr, unsigned size, unsigned count, register FILE *iop));
 
 /* stdio/freopen.c */
 FILE *freopen __P((char *file, register char *mode, register FILE *iop));
@@ -142,7 +142,7 @@ int fseek __P((register FILE *iop, long offset, int ptrname));
 long ftell __P((register FILE *iop));
 
 /* stdio/fwrite.c */
-int fwrite __P((register char *ptr, unsigned size, unsigned count, register FILE *iop));
+int fwrite __P((void *_ptr, unsigned size, unsigned count, register FILE *iop));
 
 /* stdio/getchar.c */
 int getchar __P((void));
index 8bab107..308addc 100644 (file)
@@ -287,9 +287,10 @@ rflag:             switch (*++fmt) {
                                 * NUL in the first `prec' characters, and
                                 * strlen() will go further.
                                 */
-                               char *p, *memchr();
+                               char *p;
+                               void *memchr();
 
-                               if (p = memchr(t, 0, prec)) {
+                               if (p = (char *)memchr(t, 0, prec)) {
                                        size = p - t;
                                        if (size > prec)
                                                size = prec;
index 7fdcfba..fbd0770 100644 (file)
@@ -28,7 +28,7 @@ FILE _iob[NSTATIC] = {
        { 0, NULL, NULL, 0, _IOWRT|_IONBF,      2 },    /* stderr */
 };
 
-/*extern       char    *calloc();*/
+/*extern       void    *calloc();*/
 
 static char sbuf[NSTATIC];
 char   *_smallbuf = sbuf;
@@ -89,7 +89,7 @@ int _f_morefiles() {
        for (fp = _iob, iov = iobglue; fp < &_iob[NSTATIC]; /* void */)
                *iov++ = fp++;
 
-       _smallbuf = calloc(nfiles, sizeof(*_smallbuf));
+       _smallbuf = (char *)calloc(nfiles, sizeof(*_smallbuf));
        return (1);
 }
 
index 32034dc..b213ca3 100644 (file)
@@ -13,7 +13,8 @@ static char sccsid[] = "@(#)fread.c   5.2 (Berkeley) 3/9/86";
 
 /*#include     <stdio.h>*/
 
-int fread(ptr, size, count, iop) register char *ptr; unsigned size; unsigned count; register FILE *iop; {
+int fread(_ptr, size, count, iop) void *_ptr; unsigned size; unsigned count; register FILE *iop; {
+#define ptr (*(char **)&_ptr)
        register int s;
        int c;
 
@@ -42,4 +43,5 @@ int fread(ptr, size, count, iop) register char *ptr; unsigned size; unsigned cou
                }
        }
        return (size != 0 ? count - ((s + size - 1) / size) : 0);
+#undef ptr
 }
index 4afd737..df14869 100644 (file)
@@ -13,7 +13,8 @@ static char sccsid[] = "@(#)fwrite.c  5.2 (Berkeley) 3/9/86";
 
 /*#include     <stdio.h>*/
 
-int fwrite(ptr, size, count, iop) register char *ptr; unsigned size; unsigned count; register FILE *iop; {
+int fwrite(_ptr, size, count, iop) void *_ptr; unsigned size; unsigned count; register FILE *iop; {
+#define ptr (*(char **)&_ptr)
        register int s;
 
        s = size * count;
@@ -45,4 +46,5 @@ int fwrite(ptr, size, count, iop) register char *ptr; unsigned size; unsigned co
                }
        }
        return (size != 0 ? count - ((s + size - 1) / size) : 0);
+#undef ptr
 }
index 4cb3cd0..b9b1bb6 100644 (file)
@@ -32,11 +32,11 @@ int setbuffer(iop, buf, size) register FILE *iop; char *buf; int size; {
  */
 int setlinebuf(iop) register FILE *iop; {
        char *buf;
-       extern char *malloc();
+       extern void *malloc();
 
        fflush(iop);
        setbuffer(iop, NULL, 0);
-       buf = malloc(BUFSIZ);
+       buf = (char *)malloc(BUFSIZ);
        if (buf != NULL) {
                setbuffer(iop, buf, BUFSIZ);
                iop->_flag |= _IOLBF|_IOMYBUF;
index 59eb4b2..613e9ff 100644 (file)
@@ -44,10 +44,10 @@ int execvp __P((char *name, char **argv));
 int system __P((char *s));
 
 /* sys/execl.c */
-void execl __P((char *f, char *a));
+void execl __P((char *f, ...));
 
 /* sys/execle.c */
-void execle __P((char *f, char *a));
+void execle __P((char *f, ...));
 
 /* sys/exect.c */
 void exect __P((char *s, char *v[], char *e[]));
index 702d82c..3d1950f 100644 (file)
@@ -1,6 +1,19 @@
 #include <gen.h>
 #include <sys/exec.h>
+#ifdef __STDC__
+#include <stdarg.h>
+#define _va_start(argp, arg) va_start(argp, arg)
+#else
+#include <varargs.h>
+#define _va_start(argp, arg) va_start(argp)
+#endif
 
-void execl(f, a) char *f; char *a; {
+/*#include <varargs.h>*/
+#ifdef __STDC__
+void execl(char *f, ...)
+#else
+void execl(f, va_alist) char *f; va_dcl
+#endif
+{
   abort();
 }
index e4aec0c..74d2d86 100644 (file)
@@ -1,6 +1,19 @@
 #include <gen.h>
 #include <sys/exec.h>
+#ifdef __STDC__
+#include <stdarg.h>
+#define _va_start(argp, arg) va_start(argp, arg)
+#else
+#include <varargs.h>
+#define _va_start(argp, arg) va_start(argp)
+#endif
 
-void execle(f, a) char *f; char *a; {
+/*#include <varargs.h>*/
+#ifdef __STDC__
+void execle(char *f, ...)
+#else
+void execle(f, va_alist) char *f; va_dcl
+#endif
+{
   abort();
 }
index 3bd5fdb..1e56f30 100644 (file)
@@ -4,6 +4,9 @@
 #include <sys/errno.h>
 #include <sys/param.h>
 #include <sys/types.h>
+#ifdef __STDC__
+#include <stdarg.h>
+#endif
 
 /*
  * Copyright (c) 1982, 1986 Regents of the University of California.
@@ -188,13 +191,13 @@ off_t lseek __P((int f, off_t o, int d));
 int mknod __P((char *n, int m, int a));
 
 /* sys/open.c */
-int open __P((char *f, int m, int stuff));
+int open __P((char *f, int m, ...));
 
 /* sys/pipe.c */
 int pipe __P((int f[2]));
 
 /* sys/read.c */
-int read __P((int f, char *b, int l));
+int read __P((int f, void *b, int l));
 
 /* sys/readlink.c */
 int readlink __P((char *p, char *b, int s));
@@ -217,8 +220,11 @@ int umask __P((int n));
 /* sys/unlink.c */
 int unlink __P((char *s));
 
+/* sys/vopen.c */
+int vopen __P((char *f, int m, va_list argp));
+
 /* sys/write.c */
-int write __P((int f, char *b, int l));
+int write __P((int f, void *b, int l));
 #endif
 
 #endif
index 2122da9..3e37f00 100644 (file)
@@ -3,6 +3,6 @@
 #include <sys/types.h>
 
 /*#include <sys/types.h>*/
-int ioctl(d, r, p) int d; u_long r; char *p; {
+int ioctl(d, r, p) int d; u_long r; void *p; {
   abort();
 }
index 23fb9ef..9cc88db 100644 (file)
@@ -295,7 +295,7 @@ int gtty __P((int fd, struct sgttyb *ap));
 int stty __P((int fd, struct sgttyb *ap));
 
 /* sys/ioctl.c */
-int ioctl __P((int d, u_long r, char *p));
+int ioctl __P((int d, u_long r, void *p));
 
 /* sys/isatty.c */
 int isatty __P((int f));
index 77c608c..02d0a4e 100644 (file)
@@ -1,6 +1,19 @@
 #include <gen.h>
 #include <sys/file.h>
+#ifdef __STDC__
+#include <stdarg.h>
+#define _va_start(argp, arg) va_start(argp, arg)
+#else
+#include <varargs.h>
+#define _va_start(argp, arg) va_start(argp)
+#endif
 
-int open(f, m, stuff) char *f; int m; int stuff; {
+/*#include <varargs.h>*/
+#ifdef __STDC__
+int open(char *f, int m, ...)
+#else
+int open(f, m, va_alist) char *f; int m; va_dcl
+#endif
+{
   abort();
 }
index aa2c121..6770d21 100644 (file)
@@ -1,6 +1,6 @@
 #include <gen.h>
 #include <sys/file.h>
 
-int read(f, b, l) int f; char *b; int l; {
+int read(f, b, l) int f; void *b; int l; {
   abort();
 }
index 4d175fb..1433877 100644 (file)
@@ -1,6 +1,6 @@
 #include <gen.h>
 #include <sys/socket.h>
 
-int recv(s, b, l, f) int s; char *b; int l; int f; {
+int recv(s, b, l, f) int s; void *b; int l; int f; {
   abort();
 }
index e76144c..8b315c6 100644 (file)
@@ -2,6 +2,6 @@
 #include <sys/socket.h>
 
 /*#include <sys/socket.h>*/
-int recvfrom(s, b, l, f, fr, fl) int s; char *b; int l; int f; struct sockaddr *fr; int *fl; {
+int recvfrom(s, b, l, f, fr, fl) int s; void *b; int l; int f; struct sockaddr *fr; int *fl; {
   abort();
 }
index 55d552f..7540dc4 100644 (file)
@@ -1,6 +1,6 @@
 #include <gen.h>
 #include <sys/socket.h>
 
-int send(s, m, l, f) int s; char *m; int l; int f; {
+int send(s, m, l, f) int s; void *m; int l; int f; {
   abort();
 }
index c126719..a4bbd49 100644 (file)
@@ -2,6 +2,6 @@
 #include <sys/socket.h>
 
 /*#include <sys/socket.h>*/
-int sendto(s, m, l, f, t, tl) int s; char *m; int l; int f; struct sockaddr *t; int tl; {
+int sendto(s, m, l, f, t, tl) int s; void *m; int l; int f; struct sockaddr *t; int tl; {
   abort();
 }
index d5bbedf..469941b 100644 (file)
@@ -9,7 +9,7 @@
  *     @(#)signal.h    7.1 (Berkeley) 6/4/86
  */
 
-#ifndef        NSIG
+/*#ifndef      NSIG*/
 #define NSIG   32
 
 #define        SIGHUP  1       /* hangup */
 #define SIGUSR2 31     /* user defined signal 2 */
 
 #ifndef KERNEL
-int    (*signal())();
+/*void (*signal())();*/
 #endif
 
 /*
  * Signal vector "template" used in sigvec call.
  */
+
+#ifndef __P
+#ifdef __STDC__
+#define __P(args) args
+#else
+#define __P(args) ()
+#endif
+#endif
+
+struct sigcontext; /* forward reference for sv_handler below (in ANSI case) */
+
 struct sigvec {
-       int     (*sv_handler)();        /* signal handler */
+       void    (*sv_handler) __P((int sig, int code, struct sigcontext *scp)); /* signal handler */
        int     sv_mask;                /* signal mask to apply */
        int     sv_flags;               /* see signal options below */
 };
@@ -100,15 +111,15 @@ struct    sigcontext {
        int     sc_ps;                  /* psl to restore */
 };
 
-#define        BADSIG          (int (*)())-1
-#define        SIG_DFL         (int (*)())0
-#define        SIG_IGN         (int (*)())1
+#define        BADSIG          (void (*) __P((int sig)))-1
+#define        SIG_DFL         (void (*) __P((int sig)))0
+#define        SIG_IGN         (void (*) __P((int sig)))1
 
 #ifdef KERNEL
-#define        SIG_CATCH       (int (*)())2
-#define        SIG_HOLD        (int (*)())3
-#endif
+#define        SIG_CATCH       (void (*) __P((int sig)))2
+#define        SIG_HOLD        (void (*) __P((int sig)))3
 #endif
+/*#endif*/
 
 /*
  * Macro for converting signal number to a mask suitable for
@@ -117,14 +128,6 @@ struct     sigcontext {
 #define sigmask(m)     (1 << ((m)-1))
 
 #ifndef KERNEL
-#ifndef __P
-#ifdef __STDC__
-#define __P(args) args
-#else
-#define __P(args) ()
-#endif
-#endif
-
 /* gen/psignal.c */
 int psignal __P((unsigned sig, char *s));
 
@@ -132,7 +135,7 @@ int psignal __P((unsigned sig, char *s));
 int siginterrupt __P((int sig, int flag));
 
 /* gen/signal.c */
-int (*signal __P((int s, int (*a)(void)))) __P((void));
+void (*signal __P((int s, void (*a)(int sig)))) __P((int sig));
 
 /* sys/kill.c */
 int kill __P((int p, int s));
index 95c617a..1a1f458 100644 (file)
@@ -180,22 +180,22 @@ int getsockopt __P((int s, int level, int opt, char *buf, int *len));
 int listen __P((int s, int b));
 
 /* sys/recv.c */
-int recv __P((int s, char *b, int l, int f));
+int recv __P((int s, void *b, int l, int f));
 
 /* sys/recvfrom.c */
-int recvfrom __P((int s, char *b, int l, int f, struct sockaddr *fr, int *fl));
+int recvfrom __P((int s, void *b, int l, int f, struct sockaddr *fr, int *fl));
 
 /* sys/recvmsg.c */
 int recvmsg __P((int s, struct msghdr m[], int f));
 
 /* sys/send.c */
-int send __P((int s, char *m, int l, int f));
+int send __P((int s, void *m, int l, int f));
 
 /* sys/sendmsg.c */
 int sendmsg __P((int s, struct msghdr m[], int l));
 
 /* sys/sendto.c */
-int sendto __P((int s, char *m, int l, int f, struct sockaddr *t, int tl));
+int sendto __P((int s, void *m, int l, int f, struct sockaddr *t, int tl));
 
 /* sys/setsockopt.c */
 int setsockopt __P((int s, int level, int opt, char *buf, int len));
diff --git a/lib/libstdc/sys/vopen.c b/lib/libstdc/sys/vopen.c
new file mode 100644 (file)
index 0000000..f22a8f0
--- /dev/null
@@ -0,0 +1,14 @@
+#include <gen.h>
+#include <sys/file.h>
+#ifdef __STDC__
+#include <stdarg.h>
+#define _va_start(argp, arg) va_start(argp, arg)
+#else
+#include <varargs.h>
+#define _va_start(argp, arg) va_start(argp)
+#endif
+
+/*#include <varargs.h>*/
+int vopen(f, m, argp) char *f; int m; va_list argp; {
+  abort();
+}
index 830706b..cb69e2d 100644 (file)
@@ -1,7 +1,6 @@
 #include <gen.h>
 #include <sys/wait.h>
 
-/*#include <sys/wait.h>*/
-int wait(s) union wait *s; {
+int wait(s) int *s; {
   abort();
 }
index 6a9586a..9a867e2 100644 (file)
@@ -82,7 +82,7 @@ union wait    {
 int wait3 __P((union wait *s, int o, struct rusage *r));
 
 /* sys/wait.c */
-int wait __P((union wait *s));
+int wait __P((int *s));
 #endif
 
 #endif
index 7e63c35..8665af7 100644 (file)
@@ -1,6 +1,6 @@
 #include <gen.h>
 #include <sys/file.h>
 
-int write(f, b, l) int f; char *b; int l; {
+int write(f, b, l) int f; void *b; int l; {
   abort();
 }
index b95b868..5d7bdfd 100644 (file)
@@ -46,10 +46,10 @@ x_int x_execvp __P((char *x_name, char **x_argv));
 x_int x_system __P((char *x_s));
 
 /* sys/execl.c */
-void x_execl __P((char *x_f, char *x_a));
+void x_execl __P((char *x_f, ...));
 
 /* sys/execle.c */
-void x_execle __P((char *x_f, char *x_a));
+void x_execle __P((char *x_f, ...));
 
 /* sys/exect.c */
 void x_exect __P((char *x_s, char *x_v[], char *x_e[]));
index 230e56e..220c75d 100644 (file)
@@ -6,6 +6,9 @@
 #include <sys/x_errno.h>
 #include <sys/x_param.h>
 #include <sys/x_types.h>
+#ifdef __STDC__
+#include <stdarg.h>
+#endif
 
 /*
  * Copyright (c) 1982, 1986 Regents of the University of California.
@@ -190,13 +193,13 @@ x_off_t x_lseek __P((x_int x_f, x_off_t x_o, x_int x_d));
 x_int x_mknod __P((char *x_n, x_int x_m, x_int x_a));
 
 /* sys/open.c */
-x_int x_open __P((char *x_f, x_int x_m, x_int x_stuff));
+x_int x_open __P((char *x_f, x_int x_m, ...));
 
 /* sys/pipe.c */
 x_int x_pipe __P((x_int x_f[2]));
 
 /* sys/read.c */
-x_int x_read __P((x_int x_f, char *x_b, x_int x_l));
+x_int x_read __P((x_int x_f, void *x_b, x_int x_l));
 
 /* sys/readlink.c */
 x_int x_readlink __P((char *x_p, char *x_b, x_int x_s));
@@ -219,8 +222,11 @@ x_int x_umask __P((x_int x_n));
 /* sys/unlink.c */
 x_int x_unlink __P((char *x_s));
 
+/* sys/vopen.c */
+x_int x_vopen __P((char *x_f, x_int x_m, va_list x_argp));
+
 /* sys/write.c */
-x_int x_write __P((x_int x_f, char *x_b, x_int x_l));
+x_int x_write __P((x_int x_f, void *x_b, x_int x_l));
 #endif
 
 #endif
index 2102c56..aadfb71 100644 (file)
@@ -297,7 +297,7 @@ x_int x_gtty __P((x_int x_fd, struct x_sgttyb *x_ap));
 x_int x_stty __P((x_int x_fd, struct x_sgttyb *x_ap));
 
 /* sys/ioctl.c */
-x_int x_ioctl __P((x_int x_d, x_u_long x_r, char *x_p));
+x_int x_ioctl __P((x_int x_d, x_u_long x_r, void *x_p));
 
 /* sys/isatty.c */
 x_int x_isatty __P((x_int x_f));
index 191a9f0..053d493 100644 (file)
@@ -11,7 +11,7 @@
  *     @(#)signal.h    7.1 (Berkeley) 6/4/86
  */
 
-#ifndef        x_NSIG
+/*#ifndef      NSIG*/
 #define x_NSIG 32
 
 #define        x_SIGHUP        1       /* hangup */
 #define x_SIGUSR2 31   /* user defined signal 2 */
 
 #ifndef x_KERNEL
-x_int  (*x_signal())();
+/*void (*signal())();*/
 #endif
 
 /*
  * Signal vector "template" used in sigvec call.
  */
+
+#ifndef __P
+#ifdef __STDC__
+#define __P(x_args) x_args
+#else
+#define __P(x_args) ()
+#endif
+#endif
+
+struct x_sigcontext; /* forward reference for sv_handler below (in ANSI case) */
+
 struct x_sigvec {
-       x_int   (*x_sv_handler)();      /* signal handler */
+       void    (*x_sv_handler) __P((x_int x_sig, x_int x_code, struct x_sigcontext *x_scp));   /* signal handler */
        x_int   x_sv_mask;              /* signal mask to apply */
        x_int   x_sv_flags;             /* see signal options below */
 };
@@ -102,15 +113,15 @@ struct    x_sigcontext {
        x_int   x_sc_ps;                        /* psl to restore */
 };
 
-#define        x_BADSIG                (x_int (*)())-1
-#define        x_SIG_DFL               (x_int (*)())0
-#define        x_SIG_IGN               (x_int (*)())1
+#define        x_BADSIG                (void (*) __P((x_int x_sig)))-1
+#define        x_SIG_DFL               (void (*) __P((x_int x_sig)))0
+#define        x_SIG_IGN               (void (*) __P((x_int x_sig)))1
 
 #ifdef x_KERNEL
-#define        x_SIG_CATCH     (x_int (*)())2
-#define        x_SIG_HOLD      (x_int (*)())3
-#endif
+#define        x_SIG_CATCH     (void (*) __P((x_int x_sig)))2
+#define        x_SIG_HOLD      (void (*) __P((x_int x_sig)))3
 #endif
+/*#endif*/
 
 /*
  * Macro for converting signal number to a mask suitable for
@@ -119,14 +130,6 @@ struct     x_sigcontext {
 #define x_sigmask(x_m) (1 << ((x_m)-1))
 
 #ifndef x_KERNEL
-#ifndef __P
-#ifdef __STDC__
-#define __P(x_args) x_args
-#else
-#define __P(x_args) ()
-#endif
-#endif
-
 /* gen/psignal.c */
 x_int x_psignal __P((x_unsigned_int x_sig, char *x_s));
 
@@ -134,7 +137,7 @@ x_int x_psignal __P((x_unsigned_int x_sig, char *x_s));
 x_int x_siginterrupt __P((x_int x_sig, x_int x_flag));
 
 /* gen/signal.c */
-x_int (*x_signal __P((x_int x_s, x_int (*x_a)(void)))) __P((void));
+void (*x_signal __P((x_int x_s, void (*x_a)(x_int x_sig)))) __P((x_int x_sig));
 
 /* sys/kill.c */
 x_int x_kill __P((x_int x_p, x_int x_s));
index 6ef58cd..f8d056b 100644 (file)
@@ -182,22 +182,22 @@ x_int x_getsockopt __P((x_int x_s, x_int x_level, x_int x_opt, char *x_buf, x_in
 x_int x_listen __P((x_int x_s, x_int x_b));
 
 /* sys/recv.c */
-x_int x_recv __P((x_int x_s, char *x_b, x_int x_l, x_int x_f));
+x_int x_recv __P((x_int x_s, void *x_b, x_int x_l, x_int x_f));
 
 /* sys/recvfrom.c */
-x_int x_recvfrom __P((x_int x_s, char *x_b, x_int x_l, x_int x_f, struct x_sockaddr *x_fr, x_int *x_fl));
+x_int x_recvfrom __P((x_int x_s, void *x_b, x_int x_l, x_int x_f, struct x_sockaddr *x_fr, x_int *x_fl));
 
 /* sys/recvmsg.c */
 x_int x_recvmsg __P((x_int x_s, struct x_msghdr x_m[], x_int x_f));
 
 /* sys/send.c */
-x_int x_send __P((x_int x_s, char *x_m, x_int x_l, x_int x_f));
+x_int x_send __P((x_int x_s, void *x_m, x_int x_l, x_int x_f));
 
 /* sys/sendmsg.c */
 x_int x_sendmsg __P((x_int x_s, struct x_msghdr x_m[], x_int x_l));
 
 /* sys/sendto.c */
-x_int x_sendto __P((x_int x_s, char *x_m, x_int x_l, x_int x_f, struct x_sockaddr *x_t, x_int x_tl));
+x_int x_sendto __P((x_int x_s, void *x_m, x_int x_l, x_int x_f, struct x_sockaddr *x_t, x_int x_tl));
 
 /* sys/setsockopt.c */
 x_int x_setsockopt __P((x_int x_s, x_int x_level, x_int x_opt, char *x_buf, x_int x_len));
index a771010..e09d56a 100644 (file)
@@ -84,7 +84,7 @@ union x_wait  {
 x_int x_wait3 __P((union x_wait *x_s, x_int x_o, struct x_rusage *x_r));
 
 /* sys/wait.c */
-x_int x_wait __P((union x_wait *x_s));
+x_int x_wait __P((x_int *x_s));
 #endif
 
 #endif
index 8bd91fc..4de7f95 100644 (file)
@@ -46,6 +46,46 @@ x_unsigned_int       x_r_symbolnum:24,       /* local symbol ordinal */
                :4;             /* nothing, yet */
 };
 
-#include <x_nlist.h>
+/*
+ * Format of a symbol table entry; this file is included by <a.out.h>
+ * and should be used if you aren't interested the a.out header
+ * or relocation information.
+ */
+struct x_nlist {
+       union {
+               char    *x_n_name;      /* for use when in-core */
+               x_long  x_n_strx;               /* index into file string table */
+       } x_n_un;
+unsigned char  x_n_type;               /* type flag, i.e. N_TEXT etc; see below */
+       char    x_n_other;      /* unused */
+       x_short x_n_desc;               /* see <stab.h> */
+x_unsigned_long        x_n_value;      /* value of this symbol (or sdb offset) */
+};
+#define        x_n_hash        x_n_desc                /* used internally by ld */
+
+/*
+ * Simple values for n_type.
+ */
+#define        x_N_UNDF        0x0             /* undefined */
+#define        x_N_ABS 0x2             /* absolute */
+#define        x_N_TEXT        0x4             /* text */
+#define        x_N_DATA        0x6             /* data */
+#define        x_N_BSS 0x8             /* bss */
+#define        x_N_COMM        0x12            /* common (internal to ld) */
+#define        x_N_FN  0x1f            /* file name symbol */
+
+#define        x_N_EXT 01              /* external bit, or'ed in */
+#define        x_N_TYPE        0x1e            /* mask for all the type bits */
+
+/*
+ * Sdb entries have some of the N_STAB bits set.
+ * These are given in <stab.h>
+ */
+#define        x_N_STAB        0xe0            /* if any of these bits set, a SDB entry */
+
+/*
+ * Format for namelist values.
+ */
+#define        x_N_FORMAT      "%08x"
 
 #endif
index a970980..b5433a6 100644 (file)
@@ -52,17 +52,17 @@ x_int x_atoi __P((register char *x_p));
 x_long x_atol __P((register char *x_p));
 
 /* gen/bcmp.c */
-x_int x_bcmp __P((register char *x_b1, register char *x_b2, register x_int x_length));
+x_int x_bcmp __P((void *x__b1, void *x__b2, register x_int x_length));
 
 /* gen/bcopy.c */
-x_int x_bcopy __P((register char *x_src, register char *x_dst, register x_int x_length));
+x_int x_bcopy __P((void *x__src, void *x__dst, register x_int x_length));
 
 /* gen/bzero.c */
-x_int x_bzero __P((register char *x_b, register x_int x_length));
+x_int x_bzero __P((void *x__b, register x_int x_length));
 
 /* gen/calloc.c */
-char *x_calloc __P((register x_unsigned_int x_num, register x_unsigned_int x_size));
-x_int x_cfree __P((char *x_p, x_unsigned_int x_num, x_unsigned_int x_size));
+void *x_calloc __P((register x_unsigned_int x_num, register x_unsigned_int x_size));
+x_int x_cfree __P((void *x_p, x_unsigned_int x_num, x_unsigned_int x_size));
 
 /* gen/crypt.c */
 x_int x_setkey __P((char *x_key));
@@ -97,10 +97,10 @@ x_int x_setusershell __P((void));
 x_int x_insque __P((register struct x_vaxque *x_e, register struct x_vaxque *x_prev));
 
 /* gen/malloc.c */
-char *x_malloc __P((x_unsigned_int x_nbytes));
+void *x_malloc __P((x_unsigned_int x_nbytes));
 void x_morecore __P((x_int x_bucket));
-void x_free __P((char *x_cp));
-char *x_realloc __P((char *x_cp, x_unsigned_int x_nbytes));
+void x_free __P((void *x_cp));
+void *x_realloc __P((void *x_cp, x_unsigned_int x_nbytes));
 void x_mstats __P((char *x_s));
 
 /* gen/mkstemp.c */
index af54819..8e0e5b3 100644 (file)
 #endif
 
 /* compat-sys5/memccpy.c */
-char *x_memccpy __P((register char *x_t, register char *x_f, register x_int x_c, register x_int x_n));
+char *x_memccpy __P((void *x__t, void *x__f, register x_int x_c, register x_int x_n));
 
 /* compat-sys5/memchr.c */
-char *x_memchr __P((register char *x_s, register x_int x_c, register x_int x_n));
+void *x_memchr __P((void *x__s, register x_int x_c, register x_int x_n));
 
 /* compat-sys5/memcmp.c */
-x_int x_memcmp __P((register char *x_s1, register char *x_s2, register x_int x_n));
+x_int x_memcmp __P((void *x__s1, void *x__s2, register x_int x_n));
 
 /* compat-sys5/memcpy.c */
-char *x_memcpy __P((register char *x_t, register char *x_f, register x_int x_n));
+void *x_memcpy __P((void *x__t, void *x__f, register x_int x_n));
 
 /* compat-sys5/memset.c */
-char *x_memset __P((register char *x_s, register x_int x_c, register x_int x_n));
+void *x_memset __P((void *x__s, register x_int x_c, register x_int x_n));
 #endif
 
 #endif
index 05f030e..434877a 100644 (file)
@@ -76,7 +76,7 @@ typedef struct {
 #endif
 
 /* gen/ndbm.c */
-x_DBM *x_dbm_open __P((char *x_file, x_int x_flags, x_int x_mode));
+x_DBM *x_dbm_open __P((char *x_file, x_int x_flags, ...));
 void x_dbm_close __P((x_DBM *x_db));
 x_long x_dbm_forder __P((register x_DBM *x_db, x_datum x_key));
 x_datum x_dbm_fetch __P((register x_DBM *x_db, x_datum x_key));
deleted file mode 100644 (file)
index d49ae23e121b26f944c14f6be6a65facc9dc8c2e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1,66 +0,0 @@
-#include "x_.h"
-
-#ifndef x__NLIST_H_
-#define x__NLIST_H_
-
-/*
- * Copyright (c) 1980 Regents of the University of California.
- * All rights reserved.  The Berkeley software License Agreement
- * specifies the terms and conditions for redistribution.
- *
- *     @(#)nlist.h     5.1 (Berkeley) 5/30/85
- */
-
-/*
- * Format of a symbol table entry; this file is included by <a.out.h>
- * and should be used if you aren't interested the a.out header
- * or relocation information.
- */
-struct x_nlist {
-       char    *x_n_name;      /* for use when in-core */
-       unsigned char x_n_type; /* type flag, i.e. N_TEXT etc; see below */
-       char    x_n_other;      /* unused */
-       x_short x_n_desc;               /* see <stab.h> */
-       x_unsigned_long x_n_value;      /* value of this symbol (or sdb offset) */
-};
-#define        x_n_hash        x_n_desc                /* used internally by ld */
-
-/*
- * Simple values for n_type.
- */
-#define        x_N_UNDF        0x0             /* undefined */
-#define        x_N_ABS 0x2             /* absolute */
-#define        x_N_TEXT        0x4             /* text */
-#define        x_N_DATA        0x6             /* data */
-#define        x_N_BSS 0x8             /* bss */
-#define        x_N_COMM        0x12            /* common (internal to ld) */
-#define        x_N_FN  0x1f            /* file name symbol */
-
-#define        x_N_EXT 01              /* external bit, or'ed in */
-#define        x_N_TYPE        0x1e            /* mask for all the type bits */
-
-/*
- * Sdb entries have some of the N_STAB bits set.
- * These are given in <stab.h>
- */
-#define        x_N_STAB        0xe0            /* if any of these bits set, a SDB entry */
-
-/*
- * Format for namelist values.
- */
-#define        x_N_FORMAT      "%08x"
-
-#ifndef x_KERNEL
-#ifndef __P
-#ifdef __STDC__
-#define __P(x_args) x_args
-#else
-#define __P(x_args) ()
-#endif
-#endif
-
-/* gen/nlist.c */
-x_int x_nlist __P((char *x_name, struct x_nlist *x_list));
-#endif
-
-#endif
new file mode 120000 (symlink)
index 0000000000000000000000000000000000000000..ae4e541a1a5f123f4309c0725502eda172aaca32
--- /dev/null
@@ -0,0 +1 @@
+x_a.out.h
\ No newline at end of file
index 3686f5d..ae89111 100644 (file)
@@ -132,7 +132,7 @@ x_int x_fputc __P((x_int x_c, register x_FILE *x_fp));
 x_int x_fputs __P((register char *x_s, register x_FILE *x_iop));
 
 /* stdio/fread.c */
-x_int x_fread __P((register char *x_ptr, x_unsigned_int x_size, x_unsigned_int x_count, register x_FILE *x_iop));
+x_int x_fread __P((void *x__ptr, x_unsigned_int x_size, x_unsigned_int x_count, register x_FILE *x_iop));
 
 /* stdio/freopen.c */
 x_FILE *x_freopen __P((char *x_file, register char *x_mode, register x_FILE *x_iop));
@@ -144,7 +144,7 @@ x_int x_fseek __P((register x_FILE *x_iop, x_long x_offset, x_int x_ptrname));
 x_long x_ftell __P((register x_FILE *x_iop));
 
 /* stdio/fwrite.c */
-x_int x_fwrite __P((register char *x_ptr, x_unsigned_int x_size, x_unsigned_int x_count, register x_FILE *x_iop));
+x_int x_fwrite __P((void *x__ptr, x_unsigned_int x_size, x_unsigned_int x_count, register x_FILE *x_iop));
 
 /* stdio/getchar.c */
 x_int x_getchar __P((void));
index b410925..83603c7 100644 (file)
@@ -189,6 +189,7 @@ int main() {
           l -= 4;
         }
         else if (
+          (l != 2 || memcmp(p, "X_", 2) != 0) &&
           (l != 5 || memcmp(p, "break", 5) != 0) &&
           (l != 4 || memcmp(p, "case", 4) != 0) &&
           (l != 4 || memcmp(p, "char", 4) != 0) &&
index c8161c6..c2e10c0 100755 (executable)
@@ -1,3 +1,3 @@
 #!/bin/sh
 "`dirname "$0"`/xify" |\
-sed -e 's/\(extern\|register\|static\) x_int \(x_u_long\|x_u_short\)/\1 \2/g; s/va_arg(x_argp, x_\(unsigned_\)\?\(short\|int\|long\))/_va_arg_\1\2(x_argp)/g'
+sed -e 's/\(extern\|register\|static\) x_int x_u_\(short\|int\|long\)/\1 x_u_\2/g; s/va_arg(x_argp, x_\(unsigned_\)\?\(short\|int\|long\))/_va_arg_\1\2(x_argp)/g'