Make libcross read/write routines work properly, make ld.c use libcross
authorNick Downing <downing.nick@gmail.com>
Wed, 11 Jan 2017 10:21:53 +0000 (21:21 +1100)
committerNick Downing <downing.nick@gmail.com>
Wed, 11 Jan 2017 10:21:53 +0000 (21:21 +1100)
40 files changed:
.gitignore
bin/ld/Makefile
bin/ld/include/a.out.h [deleted symlink]
bin/ld/include/ar.h [deleted symlink]
bin/ld/include/nlist.h [deleted symlink]
bin/ld/include/ranlib.h [deleted symlink]
bin/ld/include/sys/exec.h [deleted symlink]
bin/ld/include/vmf.h [deleted symlink]
bin/ld/krcompat.h [deleted file]
bin/ld/ld.c
bin/ld/n.sh
lib/libcross/subset_include/time.h [deleted file]
n.sh
o.sh
p.sh
share/zoneinfo/Makefile
share/zoneinfo/o.sh
usr.lib/libF77/Version.c
usr.lib/libcross/Makefile [moved from lib/libcross/Makefile with 89% similarity]
usr.lib/libcross/copy.sed [moved from lib/libcross/copy.sed with 71% similarity]
usr.lib/libcross/cross.c [moved from lib/libcross/cross.c with 64% similarity]
usr.lib/libcross/cross.h [moved from lib/libcross/cross.h with 62% similarity]
usr.lib/libcross/ctime.c [moved from lib/libcross/ctime.c with 75% similarity]
usr.lib/libcross/n.sh [moved from lib/libcross/n.sh with 87% similarity]
usr.lib/libcross/nlist.c [moved from lib/libcross/nlist.c with 85% similarity]
usr.lib/libcross/nlist.h [new file with mode: 0644]
usr.lib/libcross/nsym.c [moved from lib/libcross/nsym.c with 50% similarity]
usr.lib/libcross/subset_include/a.out.h [moved from lib/libcross/subset_include/a.out.h with 79% similarity]
usr.lib/libcross/subset_include/ar.h [moved from lib/libcross/subset_include/ar.h with 100% similarity]
usr.lib/libcross/subset_include/nlist.h [moved from lib/libcross/subset_include/nlist.h with 85% similarity]
usr.lib/libcross/subset_include/ranlib.h [moved from lib/libcross/subset_include/ranlib.h with 99% similarity]
usr.lib/libcross/subset_include/time.h [new file with mode: 0644]
usr.lib/libcross/subset_include/tzfile.h [moved from lib/libcross/subset_include/tzfile.h with 100% similarity]
usr.lib/libcross/subset_sys_h/exec.h [moved from lib/libcross/subset_sys_h/exec.h with 100% similarity]
usr.lib/libcross/subset_sys_h/param.h [moved from lib/libcross/subset_sys_h/param.h with 97% similarity]
usr.lib/libcross/subset_sys_h/types.h [moved from lib/libcross/subset_sys_h/types.h with 92% similarity]
usr.lib/libcross/timezone.c [moved from lib/libcross/timezone.c with 85% similarity]
usr.lib/libvmf/Makefile
usr.lib/libvmf/vmf.h [moved from include/vmf.h with 100% similarity]
usr.sbin/named/named/version

index 62e82f4..d72a3e6 100644 (file)
@@ -188,7 +188,6 @@ lib/libc/stdlib/stdliblib
 lib/libc/stdlib/stdliblib_p
 lib/libc/string/stringlib
 lib/libc/string/stringlib_p
-lib/libcross/cross
 lib/libkern/*.s
 libexec/acctd/acctd
 libexec/comsat/comsat
index 8f9bc66..44fb00c 100644 (file)
@@ -1,13 +1,9 @@
-LD=ld
 MANROFF=/usr/man/manroff
 INSTALL=install
 # Version 2.2 January 24, 1998
 
-# using VPATH to compile ./nsym.o from ../../lib/libc/pdp/gen/nsym.c does not
-# work if there is a ../../lib/libc.pdp/gen/nsym.o leftover from building libc
-#VPATH=../../lib/libc/pdp/gen
-SRCS=ld.c ../../lib/libc/pdp/gen/nsym.c
-OBJS=ld.o ../../lib/libc/pdp/gen/nsym.o
+SRCS=ld.c
+OBJS=ld.o
 MAN=ld.0
 MANSRC=ld.1
 
@@ -17,7 +13,7 @@ SEPFLAG=-i
 all:   ld ld.0
 
 ld: ${OBJS}
-       ${CC} ${SEPFLAG} ${LDFLAGS} -o ld ${OBJS} -lvmf
+       ${CC} ${SEPFLAG} ${LDFLAGS} -o ld ${OBJS} -lvmf ${LIBCROSS}
 
 install: all
        ${INSTALL} -c -s -o bin -g bin -m 755 ld ${DESTDIR}/bin/ld
diff --git a/bin/ld/include/a.out.h b/bin/ld/include/a.out.h
deleted file mode 120000 (symlink)
index 9dd9aa8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../../../include/a.out.h
\ No newline at end of file
diff --git a/bin/ld/include/ar.h b/bin/ld/include/ar.h
deleted file mode 120000 (symlink)
index 7245d58..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../../../include/ar.h
\ No newline at end of file
diff --git a/bin/ld/include/nlist.h b/bin/ld/include/nlist.h
deleted file mode 120000 (symlink)
index 0c27973..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../../../include/nlist.h
\ No newline at end of file
diff --git a/bin/ld/include/ranlib.h b/bin/ld/include/ranlib.h
deleted file mode 120000 (symlink)
index bce4b4b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../../../include/ranlib.h
\ No newline at end of file
diff --git a/bin/ld/include/sys/exec.h b/bin/ld/include/sys/exec.h
deleted file mode 120000 (symlink)
index 0f3c005..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../../../../sys/h/exec.h
\ No newline at end of file
diff --git a/bin/ld/include/vmf.h b/bin/ld/include/vmf.h
deleted file mode 120000 (symlink)
index 9594a15..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../../../include/vmf.h
\ No newline at end of file
diff --git a/bin/ld/krcompat.h b/bin/ld/krcompat.h
deleted file mode 100644 (file)
index b5c0b7d..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef _KRCOMPAT_H
-#define _KRCOMPAT_H 1
-
-#undef PARAMS
-#ifdef __STDC__
-#include <stdarg.h>
-#define VA_START(ap, arg) va_start(ap, arg)
-#define PARAMS(args) args
-#else
-#include <varargs.h>
-#define VA_START(ap, arg) va_start(ap)
-#define PARAMS(args) ()
-#endif
-
-#ifdef __GNUC__
-#define NORETURN __attribute__ ((noreturn))
-#else
-#define NORETURN
-#endif
-
-#endif
index c4b70b9..f16c49c 100644 (file)
@@ -60,24 +60,29 @@ static char *sccsid = "@(#)ld.c     4.6 1998/01/19";
 #include <signal.h>
 #include <sys/stat.h>
 #include <sys/file.h>
-#include <a.out.h>
-#include <ar.h>
-#include <ranlib.h>
 #include <vmf.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <string.h>
 #include "archive.h"
-#include "krcompat.h"
 
-#ifdef pdp11
-#include <sys/types.h>
-#define OFF_T off_t
-#define INT int
+#ifdef CROSS
+#include "cross/a.out.h"
+#include "cross/ar.h"
+#include "cross/ranlib.h"
+#include "cross/sys/types.h"
 #else
-#include <stdint.h>
-#define OFF_T int32_t
-#define INT int16_t
+#include <a.out.h>
+#include <ar.h>
+#include <ranlib.h>
+#include <sys/types.h>
+#define cross_ar_hdr ar_hdr
+#define cross_exec exec
+#define cross_int_t int
+#define cross_nlist nlist
+#define cross_off_t off_t
+#define cross_ranlib ranlib
+#define cross_xexec xexec
 #endif
 
 /*
@@ -169,7 +174,7 @@ typedef struct {
        typedef struct
                {
                union   {
-#ifdef pdp11
+#ifndef CROSS
                        int     *iptr;
 #endif
                        char    *cptr;
@@ -181,7 +186,7 @@ typedef struct {
                int     bsize;          /* MUST be a power of 2 */
                int     *buff;
                } STREAM;
-#ifdef pdp11
+#ifndef CROSS
 #define        Iptr    ptr.iptr
 #endif
 #define        Cptr    ptr.cptr
@@ -198,7 +203,7 @@ typedef struct {
 /*
  * Header from the a.out and the archive it is from (if any).
  */
-       struct  xexec   filhdr;
+       struct  cross_xexec     filhdr;
        CHDR    chdr;
 
 /* symbol management */
@@ -283,11 +288,7 @@ int        iflag;          /* I/D space separated */
        char    *ofilename = "l.out";
        int     infil;                  /* current input file descriptor */
        char    *filname;               /* and its name */
-#if pdp11
-       char    tfname[14]; /*[] = "/tmp/ldaXXXXX";*/
-#else
-       char    tfname[15]; /*[] = "/tmp/ldaXXXXXX"; linux requires 6 X's */
-#endif
+       char    tfname[15]; /*[] = "/tmp/ldaXXXXXX";*/
 
        FILE    *toutb, *doutb, *troutb, *droutb, *soutb, *voutb;
 
@@ -313,45 +314,52 @@ u_int     ovbase;                 /* The base address of the overlays */
 
        char    *rstrtab;       /* ranlib string table pointer */
 
-int main PARAMS((int argc, char **argv));
-int delexit PARAMS((void));
-void endload PARAMS((int argc, char **argv));
-VADDR sym2va PARAMS((int x));
-void load1arg PARAMS((register char *cp, int flag));
-int step PARAMS((OFF_T nloc));
-int ldrand PARAMS((int totnum, OFF_T sloc));
-void mgets PARAMS((register char *buf, int maxlen, int which));
-int load1 PARAMS((int libflg, OFF_T loc));
-void middle PARAMS((void));
-void ldrsym PARAMS((int ix, u_int val, int type));
-void setupout PARAMS((void));
-void load2arg PARAMS((char *acp, int flag));
-void load2 PARAMS((long loc));
-void load2td PARAMS((struct local *lp, u_int creloc, FILE *b1, FILE *b2));
-void finishout PARAMS((void));
-long rnd8k PARAMS((u_int siz));
-void mkfsym PARAMS((char *s));
-void mget PARAMS((register char *loc, int an, int which));
-void dseek PARAMS((int which, OFF_T aloc, int s));
-int get PARAMS((int which));
-int getfile PARAMS((char *acp, int flag, int phase));
-int libopen PARAMS((char *name, int oflags));
-short *lookup PARAMS((void));
-short *slookup PARAMS((char *s));
-int enter PARAMS((short *hp));
-void error PARAMS((int n, char *s));
-void readhdr PARAMS((OFF_T loc));
-void tcreat PARAMS((FILE **fpp, int tempflg));
-int adrof PARAMS((char *s));
-void copy PARAMS((register FILE *fp));
-short *lookloc PARAMS((struct local *alp, int r));
-void roundov PARAMS((void));
-u_int add PARAMS((int a, int b, char *s));
-int get_arobj PARAMS((int fd));
-OFF_T skip PARAMS((void));
-void inistr PARAMS((int which));
-
-static void hreset PARAMS((void));
+#ifndef __P
+#ifdef __STDC__
+#define __P(params) params
+#else
+#define __P(params) ()
+#endif
+#endif
+
+int main __P((int argc, char **argv));
+int delexit __P((void));
+void endload __P((int argc, char **argv));
+VADDR sym2va __P((int x));
+void load1arg __P((register char *cp, int flag));
+int step __P((cross_off_t nloc));
+int ldrand __P((int totnum, cross_off_t sloc));
+void mgets __P((register char *buf, int maxlen, int which));
+int load1 __P((int libflg, cross_off_t loc));
+static void hreset __P((void));
+void middle __P((void));
+void ldrsym __P((int ix, u_int val, int type));
+void setupout __P((void));
+void load2arg __P((char *acp, int flag));
+void load2 __P((long loc));
+void load2td __P((struct local *lp, u_int creloc, FILE *b1, FILE *b2));
+void finishout __P((void));
+long rnd8k __P((u_int siz));
+void mkfsym __P((char *s));
+void mget __P((register char *loc, int an, int which));
+void dseek __P((int which, cross_off_t aloc, int s));
+int get __P((int which));
+int getfile __P((char *acp, int flag, int phase));
+int libopen __P((char *name, int oflags));
+short *lookup __P((void));
+short *slookup __P((char *s));
+int enter __P((short *hp));
+void error __P((int n, char *s));
+void readhdr __P((cross_off_t loc));
+void tcreat __P((FILE **fpp, int tempflg));
+int adrof __P((char *s));
+void copy __P((register FILE *fp));
+short *lookloc __P((struct local *alp, int r));
+void roundov __P((void));
+u_int add __P((int a, int b, char *s));
+int get_arobj __P((int fd));
+cross_off_t skip __P((void));
+void inistr __P((int which));
 
 int main(argc, argv) int argc; char **argv; {
        register int c, i;
@@ -581,18 +589,18 @@ void endload(argc, argv) int argc; char **argv; {
 
                case 'D':
                        for (dnum = atoi(*p);dorigin < dnum; dorigin += 2) {
-#ifdef pdp11
-                               putw(0, doutb);
-#else
+#ifdef CROSS
                                putc(0, doutb);
                                putc(0, doutb);
+#else
+                               putw(0, doutb);
 #endif
                                if (rflag) {
-#ifdef pdp11
-                                       putw(0, droutb);
-#else
+#ifdef CROSS
                                        putc(0, droutb);
                                        putc(0, droutb);
+#else
+                                       putw(0, droutb);
 #endif
                                }
                        }
@@ -652,12 +660,9 @@ VADDR sym2va(x) u_short    x; {
  * Scan file to find defined symbols.
  */
 void load1arg(cp, flag) register char *cp; int flag; {
-       OFF_T nloc;
+       cross_off_t nloc;
        int kind, tnum;
-       OFF_T ltnum, strsize;
-#ifndef pdp11
-       char temp[sizeof (OFF_T)];
-#endif
+       cross_off_t ltnum, strsize;
 
        kind = getfile(cp, flag, 1);
        if (Mflag)
@@ -691,17 +696,14 @@ void load1arg(cp, flag) register char *cp; int flag; {
         * when there is a table of contents!)
         */
        case 2:
-               nloc = SARMAG + sizeof (struct ar_hdr) + chdr.lname;
+               nloc = SARMAG + sizeof (struct cross_ar_hdr) + chdr.lname;
                lseek(infil, (off_t)nloc, L_SET);
 /*
  * Read the size of the ranlib structures (a long).
 */
-#ifdef pdp11
-               read(infil, &ltnum, sizeof (OFF_T));
-#else
-               read(infil, temp, sizeof (OFF_T));
-               ltnum = ((temp[0] & 0xffL) << 16) | ((temp[1] & 0xffL) << 24) |
-                   (temp[2] & 0xffL) | ((temp[3] & 0xffL) << 8);
+               read(infil, &ltnum, sizeof (cross_off_t));
+#ifdef CROSS
+               ltnum = cross_read_off_t((char *)&ltnum);
 #endif
  /*fprintf(stderr, "ltnum=%08lx\n", ltnum);*/
 /*
@@ -710,16 +712,13 @@ void load1arg(cp, flag) register char *cp; int flag; {
 */
                nloc += (sizeof (ltnum) + ltnum);
  /*fprintf(stderr, "nloc=%08lx\n", nloc);*/
-               tnum = ltnum / sizeof (struct ranlib);
+               tnum = ltnum / sizeof (struct cross_ranlib);
 
                rstrtab = NULL;
                lseek(infil, (off_t)nloc, L_SET);
-#ifdef pdp11
-               read(infil, &strsize, sizeof (OFF_T));
-#else
-               read(infil, temp, sizeof (OFF_T));
-               strsize = ((temp[0] & 0xffL) << 16) | ((temp[1] & 0xffL) << 24) |
-                   (temp[2] & 0xffL) | ((temp[3] & 0xffL) << 8);
+               read(infil, &strsize, sizeof (cross_off_t));
+#ifdef CROSS
+               strsize = cross_read_off_t((char *)&strsize);
 #endif
  /*fprintf(stderr, "strsize=%08lx\n", strsize);*/
                if      (strsize <= 8192L)
@@ -769,7 +768,7 @@ void load1arg(cp, flag) register char *cp; int flag; {
  * is useful, record its location in the liblist structure
  * for use in pass2.  Mark the end of the archive in libilst with a -1.
  */
-int step(nloc) OFF_T nloc; {
+int step(nloc) cross_off_t nloc; {
        lseek(infil, (off_t)nloc, L_SET);
        if      (get_arobj(infil) <= 0)
                {
@@ -777,7 +776,7 @@ int step(nloc) OFF_T nloc; {
                libp++;
                return (0);
                }
-       if      (load1(1, nloc + sizeof (struct ar_hdr) + chdr.lname))
+       if      (load1(1, nloc + sizeof (struct cross_ar_hdr) + chdr.lname))
                {
                libp->loc = nloc;
                libp++;
@@ -787,27 +786,24 @@ int step(nloc) OFF_T nloc; {
        return (1);
 }
 
-int ldrand(totnum, sloc) int totnum; OFF_T sloc; {
+int ldrand(totnum, sloc) int totnum; cross_off_t sloc; {
        register int ntab;
        SYMBOL  *sp;
        short   *hp;
        VADDR   vsym;
        LIBLIST *oldp = libp;
        int amt, tnum = totnum;
-       OFF_T   loc;
+       cross_off_t     loc;
  /*fprintf(stderr, "totnum=%d sloc=%08lx\n", tnum, sloc);*/
 /*
  * 'ar' header + member header + SYMDEF table.of.contents + long filename
 */
-       OFF_T   opos = (OFF_T)SARMAG + sizeof (struct ar_hdr) + sizeof (OFF_T) +
+       cross_off_t     opos = (cross_off_t)SARMAG + sizeof (struct cross_ar_hdr) + sizeof (cross_off_t) +
                        chdr.lname;
 #define TABSZ 64
        char    localname[NNAMESIZE];
-       register struct ranlib *tp;
-       struct ranlib tab[TABSZ], *tplast;
-#ifndef pdp11
-       char buf[TABSZ * sizeof (struct ranlib)], *temp;
-#endif
+       register struct cross_ranlib *tp;
+       struct cross_ranlib tab[TABSZ], *tplast;
 
        while   (tnum)
                {
@@ -818,41 +814,31 @@ int ldrand(totnum, sloc) int totnum; OFF_T sloc; {
  /*fprintf(stderr, "ntab=%d opos=%08lx\n", ntab, opos);*/
                tplast = &tab[ntab - 1];
                (void)lseek(infil, (off_t)opos, L_SET);
-               amt = ntab * sizeof (struct ranlib);
-#ifdef pdp11
+               amt = ntab * sizeof (struct cross_ranlib);
                if      (read(infil, tab, amt) != amt)
                        error(1, "EOF in ldrand");
-#else
-               if      (read(infil, buf, amt) != amt)
-                       error(1, "EOF in ldrand");
-               temp = buf;
-               for     (tp = tab; tp <= tplast; tp++)
-                       {
-                       tp->ran_un.ran_strx = ((temp[0] & 0xffL) << 16) | ((temp[1] & 0xffL) << 24) |
-                           (temp[2] & 0xffL) | ((temp[3] & 0xffL) << 8);
-                       tp->ran_off = ((temp[4] & 0xffL) << 16) | ((temp[5] & 0xffL) << 24) |
-                           (temp[6] & 0xffL) | ((temp[7] & 0xffL) << 8);
-                       temp += sizeof (struct ranlib);
-                       }
-#endif
                tnum -= ntab;
                opos += amt;
 
                for     (tp = tab; tp <= tplast; tp++)
                        {
+#ifdef CROSS
+                       tp->ran_un.ran_strx = cross_read_off_t((char *)&tp->ran_un.ran_strx);
+                       tp->ran_off = cross_read_off_t((char *)&tp->ran_off);
+#endif
 /*
  * This is slower and uglier than we would like, but it is not always
  * possible to hold the entire string table in memory.  Need to add
  * an extra increment to skip over the string table size longword.
 */
- /*fprintf(stderr, "ran_strx=%ld\n", tp->ran_un.ran_strx);*/
+ /*fprintf(stderr, "ran_strx=%ld ran_off=%ld\n", tp->ran_un.ran_strx, tp->ran_off);*/
                        if      (rstrtab)
                                strncpy(localname, (int)tp->ran_un.ran_strx +
                                                rstrtab, NNAMESIZE);
                        else
                                {
                                dseek(STRINGS2, tp->ran_un.ran_strx + sloc +
-                                       sizeof (OFF_T), 07777);
+                                       sizeof (cross_off_t), 07777);
                                mgets(localname, NNAMESIZE, STRINGS2);
                                }
  /*fprintf(stderr, "localname=%s\n", localname);*/
@@ -882,7 +868,7 @@ void mgets(buf, maxlen, which) register char *buf; int maxlen; int which; {
                {
                if      (--sp->nibuf < 0)
                        {
-                       dseek(which, (OFF_T)(sp->bno + 1) * sp->bsize, 077777);
+                       dseek(which, (cross_off_t)(sp->bno + 1) * sp->bsize, 077777);
                        sp->nibuf--;
                        }
                if      ((*buf++ = *sp->Cptr++) == 0)
@@ -893,19 +879,15 @@ void mgets(buf, maxlen, which) register char *buf; int maxlen; int which; {
 /*
  * Examine a single file or archive member on pass 1.
  */
-int load1(libflg, loc) int libflg; OFF_T loc; {
+int load1(libflg, loc) int libflg; cross_off_t loc; {
        register SYMBOL *sp;
        int savindex;
        int ndef, type, mtype;
        long nlocal;
        VADDR   vsym;
-#ifndef pdp11
-       /* note: must be at least as large as OFF_T */
-       char    temp[sizeof (struct nlist)];
-#endif
-       struct  nlist objsym;
-       OFF_T   strloc;
-       OFF_T   strsize;
+       struct  cross_nlist objsym;
+       cross_off_t     strloc;
+       cross_off_t     strsize;
        char    *strtab;
        register struct vseg *seg;
 
@@ -928,12 +910,9 @@ int load1(libflg, loc) int libflg; OFF_T loc; {
 
        strloc = loc + N_STROFF(filhdr);
        lseek(infil, (off_t)strloc, L_SET);
-#ifdef pdp11
-       read(infil, &strsize, sizeof (OFF_T));
-#else
-       read(infil, temp, sizeof (OFF_T));
-       strsize = ((temp[0] & 0xffL) << 16) | ((temp[1] & 0xffL) << 24) |
-           (temp[2] & 0xffL) | ((temp[3] & 0xffL) << 8);
+       read(infil, &strsize, sizeof (cross_off_t));
+#ifdef CROSS
+       strsize = cross_read_off_t((char *)&strsize);
 #endif
        strtab = NULL;
        if      (strsize <= 8192L)
@@ -946,15 +925,10 @@ int load1(libflg, loc) int libflg; OFF_T loc; {
                inistr(STRINGS);
 
        while (Input[SYMBOLS].nsize > 0) {
-#ifdef pdp11
                mget((char *)&objsym, sizeof objsym, SYMBOLS);
-#else
-               mget(temp, sizeof objsym, SYMBOLS);
-               objsym.n_un.n_strx = ((temp[0] & 0xffL) << 16) | ((temp[1] & 0xffL) << 24) |
-                   (temp[2] & 0xffL) | ((temp[3] & 0xffL) << 8);
-               objsym.n_type = temp[4] & 0xff;
-               objsym.n_ovly = temp[5] & 0xff;
-               objsym.n_value = (temp[6] & 0xff) | ((temp[7] & 0xff) << 8);
+#ifdef CROSS
+               objsym.n_un.n_strx = cross_read_off_t((char *)&objsym.n_un.n_strx);
+               objsym.n_value = cross_read_uint((char *)&objsym.n_value);
 #endif
                type = objsym.n_type;
                if (Sflag) {
@@ -972,10 +946,10 @@ int load1(libflg, loc) int libflg; OFF_T loc; {
  * to place the strings in the same order as the symbols - so effectively
  * we are doing a sequential read of the string table.
 */
- /*fprintf(stderr, "n_strx=%ld\n", objsym.n_un.n_strx);*/
+ /*fprintf(stderr, "n_strx=%ld n_type=%d n_ovly=%d n_value=%ld\n", objsym.n_un.n_strx, objsym.n_type, objsym.n_ovly, objsym.n_value);*/
                if      (strtab)
                        strncpy(cursym.n_name, (int)objsym.n_un.n_strx + 
-                               strtab - sizeof (OFF_T), NNAMESIZE);
+                               strtab - sizeof (cross_off_t), NNAMESIZE);
                else
                        {
                        dseek(STRINGS, objsym.n_un.n_strx + strloc, 077777);
@@ -1274,9 +1248,8 @@ void ldrsym(ix, val, type) int ix; u_int val; int type; {
 void setupout() {
        VADDR   vsym;
        register SYMBOL *sp;
-#ifndef pdp11
-       /* note: must be at least as large as struct exec */
-       char    temp[sizeof (struct ovlhdr)];
+#ifdef CROSS
+       struct cross_xexec temp_filhdr;
        int i;
 #endif
 
@@ -1302,7 +1275,7 @@ void setupout() {
        filhdr.e.a_text = tsize;
        filhdr.e.a_data = dsize;
        filhdr.e.a_bss = bsize;
-       ssize = sflag? 0 : (ssize + (sizeof (struct nlist)) * symindex);
+       ssize = sflag? 0 : (ssize + (sizeof (struct cross_nlist)) * symindex);
 /*
  * This is an estimate, the real size is computed later and the
  * a.out header rewritten with the correct value.
@@ -1321,38 +1294,27 @@ void setupout() {
        } else
                filhdr.e.a_entry = 0;
        filhdr.e.a_flag = (rflag==0);
-#ifdef pdp11
-       fwrite(&filhdr.e, sizeof (filhdr.e), 1, toutb);
+#ifdef CROSS
+       cross_write_int((char *)&temp_filhdr.e.a_magic, filhdr.e.a_magic);
+       cross_write_uint((char *)&temp_filhdr.e.a_text, filhdr.e.a_text);
+       cross_write_uint((char *)&temp_filhdr.e.a_data, filhdr.e.a_data);
+       cross_write_uint((char *)&temp_filhdr.e.a_bss, filhdr.e.a_bss);
+       cross_write_uint((char *)&temp_filhdr.e.a_syms, filhdr.e.a_syms);
+       cross_write_uint((char *)&temp_filhdr.e.a_entry, filhdr.e.a_entry);
+       cross_write_uint((char *)&temp_filhdr.e.a_unused, filhdr.e.a_unused);
+       cross_write_uint((char *)&temp_filhdr.e.a_flag, filhdr.e.a_flag);
+       fwrite(&temp_filhdr.e, sizeof (filhdr.e), 1, toutb);
 #else
-       temp[0] = filhdr.e.a_magic & 0xff;
-       temp[1] = (filhdr.e.a_magic >> 8) & 0xff;
-       temp[2] = filhdr.e.a_text & 0xff;
-       temp[3] = (filhdr.e.a_text >> 8) & 0xff;
-       temp[4] = filhdr.e.a_data & 0xff;
-       temp[5] = (filhdr.e.a_data >> 8) & 0xff;
-       temp[6] = filhdr.e.a_bss & 0xff;
-       temp[7] = (filhdr.e.a_bss >> 8) & 0xff;
-       temp[8] = filhdr.e.a_syms & 0xff;
-       temp[9] = (filhdr.e.a_syms >> 8) & 0xff;
-       temp[10] = filhdr.e.a_entry & 0xff;
-       temp[11] = (filhdr.e.a_entry >> 8) & 0xff;
-       temp[12] = filhdr.e.a_unused & 0xff;
-       temp[13] = (filhdr.e.a_unused >> 8) & 0xff;
-       temp[14] = filhdr.e.a_flag & 0xff;
-       temp[15] = (filhdr.e.a_flag >> 8) & 0xff;
-       fwrite(temp, sizeof (filhdr.e), 1, toutb);
+       fwrite(&filhdr.e, sizeof (filhdr.e), 1, toutb);
 #endif
        if (numov) {
-#ifdef pdp11
-               fwrite(&filhdr.o, sizeof (filhdr.o), 1, toutb);
+#ifdef CROSS
+               cross_write_int((char *)&temp_filhdr.o.max_ovl, filhdr.o.max_ovl);
+               for (i = 0; i < NOVL; ++i)
+                       cross_write_uint((char *)(temp_filhdr.o.ov_siz + i), filhdr.o.ov_siz[i]);
+               fwrite(&temp_filhdr.o, sizeof (filhdr.o), 1, toutb);
 #else
-               temp[0] = filhdr.o.max_ovl & 0xff;
-               temp[1] = (filhdr.o.max_ovl >> 8) & 0xff;
-               for (i = 0; i < NOVL; ++i) {
-                       temp[i * 2 + 2] = filhdr.o.ov_siz[i] & 0xff;
-                       temp[i * 2 + 3] = (filhdr.o.ov_siz[i] >> 8) & 0xff;
-               }
-               fwrite(temp, sizeof (filhdr.o), 1, toutb);
+               fwrite(&filhdr.o, sizeof (filhdr.o), 1, toutb);
 #endif
        }
 }
@@ -1379,7 +1341,7 @@ void load2arg(acp, flag) char *acp; int flag; {
                                lseek(infil, (off_t)lp->loc, L_SET);
                                get_arobj(infil);
                                mkfsym(chdr.name);
-                               load2(lp->loc + sizeof (struct ar_hdr) + 
+                               load2(lp->loc + sizeof (struct cross_ar_hdr) + 
                                        chdr.lname);
                        }
                        libp = ++lp;
@@ -1395,14 +1357,10 @@ void load2(loc) long loc; {
        int type, mtype;
        VADDR   vsym;
        short   i;
-       struct  nlist objsym;
-       OFF_T   stroff;
+       struct  cross_nlist objsym;
+       cross_off_t     stroff;
        char    *strtab;
-       OFF_T   strsize;
-#ifndef pdp11
-       /* note: must be at least as large as OFF_T */
-       char    temp[sizeof (struct nlist)];
-#endif
+       cross_off_t     strsize;
 
        readhdr(loc);
        ctrel = torigin;
@@ -1418,12 +1376,9 @@ void load2(loc) long loc; {
        stroff = loc + N_STROFF(filhdr);
 
        lseek(infil, (off_t)stroff, L_SET);
-#ifdef pdp11
-       read(infil, &strsize, sizeof (OFF_T));
-#else
-       read(infil, temp, sizeof (OFF_T));
-       strsize = ((temp[0] & 0xffL) << 16) | ((temp[1] & 0xffL) << 24) |
-           (temp[2] & 0xffL) | ((temp[3] & 0xffL) << 8);
+       read(infil, &strsize, sizeof (cross_off_t));
+#ifdef CROSS
+       strsize = cross_read_off_t((char *)&strsize);
 #endif
        strtab = NULL;
        if      (strsize <= 8192L)
@@ -1437,24 +1392,21 @@ void load2(loc) long loc; {
 
        while (Input[SYMBOLS].nsize > 0) {
                symno++;
-#ifdef pdp11
                mget((char *)&objsym, sizeof objsym, SYMBOLS);
-#else
-               mget(temp, sizeof objsym, SYMBOLS);
-               objsym.n_un.n_strx = ((temp[0] & 0xffL) << 16) | ((temp[1] & 0xffL) << 24) |
-                   (temp[2] & 0xffL) | ((temp[3] & 0xffL) << 8);
-               objsym.n_type = temp[4] & 0xff;
-               objsym.n_ovly = temp[5] & 0xff;
-               objsym.n_value = (temp[6] & 0xff) | ((temp[7] & 0xff) << 8);
+#ifdef CROSS
+               objsym.n_un.n_strx = cross_read_off_t((char *)&objsym.n_un.n_strx);
+               objsym.n_value = cross_read_uint((char *)&objsym.n_value);
 #endif
+ /*fprintf(stderr, "n_strx=%ld n_type=%d n_ovly=%d n_value=%ld\n", objsym.n_un.n_strx, objsym.n_type, objsym.n_ovly, objsym.n_value);*/
                if      (strtab)
                        strncpy(cursym.n_name, (int)objsym.n_un.n_strx +
-                               strtab - sizeof (OFF_T), NNAMESIZE);
+                               strtab - sizeof (cross_off_t), NNAMESIZE);
                else
                        {
                        dseek(STRINGS, objsym.n_un.n_strx + stroff, 07777);
                        mgets(cursym.n_name, NNAMESIZE, STRINGS);
                        }
+ /*fprintf(stderr, "n_name=%s\n", cursym.n_name);*/
                cursym.n_type = objsym.n_type;
                cursym.n_value = objsym.n_value;
                cursym.n_ovly = objsym.n_ovly;
@@ -1570,11 +1522,11 @@ void load2td(lp, creloc, b1, b2) struct local *lp; u_int creloc; FILE *b1, *b2;
                        Input[TEXT].nsize++;
                        t = get(TEXT);
                } else {
-#ifdef pdp11
-                       t = *Input[TEXT].Iptr++;
-#else
+#ifdef CROSS
                        t = *Input[TEXT].Cptr++ & 0xff;
-                       t |= (*Input[TEXT].Cptr++ & 0xff) << 8; 
+                       t |= (*Input[TEXT].Cptr++ & 0xff) << 8;
+#else
+                       t = *Input[TEXT].Iptr++;
 #endif
                }
 
@@ -1589,11 +1541,11 @@ void load2td(lp, creloc, b1, b2) struct local *lp; u_int creloc; FILE *b1, *b2;
                        Input[RELOC].nsize++;
                        r = get(RELOC);
                } else {
-#ifdef pdp11
-                       r = *Input[RELOC].Iptr++;
-#else
+#ifdef CROSS
                        r = *Input[RELOC].Cptr++ & 0xff;
-                       r |= (*Input[RELOC].Cptr++ & 0xff) << 8;        
+                       r |= (*Input[RELOC].Cptr++ & 0xff) << 8;
+#else
+                       r = *Input[RELOC].Iptr++;
 #endif
                }
 #if 0
@@ -1630,18 +1582,18 @@ void load2td(lp, creloc, b1, b2) struct local *lp; u_int creloc; FILE *b1, *b2;
                }
                if (r&01)
                        t -= creloc;
-#ifdef pdp11
-               putw(t, b1);
-#else
+#ifdef CROSS
                putc(t & 0xff, b1);
                putc((t >> 8) & 0xff, b1);
+#else
+               putw(t, b1);
 #endif
                if (rflag) {
-#ifdef pdp11
-                       putw(r, b2);
-#else
+#ifdef CROSS
                        putc(r & 0xff, b2);
                        putc((r >> 8) & 0xff, b2);
+#else
+                       putw(r, b2);
 #endif
                }
        }
@@ -1650,15 +1602,15 @@ void load2td(lp, creloc, b1, b2) struct local *lp; u_int creloc; FILE *b1, *b2;
 void finishout() {
        register u_int n;
        register SYMBOL *sp;
-       struct  nlist objsym;
+       struct  cross_nlist objsym;
        VADDR   vsym;
        int type, len;
-       OFF_T   stroff;
+       cross_off_t     stroff;
        long dtotal, ovrnd;
-       INT     thunk[THUNKSIZ / sizeof (INT)];
-#ifndef pdp11
-       /* note: must be at least as large as struct nlist, THUNKSIZ, OFF_T */
-       char    temp[sizeof (struct exec)];
+       cross_int_t     thunk[THUNKSIZ / sizeof (cross_int_t)];
+#ifdef CROSS
+       cross_off_t     temp_stroff;
+       struct cross_xexec      temp_filhdr;
 #endif
  
        if (numov) {
@@ -1677,19 +1629,13 @@ void finishout() {
                                thunk[1] = sp->sovalue + 4;
                                thunk[2] = 04537;       /* jsr r5, ovhndlrx */
                                thunk[3] = aovhndlr[sp->n_ovly];
-#ifdef pdp11
-                               fwrite(thunk, THUNKSIZ, 1, toutb);
-#else
-                               temp[0] = thunk[0] & 0xff;
-                               temp[1] = (thunk[0] >> 8) & 0xff;
-                               temp[2] = thunk[1] & 0xff;
-                               temp[3] = (thunk[1] >> 8) & 0xff;
-                               temp[4] = thunk[2] & 0xff;
-                               temp[5] = (thunk[2] >> 8) & 0xff;
-                               temp[6] = thunk[3] & 0xff;
-                               temp[7] = (thunk[3] >> 8) & 0xff;
-                               fwrite(temp, THUNKSIZ, 1, toutb);
+#ifdef CROSS
+                               cross_write_int((char *)thunk, thunk[0]);
+                               cross_write_int((char *)(thunk + 1), thunk[1]);
+                               cross_write_int((char *)(thunk + 2), thunk[2]);
+                               cross_write_int((char *)(thunk + 3), thunk[3]);
 #endif
+                               fwrite(thunk, THUNKSIZ, 1, toutb);
                                torigin += THUNKSIZ;
                        }
                }
@@ -1698,18 +1644,18 @@ void finishout() {
                n = torigin;
                while (n&077) {
                        n += 2;
-#ifdef pdp11
-                       putw(0, toutb);
-#else
+#ifdef CROSS
                        putc(0, toutb);
                        putc(0, toutb);
+#else
+                       putw(0, toutb);
 #endif
                        if (rflag) {
-#ifdef pdp11
-                               putw(0, troutb);
-#else
+#ifdef CROSS
                                putc(0, troutb);
                                putc(0, troutb);
+#else
+                               putw(0, troutb);
 #endif
                        }
                }
@@ -1739,7 +1685,7 @@ void finishout() {
 
                tcreat(&doutb, 1);
                nsym = 0;
-               stroff = sizeof (OFF_T);                /* string table size */
+               stroff = sizeof (cross_off_t);          /* string table size */
                if      (xflag == 0)
                        {
                        fflush(soutb);          /* flush local symbol file */
@@ -1758,19 +1704,11 @@ void finishout() {
                                fwrite(cursym.n_name, 1, len, doutb);
                                fputc('\0', doutb);
                                stroff += (len + 1);
-#ifdef pdp11
-                               fwrite(&objsym, sizeof (objsym), 1, toutb);
-#else
-                               temp[0] = (objsym.n_un.n_strx >> 16) & 0xff;
-                               temp[1] = (objsym.n_un.n_strx >> 24) & 0xff;
-                               temp[2] = objsym.n_un.n_strx & 0xff;
-                               temp[3] = (objsym.n_un.n_strx >> 8) & 0xff;
-                               temp[4] = objsym.n_type & 0xff;
-                               temp[5] = objsym.n_ovly & 0xff;
-                               temp[6] = objsym.n_value & 0xff;
-                               temp[7] = (objsym.n_value >> 8) & 0xff;
-                               fwrite(temp, sizeof (objsym), 1, toutb);
+#ifdef CROSS
+                               cross_write_off_t((char *)&objsym.n_un.n_strx, objsym.n_un.n_strx);
+                               cross_write_uint((char *)&objsym.n_value, objsym.n_value);
 #endif
+                               fwrite(&objsym, sizeof (objsym), 1, toutb);
                                nsym++;
                                }
                        fclose(soutb);
@@ -1794,19 +1732,11 @@ void finishout() {
                        fwrite(sp->n_name, 1, len, doutb);
                        fputc('\0', doutb);
                        stroff += (len + 1);
-#ifdef pdp11
-                       fwrite(&objsym, sizeof (objsym), 1, toutb);
-#else
-                       temp[0] = (objsym.n_un.n_strx >> 16) & 0xff;
-                       temp[1] = (objsym.n_un.n_strx >> 24) & 0xff;
-                       temp[2] = objsym.n_un.n_strx & 0xff;
-                       temp[3] = (objsym.n_un.n_strx >> 8) & 0xff;
-                       temp[4] = objsym.n_type & 0xff;
-                       temp[5] = objsym.n_ovly & 0xff;
-                       temp[6] = objsym.n_value & 0xff;
-                       temp[7] = (objsym.n_value >> 8) & 0xff;
-                       fwrite(temp, sizeof (objsym), 1, toutb);
+#ifdef CROSS
+                       cross_write_off_t((char *)&objsym.n_un.n_strx, objsym.n_un.n_strx);
+                       cross_write_uint((char *)&objsym.n_value, objsym.n_value);
 #endif
+                       fwrite(&objsym, sizeof (objsym), 1, toutb);
                        nsym++;
                        }
 #ifdef whybother
@@ -1820,14 +1750,11 @@ void finishout() {
  * Now write the length of the string table out.  Then copy the temp
  * file containing the strings to the image being built.
 */
-#ifdef pdp11
-               fwrite(&stroff, sizeof (OFF_T), 1, toutb);
+#ifdef CROSS
+               cross_write_off_t((char *)&temp_stroff, stroff);
+               fwrite(&temp_stroff, sizeof (cross_off_t), 1, toutb);
 #else
-               temp[0] = (stroff >> 16) & 0xff;
-               temp[1] = (stroff >> 24) & 0xff;
-               temp[2] = stroff & 0xff;
-               temp[3] = (stroff >> 8) & 0xff;
-               fwrite(temp, sizeof (OFF_T), 1, toutb);
+               fwrite(&stroff, sizeof (cross_off_t), 1, toutb);
 #endif
                copy(doutb);
                }
@@ -1838,41 +1765,31 @@ void finishout() {
 */
        fflush(toutb);
        rewind(toutb);
-#ifdef pdp11
        fread(&filhdr.e, sizeof (filhdr.e), 1, toutb);
-#else
-       fread(temp, sizeof (filhdr.e), 1, toutb);
-       /*filhdr.e.a_magic = (temp[0] & 0xff) | ((temp[1] & 0xff) << 8);
-       filhdr.e.a_text = (temp[2] & 0xff) | ((temp[3] & 0xff) << 8);
-       filhdr.e.a_data = (temp[4] & 0xff) | ((temp[5] & 0xff) << 8);
-       filhdr.e.a_bss = (temp[6] & 0xff) | ((temp[7] & 0xff) << 8);
-       filhdr.e.a_syms = (temp[8] & 0xff) | ((temp[9] & 0xff) << 8);
-       filhdr.e.a_entry = (temp[10] & 0xff) | ((temp[11] & 0xff) << 8);
-       filhdr.e.a_unused = (temp[12] & 0xff) | ((temp[13] & 0xff) << 8);
-       filhdr.e.a_flag = (temp[14] & 0xff) | ((temp[15] & 0xff) << 8);*/
+#ifdef CROSS
+       filhdr.e.a_magic = cross_read_int((char *)&filhdr.e.a_magic);
+       filhdr.e.a_text = cross_read_uint((char *)&filhdr.e.a_text);
+       filhdr.e.a_data = cross_read_uint((char *)&filhdr.e.a_data);
+       filhdr.e.a_bss = cross_read_uint((char *)&filhdr.e.a_bss);
+       /*filhdr.e.a_syms = cross_read_uint((char *)&filhdr.e.a_syms);*/
+       filhdr.e.a_entry = cross_read_uint((char *)&filhdr.e.a_entry);
+       filhdr.e.a_unused = cross_read_uint((char *)&filhdr.e.a_unused);
+       filhdr.e.a_flag = cross_read_uint((char *)&filhdr.e.a_flag);
 #endif
        filhdr.e.a_syms = nsym * sizeof (objsym);
        rewind(toutb);
-#ifdef pdp11
-       fwrite(&filhdr.e, sizeof (filhdr.e), 1, toutb);
+#ifdef CROSS
+       cross_write_int((char *)&temp_filhdr.e.a_magic, filhdr.e.a_magic);
+       cross_write_uint((char *)&temp_filhdr.e.a_text, filhdr.e.a_text);
+       cross_write_uint((char *)&temp_filhdr.e.a_data, filhdr.e.a_data);
+       cross_write_uint((char *)&temp_filhdr.e.a_bss, filhdr.e.a_bss);
+       cross_write_uint((char *)&temp_filhdr.e.a_syms, filhdr.e.a_syms);
+       cross_write_uint((char *)&temp_filhdr.e.a_entry, filhdr.e.a_entry);
+       cross_write_uint((char *)&temp_filhdr.e.a_unused, filhdr.e.a_unused);
+       cross_write_uint((char *)&temp_filhdr.e.a_flag, filhdr.e.a_flag);
+       fwrite(&temp_filhdr.e, sizeof (filhdr.e), 1, toutb);
 #else
-       /*temp[0] = filhdr.e.a_magic & 0xff;
-       temp[1] = (filhdr.e.a_magic >> 8) & 0xff;
-       temp[2] = filhdr.e.a_text & 0xff;
-       temp[3] = (filhdr.e.a_text >> 8) & 0xff;
-       temp[4] = filhdr.e.a_data & 0xff;
-       temp[5] = (filhdr.e.a_data >> 8) & 0xff;
-       temp[6] = filhdr.e.a_bss & 0xff;
-       temp[7] = (filhdr.e.a_bss >> 8) & 0xff;*/
-       temp[8] = filhdr.e.a_syms & 0xff;
-       temp[9] = (filhdr.e.a_syms >> 8) & 0xff;
-       /*temp[10] = filhdr.e.a_entry & 0xff;
-       temp[11] = (filhdr.e.a_entry >> 8) & 0xff;
-       temp[12] = filhdr.e.a_unused & 0xff;
-       temp[13] = (filhdr.e.a_unused >> 8) & 0xff;
-       temp[14] = filhdr.e.a_flag & 0xff;
-       temp[15] = (filhdr.e.a_flag >> 8) & 0xff;*/
-       fwrite(temp, sizeof (filhdr.e), 1, toutb);
+       fwrite(&filhdr.e, sizeof (filhdr.e), 1, toutb);
 #endif
        fclose(toutb);
 
@@ -1942,7 +1859,7 @@ void mget(loc, an, which) register char *loc; int an; int which; {
                tp->Cptr += tp->nibuf * 2;
                loc += tp->nibuf * 2;
                n -= tp->nibuf;
-               dseek(which, (OFF_T)(tp->bno + 1) * tp->bsize, -1);
+               dseek(which, (cross_off_t)(tp->bno + 1) * tp->bsize, -1);
        }
        bcopy(tp->Cptr, loc, n * 2);
        tp->Cptr += n * 2;
@@ -1966,7 +1883,7 @@ void mget(loc, an, which) register char *loc; int an; int which; {
 #endif
 }
 
-void dseek(which, aloc, s) int which; OFF_T aloc; int s; {
+void dseek(which, aloc, s) int which; cross_off_t aloc; int s; {
        register STREAM *sp = &Input[which];
        register u_int b, o;
        int n;
@@ -1975,7 +1892,7 @@ void dseek(which, aloc, s) int which; OFF_T aloc; int s; {
        o = aloc & (sp->bsize - 1);
        if      (sp->bno != b)
                {
-               (void)lseek(infil, (OFF_T)sp->bsize * b, L_SET);
+               (void)lseek(infil, (cross_off_t)sp->bsize * b, L_SET);
                if      ((n = read(infil, (char *)sp->buff, sp->bsize)) < 0)
                        n = 0;
                sp->bno = b;
@@ -1993,23 +1910,23 @@ void dseek(which, aloc, s) int which; OFF_T aloc; int s; {
 
 int get(which) int which; {
        register STREAM *sp = &Input[which];
-#ifndef pdp11
+#ifdef CROSS
        register int temp;
 #endif
 
        if (--sp->nibuf < 0) {
-               dseek(which, (OFF_T)(sp->bno + 1) * sp->bsize, -1);
+               dseek(which, (cross_off_t)(sp->bno + 1) * sp->bsize, -1);
                --sp->nibuf;
        }
        if (--sp->nsize <= 0) {
                if (sp->nsize < 0)
                        error(1, "premature EOF#1");
        }
-#ifdef pdp11
-       return(*sp->Iptr++);
-#else
+#ifdef CROSS
        temp = *sp->Cptr++ & 0xff;
-       return temp | ((*sp->Cptr++ & 0xff) << 8);      
+       return temp | ((*sp->Cptr++ & 0xff) << 8);
+#else
+       return(*sp->Iptr++);
 #endif
 }
 
@@ -2033,14 +1950,14 @@ int getfile(acp, flag, phase) char *acp; int flag; int phase; { /* flag: 1 = fat
        Input[RELOC].bno = -1;
        Input[SYMBOLS].bno = -1;
        Input[STRINGS].bno = -1;
-       dseek(TEXT, (OFF_T)0L, SARMAG);
+       dseek(TEXT, (cross_off_t)0L, SARMAG);
        if (Input[TEXT].nsize <= 0)
                error(1, "premature EOF#2");
        mget(arcmag, SARMAG, TEXT);
        arcmag[SARMAG] = 0;
        if (strcmp(arcmag, ARMAG))
                return(0);
-       lseek(infil, (OFF_T)SARMAG, L_SET);
+       lseek(infil, (cross_off_t)SARMAG, L_SET);
        if (get_arobj(infil) <= 0)
                return(1);
        if      (strcmp(chdr.name, RANLIBMAG))
@@ -2172,25 +2089,19 @@ void error(n, s) int n; char *s; {
        errlev = 2;
 }
 
-void readhdr(loc) OFF_T loc; {
+void readhdr(loc) cross_off_t loc; {
  /*fprintf(stderr, "loc=%08lx\n", loc);*/
-#ifndef pdp11
-       char temp[sizeof (struct exec)];
-#endif
-
        dseek(TEXT, loc, sizeof filhdr);
-#ifdef pdp11
        mget((char *)&filhdr.e, sizeof filhdr.e, TEXT);
-#else
-       mget(temp, sizeof filhdr.e, TEXT);
-       filhdr.e.a_magic = (temp[0] & 0xff) | ((temp[1] & 0xff) << 8);
-       filhdr.e.a_text = (temp[2] & 0xff) | ((temp[3] & 0xff) << 8);
-       filhdr.e.a_data = (temp[4] & 0xff) | ((temp[5] & 0xff) << 8);
-       filhdr.e.a_bss = (temp[6] & 0xff) | ((temp[7] & 0xff) << 8);
-       filhdr.e.a_syms = (temp[8] & 0xff) | ((temp[9] & 0xff) << 8);
-       filhdr.e.a_entry = (temp[10] & 0xff) | ((temp[11] & 0xff) << 8);
-       filhdr.e.a_unused = (temp[12] & 0xff) | ((temp[13] & 0xff) << 8);
-       filhdr.e.a_flag = (temp[14] & 0xff) | ((temp[15] & 0xff) << 8);
+#ifdef CROSS
+       filhdr.e.a_magic = cross_read_int((char *)&filhdr.e.a_magic);
+       filhdr.e.a_text = cross_read_uint((char *)&filhdr.e.a_text);
+       filhdr.e.a_data = cross_read_uint((char *)&filhdr.e.a_data);
+       filhdr.e.a_bss = cross_read_uint((char *)&filhdr.e.a_bss);
+       filhdr.e.a_syms = cross_read_uint((char *)&filhdr.e.a_syms);
+       filhdr.e.a_entry = cross_read_uint((char *)&filhdr.e.a_entry);
+       filhdr.e.a_unused = cross_read_uint((char *)&filhdr.e.a_unused);
+       filhdr.e.a_flag = cross_read_uint((char *)&filhdr.e.a_flag);
 #endif
        if (filhdr.e.a_magic != A_MAGIC1)
                error(1, "bad magic number");
@@ -2212,15 +2123,7 @@ void tcreat(fpp, tempflg) FILE **fpp; int tempflg; {
 
 #if 1
        if (tempflg) {
-               /* note: we have to refresh the template each time, because
-                * linux actually checks that it ends with 6 X's, and worse,
-                * leaves it in an undefined state if something goes wrong
-                */
-#if pdp11
-               strcpy(tfname, "/tmp/ldaXXXXX");
-#else
-               strcpy(tfname, "/tmp/ldaXXXXXX"); /* linux requires 6 X's */
-#endif
+               strcpy(tfname, "/tmp/ldaXXXXXX");
                if ((ufd = mkstemp(tfname)) < 0)
                        error(2, "cannot create temp");
                unlink(tfname);
@@ -2280,11 +2183,11 @@ short *lookloc(alp, r) struct local *alp; int r; {
 void roundov() {
        while   (torigin & 077)
                {
-#ifdef pdp11
-               putw(0, voutb);
-#else
+#ifdef CROSS
                putc(0, voutb);
                putc(0, voutb);
+#else
+               putw(0, voutb);
 #endif
                torigin += 2;
                }
@@ -2312,7 +2215,7 @@ u_int add(a,b,s) int a; int b; char *s; {
  * and the rest of 'ld' figures out what to do.
 */
 
-typedef struct ar_hdr HDR;
+typedef struct cross_ar_hdr HDR;
 static char hb[sizeof(HDR) + 1];       /* real header */
 
 /* Convert ar header field to an integer. */
@@ -2381,8 +2284,8 @@ int get_arobj(fd) int fd; {
 /*
  * skip - where to seek for next archive member.
  */
-OFF_T skip() {
-       OFF_T len;
+cross_off_t skip() {
+       cross_off_t len;
 
        len = chdr.size + (chdr.size + chdr.lname & 1);
        len += sizeof (HDR);
index f5c83df..2c0c2de 100755 (executable)
@@ -1,9 +1,10 @@
 #!/bin/sh
 ROOT="`pwd |sed -e 's/\/bin\/ld$//'`"
-HOSTCC="cc -g -Iinclude -Wall -Wno-char-subscripts -Wno-deprecated-declarations -Wno-format -Wno-maybe-uninitialized -Wno-parentheses -Wno-unused-result"
+HOSTCC="cc -I$ROOT/cross/usr/include -L$ROOT/cross/usr/lib -DCROSS -Wall -Wno-char-subscripts -Wno-deprecated-declarations -Wno-format -Wno-maybe-uninitialized -Wno-parentheses -Wno-unused-result"
+HOSTLIBCROSS="-lcross"
 INSTALL="$ROOT/scripts/install.sh --strip-program=/bin/true"
 MANROFF="nroff -man"
 mkdir --parents "$ROOT/cross/bin"
 mkdir --parents "$ROOT/cross/usr/man/cat1"
-make CC="$HOSTCC" MANROFF="$MANROFF" STAGEPREFIX="\\\"$ROOT/stage\\\"" SEPFLAG= LDFLAGS="-L$ROOT/cross/usr/lib" && \
+make CC="$HOSTCC" LIBCROSS="$HOSTLIBCROSS" MANROFF="$MANROFF" STAGEPREFIX="\\\"$ROOT/stage\\\"" SEPFLAG= LDFLAGS="-L$ROOT/cross/usr/lib" && \
 make INSTALL="$INSTALL" DESTDIR="$ROOT/cross" install
diff --git a/lib/libcross/subset_include/time.h b/lib/libcross/subset_include/time.h
deleted file mode 100644 (file)
index bf5e265..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 1983, 1987 Regents of the University of California.
- * All rights reserved.  The Berkeley software License Agreement
- * specifies the terms and conditions for redistribution.
- *
- *     @(#)time.h      1.2 (Berkeley) 3/4/87
- */
-
-/*
- * Structure returned by gmtime and localtime calls (see ctime(3)).
- */
-struct tm {
-       int     tm_sec;
-       int     tm_min;
-       int     tm_hour;
-       int     tm_mday;
-       int     tm_mon;
-       int     tm_year;
-       int     tm_wday;
-       int     tm_yday;
-       int     tm_isdst;
-       long    tm_gmtoff;
-       char    *tm_zone;
-};
-
-extern struct tm *gmtime(), *localtime();
-extern char *asctime(), *ctime();
diff --git a/n.sh b/n.sh
index e024abb..7bcdd40 100755 (executable)
--- a/n.sh
+++ b/n.sh
@@ -4,7 +4,7 @@ ROOT="`pwd`"
 
 # note that -Iinclude will go away when everything converted to use libcross
 HOSTCC="cc -Iinclude -I$ROOT/cross/usr/include -L$ROOT/cross/usr/lib -DCROSS -Wall -Wno-char-subscripts -Wno-deprecated-declarations -Wno-format -Wno-maybe-uninitialized -Wno-parentheses -Wno-unused-result"
-HOSTLIBS="-lcross"
+HOSTLIBCROSS="-lcross"
 INSTALL="$ROOT/scripts/install.sh"
 MANROFF="nroff -man"
 MKDEP="$ROOT/scripts/mkdep.sh"
@@ -25,7 +25,7 @@ echo "making clean"
 echo
 
 make clean
-make -C lib/libcross clean
+make -C usr.lib/libcross clean
 
 echo
 echo "making depend"
@@ -35,36 +35,36 @@ make -C bin MKDEP="$MKDEP" AAASUBDIR="ar as cc ld nm strip" AAASCRIPT= AAASTD="s
 #make -C lib/c2 MKDEP="$MKDEP" depend
 #make -C lib/ccom MKDEP="$MKDEP" depend
 #make -C lib/cpp MKDEP="$MKDEP" depend
-#make -C lib/libcross MKDEP="$MKDEP" depend
 make -C ucb MKDEP="$MKDEP" AAASUBDIR="strcompact symcompact symdump symorder" AAACSHSCRIPT= AAASTD="mkstr unifdef xstr" AAANSTD= AAASETUID= AAAKMEM= depend
 # AAAMKDEP below suppresses problems due to empty file list
 make -C usr.bin MKDEP="$MKDEP" AAAMKDEP="true" AAASUBDIR="lex ranlib yacc" AAASCRIPT="lorder mkdep" AAASRCS= AAASTD= AAANSTD= AAAKMEM= depend
+#make -C usr.lib/libcross MKDEP="$MKDEP" depend
 #make -C usr.lib/libvmf MKDEP="$MKDEP" depend
 
 echo
 echo "making libraries"
 echo
 
-make -C lib/libcross CC="$HOSTCC" MANROFF="$MANROFF"
-make -C usr.lib/libvmf CC="$HOSTCC" MANROFF="$MANROFF"
+make -C usr.lib/libcross CC="$HOSTCC" LIBCROSS="$HOSTLIBCROSS" MANROFF="$MANROFF"
+make -C usr.lib/libvmf CC="$HOSTCC" LIBCROSS="$HOSTLIBCROSS" MANROFF="$MANROFF"
 
 echo
 echo "installing libraries"
 echo
 
-make -C lib/libcross INSTALL="$INSTALL" DESTDIR="$ROOT/cross" install
+make -C usr.lib/libcross INSTALL="$INSTALL" DESTDIR="$ROOT/cross" install
 make -C usr.lib/libvmf INSTALL="$INSTALL" DESTDIR="$ROOT/cross" install
 
 echo
 echo "making"
 echo
 
-make -C bin CC="$HOSTCC" MANROFF="$MANROFF" CROSSPREFIX="\\\"$ROOT/cross\\\"" STAGEPREFIX="\\\"$ROOT/stage\\\"" SEPFLAG= LDFLAGS="-L$ROOT/cross/usr/lib" AAASUBDIR="ar as cc ld nm strip" AAASCRIPT= AAASTD="size" AAANSTD= AAASETUID= AAAOPERATOR= AAAKMEM= AAATTY=
-make -C lib/c2 CC="$HOSTCC" MANROFF="$MANROFF" SEPFLAG=
-make -C lib/ccom CC="$HOSTCC" HOSTCC="$HOSTCC" HOSTLIBS="$HOSTLIBS" HOSTSEPFLAG= MANROFF="$MANROFF" LDC0FLAGS= LDC1FLAGS=
-make -C lib/cpp CC="$HOSTCC" MANROFF="$MANROFF" STAGEPREFIX="\\\"$ROOT/stage\\\"" SEPFLAG=
-make -C ucb CC="$HOSTCC" MANROFF="$MANROFF" SEPFLAG= CROSSPREFIX="\\\"$ROOT/cross\\\"" LOCALESTR="\\\"LC_ALL=C \\\"" AAASUBDIR="strcompact symcompact symdump symorder" AAACSHSCRIPT= AAASTD="mkstr unifdef xstr" AAANSTD= AAASETUID= AAAKMEM=
-make -C usr.bin CC="$HOSTCC" MANROFF="$MANROFF" SEPFLAG= CROSSCC="$ROOT/cross/bin/cc" CROSSNM="$ROOT/cross/bin/nm" CROSSPREFIX="\\\"$ROOT/cross\\\"" AAASUBDIR="lex ranlib yacc" AAASCRIPT="lorder mkdep" AAASRCS= AAASTD= AAANSTD= AAAKMEM=
+make -C bin CC="$HOSTCC" LIBCROSS="$HOSTLIBCROSS" MANROFF="$MANROFF" CROSSPREFIX="\\\"$ROOT/cross\\\"" STAGEPREFIX="\\\"$ROOT/stage\\\"" SEPFLAG= LDFLAGS="-L$ROOT/cross/usr/lib" AAASUBDIR="ar as cc ld nm strip" AAASCRIPT= AAASTD="size" AAANSTD= AAASETUID= AAAOPERATOR= AAAKMEM= AAATTY=
+make -C lib/c2 CC="$HOSTCC" LIBCROSS="$HOSTLIBCROSS" MANROFF="$MANROFF" SEPFLAG=
+make -C lib/ccom CC="$HOSTCC" LIBCROSS="$HOSTLIBCROSS" HOSTCC="$HOSTCC" LIBCROSS="$HOSTLIBCROSS" HOSTLIBCROSS="$HOSTLIBCROSS" HOSTSEPFLAG= MANROFF="$MANROFF" LDC0FLAGS= LDC1FLAGS=
+make -C lib/cpp CC="$HOSTCC" LIBCROSS="$HOSTLIBCROSS" MANROFF="$MANROFF" STAGEPREFIX="\\\"$ROOT/stage\\\"" SEPFLAG=
+make -C ucb CC="$HOSTCC" LIBCROSS="$HOSTLIBCROSS" MANROFF="$MANROFF" SEPFLAG= CROSSPREFIX="\\\"$ROOT/cross\\\"" LOCALESTR="\\\"LC_ALL=C \\\"" AAASUBDIR="strcompact symcompact symdump symorder" AAACSHSCRIPT= AAASTD="mkstr unifdef xstr" AAANSTD= AAASETUID= AAAKMEM=
+make -C usr.bin CC="$HOSTCC" LIBCROSS="$HOSTLIBCROSS" MANROFF="$MANROFF" SEPFLAG= CROSSCC="$ROOT/cross/bin/cc" CROSSNM="$ROOT/cross/bin/nm" CROSSPREFIX="\\\"$ROOT/cross\\\"" AAASUBDIR="lex ranlib yacc" AAASCRIPT="lorder mkdep" AAASRCS= AAASTD= AAANSTD= AAAKMEM=
 
 echo
 echo "installing"
diff --git a/o.sh b/o.sh
index 21b58c8..1a80f7e 100755 (executable)
--- a/o.sh
+++ b/o.sh
@@ -19,7 +19,7 @@ MKSTR="$ROOT/cross/usr/ucb/mkstr"
 INSTALL="$ROOT/scripts/install.sh --strip-program=\"$ROOT/cross/bin/strip\""
 # note that -Iinclude will go away when everything converted to use libcross
 HOSTCC="cc -Iinclude -I$ROOT/cross/usr/include -L$ROOT/cross/usr/lib -DCROSS -Wall -Wno-char-subscripts -Wno-deprecated-declarations -Wno-format -Wno-maybe-uninitialized -Wno-parentheses -Wno-unused-result"
-HOSTLIBS="-lcross"
+HOSTLIBCROSS="-lcross"
 RANLIB="$ROOT/cross/usr/bin/ranlib"
 UNIFDEF="$ROOT/cross/usr/ucb/unifdef"
 SIZE="$ROOT/cross/bin/size"
@@ -52,7 +52,7 @@ echo "making libc"
 echo
 
 # build libraries, except lib/libkern and usr.lib/libU77
-make -C lib/libc AR="$AR" AS="$AS" C2="$C2" CC="$CC" CHGRP="$CHGRP" CHMOD="$CHMOD" CHOWN="$CHOWN" CPP="$CPP" HOSTCC="$HOSTCC" HOSTLIBS="$HOSTLIBS" HOSTSEPFLAG= LD="$LD" LEX="$LEX" LORDER="$LORDER" MANROFF="$MANROFF" MKSTR="$MKSTR" RANLIB="$RANLIB" UNIFDEF="$UNIFDEF" SIZE="$SIZE" XSTR="$XSTR" YACC="$YACC" LOCALE="LC_ALL=C" STAGEDIR="$ROOT/stage"
+make -C lib/libc AR="$AR" AS="$AS" C2="$C2" CC="$CC" CHGRP="$CHGRP" CHMOD="$CHMOD" CHOWN="$CHOWN" CPP="$CPP" HOSTCC="$HOSTCC" HOSTLIBCROSS="$HOSTLIBCROSS" HOSTSEPFLAG= LD="$LD" LEX="$LEX" LORDER="$LORDER" MANROFF="$MANROFF" MKSTR="$MKSTR" RANLIB="$RANLIB" UNIFDEF="$UNIFDEF" SIZE="$SIZE" XSTR="$XSTR" YACC="$YACC" LOCALE="LC_ALL=C" STAGEDIR="$ROOT/stage"
 
 echo
 echo "installing libc"
@@ -64,7 +64,7 @@ echo
 echo "making libraries"
 echo
 
-make -C usr.lib AR="$AR" AS="$AS" C2="$C2" CC="$CC" CHGRP="$CHGRP" CHMOD="$CHMOD" CHOWN="$CHOWN" CPP="$CPP" HOSTCC="$HOSTCC" HOSTLIBS="$HOSTLIBS" HOSTSEPFLAG= LD="$LD" LEX="$LEX" LORDER="$LORDER" MANROFF="$MANROFF" MKSTR="$MKSTR" RANLIB="$RANLIB" UNIFDEF="$UNIFDEF" SIZE="$SIZE" XSTR="$XSTR" YACC="$YACC" LOCALE="LC_ALL=C" STAGEDIR="$ROOT/stage" SUBDIR="lib2648 libF77 libI77 libcurses libdbm libln libom libmp libplot libtermlib liby libutil libvmf liberrlst libident libstubs"
+make -C usr.lib AR="$AR" AS="$AS" C2="$C2" CC="$CC" CHGRP="$CHGRP" CHMOD="$CHMOD" CHOWN="$CHOWN" CPP="$CPP" HOSTCC="$HOSTCC" HOSTLIBCROSS="$HOSTLIBCROSS" HOSTSEPFLAG= LD="$LD" LEX="$LEX" LORDER="$LORDER" MANROFF="$MANROFF" MKSTR="$MKSTR" RANLIB="$RANLIB" UNIFDEF="$UNIFDEF" SIZE="$SIZE" XSTR="$XSTR" YACC="$YACC" LOCALE="LC_ALL=C" STAGEDIR="$ROOT/stage" SUBDIR="lib2648 libF77 libI77 libcurses libdbm libln libom libmp libplot libtermlib liby libutil libvmf liberrlst libident libstubs"
 
 echo
 echo "installing libraries"
@@ -78,8 +78,8 @@ echo "making"
 echo
 
 # build everything, except libraries and new
-make -C lib AR="$AR" AS="$AS" C2="$C2" CC="$CC" CHGRP="$CHGRP" CHMOD="$CHMOD" CHOWN="$CHOWN" CPP="$CPP" HOSTCC="$HOSTCC" HOSTLIBS="$HOSTLIBS" HOSTSEPFLAG= LD="$LD" LEX="$LEX" LORDER="$LORDER" MANROFF="$MANROFF" MKSTR="$MKSTR" RANLIB="$RANLIB" UNIFDEF="$UNIFDEF" SIZE="$SIZE" XSTR="$XSTR" YACC="$YACC" LOCALE="LC_ALL=C" STAGEDIR="$ROOT/stage" SUBDIR="ccom c2 cpp"
-make AR="$AR" AS="$AS" C2="$C2" CC="$CC" CHGRP="$CHGRP" CHMOD="$CHMOD" CHOWN="$CHOWN" CPP="$CPP" HOSTCC="$HOSTCC" HOSTLIBS="$HOSTLIBS" HOSTSEPFLAG= LD="$LD" LEX="$LEX" LORDER="$LORDER" MANROFF="$MANROFF" MKSTR="$MKSTR" RANLIB="$RANLIB" UNIFDEF="$UNIFDEF" SIZE="$SIZE" XSTR="$XSTR" YACC="$YACC" LOCALE="LC_ALL=C" STAGEDIR="$ROOT/stage" XXXLIBDIR= XXXSRCDIR="share bin sbin etc games libexec local ucb usr.bin usr.sbin man" XXXSUBDIR="backgammon battlestar boggle btlgammon cribbage fortune hack hangman hunt mille monop pdp phantasia quiz robots sail snake trek warp words" YYYSUBDIR="chess"
+make -C lib AR="$AR" AS="$AS" C2="$C2" CC="$CC" CHGRP="$CHGRP" CHMOD="$CHMOD" CHOWN="$CHOWN" CPP="$CPP" HOSTCC="$HOSTCC" HOSTLIBCROSS="$HOSTLIBCROSS" HOSTSEPFLAG= LD="$LD" LEX="$LEX" LORDER="$LORDER" MANROFF="$MANROFF" MKSTR="$MKSTR" RANLIB="$RANLIB" UNIFDEF="$UNIFDEF" SIZE="$SIZE" XSTR="$XSTR" YACC="$YACC" LOCALE="LC_ALL=C" STAGEDIR="$ROOT/stage" SUBDIR="ccom c2 cpp"
+make AR="$AR" AS="$AS" C2="$C2" CC="$CC" CHGRP="$CHGRP" CHMOD="$CHMOD" CHOWN="$CHOWN" CPP="$CPP" HOSTCC="$HOSTCC" HOSTLIBCROSS="$HOSTLIBCROSS" HOSTSEPFLAG= LD="$LD" LEX="$LEX" LORDER="$LORDER" MANROFF="$MANROFF" MKSTR="$MKSTR" RANLIB="$RANLIB" UNIFDEF="$UNIFDEF" SIZE="$SIZE" XSTR="$XSTR" YACC="$YACC" LOCALE="LC_ALL=C" STAGEDIR="$ROOT/stage" XXXLIBDIR= XXXSRCDIR="share bin sbin etc games libexec local ucb usr.bin usr.sbin man" XXXSUBDIR="backgammon battlestar boggle btlgammon cribbage fortune hack hangman hunt mille monop pdp phantasia quiz robots sail snake trek warp words" YYYSUBDIR="chess"
 
 echo
 echo "installing"
diff --git a/p.sh b/p.sh
index ce14895..7d509bd 100755 (executable)
--- a/p.sh
+++ b/p.sh
@@ -11,7 +11,7 @@ CHOWN="$ROOT/scripts/chown.sh"
 CPP="$ROOT/cross/lib/cpp"
 # note that -Iinclude will go away when everything converted to use libcross
 HOSTCC="cc -Iinclude -I$ROOT/cross/usr/include -L$ROOT/cross/usr/lib -DCROSS -Wall -Wno-char-subscripts -Wno-deprecated-declarations -Wno-format -Wno-maybe-uninitialized -Wno-parentheses -Wno-unused-result"
-HOSTLIBS="-lcross"
+HOSTLIBCROSS="-lcross"
 INSTALL="$ROOT/scripts/install.sh --strip-program=\"$ROOT/cross/bin/strip\""
 LD="$ROOT/cross/bin/ld"
 LORDER="$ROOT/cross/usr/bin/lorder"
@@ -61,7 +61,7 @@ echo
 echo "making kernel"
 echo
 
-make -C sys/GENERIC I="$ROOT/stage/usr/include" AS="$AS" CC="$CC" CPP="$CPP" HOSTCC="$HOSTCC" HOSTLIBS="$HOSTLIBS" HOSTSEPFLAG= LD="$LD" SIZE="$SIZE" STRCOMPACT="$STRCOMPACT" SYMCOMPACT="$SYMCOMPACT" SYMORDER="$SYMORDER"
+make -C sys/GENERIC I="$ROOT/stage/usr/include" AS="$AS" CC="$CC" CPP="$CPP" HOSTCC="$HOSTCC" HOSTLIBCROSS="$HOSTLIBCROSS" HOSTSEPFLAG= LD="$LD" SIZE="$SIZE" STRCOMPACT="$STRCOMPACT" SYMCOMPACT="$SYMCOMPACT" SYMORDER="$SYMORDER"
 
 echo
 echo "installing kernel"
index 37b8db3..ff68e4f 100644 (file)
@@ -65,7 +65,7 @@ zic:          $(TZCOBJS)
 
 # Nick, build a separate version to run from here (even if not cross compiling)
 hostzic:       $(TZCSRCS)
-               $(HOSTCC) $(HOSTSEPFLAG) -o $@ $(TZCSRCS) $(HOSTLIBS)
+               $(HOSTCC) $(HOSTSEPFLAG) -o $@ $(TZCSRCS) $(HOSTLIBCROSS)
 
 lint:          $(TZCSRCS) $(TZDSRCS)
                lint $(LINTFLAGS) $(CFLAGS) $(TZCSRCS)
index 1e5c44e..57697cf 100755 (executable)
@@ -2,9 +2,9 @@
 ROOT="`pwd |sed -e 's/\/share\/zoneinfo$//'`"
 CC="$ROOT/cross/bin/cc"
 HOSTCC="cc -g -I$ROOT/cross/usr/include -L$ROOT/cross/usr/lib -DCROSS -Wall -Wno-char-subscripts -Wno-deprecated-declarations -Wno-format -Wno-maybe-uninitialized -Wno-parentheses -Wno-unused-result"
-HOSTLIBS="-lcross"
+HOSTLIBCROSS="-lcross"
 INSTALL="$ROOT/scripts/install.sh --strip-program=\"$ROOT/cross/bin/strip\""
 MANROFF="nroff -man"
 mkdir --parents "$ROOT/stage/lib"
-make CC="$CC" HOSTCC="$HOSTCC" HOSTLIBS="-lcross" HOSTSEPFLAG= MANROFF="$MANROFF" && \
+make CC="$CC" HOSTCC="$HOSTCC" HOSTLIBCROSS="-lcross" HOSTSEPFLAG= MANROFF="$MANROFF" && \
 make INSTALL="$INSTALL" DESTDIR="$ROOT/stage" install
index 598374a..31ffebf 100644 (file)
@@ -1,5 +1,5 @@
 char *libF77_id[] = {
-       "@(#)libF77.a   Jan 11 03:18:38 2017",
+       "@(#)libF77.a   Jan 11 21:13:12 2017",
        "@(#)abort_.c   5.1     6/7/85",
        "@(#)besj0_.c   5.1     6/7/85",
        "@(#)besj1_.c   5.1     6/7/85",
similarity index 89%
rename from lib/libcross/Makefile
rename to usr.lib/libcross/Makefile
index 61502ea..f02bf4b 100644 (file)
@@ -26,9 +26,10 @@ cross/a.out.h: subset_include/a.out.h copy.sed
 cross/ar.h: subset_include/ar.h copy.sed
        mkdir -p cross
        sed -f copy.sed $< >$@
-cross/nlist.h: subset_include/nlist.h copy.sed
+cross/nlist.h: nlist.h
+# this one is different because cross_nlist() returns int, not cross_int_t
        mkdir -p cross
-       sed -f copy.sed $< >$@
+       sed -e 's/#ifdef CROSS/#if 1/;s/#ifndef CROSS/#if 0/' $< >$@
 cross/ranlib.h: subset_include/ranlib.h copy.sed
        mkdir -p cross
        sed -f copy.sed $< >$@
similarity index 71%
rename from lib/libcross/copy.sed
rename to usr.lib/libcross/copy.sed
index 09d3a7b..c8f8c08 100644 (file)
@@ -1,5 +1,8 @@
 s/^#\([\t ]*\)ifndef\([\t ]\+\)\(_[0-9A-Z_]\+_\)$/#\1ifndef\2_CROSS\3/
-s/^#\([\t ]*\)define\([\t ]\+\)\(_[0-9A-Z_]\+_\)$/#\1define\2_CROSS\3\n#include "cross\/cross.h"/
+s/^#\([\t ]*\)define\([\t ]\+\)\(_[0-9A-Z_]\+_\)$/#\1define\2_CROSS\3\n\n#include "cross\/cross.h"/
+
+s/^#\([\t ]*\)ifdef\([\t ]\+\)CROSS$/#\1if 1/
+s/^#\([\t ]*\)ifndef\([\t ]\+\)CROSS$/#\1if 0/
 
 s/#\([\t ]*\)include\([\t ]\)"\(a\.out\|ar\|nlist\|sys\/exec\|sys\/param\|sys\/time\|sys\/types\|ranlib\|time\|tzfile\)\.h"/#\1include\2"cross\/\3.h"/
 s/#\([\t ]*\)include\([\t ]\)<\(a\.out\|ar\|nlist\|sys\/exec\|sys\/param\|sys\/time\|sys\/types\|ranlib\|time\|tzfile\)\.h>/#\1include\2"cross\/\3.h"/
@@ -34,10 +37,10 @@ s/^\(off_t\|time_t\|u_char\|u_int\|u_long\|u_short\)\([^0-9A-Za-z_]\)/cross_\1\2
 s/\([^0-9A-Za-z_]\)\(off_t\|time_t\|u_char\|u_int\|u_long\|u_short\)$/\1cross_\2/g
 s/\([^0-9A-Za-z_]\)\(off_t\|time_t\|u_char\|u_int\|u_long\|u_short\)\([^0-9A-Za-z_]\)/\1cross_\2\3/g
 
-s/^struct[\t ]\+\(ar\|exec\|nlist\|oldnlist\|ovlhdr\|tm\|tzhead\|xexec\)$/struct cross_\1/g
-s/^struct[\t ]\+\(ar\|exec\|nlist\|oldnlist\|ovlhdr\|tm\|tzhead\|xexec\)\([^0-9A-Za-z_]\)/struct cross_\1\2/g
-s/\([^0-9A-Za-z_]\)struct[\t ]\+\(ar\|exec\|nlist\|oldnlist\|ovlhdr\|tm\|tzhead\|xexec\)$/\1struct cross_\2/g
-s/\([^0-9A-Za-z_]\)struct[\t ]\+\(ar\|exec\|nlist\|oldnlist\|ovlhdr\|tm\|tzhead\|xexec\)\([^0-9A-Za-z_]\)/\1struct cross_\2\3/g
+s/^struct[\t ]\+\(ar_hdr\|exec\|nlist\|oldnlist\|ovlhdr\|ranlib\|tm\|tzhead\|xexec\)$/struct cross_\1/g
+s/^struct[\t ]\+\(ar_hdr\|exec\|nlist\|oldnlist\|ovlhdr\|ranlib\|tm\|tzhead\|xexec\)\([^0-9A-Za-z_]\)/struct cross_\1\2/g
+s/\([^0-9A-Za-z_]\)struct[\t ]\+\(ar\|exec\|nlist\|oldnlist\|ovlhdr\|ranlib\|tm\|tzhead\|xexec\)$/\1struct cross_\2/g
+s/\([^0-9A-Za-z_]\)struct[\t ]\+\(ar\|exec\|nlist\|oldnlist\|ovlhdr\|ranlib\|tm\|tzhead\|xexec\)\([^0-9A-Za-z_]\)/\1struct cross_\2\3/g
 
-s/^\(asctime\|ctime\|gmtime\|n_stroff\|n_datoff\|n_dreloc\|n_treloc\|n_symoff\|nlist\|time\)[\t ]*(/cross_\1(/g
-s/\([^0-9A-Za-z_]\)\(asctime\|ctime\|gmtime\|n_stroff\|n_datoff\|n_dreloc\|n_treloc\|n_symoff\|nlist\|time\)[\t ]*(/\1cross_\2(/g
+s/^\(asctime\|ctime\|gmtime\|localtime\|n_stroff\|n_datoff\|n_dreloc\|n_treloc\|n_symoff\|nlist\|offtime\|time\|timezone\|tztab\|tzset\)\([\t ]*\(__P[\t ]*([\t ]*\)\?(\)/cross_\1\2/g
+s/\([^0-9A-Za-z_]\)\(asctime\|ctime\|gmtime\|localtime\|n_stroff\|n_datoff\|n_dreloc\|n_treloc\|n_symoff\|nlist\|offtime\|time\|timezone\|tztab\|tzset\)\([\t ]*\(__P[\t ]*([\t ]*\)\?(\)/\1cross_\2\3/g
similarity index 64%
rename from lib/libcross/cross.c
rename to usr.lib/libcross/cross.c
index 5a307bc..197ea90 100644 (file)
@@ -12,17 +12,24 @@ void cross_read_double(res, buf) cross_double_t *res; char *buf; {
        res->data[3] = (buf[6] & 0xff) | ((buf[7] & 0xff) << 8);
 }
 
+/* XXX we assume char is signed here */
 short cross_read_short(buf) char *buf; {
-       return (buf[0] & 0xff) | ((buf[1] & 0xff) << 8);
+       return (buf[0] & 0xff) | (buf[1] << 8);
 }
 
-int cross_read_int(buf) char *buf; {
+unsigned short cross_read_ushort(buf) char *buf; {
        return (buf[0] & 0xff) | ((buf[1] & 0xff) << 8);
 }
 
-int cross_read_long(buf) char *buf; {
-       return ((buf[0] & 0xff) < 16) | ((buf[1] & 0xff) << 24) |
-               (buf[2] & 0xff) | ((buf[3] & 0xff) << 8);
+/* XXX we assume char is signed here */
+long cross_read_long(buf) char *buf; {
+       return (((long)buf[0] & 0xff) << 16) | ((long)buf[1] << 24) |
+               ((long)buf[2] & 0xff) | (((long)buf[3] & 0xff) << 8);
+}
+
+unsigned long cross_read_ulong(buf) char *buf; {
+       return (((long)buf[0] & 0xff) << 16) | (((long)buf[1] & 0xff) << 24) |
+               ((long)buf[2] & 0xff) | (((long)buf[3] & 0xff) << 8);
 }
 
 void cross_write_float(buf, val) char *buf; cross_float_t *val; {
@@ -48,7 +55,7 @@ void cross_write_short(buf, val) char *buf; int val; {
        buf[1] = (val >> 8) & 0xff;
 }
 
-void cross_write_int(buf, val) char *buf; int val; {
+void cross_write_ushort(buf, val) char *buf; unsigned int val; {
        buf[0] = val & 0xff;
        buf[1] = (val >> 8) & 0xff;
 }
@@ -56,6 +63,13 @@ void cross_write_int(buf, val) char *buf; int val; {
 void cross_write_long(buf, val) char *buf; long val; {
        buf[0] = (val >> 16) & 0xff;
        buf[1] = (val >> 24) & 0xff;
-       buf[0] = val & 0xff;
-       buf[1] = (val >> 8) & 0xff;
+       buf[2] = val & 0xff;
+       buf[3] = (val >> 8) & 0xff;
+}
+
+void cross_write_ulong(buf, val) char *buf; unsigned long val; {
+       buf[0] = (val >> 16) & 0xff;
+       buf[1] = (val >> 24) & 0xff;
+       buf[2] = val & 0xff;
+       buf[3] = (val >> 8) & 0xff;
 }
similarity index 62%
rename from lib/libcross/cross.h
rename to usr.lib/libcross/cross.h
index 4744895..0d1361e 100644 (file)
@@ -22,6 +22,16 @@ typedef uint32_t cross_ulong_t;
 typedef uint16_t cross_ushort_t;
 #endif
 
+/* off_t and time_t stuff should really be in sys/types.h rather than here */
+#define cross_read_int cross_read_short
+#define cross_read_uint cross_read_ushort
+#define cross_read_off_t cross_read_long
+#define cross_read_time_t cross_read_long
+#define cross_write_int cross_write_short
+#define cross_write_uint cross_write_ushort
+#define cross_write_off_t cross_write_long
+#define cross_write_time_t cross_write_long
+
 #ifndef __P
 #ifdef __STDC__
 #define __P(params) params
@@ -34,12 +44,14 @@ typedef uint16_t cross_ushort_t;
 void cross_read_float __P((cross_float_t *res, char *buf));
 void cross_read_double __P((cross_double_t *res, char *buf));
 short cross_read_short __P((char *buf));
-int cross_read_int __P((char *buf));
-int cross_read_long __P((char *buf));
+unsigned short cross_read_ushort __P((char *buf));
+long cross_read_long __P((char *buf));
+unsigned long cross_read_ulong __P((char *buf));
 void cross_write_float __P((char *buf, cross_float_t *val));
 void cross_write_double __P((char *buf, cross_double_t *val));
 void cross_write_short __P((char *buf, int val));
-void cross_write_int __P((char *buf, int val));
+void cross_write_ushort __P((char *buf, unsigned int val));
 void cross_write_long __P((char *buf, long val));
+void cross_write_ulong __P((char *buf, unsigned long val));
 
 #endif
similarity index 75%
rename from lib/libcross/ctime.c
rename to usr.lib/libcross/ctime.c
index 8b74cc6..2c04b42 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)CTIME.c    1.1 (Berkeley) 3/25/87";
+static char sccsid[] = "@(#)cross_ctime.c      1.1 (Berkeley) 3/25/87";
 #endif
 
 #include <fcntl.h>
@@ -20,67 +20,35 @@ static char sccsid[] = "@(#)CTIME.c 1.1 (Berkeley) 3/25/87";
 #include "cross/sys/types.h"
 #include "cross/time.h"
 #include "cross/tzfile.h"
-#define _MAXPATHLEN CROSS_MAXPATHLEN
-#define ASCTIME cross_asctime
-#define CTIME cross_ctime
-#define GMTIME cross_gmtime
-#define LOCALTIME cross_localtime
-#define OFFTIME cross_offtime
-#define STRUCT_TM struct cross_tm
-#define STRUCT_TZHEAD struct cross_tzhead
-#define TIMEZONE cross_timezone
-#define TIME_T cross_time_t
-#define TZNAME cross_tzname
-#define TZSET cross_tzset
-#define TZTAB cross_tztab
 #else
 #include <sys/param.h>
 #include <sys/types.h>
 #include <time.h>
 #include <tzfile.h>
-#define _MAXPATHLEN MAXPATHLEN
-#define ASCTIME asctime
-#define CTIME ctime
-#define LOCALTIME localtime
-#define GMTIME gmtime
-#define OFFTIME offtime
-#define STRUCT_TM struct tm
-#define STRUCT_TZHEAD struct tzhead
-#define TIMEZONE timezone
-#define TIME_T time_t
-#define TZNAME tzname
-#define TZSET tzset
-#define TZTAB tztab
+#define CROSS_MAXPATHLEN MAXPATHLEN
+#define cross_asctime asctime
+#define cross_ctime ctime
+#define cross_localtime localtime
+#define cross_gmtime gmtime
+#define cross_offtime offtime
+#define cross_tm tm
+#define cross_tzhead tzhead
+#define cross_timezone timezone
+#define cross_time_t time_t
+#define cross_tzname tzname
+#define cross_tzset tzset
+#define cross_tztab tztab
 #endif
 
-#ifndef __P
-#ifdef __STDC__
-#define __P(params) params
-#else
-#define __P(params) ()
-#endif
-#endif
-
-/* ctime.c */
-char *CTIME __P((TIME_T *t));
-char *ASCTIME __P((register STRUCT_TM *timeptr));
-void TZSET __P((void));
-STRUCT_TM *LOCALTIME __P((TIME_T *timep));
-STRUCT_TM *GMTIME __P((TIME_T *clock));
-STRUCT_TM *OFFTIME __P((TIME_T *clock, long offset));
-/* timezone.c */
-char *TIMEZONE __P((int zone, int dst));
-char *TZTAB __P((register int zone, int dst));
-
-char *CTIME(t) TIME_T *t; {
-       return(ASCTIME(LOCALTIME(t)));
+char *cross_ctime(t) cross_time_t *t; {
+       return(cross_asctime(cross_localtime(t)));
 }
 
 /*
 ** A la X3J11
 */
 
-char *ASCTIME(timeptr) register STRUCT_TM *timeptr; {
+char *cross_asctime(timeptr) register struct cross_tm *timeptr; {
        static char     wday_name[DAYS_PER_WEEK][3] = {
                "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
        };
@@ -104,7 +72,7 @@ char *ASCTIME(timeptr) register STRUCT_TM *timeptr; {
 #define FALSE          0
 #endif /* !TRUE */
 
-STRUCT_TM *            OFFTIME();
+struct cross_tm *              cross_offtime();
 
 struct ttinfo {                                /* time type information */
        long            tt_gmtoff;      /* GMT offset in seconds */
@@ -116,7 +84,7 @@ struct state {
        int             timecnt;
        int             typecnt;
        int             charcnt;
-       TIME_T          ats[TZ_MAX_TIMES];
+       cross_time_t            ats[TZ_MAX_TIMES];
        unsigned char   types[TZ_MAX_TIMES];
        struct ttinfo   ttis[TZ_MAX_TYPES];
        char            chars[TZ_MAX_CHARS + 1];
@@ -126,13 +94,13 @@ static struct state        s;
 
 static int             tz_is_set;
 
-char *                 TZNAME[2] = {
+char *                 cross_tzname[2] = {
        "GMT",
        "GMT"
 };
 
 #ifdef USG_COMPAT
-TIME_T                 timezone = 0;
+cross_time_t                   timezone = 0;
 int                    daylight = 0;
 #endif /* USG_COMPAT */
 
@@ -155,7 +123,7 @@ static int tzload(name) register char *name; {
        {
                register char * p;
                register int    doaccess;
-               char            fullname[_MAXPATHLEN];
+               char            fullname[CROSS_MAXPATHLEN];
 
                doaccess = name[0] == '/';
                if (!doaccess) {
@@ -181,13 +149,13 @@ static int tzload(name) register char *name; {
        }
        {
                register char *                 p;
-               register STRUCT_TZHEAD *        tzhp;
+               register struct cross_tzhead *  tzhp;
                char                            buf[sizeof s];
 
                i = read(fid, buf, sizeof buf);
                if (close(fid) != 0 || i < sizeof *tzhp)
                        return -1;
-               tzhp = (STRUCT_TZHEAD *) buf;
+               tzhp = (struct cross_tzhead *) buf;
                s.timecnt = (int) detzcode(tzhp->tzh_timecnt);
                s.typecnt = (int) detzcode(tzhp->tzh_typecnt);
                s.charcnt = (int) detzcode(tzhp->tzh_charcnt);
@@ -234,9 +202,9 @@ static int tzload(name) register char *name; {
                if (s.ttis[i].tt_abbrind >= s.charcnt)
                        return -1;
        /*
-       ** Set TZNAME elements to initial values.
+       ** Set cross_tzname elements to initial values.
        */
-       TZNAME[0] = TZNAME[1] = &s.chars[0];
+       cross_tzname[0] = cross_tzname[1] = &s.chars[0];
 #ifdef USG_COMPAT
        timezone = s.ttis[0].tt_gmtoff;
        daylight = 0;
@@ -246,12 +214,12 @@ static int tzload(name) register char *name; {
 
                ttisp = &s.ttis[i];
                if (ttisp->tt_isdst) {
-                       TZNAME[1] = &s.chars[ttisp->tt_abbrind];
+                       cross_tzname[1] = &s.chars[ttisp->tt_abbrind];
 #ifdef USG_COMPAT
                        daylight = 1;
 #endif /* USG_COMPAT */ 
                } else {
-                       TZNAME[0] = &s.chars[ttisp->tt_abbrind];
+                       cross_tzname[0] = &s.chars[ttisp->tt_abbrind];
 #ifdef USG_COMPAT
                        timezone = ttisp->tt_gmtoff;
 #endif /* USG_COMPAT */ 
@@ -269,8 +237,8 @@ static int tzsetkernel() {
        s.timecnt = 0;          /* UNIX counts *west* of Greenwich */
        s.ttis[0].tt_gmtoff = tz.tz_minuteswest * -SECS_PER_MIN;
        s.ttis[0].tt_abbrind = 0;
-       (void)strcpy(s.chars, TZTAB(tz.tz_minuteswest, 0));
-       TZNAME[0] = TZNAME[1] = s.chars;
+       (void)strcpy(s.chars, cross_tztab(tz.tz_minuteswest, 0));
+       cross_tzname[0] = cross_tzname[1] = s.chars;
 #ifdef USG_COMPAT
        timezone = tz.tz_minuteswest * 60;
        daylight = tz.tz_dsttime;
@@ -283,14 +251,14 @@ static void tzsetgmt() {
        s.ttis[0].tt_gmtoff = 0;
        s.ttis[0].tt_abbrind = 0;
        (void) strcpy(s.chars, "GMT");
-       TZNAME[0] = TZNAME[1] = s.chars;
+       cross_tzname[0] = cross_tzname[1] = s.chars;
 #ifdef USG_COMPAT
        timezone = 0;
        daylight = 0;
 #endif /* USG_COMPAT */
 }
 
-void TZSET() {
+void cross_tzset() {
        register char * name;
 
        tz_is_set = TRUE;
@@ -306,14 +274,14 @@ void TZSET() {
        tzsetgmt();                             /* GMT is default */
 }
 
-STRUCT_TM *LOCALTIME(timep) TIME_T *timep; {
+struct cross_tm *cross_localtime(timep) cross_time_t *timep; {
        register struct ttinfo *        ttisp;
-       register STRUCT_TM *            tmp;
+       register struct cross_tm *              tmp;
        register int                    i;
-       TIME_T                          t;
+       cross_time_t                            t;
 
        if (!tz_is_set)
-               (void) TZSET();
+               (void) cross_tzset();
        t = *timep;
        if (s.timecnt == 0 || t < s.ats[0]) {
                i = 0;
@@ -332,20 +300,20 @@ STRUCT_TM *LOCALTIME(timep) TIME_T *timep; {
        /*
        ** To get (wrong) behavior that's compatible with System V Release 2.0
        ** you'd replace the statement below with
-       **      tmp = OFFTIME((TIME_T) (t + ttisp->tt_gmtoff), 0L);
+       **      tmp = cross_offtime((cross_time_t) (t + ttisp->tt_gmtoff), 0L);
        */
-       tmp = OFFTIME(&t, ttisp->tt_gmtoff);
+       tmp = cross_offtime(&t, ttisp->tt_gmtoff);
        tmp->tm_isdst = ttisp->tt_isdst;
-       TZNAME[tmp->tm_isdst] = &s.chars[ttisp->tt_abbrind];
+       cross_tzname[tmp->tm_isdst] = &s.chars[ttisp->tt_abbrind];
        tmp->tm_zone = &s.chars[ttisp->tt_abbrind];
        return tmp;
 }
 
-STRUCT_TM *GMTIME(clock) TIME_T *clock; {
-       register STRUCT_TM *    tmp;
+struct cross_tm *cross_gmtime(clock) cross_time_t *clock; {
+       register struct cross_tm *      tmp;
 
-       tmp = OFFTIME(clock, 0L);
-       TZNAME[0] = "GMT";
+       tmp = cross_offtime(clock, 0L);
+       cross_tzname[0] = "GMT";
        tmp->tm_zone = "GMT";           /* UCT ? */
        return tmp;
 }
@@ -359,14 +327,14 @@ static int        year_lengths[2] = {
        DAYS_PER_NYEAR, DAYS_PER_LYEAR
 };
 
-STRUCT_TM *OFFTIME(clock, offset) TIME_T *clock; long offset; {
-       register STRUCT_TM *    tmp;
+struct cross_tm *cross_offtime(clock, offset) cross_time_t *clock; cross_long_t offset; {
+       register struct cross_tm *      tmp;
        register long           days;
        register long           rem;
        register int            y;
        register int            yleap;
        register int *          ip;
-       static STRUCT_TM        tm;
+       static struct cross_tm  tm;
 
        tmp = &tm;
        days = *clock / SECS_PER_DAY;
similarity index 87%
rename from lib/libcross/n.sh
rename to usr.lib/libcross/n.sh
index a2fdfb6..86ba21c 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-ROOT="`pwd |sed -e 's/\/lib\/libcross$//'`"
+ROOT="`pwd |sed -e 's/\/usr\.lib\/libcross$//'`"
 HOSTCC="cc -g -Iinclude -Wall -Wno-char-subscripts -Wno-deprecated-declarations -Wno-format -Wno-maybe-uninitialized -Wno-parentheses -Wno-unused-result"
 INSTALL="$ROOT/scripts/install.sh --strip-program=/bin/true"
 mkdir --parents "$ROOT/cross/lib"
similarity index 85%
rename from lib/libcross/nlist.c
rename to usr.lib/libcross/nlist.c
index edc798b..a3e1ec1 100644 (file)
@@ -26,21 +26,14 @@ static char sccsid[] = "@(#)nlist.c 5.7.1 (2.11BSD GTE) 12/31/93";
 #include <unistd.h>
 
 #ifdef CROSS
-#include "cross/sys/types.h"
-/*#include "cross/sys/file.h"*/
 #include "cross/a.out.h"
-#define NLIST cross_nlist
-#define OFF_T cross_off_t
-#define STRUCT_NLIST struct cross_nlist
-#define STRUCT_XEXEC struct cross_xexec
+#include "cross/sys/types.h"
 #else
-#include <sys/types.h>
-/*#include <sys/file.h>*/
 #include <a.out.h>
-#define NLIST nlist
-#define OFF_T off_t
-#define STRUCT_NLIST struct nlist
-#define STRUCT_XEXEC struct xexec
+#include <sys/types.h>
+#define cross_nlist nlist
+#define cross_off_t off_t
+#define cross_xexec xexec
 #endif
 
 #ifdef CROSS
@@ -52,19 +45,19 @@ static char sccsid[] = "@(#)nlist.c 5.7.1 (2.11BSD GTE) 12/31/93";
 #endif
 
 #ifdef CROSS
-int NLIST(name, list, strtab) char *name; STRUCT_NLIST *list; char *strtab;
+int cross_nlist(name, list, strtab) char *name; struct cross_nlist *list; char *strtab;
 #else
-int NLIST(name, list) char *name; STRUCT_NLIST *list;
+int cross_nlist(name, list) char *name; struct cross_nlist *list;
 #endif
 {
-       register STRUCT_NLIST *p, *s;
-       STRUCT_XEXEC ebuf;
+       register struct cross_nlist *p, *s;
+       struct cross_xexec ebuf;
 #ifdef CROSS
        int i;
 #endif
        FILE *fstr, *fsym;
-       STRUCT_NLIST nbuf;
-       OFF_T strings_offset, symbol_offset, symbol_size;
+       struct cross_nlist nbuf;
+       cross_off_t strings_offset, symbol_offset, symbol_size;
        int entries, len, maxlen;
        char sbuf[128];
 
@@ -119,8 +112,8 @@ int NLIST(name, list) char *name; STRUCT_NLIST *list;
                goto done2;
        }
 
-       for (s = &nbuf; symbol_size; symbol_size -= sizeof(STRUCT_NLIST)) {
-               if (fread((char *)s, sizeof(STRUCT_NLIST), 1, fsym) != 1)
+       for (s = &nbuf; symbol_size; symbol_size -= sizeof(struct cross_nlist)) {
+               if (fread((char *)s, sizeof(struct cross_nlist), 1, fsym) != 1)
                        goto done2;
 #ifdef CROSS
                s->n_un.n_strx = cross_read_long((char *)&s->n_un.n_strx);
diff --git a/usr.lib/libcross/nlist.h b/usr.lib/libcross/nlist.h
new file mode 100644 (file)
index 0000000..bb91a17
--- /dev/null
@@ -0,0 +1,96 @@
+/*-
+ * Copyright (c) 1991 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)nlist.h     5.6.1 (2.11BSD GTE) 1/15/94
+ */
+
+#ifndef        _CROSS_NLIST_H_
+#define        _CROSS_NLIST_H_
+
+#include "cross/cross.h"
+
+#include "cross/sys/types.h"
+
+/*
+ * Symbol table entry format.  The #ifdef's are so that programs including
+ * nlist.h can initialize nlist structures statically.
+ */
+
+struct cross_oldnlist {                /* XXX - compatibility/conversion aid */
+       char    n_name[8];      /* symbol name */
+       cross_int_t     n_type;         /* type flag */
+cross_uint_t   n_value;        /* value */
+};
+
+struct cross_nlist {
+       union {
+#ifndef CROSS
+               char *n_name;   /* In memory address of symbol name */
+#endif
+               cross_off_t n_strx;     /* String table offset (file) */
+       } n_un;
+       cross_u_char    n_type;         /* Type of symbol - see below */
+       char    n_ovly;         /* Overlay number */
+       cross_u_int     n_value;        /* Symbol value */
+};
+
+/*
+ * Simple values for n_type.
+ */
+#define        N_UNDF  0x00            /* undefined */
+#define        N_ABS   0x01            /* absolute */
+#define        N_TEXT  0x02            /* text segment */
+#define        N_DATA  0x03            /* data segment */
+#define        N_BSS   0x04            /* bss segment */
+#define        N_REG   0x14            /* register symbol */
+#define        N_FN    0x1f            /* file name */
+
+#define        N_EXT   0x20            /* external (global) bit, OR'ed in */
+#define        N_TYPE  0x1f            /* mask for all the type bits */
+
+#define        N_FORMAT        "%06o"  /* namelist value format; XXX */
+
+#ifndef __P
+#ifdef __STDC__
+#define __P(params) params
+#else
+#define __P(params) ()
+#endif
+#endif
+
+#ifdef CROSS
+int cross_nlist __P((char *name, struct cross_nlist *list, char *strtab));
+#else
+int cross_nlist __P((char *name, struct cross_nlist *list));
+#endif
+
+#endif
similarity index 50%
rename from lib/libcross/nsym.c
rename to usr.lib/libcross/nsym.c
index ebec3ce..fae4538 100644 (file)
  *                                and symbol tables in an executable is
  *                                rather messy and verbose when dealing
  *                                with overlaid objects.  The macros (in
- *                                a.out.h) N_STROFF, N_SYMOFF, etc simply
+ *                                a.out.h) cross_n_stroff, cross_n_symoff, etc simply
  *                                call these routines.
  *      --------------------------------------------------              
 */
 
 #ifdef CROSS
 #include "cross/a.out.h"
-#undef N_STROFF
-#define N_STROFF cross_n_stroff
-#undef N_SYMOFF
-#define N_SYMOFF cross_n_symoff
-#undef N_DATOFF
-#define N_DATOFF cross_n_datoff
-#undef N_DRELOC
-#define N_DRELOC cross_n_dreloc
-#undef N_TRELOC
-#define N_TRELOC cross_n_treloc
-#define OFF_T cross_off_t
-#define STRUCT_OVLHDR struct cross_ovlhdr
-#define STRUCT_XEXEC struct cross_xexec
-#define U_SHORT cross_u_short
+#include "cross/sys/types.h"
 #else
 #include <a.out.h>
-#undef N_STROFF
-#define N_STROFF n_stroff
-#undef N_SYMOFF
-#define N_SYMOFF n_symoff
-#undef N_DATOFF
-#define N_DATOFF n_datoff
-#undef N_DRELOC
-#define N_DRELOC n_dreloc
-#undef N_TRELOC
-#define N_TRELOC n_treloc
-#define OFF_T off_t
-#define STRUCT_OVLHDR struct ovlhdr
-#define STRUCT_XEXEC struct xexec
-#define U_SHORT u_short
+#include <sys/types.h>
+#define cross_n_stroff n_stroff
+#define cross_n_symoff n_symoff
+#define cross_n_datoff n_datoff
+#define cross_n_dreloc n_dreloc
+#define cross_n_treloc n_treloc
+#define cross_off_t off_t
+#define cross_ovlhdr ovlhdr
+#define cross_xexec xexec
+#define cross_u_short u_short
 #endif
 
-OFF_T N_STROFF(ep) register STRUCT_XEXEC *ep; {
-       OFF_T   l;
+cross_off_t cross_n_stroff(ep) register struct cross_xexec *ep; {
+       cross_off_t     l;
 
-       l = N_SYMOFF(ep);
+       l = cross_n_symoff(ep);
        l += ep->e.a_syms;
        return(l);
 }
 
-OFF_T N_DATOFF(ep) register STRUCT_XEXEC *ep; {
-       OFF_T   l;
+cross_off_t cross_n_datoff(ep) register struct cross_xexec *ep; {
+       cross_off_t     l;
 
-       l = N_TRELOC(ep);
+       l = cross_n_treloc(ep);
        l -= ep->e.a_data;
        return(l);
 }
@@ -71,12 +54,12 @@ OFF_T N_DATOFF(ep) register STRUCT_XEXEC *ep; {
  * called.
 */
 
-OFF_T N_DRELOC(ep) register STRUCT_XEXEC *ep; {
-       OFF_T   l;
-       register U_SHORT *ov = ep->o.ov_siz;
+cross_off_t cross_n_dreloc(ep) register struct cross_xexec *ep; {
+       cross_off_t     l;
+       register cross_u_short *ov = ep->o.ov_siz;
        register int    i;
 
-       l = (OFF_T)sizeof (struct cross_exec) + ep->e.a_text + ep->e.a_data;
+       l = (cross_off_t)sizeof (struct cross_exec) + ep->e.a_text + ep->e.a_data;
        if      (ep->e.a_magic == A_MAGIC5 || ep->e.a_magic == A_MAGIC6)
                {
                for     (i = 0; i < NOVL; i++)
@@ -87,21 +70,21 @@ OFF_T N_DRELOC(ep) register STRUCT_XEXEC *ep; {
        return(l);
 }
 
-OFF_T N_TRELOC(ep) register STRUCT_XEXEC *ep; {
-       OFF_T   l;
+cross_off_t cross_n_treloc(ep) register struct cross_xexec *ep; {
+       cross_off_t     l;
 
-       l = N_DRELOC(ep);
+       l = cross_n_dreloc(ep);
        l -= ep->e.a_text;
        return(l);
 }
 
-OFF_T N_SYMOFF(ep) register STRUCT_XEXEC *ep; {
+cross_off_t cross_n_symoff(ep) register struct cross_xexec *ep; {
        register int    i;
-       register U_SHORT *ov;
-       OFF_T   sum, l;
+       register cross_u_short *ov;
+       cross_off_t     sum, l;
 
-       l = (OFF_T) N_TXTOFF(ep->e);
-       sum = (OFF_T)ep->e.a_text + ep->e.a_data;
+       l = (cross_off_t) N_TXTOFF(ep->e);
+       sum = (cross_off_t)ep->e.a_text + ep->e.a_data;
        if      (ep->e.a_magic == A_MAGIC5 || ep->e.a_magic == A_MAGIC6)
                {
                for     (ov = ep->o.ov_siz, i = 0; i < NOVL; i++)
similarity index 79%
rename from lib/libcross/subset_include/a.out.h
rename to usr.lib/libcross/subset_include/a.out.h
index f03700d..9fe1629 100644 (file)
@@ -36,7 +36,9 @@
 #ifndef        _AOUT_H_
 #define        _AOUT_H_
 
+#include <nlist.h>
 #include <sys/exec.h>
+#include <sys/types.h>
 
 #define        N_BADMAG(x) \
        (((x).a_magic)!=A_MAGIC1 && ((x).a_magic)!=A_MAGIC2 && \
  * must pass an extended header ('xexec') as the argument.
 */
 
-#include <sys/types.h>
+/* Nick added casts below, due to extra strictness when prototypes used */
+#define        N_STROFF(e) (n_stroff((struct xexec *)&e))
+#define        N_SYMOFF(e) (n_symoff((struct xexec *)&e))
+#define        N_DATOFF(e) (n_datoff((struct xexec *)&e))
+#define        N_DRELOC(e) (n_dreloc((struct xexec *)&e))
+#define        N_TRELOC(e) (n_treloc((struct xexec *)&e))
 
-off_t  n_stroff(), n_symoff(), n_datoff(), n_dreloc(), n_treloc();
+#ifndef __P
+#ifdef __STDC__
+#define __P(params) params
+#else
+#define __P(params) ()
+#endif
+#endif
 
-#define        N_STROFF(e) (n_stroff(&e))
-#define        N_SYMOFF(e) (n_symoff(&e))
-#define        N_DATOFF(e) (n_datoff(&e))
-#define        N_DRELOC(e) (n_dreloc(&e))
-#define        N_TRELOC(e) (n_treloc(&e))
-
-/*#define      _AOUT_INCLUDE_*/
-#include <nlist.h>
+off_t n_stroff __P((register struct xexec *ep));
+off_t n_datoff __P((register struct xexec *ep));
+off_t n_dreloc __P((register struct xexec *ep));
+off_t n_treloc __P((register struct xexec *ep));
+off_t n_symoff __P((register struct xexec *ep));
 
 #endif /* !_AOUT_H_ */
similarity index 85%
rename from lib/libcross/subset_include/nlist.h
rename to usr.lib/libcross/subset_include/nlist.h
index fabe1d8..8a8c3ff 100644 (file)
@@ -35,6 +35,7 @@
 
 #ifndef        _NLIST_H_
 #define        _NLIST_H_
+
 #include <sys/types.h>
 
 /*
@@ -51,7 +52,7 @@ unsigned int  n_value;        /* value */
 struct nlist {
 #if 1 /*def    _AOUT_INCLUDE_*/
        union {
-#if 0 /* Nick */
+#ifndef CROSS
                char *n_name;   /* In memory address of symbol name */
 #endif
                off_t n_strx;   /* String table offset (file) */
@@ -80,4 +81,26 @@ struct       nlist {
 #define        N_TYPE  0x1f            /* mask for all the type bits */
 
 #define        N_FORMAT        "%06o"  /* namelist value format; XXX */
-#endif /* !_NLIST_H_ */
+
+#ifndef __P
+#ifdef __STDC__
+#define __P(params) params
+#else
+#define __P(params) ()
+#endif
+#endif
+
+/* nlist.c */
+#ifdef CROSS
+int nlist __P((char *name, struct nlist *list, char *strtab));
+#else
+int nlist __P((char *name, struct nlist *list));
+#endif
+/* nsym.c */
+off_t n_stroff __P((register struct xexec *ep));
+off_t n_datoff __P((register struct xexec *ep));
+off_t n_dreloc __P((register struct xexec *ep));
+off_t n_treloc __P((register struct xexec *ep));
+off_t n_symoff __P((register struct xexec *ep));
+
+#endif
similarity index 99%
rename from lib/libcross/subset_include/ranlib.h
rename to usr.lib/libcross/subset_include/ranlib.h
index d05873f..1e5b6cb 100644 (file)
@@ -42,7 +42,9 @@
 struct ranlib {
        union {
                off_t ran_strx;         /* string table index */
+#ifndef CROSS
                char *ran_name;         /* in memory symbol name */
+#endif
        } ran_un;
        off_t ran_off;                  /* archive file offset */
 };
diff --git a/usr.lib/libcross/subset_include/time.h b/usr.lib/libcross/subset_include/time.h
new file mode 100644 (file)
index 0000000..5fce131
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1983, 1987 Regents of the University of California.
+ * All rights reserved.  The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ *
+ *     @(#)time.h      1.2 (Berkeley) 3/4/87
+ */
+
+#ifndef _TIME_H_
+#define _TIME_H_
+
+/*
+ * Structure returned by gmtime and localtime calls (see ctime(3)).
+ */
+struct tm {
+       int     tm_sec;
+       int     tm_min;
+       int     tm_hour;
+       int     tm_mday;
+       int     tm_mon;
+       int     tm_year;
+       int     tm_wday;
+       int     tm_yday;
+       int     tm_isdst;
+       long    tm_gmtoff;
+       char    *tm_zone;
+};
+
+#ifndef __P
+#ifdef __STDC__
+#define __P(params) params
+#else
+#define __P(params) ()
+#endif
+#endif
+
+/* ctime.c */
+char *ctime __P((time_t *t));
+char *asctime __P((register struct tm *timeptr));
+void tzset __P((void));
+struct tm *localtime __P((time_t *timep));
+struct tm *gmtime __P((time_t *clock));
+struct tm *offtime __P((time_t *clock, long offset));
+/* timezone.c */
+char *timezone __P((int zone, int dst));
+char *tztab __P((register int zone, int dst));
+
+#endif
similarity index 97%
rename from lib/libcross/subset_sys_h/param.h
rename to usr.lib/libcross/subset_sys_h/param.h
index ddc3f62..6719fa0 100644 (file)
@@ -9,7 +9,7 @@
 #ifndef _PARAM_
 #define _PARAM_
 
-#if 0 /* Nick */
+#ifndef CROSS
 #define        BSD     211             /* 2.11 * 10, as cpp doesn't do floats */
 
 #include <sys/localopts.h>
@@ -99,9 +99,9 @@
  * enough to allow all legitimate uses, but halt infinite loops
  * reasonably quickly.
  */
-#endif /* Nick */
+#endif
 #define MAXPATHLEN     256
-#if 0 /* Nick */
+#ifndef CROSS
 #define MAXSYMLINKS    8
 
 /*
  * MAXLOGNAME should be >= UT_NAMESIZE (see <utmp.h>)
  */
 #define        MAXLOGNAME      16              /* max login name length */
-#endif /* Nick */
+#endif
 
 #endif
similarity index 92%
rename from lib/libcross/subset_sys_h/types.h
rename to usr.lib/libcross/subset_sys_h/types.h
index d780d89..8e80bc3 100644 (file)
@@ -9,7 +9,7 @@
 #ifndef _TYPES_
 #define        _TYPES_
 
-#if 0 /* Nick */
+#ifndef CROSS
 /*
  * Basic system types and major/minor device constructing/busting macros.
  */
@@ -28,7 +28,7 @@ typedef       unsigned char   u_char;
 typedef        unsigned short  u_short;
 typedef        unsigned int    u_int;
 typedef unsigned long  u_long;         /* see this! unsigned longs at last! */
-#if 0 /* Nick */
+#ifndef CROSS
 typedef        unsigned short  ushort;         /* sys III compat */
 
 #ifdef pdp11
@@ -44,13 +44,13 @@ typedef     u_short ino_t;
 typedef        long    swblk_t;
 typedef        u_int   size_t;
 typedef        int     ssize_t;
-#endif /* Nick */
+#endif
 typedef        long    time_t;
-#if 0 /* Nick */
+#ifndef CROSS
 typedef        short   dev_t;
-#endif /* Nick */
+#endif
 typedef        long    off_t;
-#if 0 /* Nick */
+#ifndef CROSS
 typedef        u_short uid_t;
 typedef        u_short gid_t;
 typedef        int     pid_t;
@@ -67,6 +67,6 @@ typedef       u_short mode_t;
 typedef char   bool_t;         /* boolean */
 typedef u_int  memaddr;        /* core or swap address */
 typedef long   ubadr_t;        /* unibus address */
-#endif /* Nick */
+#endif
 
 #endif
similarity index 85%
rename from lib/libcross/timezone.c
rename to usr.lib/libcross/timezone.c
index 5b3d510..38b987b 100644 (file)
@@ -14,12 +14,10 @@ static char sccsid[] = "@(#)timezone.c      1.2 (2.11BSD) 1996/11/27";
 
 #ifdef CROSS
 #include "cross/tzfile.h"
-#define TIMEZONE cross_timezone
-#define TZTAB cross_tztab
 #else
 #include <tzfile.h>
-#define TIMEZONE timezone
-#define TZTAB tztab
+#define cross_timezone timezone
+#define cross_tztab tztab
 #endif
 
 /*
@@ -40,14 +38,14 @@ static char czone[TZ_MAX_CHARS];            /* space for zone name */
 #endif
 #endif
 
-char *TIMEZONE __P((int zone, int dst));
-char *TZTAB __P((register int zone, int dst));
+char *cross_timezone __P((int zone, int dst));
+char *cross_tztab __P((register int zone, int dst));
 
-char *TIMEZONE(zone, dst) int zone; int dst; {
+char *cross_timezone(zone, dst) int zone; int dst; {
        register char   *beg,
                        *end;
 
-       if (beg = getenv("TZNAME")) {           /* set in environment */
+       if (beg = getenv("cross_tzname")) {             /* set in environment */
                if (end = index(beg, ',')) {    /* "PST,PDT" */
                        if (dst)
                                return(++end);
@@ -59,7 +57,7 @@ char *TIMEZONE(zone, dst) int zone; int dst; {
                }
                return(beg);
        }
-       return(TZTAB(zone,dst));        /* default: table or created zone */
+       return(cross_tztab(zone,dst));  /* default: table or created zone */
 }
 
 static struct zone {
@@ -92,7 +90,7 @@ static struct zone {
  *     aren't in place in /usr/share/misc.  DO NOT USE THIS ROUTINE OUTSIDE 
  *     OF THE STANDARD LIBRARY.
  */
-char *TZTAB(zone, dst) register int zone; int dst; {
+char *cross_tztab(zone, dst) register int zone; int dst; {
        register struct zone    *zp;
        register char   sign;
 
index c3e46fd..a4fe6cb 100644 (file)
@@ -8,12 +8,13 @@ OBJECTS = vmf.o
 
 all:  genlib genlib_p vmf.0
 
-CFLAGS = -O
+CFLAGS = -I. -O
 
 vmf.0: vmf.3
        ${MANROFF} vmf.3 > vmf.0
 
 install: all
+       ${INSTALL} -c -m 644 vmf.h ${DESTDIR}/usr/include
        ${INSTALL} -c -m 644 genlib ${DESTDIR}/usr/lib/libvmf.a
        ${RANLIB} ${DESTDIR}/usr/lib/libvmf.a
        ${INSTALL} -c -m 644 genlib_p ${DESTDIR}/usr/lib/libvmf_p.a
similarity index 100%
rename from include/vmf.h
rename to usr.lib/libvmf/vmf.h