Post-ansification changes for include, lib/libc, sys
authorNick Downing <downing.nick@gmail.com>
Tue, 24 Jan 2017 10:49:41 +0000 (21:49 +1100)
committerNick Downing <downing.nick@gmail.com>
Tue, 24 Jan 2017 15:18:44 +0000 (02:18 +1100)
47 files changed:
include/Makefile
include/gen.h
include/stdio.h
include/string.h
lib/libc/Makefile
lib/libc/gen/Makefile
lib/libc/gen/bcopy.c
lib/libc/gen/execvp.c
lib/libc/gen/getpass.c
lib/libc/gen/getpwnamuid.c
lib/libc/gen/malloc.c
lib/libc/gen/ndbm.c
lib/libc/gen/qsort.c
lib/libc/gen/scandir.c
lib/libc/gen/signal.c
lib/libc/gen/sleep.c
lib/libc/gen/system.c
lib/libc/gen/usleep.c
lib/libc/gen/valloc.c
lib/libc/linux/Makefile [new file with mode: 0644]
lib/libc/linux/csu/Makefile [new file with mode: 0644]
lib/libc/linux/csu/crt0.c [new file with mode: 0644]
lib/libc/linux/gen/Makefile [new file with mode: 0644]
lib/libc/linux/gen/abort.c [new file with mode: 0644]
lib/libc/linux/gen/modf.c [new file with mode: 0644]
lib/libc/linux/sys/Makefile [new file with mode: 0644]
lib/libc/linux/sys/_exit.c [new file with mode: 0644]
lib/libc/linux/sys/close.c [new file with mode: 0644]
lib/libc/linux/sys/fstat.c [new file with mode: 0644]
lib/libc/linux/sys/getpagesize.c [new file with mode: 0644]
lib/libc/linux/sys/isatty.c [new file with mode: 0644]
lib/libc/linux/sys/lseek.c [new file with mode: 0644]
lib/libc/linux/sys/read.c [new file with mode: 0644]
lib/libc/linux/sys/readv.c [new file with mode: 0644]
lib/libc/linux/sys/sbrk.c [new file with mode: 0644]
lib/libc/linux/sys/vopen.c [new file with mode: 0644]
lib/libc/linux/sys/write.c [new file with mode: 0644]
lib/libc/linux/sys/writev.c [new file with mode: 0644]
lib/libc/net/named/gethostnamadr.c
lib/libc/stdio/doprnt.c
lib/libc/stdio/findiop.c
lib/libc/sys/open.c
sys/h/dir.h
sys/h/signal.h
sys/net/if.h
sys/netinet/in.h
sys/netns/ns.h

index d74d9e7..21bbf71 100644 (file)
 #
 DESTDIR=
 SUBDIRS=arpa pascal protocols
-STD=   a.out.h ar.h assert.h ctype.h disktab.h fstab.h gen.h grp.h lastlog.h \
-       math.h memory.h mtab.h ndbm.h net.h netdb.h pcc.h pwd.h ranlib.h \
-       resolv.h setjmp.h sgtty.h stab.h stdio.h string.h strings.h struct.h \
-       syscall.h sysexits.h time.h ttyent.h utmp.h varargs.h vfont.h
+STD=   a.out.h ar.h assert.h compat-4.1.h compat-sys5.h ctype.h disktab.h \
+       fstab.h gen.h grp.h inet.h lastlog.h math.h memory.h mtab.h ndbm.h \
+       netdb.h net.h ns.h pcc.h pwd.h ranlib.h resolv.h setjmp.h sgtty.h \
+       stab.h stdio.h string.h strings.h struct.h syscall.h sysexits.h sys.h \
+       time.h ttyent.h utmp.h varargs.h vfont.h
 LINKS= errno.h signal.h syslog.h
 MACHINE=vax
 MACHDEP=${MACHINE} vaxif vaxmba vaxuba
index 21024f5..991b438 100644 (file)
@@ -98,7 +98,7 @@ int mkstemp __P((char *as));
 char *mktemp __P((char *as));
 
 /* gen/qsort.c */
-void qsort __P((void *_base, int n, int size, int (*compar)(void)));
+void qsort __P((void *_base, int n, int size, int (*compar)(void *p0, void *p1)));
 
 /* gen/random.c */
 int srandom __P((unsigned x));
index 98070cf..743157b 100644 (file)
@@ -81,7 +81,7 @@ extern        struct  _iobuf {
 #endif
 
 /* stdio/clrerr.c */
-int clearerr __P((register FILE *iop));
+/*int clearerr __P((register FILE *iop));*/
 
 /* stdio/doprnt.c */
 int _doprnt __P((u_char *fmt0, va_list argp, register FILE *fp));
@@ -96,7 +96,7 @@ int exit __P((int code));
 FILE *fdopen __P((int fd, register char *mode));
 
 /* stdio/fgetc.c */
-int fgetc __P((FILE *fp));
+/*int fgetc __P((FILE *fp));*/
 
 /* stdio/fgets.c */
 char *fgets __P((char *s, int n, register FILE *iop));
@@ -108,7 +108,7 @@ int _filbuf __P((register FILE *iop));
 FILE *_findiop __P((void));
 int _f_morefiles __P((void));
 void f_prealloc __P((void));
-void _fwalk __P((register int (*function)(void)));
+void _fwalk __P((register int (*function) __P((FILE *iop))));
 void _cleanup __P((void));
 
 /* stdio/flsbuf.c */
@@ -123,7 +123,7 @@ FILE *fopen __P((char *file, register char *mode));
 int fprintf __P((register FILE *iop, char *fmt, ...));
 
 /* stdio/fputc.c */
-int fputc __P((int c, register FILE *fp));
+/*int fputc __P((int c, register FILE *fp));*/
 
 /* stdio/fputs.c */
 int fputs __P((register char *s, register FILE *iop));
@@ -144,7 +144,7 @@ long ftell __P((register FILE *iop));
 int fwrite __P((void *_ptr, unsigned size, unsigned count, register FILE *iop));
 
 /* stdio/getchar.c */
-int getchar __P((void));
+/*int getchar __P((void));*/
 
 /* stdio/gets.c */
 char *gets __P((char *s));
@@ -160,7 +160,7 @@ int pclose __P((FILE *ptr));
 int printf __P((char *fmt, ...));
 
 /* stdio/putchar.c */
-int putchar __P((register c));
+/*int putchar __P((register c));*/
 
 /* stdio/puts.c */
 int puts __P((register char *s));
index 564cf9f..bd52705 100644 (file)
@@ -9,7 +9,8 @@
  *     @(#)string.h    5.1 (Berkeley) 85/08/05
  */
 
-/*#include <strings.h>*/
+#include <memory.h>
+#include <strings.h>
 
 /*
  * these next few are obsolete trash
index 15fb840..832b525 100644 (file)
@@ -42,7 +42,8 @@ HOSTLOOKUP=   named
 DESTDIR=
 INSTALL=install -m 644
 DFLMON=        mon.o
-MACHINE=vax
+MACHINE=linux
+#vax
 DEFS=
 COMPAT=        compat-4.1 compat-sys5
 ALL=   gen inet net ns stdio sys ${COMPAT} ${MACHINE}
@@ -53,15 +54,19 @@ libc.a libc_p.a: ${MACHINE}/csu ${ALL} net/${HOSTLOOKUP}
        -mkdir tmp
        for i in ${ALL}; do (cd tmp; ar x ../$$i/$${i}lib); done
        cd tmp; ar x ../net/${HOSTLOOKUP}/hostlib
-       ls tmp/*.o | sort -t/ +1 > t1
-       ar cr libc.a `lorder \`cat t1\` | tsort` ${MACHINE}/csu/${DFLMON}
+#      ls tmp/*.o | sort -t/ +1 > t1
+       ls tmp/*.o | LC_ALL=C sort -t/ > t1
+       ar cr libc.a `lorder \`cat t1\` | tsort`
+# ${MACHINE}/csu/${DFLMON}
        ar ma findiop.o libc.a exit.o
        ar ma exit.o libc.a fakcu.o
        rm -f t1 tmp/*
        for i in ${ALL}; do (cd tmp; ar x ../$$i/$${i}lib_p); done
        cd tmp; ar x ../net/${HOSTLOOKUP}/hostlib_p
-       ls tmp/*.o | sort -t/ +1 > t1
-       ar cr libc_p.a `lorder \`cat t1\` | tsort` ${MACHINE}/csu/${DFLMON}
+#      ls tmp/*.o | sort -t/ +1 > t1
+       ls tmp/*.o | LC_ALL=C sort -t/ > t1
+       ar cr libc_p.a `lorder \`cat t1\` | tsort`
+# ${MACHINE}/csu/${DFLMON}
        ar ma findiop.o libc_p.a exit.o
        ar ma exit.o libc_p.a fakcu.o
        rm -rf t1 tmp
index 0c34b49..96534cf 100644 (file)
@@ -50,12 +50,12 @@ genlib genlib_p: ${OBJS}
        @echo "buiding normal genlib"
        @ar cru genlib ${OBJS}
 
-errlst.o: errlst.c
-       ${CC} -S ${DEFS} errlst.c
-       ed - <:errfix errlst.s
-       as -o errlst.o errlst.s
-       cp errlst.o profiled/errlst.o
-       rm errlst.s
+#errlst.o: errlst.c
+#      ${CC} -S ${DEFS} errlst.c
+#      ed - <:errfix errlst.s
+#      as -o errlst.o errlst.s
+#      cp errlst.o profiled/errlst.o
+#      rm errlst.s
 
 tags:
        cwd=`pwd`; \
index 4fedfbc..338e7ef 100644 (file)
@@ -1,6 +1,12 @@
 #include <strings.h>
 #include <sys/types.h>
 
+#ifdef __STDC__
+#include <stdint.h>
+#else
+typedef int intptr_t;
+#endif
+
 /*
  * Copyright (c) 1987 Regents of the University of California.
  * All rights reserved.  The Berkeley software License Agreement
@@ -18,8 +24,8 @@ 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)
+               if (/*(u_int)*/dst < /*(u_int)*/src)
+                       if (((intptr_t)src | (intptr_t)dst | length) & 3)
                                do      /* copy by bytes */
                                        *dst++ = *src++;
                                while (--length);
@@ -32,7 +38,7 @@ int bcopy(_src, _dst, length) void *_src; void *_dst; register int length; {
                else {                  /* copy backwards */
                        src += length;
                        dst += length;
-                       if (((int)src | (int)dst | length) & 3)
+                       if (((intptr_t)src | (intptr_t)dst | length) & 3)
                                do      /* copy by bytes */
                                        *--dst = *--src;
                                while (--length);
index a286431..d84bb20 100644 (file)
@@ -27,9 +27,9 @@ static        char shell[] =  "/bin/sh";
 /*char *execat(), *getenv();*/
 extern errno;
 
-#ifdef __STDC__
 static char *execat __P((register char *s1, register char *s2, char *si));
 
+#ifdef __STDC__
 int execlp(char *name, ...)
 #else
 int execlp(name, va_alist) char *name; va_dcl
@@ -38,7 +38,7 @@ int execlp(name, va_alist) char *name; va_dcl
        va_list argp;
        int res;
 
-       _va_start(argp, fmt);
+       _va_start(argp, name);
        res = execvp(name, (char **)argp);
        va_end(argp);
        return res;
index d8bc3ad..5c21ee4 100644 (file)
@@ -20,7 +20,7 @@ char *getpass(prompt) char *prompt; {
        FILE *fi;
        static char pbuf[9];
        void (*signal())();
-       void (*sig)();
+       void (*sig) __P((int sig));
 
        if ((fi = fdopen(open("/dev/tty", 2), "r")) == NULL)
                fi = stdin;
index f2e9e26..6d2ab2f 100644 (file)
@@ -43,19 +43,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 ee85116..5731d0c 100644 (file)
@@ -5,6 +5,12 @@
 /*#include <sys/proc.h> gen.h*/
 /*#include <sys/types.h> gen.h*/
 
+#ifdef __STDC__
+#include <stdint.h>
+#else
+typedef int intptr_t;
+#endif
+
 /*
  * Copyright (c) 1983 Regents of the University of California.
  * All rights reserved.  The Berkeley software License Agreement
@@ -89,9 +95,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 */
@@ -101,6 +104,8 @@ static void botch(s) char *s; {
 #define        ASSERT(p)
 #endif
 
+static findbucket __P((union overhead *freep, int srchlen));
+
 void *malloc(nbytes) unsigned nbytes; {
        register union overhead *op;
        register int bucket;
@@ -113,7 +118,7 @@ void *malloc(nbytes) unsigned nbytes; {
        if (pagesz == 0) {
                pagesz = n = getpagesize();
                op = (union overhead *)sbrk(0);
-               n = n - sizeof (*op) - ((int)op & (n - 1));
+               n = n - sizeof (*op) - ((intptr_t)op & (n - 1));
                if (n < 0)
                        n += pagesz;
                if (n) {
@@ -141,7 +146,7 @@ void *malloc(nbytes) unsigned nbytes; {
                amt = 16;       /* size of first bucket */
                bucket = 1;
 #endif
-               n = -(sizeof (*op) + RSLOP);
+               n = -(intptr_t)(sizeof (*op) + RSLOP);
        } else {
                amt = pagesz;
                bucket = pagebucket;
@@ -209,7 +214,7 @@ void morecore(bucket) int bucket; {
        }
        op = (union overhead *)sbrk(amt);
        /* no more room! */
-       if ((int)op == -1)
+       if ((intptr_t)op == -1)
                return;
        /*
         * Add new memory allocated to that on
index 2d2d874..4cb22b7 100644 (file)
@@ -40,7 +40,6 @@ 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));
@@ -52,6 +51,7 @@ static delitem __P((char buf[PBLKSIZ], int n));
 static additem __P((char buf[PBLKSIZ], datum item, datum item1));
 static chkblk __P((char buf[PBLKSIZ]));
 
+#ifdef __STDC__
 DBM *dbm_open(char *file, int flags, ...)
 #else
 DBM *dbm_open(file, flags, va_alist) char *file; int flags; va_dcl
@@ -70,14 +70,14 @@ DBM *dbm_open(file, flags, va_alist) char *file; int flags; va_dcl
                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)
index 2801b45..0ade312 100644 (file)
@@ -36,7 +36,7 @@ static  int           mthresh;                /* MTHRESHold in chars */
 
 static void qst __P((char *base, char *max));
 
-void qsort(_base, n, size, compar) void *_base; int n; int size; int (*compar)(); {
+void qsort(_base, n, size, compar) void *_base; int n; int size; int (*compar) __P((void *p0, void *p1)); {
 #define base ((char *)_base)
        register char c, *i, *j, *lo, *hi;
        char *min, *max;
index 22f7142..cf1d474 100644 (file)
@@ -24,7 +24,7 @@ static char sccsid[] = "@(#)scandir.c 5.2 (Berkeley) 3/9/86";
 /*#include <sys/stat.h>*/
 /*#include <sys/dir.h>*/
 
-int scandir(dirname, namelist, select, dcomp) char *dirname; struct direct *(*namelist[]); int (*select)(); int (*dcomp)(); {
+int scandir(dirname, namelist, select, dcomp) char *dirname; struct direct *(*namelist[]); int (*select) __P((struct direct *d)); int (*dcomp) __P((struct direct *d0, struct direct *d1)); {
        register struct direct *d, *p, **names;
        register int nitems;
        register char *cp1, *cp2;
@@ -77,7 +77,7 @@ int scandir(dirname, namelist, select, dcomp) char *dirname; struct direct *(*na
        }
        closedir(dirp);
        if (nitems && dcomp != NULL)
-               qsort(names, nitems, sizeof(struct direct *), dcomp);
+               qsort(names, nitems, sizeof(struct direct *), (int (*) __P((void *p0, void *p1)))dcomp);
        *namelist = names;
        return(nitems);
 }
index 1e85ee4..b633adc 100644 (file)
@@ -15,12 +15,12 @@ static char sccsid[] = "@(#)signal.c        5.2 (Berkeley) 3/9/86";
  */
 /*#include <signal.h>*/
 
-void (*signal(s, a))() int s; void (*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 @@ void (*signal(s, a))() int s; void (*a)(); {
                if (sigvec(s, &sv, 0) < 0)
                        return (BADSIG);
        }
-       return (osv.sv_handler);
+       return ((void (*) __P((int sig)))osv.sv_handler);
 }
index 084f204..5f56799 100644 (file)
@@ -15,7 +15,7 @@ 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;
 
index ffcb153..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 void (*istat)(), (*qstat)();
+       register void (*istat) __P((int sig)), (*qstat) __P((int sig));
 
        if ((pid = vfork()) == 0) {
                execl("/bin/sh", "sh", "-c", s, 0);
index 6d544fe..eafb631 100644 (file)
@@ -18,7 +18,7 @@ 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;
 
index 5af312f..7a088af 100644 (file)
@@ -1,6 +1,12 @@
 #include <gen.h>
 #include <sys.h>
 
+#ifdef __STDC__
+#include <stdint.h>
+#else
+typedef int intptr_t;
+#endif
+
 /*
  * Copyright (c) 1980 Regents of the University of California.
  * All rights reserved.  The Berkeley software License Agreement
@@ -14,9 +20,10 @@ static char sccsid[] = "@(#)valloc.c 5.2 (Berkeley) 3/9/86";
 /*void *malloc();*/
 
 void *valloc(i) int i; {
-       int valsiz = getpagesize(), j;
+       int valsiz = getpagesize();
+       intptr_t j;
        char *cp = malloc(i + (valsiz-1));
 
-       j = ((int)cp + (valsiz-1)) &~ (valsiz-1);
+       j = ((intptr_t)cp + (valsiz-1)) &~ (valsiz-1);
        return ((char *)j);
 }
diff --git a/lib/libc/linux/Makefile b/lib/libc/linux/Makefile
new file mode 100644 (file)
index 0000000..59429e2
--- /dev/null
@@ -0,0 +1,43 @@
+#
+# Copyright (c) 1980 Regents of the University of California.
+# All rights reserved.  The Berkeley software License Agreement
+# specifies the terms and conditions for redistribution.
+#
+#      @(#)Makefile    5.5 (Berkeley) 9/5/85
+#
+# Machine dependent routines for linux hosted are located here
+#
+#COMPAT=       compat-4.1
+ALL=   gen sys
+#gen net stdio sys ${COMPAT}
+TAGSFILE=tags
+
+linuxlib linuxlib_p: ${ALL}
+       -mkdir tmp
+       for i in ${ALL}; do (cd tmp; ar x ../$$i/$${i}lib); done
+#      ar cr linuxlib `ls tmp/*.o | sort -t/ +1`
+       ar cr linuxlib `ls tmp/*.o | LC_ALL=C sort -t/`
+       rm -f tmp/*
+       for i in ${ALL}; do (cd tmp; ar x ../$$i/$${i}lib_p); done
+#      ar cr linuxlib_p `ls tmp/*.o | sort -t/ +1`
+       ar cr linuxlib_p `ls tmp/*.o | LC_ALL=C sort -t/`
+       rm -rf tmp
+
+${ALL}:        FRC
+       cd $@; make ${MFLAGS} DEFS=${DEFS}
+
+FRC:
+
+tags:
+       for i in ${ALL}; do \
+               (cd $$i; make ${MFLAGS} TAGSFILE=../${TAGSFILE} tags); \
+       done
+
+clean:
+       for i in ${ALL}; do (cd $$i; make ${MFLAGS} clean); done
+       rm -f linuxlib linuxlib_p tmp/*.o;
+       -rmdir tmp
+
+depend:
+       for i in ${ALL}; do \
+               (cd $$i; make ${MFLAGS} DEFS=${DEFS} depend); done
diff --git a/lib/libc/linux/csu/Makefile b/lib/libc/linux/csu/Makefile
new file mode 100644 (file)
index 0000000..1729626
--- /dev/null
@@ -0,0 +1,102 @@
+LD=ld
+#
+# Copyright (c) 1980 Regents of the University of California.
+# All rights reserved.  The Berkeley software License Agreement
+# specifies the terms and conditions for redistribution.
+#
+#      @(#)Makefile    5.4 (Berkeley) 9/5/85
+#
+#      crt0    Normal C run time startoff
+#      mcrt0   C run time start off for profiling, ``prof'' conventions
+#      gcrt0   C run time start off for profiling, ``gprof'' conventions
+#
+#DESTDIR=
+SRCS=  crt0.c
+# mon.c gmon.c
+OBJS=  crt0.o mcrt0.o gcrt0.o
+# mon.o gmon.o
+TAGSFILE=tags
+
+all: ${OBJS}
+
+install: ${OBJS}
+       mv crt0.o ${DESTDIR}/lib/crt0.o
+       mv mcrt0.o ${DESTDIR}/lib/mcrt0.o
+       mv gcrt0.o ${DESTDIR}/usr/lib/gcrt0.o
+
+crt0.o: crt0.c
+       ${CC} -DCRT0 -c crt0.c
+
+mcrt0.o: crt0.c
+       ${CC} -DMCRT0 -o $@ -c crt0.c
+
+gcrt0.o: crt0.c
+       ${CC} -DGCRT0 -o $@ -c crt0.c
+
+#crt0.o:       crt0.c
+#      cc -S ${DFLAGS} -DCRT0 crt0.c
+#      /lib/cpp crt0.s > x.s
+#      as -o x.o x.s
+#      ${LD} -x -r -o crt0.o x.o
+#      rm -f x.s x.o crt0.s
+#
+#moncrt0.o: crt0.c
+#      cc -S ${DFLAGS} -DMCRT0 crt0.c
+#      /lib/cpp crt0.s > x.s
+#      as -o x.o x.s
+#      ${LD} -x -r -o moncrt0.o x.o
+#      rm -f x.s x.o crt0.s
+#
+#gcrt0.o: moncrt0.o gmon.o
+#      ${LD} -x -r -o gcrt0.o moncrt0.o gmon.o
+#
+#mcrt0.o: moncrt0.o mon.o
+#      ${LD} -x -r -o mcrt0.o moncrt0.o mon.o
+#
+#mon.o: mon.c mon.ex
+#      cc -S ${DEFS} ${DFLAGS} mon.c
+#      ex - mon.s < mon.ex
+#      as -o x.o mon.s
+#      ${LD} -x -r -o mon.o x.o
+#      rm -f x.o mon.s
+#
+#gmon.o: gmon.c gmon.h gmon.ex
+#      cc -S ${DEFS} ${DFLAGS} gmon.c
+#      ex - gmon.s < gmon.ex
+#      as -o x.o gmon.s
+#      ${LD} -x -r -o gmon.o x.o
+#      rm -f x.o gmon.s
+
+tags:  
+       cwd=`pwd`; \
+       for i in ${SRCS}; do \
+               ctags -a -f ${TAGSFILE} $$cwd/$$i; \
+       done
+
+clean:
+       rm -f ${OBJS} *.o *.s core errs tags Makefile.bak
+
+lint:  crt0.c
+       lint crt0.c -DMCRT0
+       lint crt0.c -DGCRT0
+       lint crt0.c -DCRT0
+
+depend:
+       for i in ${SRCS}; do \
+           cc -M ${DEFS} ${DFLAGS} $$i | awk ' { if ($$1 != prev) \
+               { if (rec != "") print rec; rec = $$0; prev = $$1; } \
+               else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
+               else rec = rec " " $$2 } } \
+               END { print rec } ' >> makedep; done
+       echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep
+       echo '$$r makedep' >>eddep
+       echo 'w' >>eddep
+       cp Makefile Makefile.bak
+       ed - Makefile < eddep
+       rm eddep makedep
+       echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile
+       echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile
+       echo '# see make depend above' >> Makefile
+
+# DO NOT DELETE THIS LINE -- make depend uses it
+
diff --git a/lib/libc/linux/csu/crt0.c b/lib/libc/linux/csu/crt0.c
new file mode 100644 (file)
index 0000000..5640b92
--- /dev/null
@@ -0,0 +1,19 @@
+#include <stdio.h>
+
+extern char **nox_environ;
+char **environ;
+
+#ifndef __P
+#ifdef __STDC__
+#define __P(args) args
+#else
+#define __P(args) ()
+#endif
+#endif
+
+int main __P((int argc, char **argv));
+
+nox_int nox_main(argc, argv) nox_int argc; char **argv; {
+       environ = nox_environ;
+       exit(main(argc, argv));
+}
diff --git a/lib/libc/linux/gen/Makefile b/lib/libc/linux/gen/Makefile
new file mode 100644 (file)
index 0000000..dadc9b6
--- /dev/null
@@ -0,0 +1,51 @@
+LD=ld
+#
+# Copyright (c) 1980 Regents of the University of California.
+# All rights reserved.  The Berkeley software License Agreement
+# specifies the terms and conditions for redistribution.
+#
+#      @(#)Makefile    5.4 (Berkeley) 9/5/85
+#
+
+SRCS=  abort.c modf.c
+OBJS=  abort.o modf.o
+TAGSFILE=tags
+
+.c.o:
+       ${CC} -p ${CFLAGS} -c $*.c
+       -${LD} -X -r $*.o
+       mv a.out profiled/$*.o
+       ${CC} ${CFLAGS} -c $*.c
+       -${LD} -x -r $*.o
+       mv a.out $*.o
+
+genlib genlib_p: ${OBJS}
+       @echo "building profiled genlib"
+       @cd profiled; ar cru ../genlib_p ${OBJS}
+       @echo "building normal genlib"
+       @ar cru genlib ${OBJS}
+
+tags:
+
+clean:
+       rm -f genlib genlib_p ${OBJS} profiled/*.o tags Makefile.bak
+
+depend:
+       for i in ${SRCS}; do \
+           cc -M ${DEFS} $$i | awk ' { if ($$1 != prev) \
+               { if (rec != "") print rec; rec = $$0; prev = $$1; } \
+               else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
+               else rec = rec " " $$2 } } \
+               END { print rec } ' >> makedep; done
+       echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep
+       echo '$$r makedep' >>eddep
+       echo 'w' >>eddep
+       cp Makefile Makefile.bak
+       ed - Makefile < eddep
+       rm eddep makedep
+       echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile
+       echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile
+       echo '# see make depend above' >> Makefile
+
+# DO NOT DELETE THIS LINE -- make depend uses it
+
diff --git a/lib/libc/linux/gen/abort.c b/lib/libc/linux/gen/abort.c
new file mode 100644 (file)
index 0000000..e4eb702
--- /dev/null
@@ -0,0 +1,7 @@
+#include <nox_stdlib.h>
+
+#include <gen.h>
+
+int abort() {
+       nox_abort();
+}
diff --git a/lib/libc/linux/gen/modf.c b/lib/libc/linux/gen/modf.c
new file mode 100644 (file)
index 0000000..564ab52
--- /dev/null
@@ -0,0 +1,7 @@
+#include <nox_math.h>
+
+#include <math.h>
+
+double modf(v, p) double v; double *p; {
+       return nox_modf(v, p);
+}
diff --git a/lib/libc/linux/sys/Makefile b/lib/libc/linux/sys/Makefile
new file mode 100644 (file)
index 0000000..f9498f7
--- /dev/null
@@ -0,0 +1,53 @@
+LD=ld
+#
+# Copyright (c) 1980 Regents of the University of California.
+# All rights reserved.  The Berkeley software License Agreement
+# specifies the terms and conditions for redistribution.
+#
+#      @(#)Makefile    5.4 (Berkeley) 9/5/85
+#
+
+SRCS=  close.c fstat.c getpagesize.c isatty.c lseek.c read.c readv.c sbrk.c \
+       vopen.c write.c writev.c _exit.c
+OBJS=  close.o fstat.o getpagesize.o isatty.o lseek.o read.o readv.o sbrk.o \
+       vopen.o write.o writev.o _exit.o
+TAGSFILE=tags
+
+.c.o:
+       ${CC} -p ${CFLAGS} -c $*.c
+       -${LD} -X -r $*.o
+       mv a.out profiled/$*.o
+       ${CC} ${CFLAGS} -c $*.c
+       -${LD} -x -r $*.o
+       mv a.out $*.o
+
+syslib syslib_p: ${OBJS}
+       @echo "building profiled syslib"
+       @cd profiled; ar cru ../syslib_p ${OBJS}
+       @echo "building normal syslib"
+       @ar cru syslib ${OBJS}
+
+tags:
+
+clean:
+       rm -f syslib syslib_p ${OBJS} profiled/*.o tags Makefile.bak
+
+depend:
+       for i in ${SRCS}; do \
+           cc -M ${DEFS} $$i | awk ' { if ($$1 != prev) \
+               { if (rec != "") print rec; rec = $$0; prev = $$1; } \
+               else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
+               else rec = rec " " $$2 } } \
+               END { print rec } ' >> makedep; done
+       echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep
+       echo '$$r makedep' >>eddep
+       echo 'w' >>eddep
+       cp Makefile Makefile.bak
+       ed - Makefile < eddep
+       rm eddep makedep
+       echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile
+       echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile
+       echo '# see make depend above' >> Makefile
+
+# DO NOT DELETE THIS LINE -- make depend uses it
+
diff --git a/lib/libc/linux/sys/_exit.c b/lib/libc/linux/sys/_exit.c
new file mode 100644 (file)
index 0000000..6738361
--- /dev/null
@@ -0,0 +1,7 @@
+#include <nox_unistd.h>
+
+#include <sys/proc.h>
+
+void _exit(s) int s; {
+       nox__exit(s);
+}
diff --git a/lib/libc/linux/sys/close.c b/lib/libc/linux/sys/close.c
new file mode 100644 (file)
index 0000000..081b87e
--- /dev/null
@@ -0,0 +1,13 @@
+#include <nox_unistd.h>
+
+#include <sys/errno.h>
+#include <sys/file.h>
+
+int close(f) int f; {
+       int res;
+
+       res = nox_close(f);
+       if (res == -1)
+               errno = EBADF;
+       return res;
+}
diff --git a/lib/libc/linux/sys/fstat.c b/lib/libc/linux/sys/fstat.c
new file mode 100644 (file)
index 0000000..6a8810c
--- /dev/null
@@ -0,0 +1,17 @@
+#include <sys/nox_stat.h>
+#include <nox_unistd.h>
+
+#include <gen.h>
+#include <sys/errno.h>
+#include <sys/stat.h>
+
+int fstat(f, b) int f; struct stat *b; {
+       struct nox_stat statbuf;
+       if (nox_fstat(f, &statbuf) == -1) {
+               errno = ENOENT;
+               return -1;
+       }
+       bzero(b, sizeof(struct stat));
+       b->st_size = (off_t)statbuf.nox_st_size;
+       return 0;
+}
diff --git a/lib/libc/linux/sys/getpagesize.c b/lib/libc/linux/sys/getpagesize.c
new file mode 100644 (file)
index 0000000..db8b2ac
--- /dev/null
@@ -0,0 +1,7 @@
+#include <nox_unistd.h>
+
+#include <sys.h>
+
+int getpagesize() {
+       return nox_getpagesize();
+}
diff --git a/lib/libc/linux/sys/isatty.c b/lib/libc/linux/sys/isatty.c
new file mode 100644 (file)
index 0000000..a93ed6a
--- /dev/null
@@ -0,0 +1,13 @@
+#include <nox_unistd.h>
+
+#include <sys/errno.h>
+#include <sys/ioctl.h>
+
+int isatty(f) int f; {
+       int res;
+
+       res = nox_isatty(f);
+       if (res == -1)
+               errno = EBADF;
+       return res;
+}
diff --git a/lib/libc/linux/sys/lseek.c b/lib/libc/linux/sys/lseek.c
new file mode 100644 (file)
index 0000000..e7fbbe3
--- /dev/null
@@ -0,0 +1,15 @@
+#include <nox_unistd.h>
+#include <sys/nox_types.h>
+
+#include <sys/errno.h>
+#include <sys/file.h>
+#include <sys/types.h>
+
+off_t lseek(f, o, d) int f; off_t o; int d; {
+       off_t res;
+
+       res = (off_t)nox_lseek(f, (nox_off_t)o, d);
+       if (res == (off_t)-1)
+               errno = EINVAL;
+       return res;
+}
diff --git a/lib/libc/linux/sys/read.c b/lib/libc/linux/sys/read.c
new file mode 100644 (file)
index 0000000..a73b7e9
--- /dev/null
@@ -0,0 +1,15 @@
+#include <nox_unistd.h>
+
+#include <sys/errno.h>
+#include <sys/file.h>
+
+int read(f, b, l) int f; void *b; int l; {
+       nox_size_t res;
+       
+       res = nox_read(f, b, l);
+       if (res == (nox_size_t)-1) {
+               errno = EIO;
+               return -1;
+       }
+       return (int)res;
+}
diff --git a/lib/libc/linux/sys/readv.c b/lib/libc/linux/sys/readv.c
new file mode 100644 (file)
index 0000000..8fdb3d7
--- /dev/null
@@ -0,0 +1,26 @@
+#include <nox_unistd.h>
+#include <sys/nox_uio.h>
+
+#include <gen.h>
+#include <sys/errno.h>
+#include <sys/file.h>
+#include <sys/uio.h>
+
+int readv(f, v, l) int f; struct iovec *v; int l; {
+       int i;
+       struct nox_iovec iov[8];
+       int res;
+
+       if (l > 8) {
+               read(2, "readv(): iovec too large\n", 25);
+               abort();
+       }
+       for (i = 0; i < l; ++i) {
+               iov[i].nox_iov_base = v[i].iov_base;
+               iov[i].nox_iov_len = v[i].iov_len;
+       }
+       res = nox_readv(f, iov, l);
+       if (res == -1)
+               errno = EIO;
+       return res;
+}
diff --git a/lib/libc/linux/sys/sbrk.c b/lib/libc/linux/sys/sbrk.c
new file mode 100644 (file)
index 0000000..72146e9
--- /dev/null
@@ -0,0 +1,14 @@
+#include <nox_stdint.h>
+#include <nox_unistd.h>
+
+#include <sys/errno.h>
+#include <sys/proc.h>
+
+void *sbrk(i) int i; {
+       void *res;
+
+       res = nox_sbrk(i);
+       if ((intptr_t)res == -1)
+               errno = ENOMEM;
+       return res;
+}
diff --git a/lib/libc/linux/sys/vopen.c b/lib/libc/linux/sys/vopen.c
new file mode 100644 (file)
index 0000000..7fee17a
--- /dev/null
@@ -0,0 +1,49 @@
+#include <nox_fcntl.h>
+
+#include <gen.h>
+#include <sys/errno.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 vopen(f, m, argp) char *f; int m; va_list argp; {
+       int flags;
+       nox_mode_t mode = 0;
+       int res;
+
+       switch (m & 3) {
+       case O_RDONLY:
+               flags = nox_O_RDONLY;
+               break;
+       case O_WRONLY:
+               flags = nox_O_WRONLY;
+               break;
+       case O_RDWR:
+               flags = nox_O_RDWR;
+               break;
+       default:
+               write(2, "vopen(): invalid flags\n", 23);
+               abort();
+       }
+       if (m & O_NDELAY)
+               flags |= nox_O_NDELAY;
+       if (m & O_APPEND)
+               flags |= nox_O_APPEND;
+       if (m & O_CREAT) {
+               flags |= nox_O_CREAT;
+               mode = va_arg(argp, int);
+       }
+       if (m & O_TRUNC)
+               flags |= nox_O_TRUNC;
+       if (m & O_EXCL)
+               flags |= nox_O_EXCL;
+       res = nox_open(f, flags, mode);
+       if (res == -1)
+               errno = ENOENT;
+       return res;
+}
diff --git a/lib/libc/linux/sys/write.c b/lib/libc/linux/sys/write.c
new file mode 100644 (file)
index 0000000..3246a04
--- /dev/null
@@ -0,0 +1,15 @@
+#include <nox_unistd.h>
+
+#include <sys/errno.h>
+#include <sys/file.h>
+
+int write(f, b, l) int f; void *b; int l; {
+       nox_size_t res;
+       
+       res = nox_write(f, b, l);
+       if (res == (nox_size_t)-1) {
+               errno = EIO;
+               return -1;
+       }
+       return (int)res;
+}
diff --git a/lib/libc/linux/sys/writev.c b/lib/libc/linux/sys/writev.c
new file mode 100644 (file)
index 0000000..437936f
--- /dev/null
@@ -0,0 +1,26 @@
+#include <nox_unistd.h>
+#include <sys/nox_uio.h>
+
+#include <gen.h>
+#include <sys/errno.h>
+#include <sys/file.h>
+#include <sys/uio.h>
+
+int writev(f, v, l) int f; struct iovec *v; int l; {
+       int i;
+       struct nox_iovec iov[8];
+       int res;
+
+       if (l > 8) {
+               write(2, "writev(): iovec too large\n", 26);
+               abort();
+       }
+       for (i = 0; i < l; ++i) {
+               iov[i].nox_iov_base = v[i].iov_base;
+               iov[i].nox_iov_len = v[i].iov_len;
+       }
+       res = nox_writev(f, iov, l);
+       if (res == -1)
+               errno = EIO;
+       return res;
+}
index d17a59e..8653f11 100644 (file)
 #include <sys/socket.h>
 /*#include <sys/types.h> arpa/inet.h*/
 
+#ifdef __STDC__
+#include <stdint.h>
+#else
+typedef u_long uintptr_t;
+#endif
+
 /*
  * Copyright (c) 1985 Regents of the University of California.
  * All rights reserved.  The Berkeley software License Agreement
@@ -209,7 +215,9 @@ static struct hostent *getanswer(msg, msglen, iquery) char *msg; int msglen; int
                        }
                }
 
-               bp += ((u_long)bp % sizeof(align));
+/* XXX bp = (char *)(((uintptr_t)bp + sizeof(align) - 1) & ~sizeof(align)); */
+ abort();
+               bp += ((uintptr_t)bp % sizeof(align));
 
                if (bp + n >= &hostbuf[sizeof(hostbuf)]) {
 #ifdef DEBUG
index a84cd95..77895ae 100644 (file)
 #define _va_start(argp, arg) va_start(argp)
 #endif
 
+#ifdef __STDC__
+#include <stdint.h>
+#else
+typedef long intptr_t;
+#ypedef u_long uintptr_t;
+#endif
+
 /*
  * Copyright (c) 1988 Regents of the University of California.
  * All rights reserved.
@@ -78,7 +85,7 @@ int _doprnt(fmt0, argp, fp) u_char *fmt0; va_list argp; register FILE *fp; {
        register int n;         /* random handy integer */
        register char *t;       /* buffer pointer */
        double _double;         /* double precision arguments %[eEfgG] */
-       u_long _ulong;          /* integer arguments %[diouxX] */
+       uintptr_t _ulong;               /* integer arguments %[diouxX] */
        int base;               /* base for [diouxX] conversion */
        int dprec;              /* decimal precision in [diouxX] */
        int fieldsz;            /* field size expanded by sign, etc */
@@ -205,7 +212,8 @@ rflag:              switch (*++fmt) {
                case 'd':
                case 'i':
                        ARG();
-                       if ((long)_ulong < 0) {
+                       if ((intptr_t)_ulong < 0)
+                       {
                                _ulong = -_ulong;
                                sign = '-';
                        }
@@ -274,7 +282,7 @@ rflag:              switch (*++fmt) {
                         *      -- ANSI X3J11
                         */
                        /* NOSTRICT */
-                       _ulong = (u_long)va_arg(argp, void *);
+                       _ulong = (uintptr_t)va_arg(argp, void *);
                        base = 16;
                        goto nosign;
                case 's':
index 9f1e28d..07fee1e 100644 (file)
@@ -105,7 +105,7 @@ void f_prealloc() {
                        *iov = (FILE *)calloc(1, sizeof **iov);
 }
 
-void _fwalk(function) register int (*function)(); {
+void _fwalk(function) register int (*function) __P((FILE *iop)); {
        register FILE **iov;
        register FILE *fp;
 
index 051becb..5830858 100644 (file)
@@ -18,7 +18,7 @@ int open(f, m, va_alist) char *f; int m; va_dcl
        va_list argp;
        int res;
 
-       _va_start(argp, fmt);
+       _va_start(argp, m);
        res = vopen(f, m, argp);
        va_end(argp);
        return res;
index 5aca21c..76394d0 100644 (file)
@@ -122,7 +122,7 @@ DIR *opendir __P((char *name));
 struct direct *readdir __P((register DIR *dirp));
 
 /* gen/scandir.c */
-int scandir __P((char *dirname, struct direct *(*namelist[]), int (*select)(void), int (*dcomp)(void)));
+int scandir __P((char *dirname, struct direct *(*namelist[]), int (*select)(struct direct *d), int (*dcomp)(struct direct *d0, struct direct *d1)));
 int alphasort __P((struct direct **d1, struct direct **d2));
 
 /* gen/seekdir.c */
index 5c1bba9..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
-void   (*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 {
-       void    (*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          (void (*)())-1
-#define        SIG_DFL         (void (*)())0
-#define        SIG_IGN         (void (*)())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       (void (*)())2
-#define        SIG_HOLD        (void (*)())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 */
-void (*signal __P((int s, void (*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 308c9af..e39fdcd 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef _NET_IF_H_
 #define _NET_IF_H_
 
+#include <net/if_arp.h>
 #include <sys/mbuf.h>
 /*#include <sys/socket.h> net/if_arp.h*/
 /*#include <sys/types.h> net/if_arp.h*/
@@ -217,7 +218,7 @@ struct      ifnet *ifnet;
 /*struct       ifaddr *ifa_ifwithaddr(), *ifa_ifwithnet();*/
 /*struct       ifaddr *ifa_ifwithdstaddr();*/
 #else
-#include <net/if_arp.h>
+/*#include <net/if_arp.h>*/
 #endif
 
 #endif
index 440c42e..1ea1666 100644 (file)
@@ -109,4 +109,30 @@ extern     struct protosw inetsw[];
 /*u_long       in_netof(), in_lnaof();*/
 #endif
 
+#ifndef KERNEL
+#ifndef __P
+#ifdef __STDC__
+#define __P(args) args
+#else
+#define __P(args) ()
+#endif
+#endif
+
+/* these should not be here, as they have moved to net.h to be shared with */
+/* netns/ns.h, but I've duplicated them here so that older programs won't */
+/* silently fail due to truncating the return value of ntohl() and htonl() */
+
+/* net/htonl.c */
+u_long htonl __P((u_long hostlong));
+
+/* net/htons.c */
+u_short htons __P((int hostshort));
+
+/* net/ntohl.c */
+u_long ntohl __P((u_long netlong));
+
+/* net/ntohs.c */
+u_short ntohs __P((int netshort));
+#endif
+
 #endif
index fa23b58..4688d87 100644 (file)
@@ -133,6 +133,22 @@ union ns_net ns_broadnet;
 #endif
 #endif
 
+/* these should not be here, as they have moved to net.h to be shared with */
+/* netinet/in.h, but I've duplicated them here so that older programs won't */
+/* silently fail due to truncating the return value of ntohl() and htonl() */
+
+/* net/htonl.c */
+u_long htonl __P((u_long hostlong));
+
+/* net/htons.c */
+u_short htons __P((int hostshort));
+
+/* net/ntohl.c */
+u_long ntohl __P((u_long netlong));
+
+/* net/ntohs.c */
+u_short ntohs __P((int netshort));
+
 /* ns/ns_addr.c */
 struct ns_addr ns_addr __P((char *name));