Implement build-time zone info compilation, not tested yet, implement libcross which...
authorNick Downing <downing.nick@gmail.com>
Tue, 10 Jan 2017 16:04:13 +0000 (03:04 +1100)
committerNick Downing <downing.nick@gmail.com>
Tue, 10 Jan 2017 16:19:57 +0000 (03:19 +1100)
34 files changed:
.gitignore
lib/libc/o.sh [moved from lib/libc/n.sh with 100% similarity]
lib/libcross/Makefile [new file with mode: 0644]
lib/libcross/copy.sed [new file with mode: 0644]
lib/libcross/cross.c [new file with mode: 0644]
lib/libcross/cross.h [new file with mode: 0644]
lib/libcross/ctime.c [new file with mode: 0644]
lib/libcross/n.sh [new file with mode: 0755]
lib/libcross/nlist.c [new file with mode: 0644]
lib/libcross/nsym.c [new file with mode: 0644]
lib/libcross/subset_include/a.out.h [new file with mode: 0644]
lib/libcross/subset_include/ar.h [new file with mode: 0644]
lib/libcross/subset_include/nlist.h [new file with mode: 0644]
lib/libcross/subset_include/ranlib.h [new file with mode: 0644]
lib/libcross/subset_include/time.h [new file with mode: 0644]
lib/libcross/subset_include/tzfile.h [new file with mode: 0644]
lib/libcross/subset_sys_h/exec.h [new file with mode: 0644]
lib/libcross/subset_sys_h/param.h [new file with mode: 0644]
lib/libcross/subset_sys_h/types.h [new file with mode: 0644]
lib/libcross/timezone.c [new file with mode: 0644]
n.sh
o.sh
p.sh
share/zoneinfo/Makefile
share/zoneinfo/ialloc.c
share/zoneinfo/include/tzfile.h [deleted symlink]
share/zoneinfo/o.sh
share/zoneinfo/scheck.c
share/zoneinfo/zdump.c
share/zoneinfo/zic.c
ucb/tn3270/Makefile
usr.lib/libF77/Version.c
usr.sbin/named/named/version
usr.sbin/named/tools/nslookup/Makefile

index 4cfd514..62e82f4 100644 (file)
@@ -188,6 +188,7 @@ 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
@@ -286,6 +287,7 @@ sbin/tunefs/tunefs
 sbin/umount/umount
 share/me/_mac_tmp_
 share/termcap/termcap
+share/zoneinfo/hostzic
 share/zoneinfo/zdump
 share/zoneinfo/zic
 stage
similarity index 100%
rename from lib/libc/n.sh
rename to lib/libc/o.sh
diff --git a/lib/libcross/Makefile b/lib/libcross/Makefile
new file mode 100644 (file)
index 0000000..61502ea
--- /dev/null
@@ -0,0 +1,53 @@
+CFLAGS=-I. -DCROSS
+INSTALL=install
+RANLIB=ranlib
+
+all: include libcross.a
+
+include: cross/cross.h cross/a.out.h cross/ar.h cross/nlist.h cross/ranlib.h cross/time.h cross/tzfile.h cross/sys/exec.h cross/sys/param.h cross/sys/types.h
+
+libcross.a: cross.o ctime.o nlist.o nsym.o timezone.o
+       rm -f $@
+       ar cr $@ cross.o ctime.o nlist.o nsym.o timezone.o
+
+install: include libcross.a
+       rm -rf ${DESTDIR}/usr/include/cross
+       cp -r cross ${DESTDIR}/usr/include
+       ${INSTALL} libcross.a ${DESTDIR}/usr/lib
+       ${RANLIB} ${DESTDIR}/usr/lib/libcross.a
+
+cross/cross.h: cross.h
+       mkdir -p cross
+       cp $< $@
+
+cross/a.out.h: subset_include/a.out.h copy.sed
+       mkdir -p cross
+       sed -f 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
+       mkdir -p cross
+       sed -f copy.sed $< >$@
+cross/ranlib.h: subset_include/ranlib.h copy.sed
+       mkdir -p cross
+       sed -f copy.sed $< >$@
+cross/time.h: subset_include/time.h copy.sed
+       mkdir -p cross
+       sed -f copy.sed $< >$@
+cross/tzfile.h: subset_include/tzfile.h copy.sed
+       mkdir -p cross
+       sed -f copy.sed $< >$@
+
+cross/sys/exec.h: subset_sys_h/exec.h copy.sed
+       mkdir -p cross/sys
+       sed -f copy.sed $< >$@
+cross/sys/param.h: subset_sys_h/param.h copy.sed
+       mkdir -p cross/sys
+       sed -f copy.sed $< >$@
+cross/sys/types.h: subset_sys_h/types.h copy.sed
+       mkdir -p cross/sys
+       sed -f copy.sed $< >$@
+
+clean:
+       rm -rf cross *.o
diff --git a/lib/libcross/copy.sed b/lib/libcross/copy.sed
new file mode 100644 (file)
index 0000000..09d3a7b
--- /dev/null
@@ -0,0 +1,43 @@
+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 ]*\)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"/
+
+s/^unsigned[\t ]\+\(int\|long\|short\)$/cross_u\1_t/g
+s/^unsigned[\t ]\+\(int\|long\|short\)\([^0-9A-Za-z_]\)/cross_u\1_t\2/g
+s/\([^0-9A-Za-z_]\)unsigned[\t ]\+\(int\|long\|short\)$/\1cross_u\2_t/g
+s/\([^0-9A-Za-z_]\)unsigned[\t ]\+\(int\|long\|short\)\([^0-9A-Za-z_]\)/\1cross_u\2_t\3/g
+
+s/^\(int\|long\|short\|unsigned\)$/cross_\1_t/g
+s/^\(int\|long\|short\|unsigned\)\([^0-9A-Za-z_]\)/cross_\1_t\2/g
+s/\([^0-9A-Za-z_]\)\(int\|long\|short\|unsigned\)$/\1cross_\2_t/g
+s/\([^0-9A-Za-z_]\)\(int\|long\|short\|unsigned\)\([^0-9A-Za-z_]\)/\1cross_\2_t\3/g
+
+s/^cross_unsigned_t\([\t ]\+\)char$/unsigned\1char/g
+s/^cross_unsigned_t\([\t ]\+\)char\([^0-9A-Za-z_]\)/unsigned\1char\2/g
+s/\([^0-9A-Za-z_]\)cross_unsigned_t\([\t ]\+\)char$/\1unsigned\2char/g
+s/\([^0-9A-Za-z_]\)cross_unsigned_t\([\t ]\+\)char\([^0-9A-Za-z_]\)/\1unsigned\2char\3/g
+
+s/^cross_unsigned_t$/cross_uint_t/g
+s/^cross_unsigned_t\([^0-9A-Za-z_]\)/cross_uint_t\1/g
+s/\([^0-9A-Za-z_]\)cross_unsigned_t$/\1cross_uint_t/g
+s/\([^0-9A-Za-z_]\)cross_unsigned_t\([^0-9A-Za-z_]\)/\1cross_uint_t\2/g
+
+s/^\(MAXPATHLEN\)$/CROSS_\1/g
+s/^\(MAXPATHLEN\)\([^0-9A-Za-z_]\)/CROSS_\1\2/g
+s/\([^0-9A-Za-z_]\)\(MAXPATHLEN\)$/\1CROSS_\2/g
+s/\([^0-9A-Za-z_]\)\(MAXPATHLEN\)\([^0-9A-Za-z_]\)/\1CROSS_\2\3/g
+
+s/^\(off_t\|time_t\|u_char\|u_int\|u_long\|u_short\)$/cross_\1/g
+s/^\(off_t\|time_t\|u_char\|u_int\|u_long\|u_short\)\([^0-9A-Za-z_]\)/cross_\1\2/g
+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/^\(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
diff --git a/lib/libcross/cross.c b/lib/libcross/cross.c
new file mode 100644 (file)
index 0000000..5a307bc
--- /dev/null
@@ -0,0 +1,61 @@
+#include "cross/cross.h"
+
+void cross_read_float(res, buf) cross_float_t *res; char *buf; {
+       res->data[0] = (buf[0] & 0xff) | ((buf[1] & 0xff) << 8);
+       res->data[1] = (buf[2] & 0xff) | ((buf[3] & 0xff) << 8);
+}
+
+void cross_read_double(res, buf) cross_double_t *res; char *buf; {
+       res->data[0] = (buf[0] & 0xff) | ((buf[1] & 0xff) << 8);
+       res->data[1] = (buf[2] & 0xff) | ((buf[3] & 0xff) << 8);
+       res->data[2] = (buf[4] & 0xff) | ((buf[5] & 0xff) << 8);
+       res->data[3] = (buf[6] & 0xff) | ((buf[7] & 0xff) << 8);
+}
+
+short cross_read_short(buf) char *buf; {
+       return (buf[0] & 0xff) | ((buf[1] & 0xff) << 8);
+}
+
+int cross_read_int(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);
+}
+
+void cross_write_float(buf, val) char *buf; cross_float_t *val; {
+       buf[0] = val->data[0] & 0xff;
+       buf[1] = (val->data[0] >> 8) & 0xff;
+       buf[2] = val->data[1] & 0xff;
+       buf[3] = (val->data[1] >> 8) & 0xff;
+}
+
+void cross_write_double(buf, val) char *buf; cross_double_t *val; {
+       buf[0] = val->data[0] & 0xff;
+       buf[1] = (val->data[0] >> 8) & 0xff;
+       buf[2] = val->data[1] & 0xff;
+       buf[3] = (val->data[1] >> 8) & 0xff;
+       buf[4] = val->data[2] & 0xff;
+       buf[5] = (val->data[2] >> 8) & 0xff;
+       buf[6] = val->data[3] & 0xff;
+       buf[7] = (val->data[3] >> 8) & 0xff;
+}
+
+void cross_write_short(buf, val) char *buf; int val; {
+       buf[0] = val & 0xff;
+       buf[1] = (val >> 8) & 0xff;
+}
+
+void cross_write_int(buf, val) char *buf; int val; {
+       buf[0] = val & 0xff;
+       buf[1] = (val >> 8) & 0xff;
+}
+
+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;
+}
diff --git a/lib/libcross/cross.h b/lib/libcross/cross.h
new file mode 100644 (file)
index 0000000..4744895
--- /dev/null
@@ -0,0 +1,45 @@
+#ifndef _CROSS_H_
+#define _CROSS_H_
+
+#ifdef pdp11
+typedef double cross_double_t;
+typedef float cross_float_t;
+typedef int cross_int_t;
+typedef long cross_long_t;
+typedef short cross_short_t;
+typedef unsigned int cross_uint_t;
+typedef unsigned long cross_ulong_t;
+typedef unsigned short cross_ushort_t;
+#else
+#include <stdint.h>
+typedef struct { uint16_t data[4]; } cross_double_t;
+typedef struct { uint16_t data[2]; } cross_float_t;
+typedef int16_t cross_int_t;
+typedef int32_t cross_long_t;
+typedef int16_t cross_short_t;
+typedef uint16_t cross_uint_t;
+typedef uint32_t cross_ulong_t;
+typedef uint16_t cross_ushort_t;
+#endif
+
+#ifndef __P
+#ifdef __STDC__
+#define __P(params) params
+#else
+#define __P(params) ()
+#endif
+#endif
+
+/* cross.c */
+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));
+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_long __P((char *buf, long val));
+
+#endif
diff --git a/lib/libcross/ctime.c b/lib/libcross/ctime.c
new file mode 100644 (file)
index 0000000..8b74cc6
--- /dev/null
@@ -0,0 +1,414 @@
+/*
+ * Copyright (c) 1987 Regents of the University of California.
+ * This file may be freely redistributed provided that this
+ * notice remains attached.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)CTIME.c    1.1 (Berkeley) 3/25/87";
+#endif
+
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/time.h>
+
+#ifdef CROSS
+#include "cross/sys/param.h"
+#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
+#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)));
+}
+
+/*
+** A la X3J11
+*/
+
+char *ASCTIME(timeptr) register STRUCT_TM *timeptr; {
+       static char     wday_name[DAYS_PER_WEEK][3] = {
+               "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
+       };
+       static char     mon_name[MONS_PER_YEAR][3] = {
+               "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+               "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
+       };
+       static char     result[26];
+
+       (void) sprintf(result, "%.3s %.3s%3d %02d:%02d:%02d %d\n",
+               wday_name[timeptr->tm_wday],
+               mon_name[timeptr->tm_mon],
+               timeptr->tm_mday, timeptr->tm_hour,
+               timeptr->tm_min, timeptr->tm_sec,
+               TM_YEAR_BASE + timeptr->tm_year);
+       return result;
+}
+
+#ifndef TRUE
+#define TRUE           1
+#define FALSE          0
+#endif /* !TRUE */
+
+STRUCT_TM *            OFFTIME();
+
+struct ttinfo {                                /* time type information */
+       long            tt_gmtoff;      /* GMT offset in seconds */
+       int             tt_isdst;       /* used to set tm_isdst */
+       int             tt_abbrind;     /* abbreviation list index */
+};
+
+struct state {
+       int             timecnt;
+       int             typecnt;
+       int             charcnt;
+       TIME_T          ats[TZ_MAX_TIMES];
+       unsigned char   types[TZ_MAX_TIMES];
+       struct ttinfo   ttis[TZ_MAX_TYPES];
+       char            chars[TZ_MAX_CHARS + 1];
+};
+
+static struct state    s;
+
+static int             tz_is_set;
+
+char *                 TZNAME[2] = {
+       "GMT",
+       "GMT"
+};
+
+#ifdef USG_COMPAT
+TIME_T                 timezone = 0;
+int                    daylight = 0;
+#endif /* USG_COMPAT */
+
+static long detzcode(codep) char *codep; {
+       register long   result;
+       register int    i;
+
+       result = 0;
+       for (i = 0; i < 4; ++i)
+               result = (result << 8) | (codep[i] & 0xff);
+       return result;
+}
+
+static int tzload(name) register char *name; {
+       register int    i;
+       register int    fid;
+
+       if (name == 0 && (name = TZDEFAULT) == 0)
+               return -1;
+       {
+               register char * p;
+               register int    doaccess;
+               char            fullname[_MAXPATHLEN];
+
+               doaccess = name[0] == '/';
+               if (!doaccess) {
+                       if ((p = TZDIR) == 0)
+                               return -1;
+                       if ((strlen(p) + strlen(name) + 1) >= sizeof fullname)
+                               return -1;
+                       (void) strcpy(fullname, p);
+                       (void) strcat(fullname, "/");
+                       (void) strcat(fullname, name);
+                       /*
+                       ** Set doaccess if '.' (as in "../") shows up in name.
+                       */
+                       while (*name != '\0')
+                               if (*name++ == '.')
+                                       doaccess = TRUE;
+                       name = fullname;
+               }
+               if (doaccess && access(name, 4) != 0)
+                       return -1;
+               if ((fid = open(name, 0)) == -1)
+                       return -1;
+       }
+       {
+               register char *                 p;
+               register STRUCT_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;
+               s.timecnt = (int) detzcode(tzhp->tzh_timecnt);
+               s.typecnt = (int) detzcode(tzhp->tzh_typecnt);
+               s.charcnt = (int) detzcode(tzhp->tzh_charcnt);
+               if (s.timecnt > TZ_MAX_TIMES ||
+                       s.typecnt == 0 ||
+                       s.typecnt > TZ_MAX_TYPES ||
+                       s.charcnt > TZ_MAX_CHARS)
+                               return -1;
+               if (i < sizeof *tzhp +
+                       s.timecnt * (4 + sizeof (char)) +
+                       s.typecnt * (4 + 2 * sizeof (char)) +
+                       s.charcnt * sizeof (char))
+                               return -1;
+               p = buf + sizeof *tzhp;
+               for (i = 0; i < s.timecnt; ++i) {
+                       s.ats[i] = detzcode(p);
+                       p += 4;
+               }
+               for (i = 0; i < s.timecnt; ++i)
+                       s.types[i] = (unsigned char) *p++;
+               for (i = 0; i < s.typecnt; ++i) {
+                       register struct ttinfo *        ttisp;
+
+                       ttisp = &s.ttis[i];
+                       ttisp->tt_gmtoff = detzcode(p);
+                       p += 4;
+                       ttisp->tt_isdst = (unsigned char) *p++;
+                       ttisp->tt_abbrind = (unsigned char) *p++;
+               }
+               for (i = 0; i < s.charcnt; ++i)
+                       s.chars[i] = *p++;
+               s.chars[i] = '\0';      /* ensure '\0' at end */
+       }
+       /*
+       ** Check that all the local time type indices are valid.
+       */
+       for (i = 0; i < s.timecnt; ++i)
+               if (s.types[i] >= s.typecnt)
+                       return -1;
+       /*
+       ** Check that all abbreviation indices are valid.
+       */
+       for (i = 0; i < s.typecnt; ++i)
+               if (s.ttis[i].tt_abbrind >= s.charcnt)
+                       return -1;
+       /*
+       ** Set TZNAME elements to initial values.
+       */
+       TZNAME[0] = TZNAME[1] = &s.chars[0];
+#ifdef USG_COMPAT
+       timezone = s.ttis[0].tt_gmtoff;
+       daylight = 0;
+#endif /* USG_COMPAT */
+       for (i = 1; i < s.typecnt; ++i) {
+               register struct ttinfo *        ttisp;
+
+               ttisp = &s.ttis[i];
+               if (ttisp->tt_isdst) {
+                       TZNAME[1] = &s.chars[ttisp->tt_abbrind];
+#ifdef USG_COMPAT
+                       daylight = 1;
+#endif /* USG_COMPAT */ 
+               } else {
+                       TZNAME[0] = &s.chars[ttisp->tt_abbrind];
+#ifdef USG_COMPAT
+                       timezone = ttisp->tt_gmtoff;
+#endif /* USG_COMPAT */ 
+               }
+       }
+       return 0;
+}
+
+static int tzsetkernel() {
+       struct timeval  tv;
+       struct timezone tz;
+
+       if (gettimeofday(&tv, &tz))
+               return -1;
+       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;
+#ifdef USG_COMPAT
+       timezone = tz.tz_minuteswest * 60;
+       daylight = tz.tz_dsttime;
+#endif /* USG_COMPAT */
+       return 0;
+}
+
+static void tzsetgmt() {
+       s.timecnt = 0;
+       s.ttis[0].tt_gmtoff = 0;
+       s.ttis[0].tt_abbrind = 0;
+       (void) strcpy(s.chars, "GMT");
+       TZNAME[0] = TZNAME[1] = s.chars;
+#ifdef USG_COMPAT
+       timezone = 0;
+       daylight = 0;
+#endif /* USG_COMPAT */
+}
+
+void TZSET() {
+       register char * name;
+
+       tz_is_set = TRUE;
+       name = getenv("TZ");
+       if (!name || *name) {                   /* did not request GMT */
+               if (name && !tzload(name))      /* requested name worked */
+                       return;
+               if (!tzload((char *)0))         /* default name worked */
+                       return;
+               if (!tzsetkernel())             /* kernel guess worked */
+                       return;
+       }
+       tzsetgmt();                             /* GMT is default */
+}
+
+STRUCT_TM *LOCALTIME(timep) TIME_T *timep; {
+       register struct ttinfo *        ttisp;
+       register STRUCT_TM *            tmp;
+       register int                    i;
+       TIME_T                          t;
+
+       if (!tz_is_set)
+               (void) TZSET();
+       t = *timep;
+       if (s.timecnt == 0 || t < s.ats[0]) {
+               i = 0;
+               while (s.ttis[i].tt_isdst)
+                       if (++i >= s.timecnt) {
+                               i = 0;
+                               break;
+                       }
+       } else {
+               for (i = 1; i < s.timecnt; ++i)
+                       if (t < s.ats[i])
+                               break;
+               i = s.types[i - 1];
+       }
+       ttisp = &s.ttis[i];
+       /*
+       ** 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 = OFFTIME(&t, ttisp->tt_gmtoff);
+       tmp->tm_isdst = ttisp->tt_isdst;
+       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;
+
+       tmp = OFFTIME(clock, 0L);
+       TZNAME[0] = "GMT";
+       tmp->tm_zone = "GMT";           /* UCT ? */
+       return tmp;
+}
+
+static int     mon_lengths[2][MONS_PER_YEAR] = {
+       {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
+       {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
+};
+
+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;
+       register long           days;
+       register long           rem;
+       register int            y;
+       register int            yleap;
+       register int *          ip;
+       static STRUCT_TM        tm;
+
+       tmp = &tm;
+       days = *clock / SECS_PER_DAY;
+       rem = *clock % SECS_PER_DAY;
+       rem += offset;
+       while (rem < 0) {
+               rem += SECS_PER_DAY;
+               --days;
+       }
+       while (rem >= SECS_PER_DAY) {
+               rem -= SECS_PER_DAY;
+               ++days;
+       }
+       tmp->tm_hour = (int) (rem / SECS_PER_HOUR);
+       rem = rem % SECS_PER_HOUR;
+       tmp->tm_min = (int) (rem / SECS_PER_MIN);
+       tmp->tm_sec = (int) (rem % SECS_PER_MIN);
+       tmp->tm_wday = (int) ((EPOCH_WDAY + days) % DAYS_PER_WEEK);
+       if (tmp->tm_wday < 0)
+               tmp->tm_wday += DAYS_PER_WEEK;
+       y = EPOCH_YEAR;
+       if (days >= 0)
+               for ( ; ; ) {
+                       yleap = isleap(y);
+                       if (days < (long) year_lengths[yleap])
+                               break;
+                       ++y;
+                       days = days - (long) year_lengths[yleap];
+               }
+       else do {
+               --y;
+               yleap = isleap(y);
+               days = days + (long) year_lengths[yleap];
+       } while (days < 0);
+       tmp->tm_year = y - TM_YEAR_BASE;
+       tmp->tm_yday = (int) days;
+       ip = mon_lengths[yleap];
+       for (tmp->tm_mon = 0; days >= (long) ip[tmp->tm_mon]; ++(tmp->tm_mon))
+               days = days - (long) ip[tmp->tm_mon];
+       tmp->tm_mday = (int) (days + 1);
+       tmp->tm_isdst = 0;
+       tmp->tm_zone = "";
+       tmp->tm_gmtoff = offset;
+       return tmp;
+}
diff --git a/lib/libcross/n.sh b/lib/libcross/n.sh
new file mode 100755 (executable)
index 0000000..a2fdfb6
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh
+ROOT="`pwd |sed -e 's/\/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"
+make CC="$HOSTCC" && \
+make INSTALL="$INSTALL" DESTDIR="$ROOT/cross" install
diff --git a/lib/libcross/nlist.c b/lib/libcross/nlist.c
new file mode 100644 (file)
index 0000000..edc798b
--- /dev/null
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 1989 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that: (1) source distributions retain this entire copyright
+ * notice and comment, and (2) distributions including binaries display
+ * the following acknowledgement:  ``This product includes software
+ * developed by the University of California, Berkeley and its contributors''
+ * in the documentation or other materials provided with the distribution
+ * and in all advertising materials mentioning features or use of this
+ * software. 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 ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)nlist.c    5.7.1 (2.11BSD GTE) 12/31/93";
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#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
+#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
+#endif
+
+#ifdef CROSS
+#define N_NAME(sp) (strtab + (sp)->n_un.n_strx)
+#define ISVALID(sp) ((sp)->n_un.n_strx && strtab[(sp)->n_un.n_strx])
+#else
+#define N_NAME(sp) ((sp)->n_un.n_name)
+#define ISVALID(sp) ((sp)->n_un.n_name && (sp)->n_un.n_name[0])
+#endif
+
+#ifdef CROSS
+int NLIST(name, list, strtab) char *name; STRUCT_NLIST *list; char *strtab;
+#else
+int NLIST(name, list) char *name; STRUCT_NLIST *list;
+#endif
+{
+       register STRUCT_NLIST *p, *s;
+       STRUCT_XEXEC ebuf;
+#ifdef CROSS
+       int i;
+#endif
+       FILE *fstr, *fsym;
+       STRUCT_NLIST nbuf;
+       OFF_T strings_offset, symbol_offset, symbol_size;
+       int entries, len, maxlen;
+       char sbuf[128];
+
+       entries = -1;
+
+       if (!(fsym = fopen(name, "r")))
+               return(-1);
+       if (fread((char *)&ebuf, sizeof(ebuf), 1, fsym) != 1)
+               goto done1;
+#ifdef CROSS
+       ebuf.e.a_magic = cross_read_int((char *)&ebuf.e.a_magic);
+       ebuf.e.a_text = cross_read_int((char *)&ebuf.e.a_text);
+       ebuf.e.a_data = cross_read_int((char *)&ebuf.e.a_data);
+       ebuf.e.a_bss = cross_read_int((char *)&ebuf.e.a_bss);
+       ebuf.e.a_syms = cross_read_int((char *)&ebuf.e.a_syms);
+       ebuf.e.a_entry = cross_read_int((char *)&ebuf.e.a_entry);
+       ebuf.e.a_unused = cross_read_int((char *)&ebuf.e.a_unused);
+       ebuf.e.a_flag = cross_read_int((char *)&ebuf.e.a_flag);
+       ebuf.o.max_ovl = cross_read_int((char *)&ebuf.o.max_ovl);
+       for (i = 0; i < NOVL; ++i)
+               ebuf.o.ov_siz[i] = cross_read_int((char *)(ebuf.o.ov_siz + i));
+#endif
+       if (N_BADMAG(ebuf.e))
+               goto done1;
+
+       symbol_offset = N_SYMOFF(ebuf);
+       symbol_size = ebuf.e.a_syms;
+       strings_offset = N_STROFF(ebuf);
+       if (fseek(fsym, (off_t)symbol_offset, L_SET))
+               goto done1;
+
+       if (!(fstr = fopen(name, "r")))
+               goto done1;
+
+       /*
+        * clean out any left-over information for all valid entries.
+        * Type and value defined to be 0 if not found; historical
+        * versions cleared other and desc as well.  Also figure out
+        * the largest string length so don't read any more of the
+        * string table than we have to.
+        */
+       for (p = list, entries = maxlen = 0; ISVALID(p); ++p, ++entries) {
+               p->n_type = 0;
+               p->n_ovly = 0;
+               p->n_value = 0;
+               if ((len = strlen(N_NAME(p))) > maxlen)
+                       maxlen = len;
+       }
+       if (++maxlen > sizeof(sbuf)) {          /* for the NULL */
+               (void)fprintf(stderr, "nlist: sym 2 big\n");
+               entries = -1;
+               goto done2;
+       }
+
+       for (s = &nbuf; symbol_size; symbol_size -= sizeof(STRUCT_NLIST)) {
+               if (fread((char *)s, sizeof(STRUCT_NLIST), 1, fsym) != 1)
+                       goto done2;
+#ifdef CROSS
+               s->n_un.n_strx = cross_read_long((char *)&s->n_un.n_strx);
+               s->n_value = cross_read_int((char *)&s->n_value);
+#endif
+               if (!s->n_un.n_strx)
+                       continue;
+               if (fseek(fstr, (off_t)(strings_offset + s->n_un.n_strx), L_SET))
+                       goto done2;
+               (void)fread(sbuf, sizeof(sbuf[0]), maxlen, fstr);
+               for (p = list; ISVALID(p); p++)
+                       if (!strcmp(N_NAME(p), sbuf)) {
+                               p->n_value = s->n_value;
+                               p->n_type = s->n_type;
+                               p->n_ovly = s->n_ovly;
+                               if (!--entries)
+                                       goto done2;
+                       }
+       }
+done2: (void)fclose(fstr);
+done1: (void)fclose(fsym);
+       return(entries);
+}
diff --git a/lib/libcross/nsym.c b/lib/libcross/nsym.c
new file mode 100644 (file)
index 0000000..ebec3ce
--- /dev/null
@@ -0,0 +1,114 @@
+
+/*
+ *      Program Name:   nsym.c
+ *      Author:  S.M. Schultz
+ *
+ *      -----------   Modification History   ------------
+ *      Version Date            Reason For Modification
+ *      1.0     31Oct93         1. Initial release into the public domain.
+ *                                Calculating the offsets of the string
+ *                                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
+ *                                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
+#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
+#endif
+
+OFF_T N_STROFF(ep) register STRUCT_XEXEC *ep; {
+       OFF_T   l;
+
+       l = N_SYMOFF(ep);
+       l += ep->e.a_syms;
+       return(l);
+}
+
+OFF_T N_DATOFF(ep) register STRUCT_XEXEC *ep; {
+       OFF_T   l;
+
+       l = N_TRELOC(ep);
+       l -= ep->e.a_data;
+       return(l);
+}
+
+/*
+ * Obviously if bit 0 of the flags word (a_flag) is not off then there's
+ * no relocation information present and this routine shouldn't have been
+ * called.
+*/
+
+OFF_T N_DRELOC(ep) register STRUCT_XEXEC *ep; {
+       OFF_T   l;
+       register 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;
+       if      (ep->e.a_magic == A_MAGIC5 || ep->e.a_magic == A_MAGIC6)
+               {
+               for     (i = 0; i < NOVL; i++)
+                       l += *ov++;
+               l += sizeof (struct cross_ovlhdr);
+               }
+       l += ep->e.a_text;
+       return(l);
+}
+
+OFF_T N_TRELOC(ep) register STRUCT_XEXEC *ep; {
+       OFF_T   l;
+
+       l = N_DRELOC(ep);
+       l -= ep->e.a_text;
+       return(l);
+}
+
+OFF_T N_SYMOFF(ep) register STRUCT_XEXEC *ep; {
+       register int    i;
+       register U_SHORT *ov;
+       OFF_T   sum, l;
+
+       l = (OFF_T) N_TXTOFF(ep->e);
+       sum = (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++)
+                       sum += *ov++;
+               }
+       l += sum;
+       if      ((ep->e.a_flag & 1) == 0)       /* relocation present? */
+               l += sum;
+       return(l);
+}
diff --git a/lib/libcross/subset_include/a.out.h b/lib/libcross/subset_include/a.out.h
new file mode 100644 (file)
index 0000000..f03700d
--- /dev/null
@@ -0,0 +1,72 @@
+/*-
+ * 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.
+ *
+ *     @(#)a.out.h     5.6.1 (2.11BSD GTE) 1/6/94
+ */
+
+#ifndef        _AOUT_H_
+#define        _AOUT_H_
+
+#include <sys/exec.h>
+
+#define        N_BADMAG(x) \
+       (((x).a_magic)!=A_MAGIC1 && ((x).a_magic)!=A_MAGIC2 && \
+       ((x).a_magic)!=A_MAGIC3 && ((x).a_magic)!=A_MAGIC4 && \
+       ((x).a_magic)!=A_MAGIC5 && ((x).a_magic)!=A_MAGIC6)
+
+#define        N_TXTOFF(x) \
+       ((x).a_magic==A_MAGIC5 || (x).a_magic==A_MAGIC6 ? \
+       sizeof(struct ovlhdr) + sizeof(struct exec) : sizeof(struct exec))
+
+/*
+ * The following were added as part of the new object file format.  They
+ * call functions because calculating the sums of overlay sizes was too
+ * messy (and verbose) to do 'inline'.
+ *
+ * NOTE: if the magic number is that of an overlaid object the program
+ * must pass an extended header ('xexec') as the argument.
+*/
+
+#include <sys/types.h>
+
+off_t  n_stroff(), n_symoff(), n_datoff(), n_dreloc(), n_treloc();
+
+#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>
+
+#endif /* !_AOUT_H_ */
diff --git a/lib/libcross/subset_include/ar.h b/lib/libcross/subset_include/ar.h
new file mode 100644 (file)
index 0000000..b0bd443
--- /dev/null
@@ -0,0 +1,62 @@
+/*-
+ * Copyright (c) 1991 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Hugh Smith at The University of Guelph.
+ *
+ * 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.
+ *
+ *     @(#)ar.h        5.4 (Berkeley) 4/3/91
+ */
+
+#ifndef _AR_H_
+#define        _AR_H_
+
+/* Pre-4BSD archives had these magic numbers in them. */
+#define        OARMAG1 0177555
+#define        OARMAG2 0177545
+
+#define        ARMAG           "!<arch>\n"     /* ar "magic number" */
+#define        SARMAG          8               /* strlen(ARMAG); */
+
+#define        AR_EFMT1        "#1/"           /* extended format #1 */
+
+struct ar_hdr {
+       char ar_name[16];               /* name */
+       char ar_date[12];               /* modification time */
+       char ar_uid[6];                 /* user id */
+       char ar_gid[6];                 /* group id */
+       char ar_mode[8];                /* octal file permissions */
+       char ar_size[10];               /* size in bytes */
+#define        ARFMAG  "`\n"
+       char ar_fmag[2];                /* consistency check */
+};
+
+#endif /* !_AR_H_ */
diff --git a/lib/libcross/subset_include/nlist.h b/lib/libcross/subset_include/nlist.h
new file mode 100644 (file)
index 0000000..fabe1d8
--- /dev/null
@@ -0,0 +1,83 @@
+/*-
+ * 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        _NLIST_H_
+#define        _NLIST_H_
+#include <sys/types.h>
+
+/*
+ * Symbol table entry format.  The #ifdef's are so that programs including
+ * nlist.h can initialize nlist structures statically.
+ */
+
+struct oldnlist {              /* XXX - compatibility/conversion aid */
+       char    n_name[8];      /* symbol name */
+       int     n_type;         /* type flag */
+unsigned int   n_value;        /* value */
+};
+
+struct nlist {
+#if 1 /*def    _AOUT_INCLUDE_*/
+       union {
+#if 0 /* Nick */
+               char *n_name;   /* In memory address of symbol name */
+#endif
+               off_t n_strx;   /* String table offset (file) */
+       } n_un;
+#else
+       char    *n_name;        /* symbol name (in memory) */
+       char    *n_filler;      /* need to pad out to the union's size */
+#endif
+       u_char  n_type;         /* Type of symbol - see below */
+       char    n_ovly;         /* Overlay number */
+       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 */
+#endif /* !_NLIST_H_ */
diff --git a/lib/libcross/subset_include/ranlib.h b/lib/libcross/subset_include/ranlib.h
new file mode 100644 (file)
index 0000000..d05873f
--- /dev/null
@@ -0,0 +1,50 @@
+/*-
+ * Copyright (c) 1990 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.
+ *
+ *     @(#)ranlib.h    5.2 (Berkeley) 4/3/91
+ */
+
+#ifndef _RANLIB_H_
+#define        _RANLIB_H_
+
+#define        RANLIBMAG       "__.SYMDEF"     /* archive file name */
+#define        RANLIBSKEW      3               /* creation time offset */
+
+struct ranlib {
+       union {
+               off_t ran_strx;         /* string table index */
+               char *ran_name;         /* in memory symbol name */
+       } ran_un;
+       off_t ran_off;                  /* archive file offset */
+};
+
+#endif /* !_RANLIB_H_ */
diff --git a/lib/libcross/subset_include/time.h b/lib/libcross/subset_include/time.h
new file mode 100644 (file)
index 0000000..bf5e265
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * 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/lib/libcross/subset_include/tzfile.h b/lib/libcross/subset_include/tzfile.h
new file mode 100644 (file)
index 0000000..d77e34b
--- /dev/null
@@ -0,0 +1,101 @@
+/*
+ *     @(#)tzfile.h    5.2.1 (2.11BSD) 1996/11/29
+ */
+
+/*
+** Information about time zone files.
+*/
+
+                       /* Time zone object file directory */
+#define        TZDIR           "/usr/share/zoneinfo"
+#define        TZDEFAULT       "/etc/localtime"
+
+/*
+** Each file begins with. . .
+*/
+
+struct tzhead {
+       char    tzh_reserved[32];       /* reserved for future use */
+       char    tzh_timecnt[4];         /* coded number of transition times */
+       char    tzh_typecnt[4];         /* coded number of local time types */
+       char    tzh_charcnt[4];         /* coded number of abbr. chars */
+};
+
+/*
+** . . .followed by. . .
+**
+**     tzh_timecnt (char [4])s         coded transition times a la time(2)
+**     tzh_timecnt (unsigned char)s    types of local time starting at above
+**     tzh_typecnt repetitions of
+**             one (char [4])          coded GMT offset in seconds
+**             one (unsigned char)     used to set tm_isdt
+**             one (unsigned char)     that's an abbreviation list index
+**     tzh_charcnt (char)s             '\0'-terminated zone abbreviaton strings
+*/
+
+/*
+** In the current implementation, "tzset()" refuses to deal with files that
+** exceed any of the limits below.
+*/
+
+/*
+** The TZ_MAX_TIMES value below is enough to handle a bit more than a
+** year's worth of solar time (corrected daily to the nearest second) or
+** 138 years of Pacific Presidential Election time
+** (where there are three time zone transitions every fourth year).
+*/
+#define        TZ_MAX_TIMES    370
+
+#define        NOSOLAR                 /* We currently don't handle solar time */
+
+#ifndef        NOSOLAR
+#define        TZ_MAX_TYPES    256     /* Limited by what (unsigned char)'s can hold */
+#else /* !NOSOLAR */
+#define        TZ_MAX_TYPES    10      /* Maximum number of local time types */
+#endif /* !NOSOLAR */
+
+#define        TZ_MAX_CHARS    50      /* Maximum number of abbreviation characters */
+
+#define        SECS_PER_MIN    60
+#define        MINS_PER_HOUR   60
+#define        HOURS_PER_DAY   24
+#define        DAYS_PER_WEEK   7
+#define        DAYS_PER_NYEAR  365
+#define        DAYS_PER_LYEAR  366
+#define        SECS_PER_HOUR   (SECS_PER_MIN * MINS_PER_HOUR)
+#define        SECS_PER_DAY    ((long) SECS_PER_HOUR * HOURS_PER_DAY)
+#define        MONS_PER_YEAR   12
+
+#define        TM_SUNDAY       0
+#define        TM_MONDAY       1
+#define        TM_TUESDAY      2
+#define        TM_WEDNESDAY    3
+#define        TM_THURSDAY     4
+#define        TM_FRIDAY       5
+#define        TM_SATURDAY     6
+
+#define        TM_JANUARY      0
+#define        TM_FEBRUARY     1
+#define        TM_MARCH        2
+#define        TM_APRIL        3
+#define        TM_MAY          4
+#define        TM_JUNE         5
+#define        TM_JULY         6
+#define        TM_AUGUST       7
+#define        TM_SEPTEMBER    8
+#define        TM_OCTOBER      9
+#define        TM_NOVEMBER     10
+#define        TM_DECEMBER     11
+#define        TM_SUNDAY       0
+
+#define        TM_YEAR_BASE    1900
+
+#define        EPOCH_YEAR      1970
+#define        EPOCH_WDAY      TM_THURSDAY
+
+/*
+** Accurate only for the past couple of centuries;
+** that will probably do.
+*/
+
+#define        isleap(y) (((y) % 4) == 0 && ((y) % 100) != 0 || ((y) % 400) == 0)
diff --git a/lib/libcross/subset_sys_h/exec.h b/lib/libcross/subset_sys_h/exec.h
new file mode 100644 (file)
index 0000000..139e838
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 1986 Regents of the University of California.
+ * All rights reserved.  The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ *
+ *     @(#)exec.h      1.2 (2.11BSD GTE) 10/31/93
+ */
+
+#ifndef _EXEC_
+#define _EXEC_
+/*
+ * Header prepended to each a.out file.
+ */
+struct exec {
+       int     a_magic;        /* magic number */
+unsigned int   a_text;         /* size of text segment */
+unsigned int   a_data;         /* size of initialized data */
+unsigned int   a_bss;          /* size of uninitialized data */
+unsigned int   a_syms;         /* size of symbol table */
+unsigned int   a_entry;        /* entry point */
+unsigned int   a_unused;       /* not used */
+unsigned int   a_flag;         /* relocation info stripped */
+};
+
+#define        NOVL    15              /* number of overlays */
+struct ovlhdr {
+       int     max_ovl;        /* maximum overlay size */
+unsigned int   ov_siz[NOVL];   /* size of i'th overlay */
+};
+
+/*
+ * eXtended header definition for use with the new macros in a.out.h
+*/
+struct xexec {
+       struct  exec    e;
+       struct  ovlhdr  o;
+       };
+
+#define        A_MAGIC1        0407    /* normal */
+#define        A_MAGIC2        0410    /* read-only text */
+#define        A_MAGIC3        0411    /* separated I&D */
+#define        A_MAGIC4        0405    /* overlay */
+#define        A_MAGIC5        0430    /* auto-overlay (nonseparate) */
+#define        A_MAGIC6        0431    /* auto-overlay (separate) */
+
+#endif
diff --git a/lib/libcross/subset_sys_h/param.h b/lib/libcross/subset_sys_h/param.h
new file mode 100644 (file)
index 0000000..ddc3f62
--- /dev/null
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 1986 Regents of the University of California.
+ * All rights reserved.  The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ *
+ *     @(#)param.h     1.6 (2.11BSD) 1999/9/5
+ */
+
+#ifndef _PARAM_
+#define _PARAM_
+
+#if 0 /* Nick */
+#define        BSD     211             /* 2.11 * 10, as cpp doesn't do floats */
+
+#include <sys/localopts.h>
+#include <sys/stddef.h>                /* for 'offsetof' */
+
+/*
+ * Machine type dependent parameters.
+ */
+#include <machine/machparam.h>
+
+/*
+ * Machine-independent constants
+ */
+#define        NMOUNT  6               /* number of mountable file systems */
+#define        MAXUPRC 20              /* max processes per user */
+#define        NOFILE  30              /* max open files per process */
+#define        CANBSIZ 256             /* max size of typewriter line */
+#define        NCARGS  5120            /* # characters in exec arglist */
+#define        NGROUPS 16              /* max number groups */
+
+#define        NOGROUP 65535           /* marker for empty group set member */
+
+/*
+ * Priorities
+ */
+#define        PSWP    0
+#define        PINOD   10
+#define        PRIBIO  20
+#define        PRIUBA  24
+#define        PZERO   25
+#define        PPIPE   26
+#define        PSOCK   26
+#define        PWAIT   30
+#define        PLOCK   35
+#define        PPAUSE  40
+#define        PUSER   50
+
+#define        NZERO   0
+
+#define        PRIMASK 0xff
+#define        PCATCH  0x100
+
+/*
+ * Signals
+ */
+#include <signal.h>
+
+#define        NBPW    sizeof(int)     /* number of bytes in an integer */
+
+#ifndef        NULL
+#define        NULL    0
+#endif
+#define        CMASK   026             /* default mask for file creation */
+#define        NODEV   (dev_t)(-1)
+
+#define        CLBYTES         (CLSIZE*NBPG)
+#define        CLOFSET         (CLBYTES-1)
+#define        claligned(x)    ((((int)(x))&CLOFSET)==0)
+#define        CLOFF           CLOFSET
+#define        CLSHIFT         (PGSHIFT + CLSIZELOG2)
+
+/* round a number of clicks up to a whole cluster */
+#define        clrnd(i)        (((i) + (CLSIZE-1)) &~ ((long)(CLSIZE-1)))
+
+/* CBLOCK is the size of a clist block, must be power of 2 */
+#define        CBLOCK  32
+#define        CBSIZE  (CBLOCK - sizeof(struct cblock *))      /* data chars/clist */
+#define        CROUND  (CBLOCK - 1)                            /* clist rounding */
+
+#include       <sys/types.h>
+
+/*
+ * File system parameters and macros.
+ *
+ * The file system is made out of blocks of most MAXBSIZE units.
+ */
+#define        MAXBSIZE        1024
+
+/*
+ * MAXPATHLEN defines the longest permissable path length
+ * after expanding symbolic links. It is used to allocate
+ * a temporary buffer from the buffer pool in which to do the
+ * name expansion, hence should be a power of two, and must
+ * be less than or equal to MAXBSIZE.
+ * MAXSYMLINKS defines the maximum number of symbolic links
+ * that may be expanded in a path name. It should be set high
+ * enough to allow all legitimate uses, but halt infinite loops
+ * reasonably quickly.
+ */
+#endif /* Nick */
+#define MAXPATHLEN     256
+#if 0 /* Nick */
+#define MAXSYMLINKS    8
+
+/*
+ * Macros for fast min/max.
+ */
+#define        MIN(a,b) (((a)<(b))?(a):(b))
+#define        MAX(a,b) (((a)>(b))?(a):(b))
+
+/*
+ * Macros for counting and rounding.
+ */
+#ifndef howmany
+#define        howmany(x, y)   (((x)+((y)-1))/(y))
+#endif
+#define        roundup(x, y)   ((((x)+((y)-1))/(y))*(y))
+
+/*
+ * Maximum size of hostname recognized and stored in the kernel.
+ */
+#define MAXHOSTNAMELEN 64
+
+#if defined(KERNEL) && defined(INET)
+#include "../machine/net_mac.h"
+#endif
+
+/*
+ * MAXMEM is the maximum core per process is allowed.  First number is Kb.
+*/
+#define        MAXMEM          (300*16)
+
+/*
+ * MAXLOGNAME should be >= UT_NAMESIZE (see <utmp.h>)
+ */
+#define        MAXLOGNAME      16              /* max login name length */
+#endif /* Nick */
+
+#endif
diff --git a/lib/libcross/subset_sys_h/types.h b/lib/libcross/subset_sys_h/types.h
new file mode 100644 (file)
index 0000000..d780d89
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 1986 Regents of the University of California.
+ * All rights reserved.  The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ *
+ *     @(#)types.h     1.4.1 (2.11BSD) 2000/2/28
+ */
+
+#ifndef _TYPES_
+#define        _TYPES_
+
+#if 0 /* Nick */
+/*
+ * Basic system types and major/minor device constructing/busting macros.
+ */
+
+/* major part of a device */
+#define        major(x)        ((int)(((int)(x)>>8)&0377))
+
+/* minor part of a device */
+#define        minor(x)        ((int)((x)&0377))
+
+/* make a device number */
+#define        makedev(x,y)    ((dev_t)(((x)<<8) | (y)))
+#endif
+
+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 */
+typedef        unsigned short  ushort;         /* sys III compat */
+
+#ifdef pdp11
+typedef        struct  _physadr { short r[1]; } *physadr;
+typedef        struct  label_t {
+       int     val[8];                 /* regs 2-7, __ovno and super SP */
+} label_t;
+#endif
+typedef        struct  _quad { long val[2]; } quad;
+typedef        long    daddr_t;
+typedef        char *  caddr_t;
+typedef        u_short ino_t;
+typedef        long    swblk_t;
+typedef        u_int   size_t;
+typedef        int     ssize_t;
+#endif /* Nick */
+typedef        long    time_t;
+#if 0 /* Nick */
+typedef        short   dev_t;
+#endif /* Nick */
+typedef        long    off_t;
+#if 0 /* Nick */
+typedef        u_short uid_t;
+typedef        u_short gid_t;
+typedef        int     pid_t;
+typedef        u_short mode_t;
+
+#define        NBBY    8               /* number of bits in a byte */
+
+#ifndef howmany
+#define        howmany(x, y)   (((x)+((y)-1))/(y))
+#endif
+
+#include <sys/select.h>
+
+typedef char   bool_t;         /* boolean */
+typedef u_int  memaddr;        /* core or swap address */
+typedef long   ubadr_t;        /* unibus address */
+#endif /* Nick */
+
+#endif
diff --git a/lib/libcross/timezone.c b/lib/libcross/timezone.c
new file mode 100644 (file)
index 0000000..5b3d510
--- /dev/null
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 1987 Regents of the University of California.
+ * This file may be freely redistributed provided that this
+ * notice remains attached.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)timezone.c 1.2 (2.11BSD) 1996/11/27";
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef CROSS
+#include "cross/tzfile.h"
+#define TIMEZONE cross_timezone
+#define TZTAB cross_tztab
+#else
+#include <tzfile.h>
+#define TIMEZONE timezone
+#define TZTAB tztab
+#endif
+
+/*
+ * timezone --
+ *     The arguments are the number of minutes of time you are westward
+ *     from Greenwich and whether DST is in effect.  It returns a string
+ *     giving the name of the local timezone.  Should be replaced, in the
+ *     application code, by a call to localtime.
+ */
+
+static char    czone[TZ_MAX_CHARS];            /* space for zone name */
+
+#ifndef __P
+#ifdef __STDC__
+#define __P(params) params
+#else
+#define __P(params) ()
+#endif
+#endif
+
+char *TIMEZONE __P((int zone, int dst));
+char *TZTAB __P((register int zone, int dst));
+
+char *TIMEZONE(zone, dst) int zone; int dst; {
+       register char   *beg,
+                       *end;
+
+       if (beg = getenv("TZNAME")) {           /* set in environment */
+               if (end = index(beg, ',')) {    /* "PST,PDT" */
+                       if (dst)
+                               return(++end);
+                       *end = '\0';
+                       (void)strncpy(czone,beg,sizeof(czone) - 1);
+                       czone[sizeof(czone) - 1] = '\0';
+                       *end = ',';
+                       return(czone);
+               }
+               return(beg);
+       }
+       return(TZTAB(zone,dst));        /* default: table or created zone */
+}
+
+static struct zone {
+       int     offset;
+       char    *stdzone;
+       char    *dlzone;
+} zonetab[] = {
+       {-1*60,         "MET",  "MET DST"},     /* Middle European */
+       {-2*60,         "EET",  "EET DST"},     /* Eastern European */
+       {4*60,          "AST",  "ADT"},         /* Atlantic */
+       {5*60,          "EST",  "EDT"},         /* Eastern */
+       {6*60,          "CST",  "CDT"},         /* Central */
+       {7*60,          "MST",  "MDT"},         /* Mountain */
+       {8*60,          "PST",  "PDT"},         /* Pacific */
+#ifdef notdef
+       {/* there's no way to distinguish this from WET */
+       {0,             "GMT",  0},             /* Greenwich */
+#endif
+       {0*60,          "WET",  "WET DST"},     /* Western European */
+       {-10*60,        "EST",  "EST"},         /* Aust: Eastern */
+       {-10*60+30,     "CST",  "CST"},         /* Aust: Central */
+       {-8*60,         "WST",  0},             /* Aust: Western */
+       {-1,            0,      0}
+};
+
+/*
+ * tztab --
+ *     check static tables or create a new zone name; broken out so that
+ *     we can make a guess as to what the zone is if the standard tables
+ *     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; {
+       register struct zone    *zp;
+       register char   sign;
+
+       for (zp = zonetab; zp->offset != -1;++zp)       /* static tables */
+               if (zp->offset == zone) {
+                       if (dst && zp->dlzone)
+                               return(zp->dlzone);
+                       if (!dst && zp->stdzone)
+                               return(zp->stdzone);
+               }
+
+       if (zone < 0) {                                 /* create one */
+               zone = -zone;
+               sign = '+';
+       }
+       else
+               sign = '-';
+       (void)sprintf(czone,"GMT%c%d:%02d",sign,zone / 60,zone % 60);
+       return(czone);
+}
diff --git a/n.sh b/n.sh
index a98820b..e024abb 100755 (executable)
--- a/n.sh
+++ b/n.sh
@@ -2,7 +2,9 @@
 
 ROOT="`pwd`"
 
-HOSTCC="cc -Iinclude -Wall -Wno-char-subscripts -Wno-deprecated-declarations -Wno-format -Wno-maybe-uninitialized -Wno-parentheses -Wno-unused-result"
+# 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"
 INSTALL="$ROOT/scripts/install.sh"
 MANROFF="nroff -man"
 MKDEP="$ROOT/scripts/mkdep.sh"
@@ -10,6 +12,7 @@ MKDEP="$ROOT/scripts/mkdep.sh"
 mkdir --parents "$ROOT/cross/bin"
 mkdir --parents "$ROOT/cross/lib"
 mkdir --parents "$ROOT/cross/usr/bin"
+mkdir --parents "$ROOT/cross/usr/include"
 mkdir --parents "$ROOT/cross/usr/lib"
 mkdir --parents "$ROOT/cross/usr/man/cat1"
 mkdir --parents "$ROOT/cross/usr/man/cat3"
@@ -22,6 +25,7 @@ echo "making clean"
 echo
 
 make clean
+make -C lib/libcross clean
 
 echo
 echo "making depend"
@@ -31,21 +35,24 @@ 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/libvmf MKDEP="$MKDEP" depend
 
 echo
-echo "making libvmf"
+echo "making libraries"
 echo
 
+make -C lib/libcross CC="$HOSTCC" MANROFF="$MANROFF"
 make -C usr.lib/libvmf CC="$HOSTCC" MANROFF="$MANROFF"
 
 echo
-echo "installing libvmf"
+echo "installing libraries"
 echo
 
+make -C lib/libcross INSTALL="$INSTALL" DESTDIR="$ROOT/cross" install
 make -C usr.lib/libvmf INSTALL="$INSTALL" DESTDIR="$ROOT/cross" install
 
 echo
@@ -54,7 +61,7 @@ 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" MANROFF="$MANROFF" LDC0FLAGS= LDC1FLAGS=
+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=
diff --git a/o.sh b/o.sh
index cc977b3..21b58c8 100755 (executable)
--- a/o.sh
+++ b/o.sh
@@ -17,7 +17,9 @@ MANROFF="nroff -man"
 MKDEP="$ROOT/cross/usr/bin/mkdep"
 MKSTR="$ROOT/cross/usr/ucb/mkstr"
 INSTALL="$ROOT/scripts/install.sh --strip-program=\"$ROOT/cross/bin/strip\""
-HOSTCC="cc -Iinclude -Wall -Wno-char-subscripts -Wno-deprecated-declarations -Wno-format -Wno-maybe-uninitialized -Wno-parentheses -Wno-unused-result"
+# 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"
 RANLIB="$ROOT/cross/usr/bin/ranlib"
 UNIFDEF="$ROOT/cross/usr/ucb/unifdef"
 SIZE="$ROOT/cross/bin/size"
@@ -33,7 +35,7 @@ echo
 echo "making clean"
 echo
 
-#make clean
+make clean
 
 echo
 echo "making depend"
@@ -50,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" 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" 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"
 
 echo
 echo "installing libc"
@@ -62,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" 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" 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"
 
 echo
 echo "installing libraries"
@@ -76,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" 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" 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" 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"
 
 echo
 echo "installing"
diff --git a/p.sh b/p.sh
index 2365f43..ce14895 100755 (executable)
--- a/p.sh
+++ b/p.sh
@@ -9,7 +9,9 @@ CHGRP="$ROOT/scripts/chgrp.sh"
 CHMOD="$ROOT/scripts/chmod.sh"
 CHOWN="$ROOT/scripts/chown.sh"
 CPP="$ROOT/cross/lib/cpp"
-HOSTCC="cc -Iinclude -Wall -Wno-char-subscripts -Wno-deprecated-declarations -Wno-format -Wno-maybe-uninitialized -Wno-parentheses -Wno-unused-result"
+# 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"
 INSTALL="$ROOT/scripts/install.sh --strip-program=\"$ROOT/cross/bin/strip\""
 LD="$ROOT/cross/bin/ld"
 LORDER="$ROOT/cross/usr/bin/lorder"
@@ -59,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" 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" HOSTLIBS="$HOSTLIBS" HOSTSEPFLAG= LD="$LD" SIZE="$SIZE" STRCOMPACT="$STRCOMPACT" SYMCOMPACT="$SYMCOMPACT" SYMORDER="$SYMORDER"
 
 echo
 echo "installing kernel"
index 57bee7e..37b8db3 100644 (file)
@@ -1,3 +1,5 @@
+HOSTCC=cc
+HOSTSEPFLAG=-i
 MANROFF=/usr/man/manroff
 INSTALL=install
 # @(#)Makefile 1.6 Makefile 1997/12/28
@@ -23,7 +25,6 @@ LOCALTIME=    US/Pacific
 CFLAGS= -O
 SEPFLAG=-i
 LINTFLAGS=     -phbaxc
-CC=            cc
 
 TZCSRCS=       zic.c scheck.c ialloc.c
 TZCOBJS=       zic.o scheck.o ialloc.o
@@ -41,14 +42,10 @@ MANSRC=             $(ZICMANSRC) $(ZDUMAN)
 SHARDIR=       ${DESTDIR}/usr/share/zoneinfo
 MANDIR=                ${DESTDIR}/usr/man/cat8
 
-# Nick, hostzic not working yet
-#all:          zdump zic hostzic ${ZICMAN} ${ZDUMAN}
-all:           zdump zic ${ZICMAN} ${ZDUMAN}
+all:           zdump zic hostzic ${ZICMAN} ${ZDUMAN}
 
-# Nick, hostzic not working yet
-#install:      zic hostzic $(DATA) $(MAN)
-#              (umask 22; ./hostzic -d ${SHARDIR} $(DATA))
-install:       zic $(DATA) $(MAN)
+install:       zic hostzic $(DATA) $(MAN)
+               (umask 22; ./hostzic -d ${SHARDIR} $(DATA))
                ${INSTALL} -c -m 444 -o bin -g bin ${SHARDIR}/${LOCALTIME} ${DESTDIR}/etc/localtime
                ${INSTALL} -c -m 444 -o bin -g bin $(ZICMAN) ${MANDIR}/${ZICMAN}
                ${INSTALL} -c -m 444 -o bin -g bin $(ZDUMAN) ${MANDIR}/${ZDUMAN}
@@ -68,11 +65,11 @@ zic:                $(TZCOBJS)
 
 # Nick, build a separate version to run from here (even if not cross compiling)
 hostzic:       $(TZCSRCS)
-               $(HOSTCC) $(HOSTSEPFLAG) -o $@ $(TZCSRCS)
+               $(HOSTCC) $(HOSTSEPFLAG) -o $@ $(TZCSRCS) $(HOSTLIBS)
 
 lint:          $(TZCSRCS) $(TZDSRCS)
                lint $(LINTFLAGS) $(CFLAGS) $(TZCSRCS)
                lint $(LINTFLAGS) $(CFLAGS) $(TZDSRCS)
 
 clean:
-               rm -f *.o zdump zic $(ZICMAN) $(ZDUMAN)
+               rm -f *.o zdump zic hostzic $(ZICMAN) $(ZDUMAN)
index 32aad04..64a535a 100644 (file)
@@ -5,6 +5,8 @@
 /*LINTLIBRARY*/
 
 #include "stdio.h"
+#include "stdlib.h"
+#include "string.h"
 
 #ifndef alloc_t
 #define alloc_t        unsigned
 #define NULLMAL(x)     ((x) == NULL)
 #endif /* !MAL */
 
-extern char *  calloc();
-extern char *  malloc();
-extern char *  realloc();
-extern char *  strcpy();
+#ifndef __P
+#ifdef __STDC__
+#define __P(params) params
+#else
+#define __P(params) ()
+#endif
+#endif
 
-char *
-imalloc(n)
-{
+char *imalloc __P((int n));
+char *icalloc __P((int nelem, int elsize));
+char *irealloc __P((char *pointer, int size));
+char *icatalloc __P((char *old, char *new));
+char *icpyalloc __P((char *string));
+void ifree __P((char *p));
+
+char *imalloc(n) int n; {
 #ifdef MAL
        register char * result;
 
        if (n == 0)
                n = 1;
-       result = malloc((alloc_t) n);
+       result = (char *)malloc((alloc_t) n);
        return (result == MAL) ? NULL : result;
 #else /* !MAL */
        if (n == 0)
                n = 1;
-       return malloc((alloc_t) n);
+       return (char *)malloc((alloc_t) n);
 #endif /* !MAL */
 }
 
-char *
-icalloc(nelem, elsize)
-{
+char *icalloc(nelem, elsize) int nelem; int elsize; {
        if (nelem == 0 || elsize == 0)
                nelem = elsize = 1;
-       return calloc((alloc_t) nelem, (alloc_t) elsize);
+       return (char *)calloc((alloc_t) nelem, (alloc_t) elsize);
 }
 
-char *
-irealloc(pointer, size)
-char * pointer;
-{
+char *irealloc(pointer, size) char *pointer; int size; {
        if (NULLMAL(pointer))
                return imalloc(size);
        if (size == 0)
                size = 1;
-       return realloc(pointer, (alloc_t) size);
+       return (char *)realloc(pointer, (alloc_t) size);
 }
 
-char *
-icatalloc(old, new)
-char * old;
-char * new;
-{
+char *icatalloc(old, new) char *old; char *new; {
        register char * result;
-       register        oldsize, newsize;
+       register int oldsize, newsize;
 
        oldsize = NULLMAL(old) ? 0 : strlen(old);
        newsize = NULLMAL(new) ? 0 : strlen(new);
@@ -73,16 +74,11 @@ char *      new;
        return result;
 }
 
-char *
-icpyalloc(string)
-char * string;
-{
+char *icpyalloc(string) char *string; {
        return icatalloc((char *) NULL, string);
 }
 
-ifree(p)
-char * p;
-{
+void ifree(p) char *p; {
        if (!NULLMAL(p))
                free(p);
 }
diff --git a/share/zoneinfo/include/tzfile.h b/share/zoneinfo/include/tzfile.h
deleted file mode 120000 (symlink)
index 2a447b8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../../../include/tzfile.h
\ No newline at end of file
index 96fa464..1e5c44e 100755 (executable)
@@ -1,9 +1,10 @@
 #!/bin/sh
 ROOT="`pwd |sed -e 's/\/share\/zoneinfo$//'`"
 CC="$ROOT/cross/bin/cc"
-HOSTCC="cc -g -Iinclude -Wall -Wno-char-subscripts -Wno-deprecated-declarations -Wno-format -Wno-maybe-uninitialized -Wno-parentheses -Wno-unused-result"
+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"
 INSTALL="$ROOT/scripts/install.sh --strip-program=\"$ROOT/cross/bin/strip\""
-#mkdir --parents "$ROOT/stage/usr/bin"
-#mkdir --parents "$ROOT/stage/usr/share/misc"
-make CC="$CC" HOSTCC="$HOSTCC" && \
+MANROFF="nroff -man"
+mkdir --parents "$ROOT/stage/lib"
+make CC="$CC" HOSTCC="$HOSTCC" HOSTLIBS="-lcross" HOSTSEPFLAG= MANROFF="$MANROFF" && \
 make INSTALL="$INSTALL" DESTDIR="$ROOT/stage" install
index 0fd6fcf..b2a235e 100644 (file)
@@ -5,15 +5,29 @@
 /*LINTLIBRARY*/
 
 #include "stdio.h"
+#include "stdlib.h"
+#include "string.h"
 #include "ctype.h"
 
-extern char *  imalloc();
+#ifndef __P
+#ifdef __STDC__
+#define __P(params) params
+#else
+#define __P(params) ()
+#endif
+#endif
 
-char *
-scheck(string, format)
-char * string;
-char * format;
-{
+/* ialloc.c */
+char *imalloc __P((int n));
+char *icalloc __P((int nelem, int elsize));
+char *irealloc __P((char *pointer, int size));
+char *icatalloc __P((char *old, char *new));
+char *icpyalloc __P((char *string));
+void ifree __P((char *p));
+/* scheck.c */
+char *scheck __P((char *string, char *format));
+
+char *scheck(string, format) char *string; char *format; {
        register char * fbuf;
        register char * fp;
        register char * tp;
index 5c8925d..c603874 100644 (file)
@@ -3,41 +3,68 @@
  */
 
 #include "stdio.h"
-
+#include "stdlib.h"
+
+#ifdef CROSS
+#include <time.h>
+#include "cross/sys/types.h"
+#include "cross/tzfile.h"
+#include "cross/time.h"
+#define STRUCT_TM struct cross_tm
+#define TIME_T cross_time_t
+#define ASCTIME cross_asctime
+#define GMTIME cross_gmtime
+#define LOCALTIME cross_localtime
+#else
 #include "sys/types.h"
 #include "tzfile.h"
 #include "time.h"
+#define STRUCT_TM struct tm
+#define TIME_T time_t
+#define ASCTIME asctime
+#define GMTIME gmtime
+#define LOCALTIME localtime
+#endif
 
 #ifndef TRUE
 #define TRUE           1
 #define FALSE          0
 #endif
 
-extern char *          asctime();
+/*extern char *                ASCTIME();*/
 extern char **         environ;
-extern struct tm *     gmtime();
-extern char *          imalloc();
+/*extern STRUCT_TM *   GMTIME();
 extern char *          optarg;
 extern int             optind;
 extern char *          sprintf();
-extern long            time();
+extern long            time();*/
 extern char *          tzname[2];
-extern void            tzset();
-
-/*
-** For the benefit of cyntax...
-*/
-
-static long            tzdecode();
-static                 readerr();
-static                 show();
+/*extern void          tzset();*/
 
 static int             longest;
 
-static long
-tzdecode(codep)
-char * codep;
-{
+#ifndef __P
+#ifdef __STDC__
+#define __P(params) params
+#else
+#define __P(params) ()
+#endif
+#endif
+
+/* ialloc.c */
+char *imalloc __P((int n));
+char *icalloc __P((int nelem, int elsize));
+char *irealloc __P((char *pointer, int size));
+char *icatalloc __P((char *old, char *new));
+char *icpyalloc __P((char *string));
+void ifree __P((char *p));
+/* zdump.c */
+long tzdecode __P((char *codep));
+int main __P((int argc, char *argv[]));
+void show __P((char *zone, TIME_T t, int v));
+void readerr __P((FILE *fp, char *progname, char *filename));
+
+static long tzdecode(codep) char *codep; {
        register int    i;
        register long   result;
 
@@ -47,18 +74,18 @@ char *      codep;
        return result;
 }
 
-main(argc, argv)
-int    argc;
-char * argv[];
-{
+int main(argc, argv) int argc; char *argv[]; {
        register FILE * fp;
        register int    i, j, c;
        register int    vflag;
        register char * cutoff;
        register int    cutyear;
        register long   cuttime;
-       time_t          now;
-       time_t          t;
+#ifdef CROSS
+       time_t          temp;
+#endif
+       TIME_T          now;
+       TIME_T          t;
        long            timecnt;
        char            buf[BUFSIZ];
 
@@ -80,7 +107,12 @@ char *      argv[];
        */
        cuttime = (long) (cutyear - EPOCH_YEAR) *
                SECS_PER_HOUR * HOURS_PER_DAY * DAYS_PER_NYEAR;
+#ifdef CROSS
+       (void) time(&temp);
+       now = temp;
+#else
        (void) time(&now);
+#endif
        longest = 0;
        for (i = optind; i < argc; ++i)
                if (strlen(argv[i]) > longest)
@@ -134,7 +166,7 @@ char *      argv[];
                        (void) fseek(fp, (long) (2 * sizeof code), 1);
                }
                t = 0x80000000;
-               if (t > 0)              /* time_t is unsigned */
+               if (t > 0)              /* TIME_T is unsigned */
                        t = 0;
                show(argv[i], t, TRUE);
                t += SECS_PER_HOUR * HOURS_PER_DAY;
@@ -156,7 +188,7 @@ char *      argv[];
                        exit(1);
                }
                t = 0xffffffff;
-               if (t < 0)              /* time_t is signed */
+               if (t < 0)              /* TIME_T is signed */
                        t = 0x7fffffff ;
                t -= SECS_PER_HOUR * HOURS_PER_DAY;
                show(argv[i], t, TRUE);
@@ -173,19 +205,15 @@ char *    argv[];
        return 0;
 }
 
-static
-show(zone, t, v)
-char * zone;
-time_t t;
-{
-       struct tm *             tmp;
-       extern struct tm *      localtime();
+static void show(zone, t, v) char *zone; TIME_T        t; int v; {
+       STRUCT_TM *             tmp;
+       extern STRUCT_TM *      LOCALTIME();
 
        (void) printf("%-*s  ", longest, zone);
        if (v)
-               (void) printf("%.24s GMT = ", asctime(gmtime(&t)));
-       tmp = localtime(&t);
-       (void) printf("%.24s", asctime(tmp));
+               (void) printf("%.24s GMT = ", ASCTIME(GMTIME(&t)));
+       tmp = LOCALTIME(&t);
+       (void) printf("%.24s", ASCTIME(tmp));
        if (*tzname[tmp->tm_isdst] != '\0')
                (void) printf(" %s", tzname[tmp->tm_isdst]);
        if (v) {
@@ -195,12 +223,7 @@ time_t     t;
        (void) printf("\n");
 }
 
-static
-readerr(fp, progname, filename)
-FILE * fp;
-char * progname;
-char * filename;
-{
+static void readerr(fp, progname, filename) FILE *fp; char *progname; char *filename; {
        (void) fprintf(stderr, "%s: Error reading ", progname);
        if (ferror(fp))
                perror(filename);
index 752613d..27d329f 100644 (file)
@@ -3,13 +3,31 @@
  */
 
 #include "stdio.h"
+#include "stdlib.h"
 #include "ctype.h"
 #include "sys/types.h"
 #include "sys/stat.h"
 #include "sys/file.h"
-#include "strings.h"
-#include "time.h"
+#include "string.h"
+#include "unistd.h"
+
+#ifdef CROSS
+#include "cross/sys/types.h"
+#include "cross/tzfile.h"
+#include "cross/time.h"
+#define GMTIME cross_gmtime
+#define STRUCT_TM struct cross_tm
+#define STRUCT_TZHEAD struct cross_tzhead
+#define TIME_T cross_time_t
+#else
+#include "sys/types.h"
 #include "tzfile.h"
+#include "time.h"
+#define GMTIME gmtime
+#define STRUCT_TM struct tm
+#define STRUCT_TZHEAD struct tzhead
+#define TIME_T time_t
+#endif
 
 #ifndef BUFSIZ
 #define BUFSIZ 1024
 #define FALSE  0
 #endif
 
-extern char *  icpyalloc();
-extern char *  imalloc();
-extern char *  irealloc();
-extern char *  optarg;
-extern int     optind;
-extern char *  scheck();
-extern char *  sprintf();
-
-static         addtt();
-static         addtype();
-static         associate();
 static int     charcnt;
-static         ciequal();
-static long    eitol();
 static int     errors;
 static char *  filename;
-static char ** getfields();
-static long    gethms();
-static         infile();
-static         inlink();
-static         inrule();
-static         inzcont();
-static         inzone();
-static         inzsub();
 static int     linenum;
-static         lowerit();
-static time_t  max_time;
+static TIME_T  max_time;
 static int     max_year;
-static time_t  min_time;
+static TIME_T  min_time;
 static int     min_year;
-static         mkdirs();
-static         newabbr();
 static int     noise;
-static         nondunlink();
-static long    oadd();
-static         outzone();
 static char *  progname;
 static char *  rfilename;
 static int     rlinenum;
-static time_t  rpytime();
-static         rulesub();
-static         setboundaries();
-static time_t  tadd();
 static int     timecnt;
 static int     tt_signed;
 static int     typecnt;
-static         yearistype();
 
 /*
 ** Line codes.
@@ -150,7 +136,7 @@ struct rule {
        char *  r_abbrvar;      /* variable part of time zone abbreviation */
 
        int     r_todo;         /* a rule to do (used in outzone) */
-       time_t  r_temp;         /* used in outzone */
+       TIME_T  r_temp;         /* used in outzone */
 };
 
 /*
@@ -186,7 +172,7 @@ struct zone {
        int             z_nrules;
 
        struct rule     z_untilrule;
-       time_t          z_untiltime;
+       TIME_T          z_untiltime;
 };
 
 static struct zone *   zones;
@@ -210,87 +196,138 @@ struct lookup {
 static struct lookup * byword();
 
 static struct lookup   line_codes[] = {
-       "Rule",         LC_RULE,
-       "Zone",         LC_ZONE,
-       "Link",         LC_LINK,
-       NULL,           0
+       {"Rule",        LC_RULE},
+       {"Zone",        LC_ZONE},
+       {"Link",        LC_LINK},
+       {NULL,          0}
 };
 
 static struct lookup   mon_names[] = {
-       "January",      TM_JANUARY,
-       "February",     TM_FEBRUARY,
-       "March",        TM_MARCH,
-       "April",        TM_APRIL,
-       "May",          TM_MAY,
-       "June",         TM_JUNE,
-       "July",         TM_JULY,
-       "August",       TM_AUGUST,
-       "September",    TM_SEPTEMBER,
-       "October",      TM_OCTOBER,
-       "November",     TM_NOVEMBER,
-       "December",     TM_DECEMBER,
-       NULL,           0
+       {"January",     TM_JANUARY},
+       {"February",    TM_FEBRUARY},
+       {"March",       TM_MARCH},
+       {"April",       TM_APRIL},
+       {"May",         TM_MAY},
+       {"June",        TM_JUNE},
+       {"July",        TM_JULY},
+       {"August",      TM_AUGUST},
+       {"September",   TM_SEPTEMBER},
+       {"October",     TM_OCTOBER},
+       {"November",    TM_NOVEMBER},
+       {"December",    TM_DECEMBER},
+       {NULL,          0}
 };
 
 static struct lookup   wday_names[] = {
-       "Sunday",       TM_SUNDAY,
-       "Monday",       TM_MONDAY,
-       "Tuesday",      TM_TUESDAY,
-       "Wednesday",    TM_WEDNESDAY,
-       "Thursday",     TM_THURSDAY,
-       "Friday",       TM_FRIDAY,
-       "Saturday",     TM_SATURDAY,
-       NULL,           0
+       {"Sunday",      TM_SUNDAY},
+       {"Monday",      TM_MONDAY},
+       {"Tuesday",     TM_TUESDAY},
+       {"Wednesday",   TM_WEDNESDAY},
+       {"Thursday",    TM_THURSDAY},
+       {"Friday",      TM_FRIDAY},
+       {"Saturday",    TM_SATURDAY},
+       {NULL,          0}
 };
 
 static struct lookup   lasts[] = {
-       "last-Sunday",          TM_SUNDAY,
-       "last-Monday",          TM_MONDAY,
-       "last-Tuesday",         TM_TUESDAY,
-       "last-Wednesday",       TM_WEDNESDAY,
-       "last-Thursday",        TM_THURSDAY,
-       "last-Friday",          TM_FRIDAY,
-       "last-Saturday",        TM_SATURDAY,
-       NULL,                   0
+       {"last-Sunday",         TM_SUNDAY},
+       {"last-Monday",         TM_MONDAY},
+       {"last-Tuesday",        TM_TUESDAY},
+       {"last-Wednesday",      TM_WEDNESDAY},
+       {"last-Thursday",       TM_THURSDAY},
+       {"last-Friday",         TM_FRIDAY},
+       {"last-Saturday",       TM_SATURDAY},
+       {NULL,                  0}
 };
 
 static struct lookup   begin_years[] = {
-       "minimum",              YR_MINIMUM,
-       "maximum",              YR_MAXIMUM,
-       NULL,                   0
+       {"minimum",             YR_MINIMUM},
+       {"maximum",             YR_MAXIMUM},
+       {NULL,                  0}
 };
 
 static struct lookup   end_years[] = {
-       "minimum",              YR_MINIMUM,
-       "maximum",              YR_MAXIMUM,
-       "only",                 YR_ONLY,
-       NULL,                   0
+       {"minimum",             YR_MINIMUM},
+       {"maximum",             YR_MAXIMUM},
+       {"only",                YR_ONLY},
+       {NULL,                  0}
 };
 
 static int     len_months[2][MONS_PER_YEAR] = {
-       31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,
-       31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
+       {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
+       {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
 };
 
 static int     len_years[2] = {
        DAYS_PER_NYEAR, DAYS_PER_LYEAR
 };
 
-static time_t          ats[TZ_MAX_TIMES];
+static TIME_T          ats[TZ_MAX_TIMES];
 static unsigned char   types[TZ_MAX_TIMES];
 static long            gmtoffs[TZ_MAX_TYPES];
 static char            isdsts[TZ_MAX_TYPES];
 static char            abbrinds[TZ_MAX_TYPES];
 static char            chars[TZ_MAX_CHARS];
 
+#ifndef __P
+#ifdef __STDC__
+#define __P(params) params
+#else
+#define __P(params) ()
+#endif
+#endif
+
+/* ialloc.c */
+char *imalloc __P((int n));
+char *icalloc __P((int nelem, int elsize));
+char *irealloc __P((char *pointer, int size));
+char *icatalloc __P((char *old, char *new));
+char *icpyalloc __P((char *string));
+void ifree __P((char *p));
+/* scheck.c */
+char *scheck __P((char *string, char *format));
+/* zic.c */
+static char *memcheck __P((char *ptr));
+static void eats __P((char *name, int num, char *rname, int rnum));
+static void eat __P((char *name, int num));
+static void error __P((char *string));
+static void usage __P((void));
+int main __P((int argc, char *argv[]));
+static void setboundaries __P((void));
+static void nondunlink __P((char *name));
+static int rcomp __P((char *cp1, char *cp2));
+static void associate __P((void));
+static void infile __P((char *name));
+static long gethms __P((char *string, char *errstring, int signable));
+static void inrule __P((register char **fields, int nfields));
+static int inzone __P((register char **fields, int nfields));
+static int inzcont __P((register char **fields, int nfields));
+static int inzsub __P((register char **fields, int nfields, int iscont));
+static void inlink __P((register char **fields, int nfields));
+static void rulesub __P((register struct rule *rp, char *loyearp, char *hiyearp, char *typep, char *monthp, char *dayp, char *timep));
+static void puttzcode __P((long val, FILE *fp));
+static void writezone __P((char *name));
+static void outzone __P((struct zone *zpfirst, int zonecount));
+static void addtt __P((TIME_T starttime, int type));
+static int addtype __P((long gmtoff, char *abbr, int isdst));
+static int yearistype __P((int year, char *type));
+static int lowerit __P((int a));
+static int ciequal __P((register char *ap, register char *bp));
+static int isabbr __P((register char *abbr, register char *word));
+static struct lookup *byword __P((register char *word, register struct lookup *table));
+static char **getfields __P((register char *cp));
+static long oadd __P((long t1, long t2));
+static TIME_T tadd __P((TIME_T t1, long t2));
+static TIME_T rpytime __P((register struct rule *rp, register int wantedy));
+static void newabbr __P((char *string));
+static int mkdirs __P((char *name));
+static long eitol __P((int i));
+
 /*
 ** Memory allocation.
 */
 
-static char *
-memcheck(ptr)
-char * ptr;
-{
+static char *memcheck(ptr) char *ptr; {
        if (ptr == NULL) {
                perror(progname);
                exit(1);
@@ -306,28 +343,18 @@ char *    ptr;
 ** Error handling.
 */
 
-static
-eats(name, num, rname, rnum)
-char * name;
-char * rname;
-{
+static void eats(name, num, rname, rnum) char *name; int num; char *rname; int rnum; {
        filename = name;
        linenum = num;
        rfilename = rname;
        rlinenum = rnum;
 }
 
-static
-eat(name, num)
-char * name;
-{
+static void eat(name, num) char *name; int num; {
        eats(name, num, (char *) NULL, -1);
 }
 
-static
-error(string)
-char * string;
-{
+static void error(string) char *string; {
        /*
        ** Match the format of "cc" to allow sh users to
        **      zic ... 2>&1 | error -t "*" -v
@@ -342,9 +369,7 @@ char *      string;
        ++errors;
 }
 
-static
-usage()
-{
+static void usage() {
        (void) fprintf(stderr,
 "%s: usage is %s [ -v ] [ -l localtime ] [ -d directory ] [ filename ... ]\n",
                progname, progname);
@@ -354,10 +379,7 @@ usage()
 static char *  lcltime = NULL;
 static char *  directory = NULL;
 
-main(argc, argv)
-int    argc;
-char * argv[];
-{
+int main(argc, argv) int argc; char *argv[]; {
        register int    i, j;
        register int    c;
 
@@ -445,17 +467,15 @@ char *    argv[];
        exit((errors == 0) ? 0 : 1);
 }
 
-static
-setboundaries()
-{
-       register time_t         bit;
+static void setboundaries() {
+       register TIME_T         bit;
 
        for (bit = 1; bit > 0; bit <<= 1)
                ;
-       if (bit == 0) {         /* time_t is an unsigned type */
+       if (bit == 0) {         /* TIME_T is an unsigned type */
                tt_signed = FALSE;
                min_time = 0;
-               max_time = ~(time_t) 0;
+               max_time = ~(TIME_T) 0;
        } else {
                tt_signed = TRUE;
                min_time = bit;
@@ -463,18 +483,15 @@ setboundaries()
                ++max_time;
                max_time = -max_time;
        }
-       min_year = TM_YEAR_BASE + gmtime(&min_time)->tm_year;
-       max_year = TM_YEAR_BASE + gmtime(&max_time)->tm_year;
+       min_year = TM_YEAR_BASE + GMTIME(&min_time)->tm_year;
+       max_year = TM_YEAR_BASE + GMTIME(&max_time)->tm_year;
 }
 
 /*
 ** We get to be careful here since there's a fair chance of root running us.
 */
 
-static
-nondunlink(name)
-char * name;
-{
+static void nondunlink(name) char *name; {
        struct stat     s;
 
        if (stat(name, &s) != 0)
@@ -492,25 +509,19 @@ char *    name;
 ** Sort by rule name.
 */
 
-static
-rcomp(cp1, cp2)
-char * cp1;
-char * cp2;
-{
+static int rcomp(cp1, cp2) char *cp1; char *cp2; {
        return strcmp(((struct rule *) cp1)->r_name,
                ((struct rule *) cp2)->r_name);
 }
 
-static
-associate()
-{
+static void associate() {
        register struct zone *  zp;
        register struct rule *  rp;
        register int            base, out;
        register int            i;
 
        if (nrules != 0)
-               (void) qsort((char *) rules, nrules, sizeof *rules, rcomp);
+               (void) qsort((char *) rules, nrules, sizeof *rules, (int (*) __P((const void *, const void *))) rcomp);
        for (i = 0; i < nzones; ++i) {
                zp = &zones[i];
                zp->z_rules = NULL;
@@ -549,10 +560,7 @@ associate()
                exit(1);
 }
 
-static
-infile(name)
-char * name;
-{
+static void infile(name) char *name; {
        register FILE *                 fp;
        register char **                fields;
        register char *                 cp;
@@ -639,11 +647,7 @@ char *     name;
 ** Call error with errstring and return zero on errors.
 */
 
-static long
-gethms(string, errstring, signable)
-char * string;
-char * errstring;
-{
+static long gethms(string, errstring, signable) char *string; char *errstring; int signable; {
        int     hh, mm, ss, sign;
 
        if (string == NULL || *string == '\0')
@@ -674,10 +678,7 @@ char *     errstring;
                eitol(SECS_PER_MIN) + eitol(ss));
 }
 
-static
-inrule(fields, nfields)
-register char **       fields;
-{
+static void inrule(fields, nfields) register char **fields; int nfields; {
        struct rule     r;
 
        if (nfields != RULE_FIELDS) {
@@ -700,10 +701,7 @@ register char **   fields;
        rules[nrules++] = r;
 }
 
-static
-inzone(fields, nfields)
-register char **       fields;
-{
+static int inzone(fields, nfields) register char **fields; int nfields; {
        register int    i;
        char            buf[132];
 
@@ -732,10 +730,7 @@ register char **   fields;
        return inzsub(fields, nfields, FALSE);
 }
 
-static
-inzcont(fields, nfields)
-register char **       fields;
-{
+static int inzcont(fields, nfields) register char **fields; int nfields; {
        if (nfields < ZONEC_MINFIELDS || nfields > ZONEC_MAXFIELDS) {
                error("wrong number of fields on Zone continuation line");
                return FALSE;
@@ -743,10 +738,7 @@ register char **   fields;
        return inzsub(fields, nfields, TRUE);
 }
 
-static
-inzsub(fields, nfields, iscont)
-register char **       fields;
-{
+static int inzsub(fields, nfields, iscont) register char **fields; int nfields; int iscont; {
        register char * cp;
        struct zone     z;
        register int    i_gmtoff, i_rule, i_format;
@@ -813,10 +805,7 @@ error("Zone continuation line end time is not after end time of previous line");
        return hasuntil;
 }
 
-static
-inlink(fields, nfields)
-register char **       fields;
-{
+static void inlink(fields, nfields) register char **fields; int nfields; {
        struct link     l;
 
        if (nfields != LINK_FIELDS) {
@@ -840,16 +829,7 @@ register char **   fields;
        links[nlinks++] = l;
 }
 
-static
-rulesub(rp, loyearp, hiyearp, typep, monthp, dayp, timep)
-register struct rule * rp;
-char *                 loyearp;
-char *                 hiyearp;
-char *                 typep;
-char *                 monthp;
-char *                 dayp;
-char *                 timep;
-{
+static void rulesub(rp, loyearp, hiyearp, typep, monthp, dayp, timep) register struct rule *rp; char *loyearp; char *hiyearp; char *typep; char *monthp; char *dayp; char *timep; {
        register struct lookup *        lp;
        register char *                 cp;
 
@@ -981,11 +961,7 @@ char *                     timep;
        }
 }
 
-static
-puttzcode(val, fp)
-long   val;
-FILE * fp;
-{
+static void puttzcode(val, fp) long val; FILE *fp; {
        register int    c;
        register int    shift;
 
@@ -995,10 +971,7 @@ FILE *     fp;
        }
 }
 
-static
-writezone(name)
-char * name;
-{
+static void writezone(name) char *name; {
        register FILE *         fp;
        register int            i;
        char                    fullname[BUFSIZ];
@@ -1019,7 +992,7 @@ char *     name;
                        exit(1);
                }
        }
-       (void) fseek(fp, (long) sizeof ((struct tzhead *) 0)->tzh_reserved, 0);
+       (void) fseek(fp, (long) sizeof ((STRUCT_TZHEAD *) 0)->tzh_reserved, 0);
        puttzcode(eitol(timecnt), fp);
        puttzcode(eitol(typecnt), fp);
        puttzcode(eitol(charcnt), fp);
@@ -1042,15 +1015,12 @@ char *  name;
        }
 }
 
-static
-outzone(zpfirst, zonecount)
-struct zone *  zpfirst;
-{
+static void outzone(zpfirst, zonecount) struct zone *zpfirst; int zonecount; {
        register struct zone *          zp;
        register struct rule *          rp;
        register int                    i, j;
        register int                    usestart, useuntil;
-       register time_t                 starttime, untiltime;
+       register TIME_T                 starttime, untiltime;
        register long                   gmtoff;
        register long                   stdoff;
        register int                    year;
@@ -1102,7 +1072,7 @@ struct zone *     zpfirst;
                        }
                        for ( ; ; ) {
                                register int    k;
-                               register time_t jtime, ktime;
+                               register TIME_T jtime, ktime;
                                register long   offset;
                                char            buf[BUFSIZ];
 
@@ -1187,10 +1157,7 @@ addtt(starttime, addtype(startoff, startbuf, startisdst));
        writezone(zpfirst->z_name);
 }
 
-static
-addtt(starttime, type)
-time_t starttime;
-{
+static void addtt(starttime, type) TIME_T starttime; int type; {
        if (timecnt != 0 && type == types[timecnt - 1])
                return; /* easy enough! */
        if (timecnt >= TZ_MAX_TIMES) {
@@ -1202,11 +1169,7 @@ time_t   starttime;
        ++timecnt;
 }
 
-static
-addtype(gmtoff, abbr, isdst)
-long   gmtoff;
-char * abbr;
-{
+static int addtype(gmtoff, abbr, isdst) long gmtoff; char *abbr; int isdst; {
        register int    i, j;
 
        /*
@@ -1239,10 +1202,7 @@ char *   abbr;
        return i;
 }
 
-static
-yearistype(year, type)
-char * type;
-{
+static int yearistype(year, type) int year; char *type; {
        char    buf[BUFSIZ];
        int     result;
 
@@ -1265,28 +1225,18 @@ char *  type;
                exit(1);
 }
 
-static
-lowerit(a)
-{
+static int lowerit(a) int a; {
        return (isascii(a) && isupper(a)) ? tolower(a) : a;
 }
 
-static
-ciequal(ap, bp)                /* case-insensitive equality */
-register char *        ap;
-register char *        bp;
-{
+static int ciequal(ap, bp) register char *ap; register char *bp; {             /* case-insensitive equality */
        while (lowerit(*ap) == lowerit(*bp++))
                if (*ap++ == '\0')
                        return TRUE;
        return FALSE;
 }
 
-static
-isabbr(abbr, word)
-register char *        abbr;
-register char *        word;
-{
+static int isabbr(abbr, word) register char *abbr; register char *word; {
        if (lowerit(*abbr) != lowerit(*word))
                return FALSE;
        ++word;
@@ -1297,11 +1247,7 @@ register char *  word;
        return TRUE;
 }
 
-static struct lookup *
-byword(word, table)
-register char *                        word;
-register struct lookup *       table;
-{
+static struct lookup *byword(word, table) register char *word; register struct lookup *table; {
        register struct lookup *        foundlp;
        register struct lookup *        lp;
 
@@ -1325,10 +1271,7 @@ register struct lookup * table;
        return foundlp;
 }
 
-static char **
-getfields(cp)
-register char *        cp;
-{
+static char **getfields(cp) register char *cp; {
        register char *         dp;
        register char **        array;
        register int            nsubs;
@@ -1360,11 +1303,7 @@ register char *  cp;
        return array;
 }
 
-static long
-oadd(t1, t2)
-long   t1;
-long   t2;
-{
+static long oadd(t1, t2) long t1; long t2; {
        register long   t;
 
        t = t1 + t2;
@@ -1375,12 +1314,8 @@ long     t2;
        return t;
 }
 
-static time_t
-tadd(t1, t2)
-time_t t1;
-long   t2;
-{
-       register time_t t;
+static TIME_T tadd(t1, t2) TIME_T t1; long t2; {
+       register TIME_T t;
 
        if (t1 == max_time && t2 > 0)
                return max_time;
@@ -1399,14 +1334,10 @@ long    t2;
 ** 1970, 00:00 LOCAL time - in that year that the rule refers to.
 */
 
-static time_t
-rpytime(rp, wantedy)
-register struct rule * rp;
-register int           wantedy;
-{
+static TIME_T rpytime(rp, wantedy) register struct rule *rp; register int wantedy; {
        register int    y, m, i;
        register long   dayoff;                 /* with a nod to Margaret O. */
-       register time_t t;
+       register TIME_T t;
 
        dayoff = 0;
        m = TM_JANUARY;
@@ -1475,7 +1406,7 @@ register int              wantedy;
                error("time before zero");
                exit(1);
        }
-       t = (time_t) dayoff * SECS_PER_DAY;
+       t = (TIME_T) dayoff * SECS_PER_DAY;
        /*
        ** Cheap overflow check.
        */
@@ -1490,10 +1421,7 @@ register int             wantedy;
        return tadd(t, rp->r_tod);
 }
 
-static
-newabbr(string)
-char * string;
-{
+static void newabbr(string) char *string; {
        register int    i;
 
        i = strlen(string) + 1;
@@ -1505,10 +1433,7 @@ char *   string;
        charcnt += eitol(i);
 }
 
-static
-mkdirs(name)
-char * name;
-{
+static int mkdirs(name) char *name; {
        register char * cp;
 
        if ((cp = name) == NULL || *cp == '\0')
@@ -1524,9 +1449,7 @@ char *    name;
        return 0;
 }
 
-static long
-eitol(i)
-{
+static long eitol(i) int i; {
        long    l;
 
        l = i;
@@ -1537,7 +1460,3 @@ eitol(i)
        }
        return l;
 }
-
-/*
-** UNIX is a registered trademark of AT&T.
-*/
index b929dae..b719daa 100644 (file)
@@ -124,9 +124,8 @@ datastream.o: /home/nick/src/211bsd.git/stage/usr/include/curses.h
 datastream.o: /home/nick/src/211bsd.git/stage/usr/include/stdio.h
 datastream.o: /home/nick/src/211bsd.git/stage/usr/include/sgtty.h ascebc.h
 datastream.o: 3270.h screen.h
-keyboard.o: keyboard.c m4.out ascebc.h 3270.h screen.h options.h ectype.h
-termin.o: termin.c /home/nick/src/211bsd.git/stage/usr/include/ctype.h m4.out
-termin.o: state.h
+keyboard.o: keyboard.c ascebc.h 3270.h screen.h options.h ectype.h
+termin.o: termin.c /home/nick/src/211bsd.git/stage/usr/include/ctype.h state.h
 map3270.o: map3270.c /home/nick/src/211bsd.git/stage/usr/include/stdio.h
 map3270.o: /home/nick/src/211bsd.git/stage/usr/include/ctype.h
 map3270.o: /home/nick/src/211bsd.git/stage/usr/include/curses.h
@@ -134,8 +133,8 @@ map3270.o: /home/nick/src/211bsd.git/stage/usr/include/stdio.h
 map3270.o: /home/nick/src/211bsd.git/stage/usr/include/sgtty.h
 map3270.o: /home/nick/src/211bsd.git/stage/usr/include/sys/ioctl.h
 map3270.o: /home/nick/src/211bsd.git/stage/usr/include/sys/ttychars.h
-map3270.o: /home/nick/src/211bsd.git/stage/usr/include/sys/ttydev.h m4.out
-map3270.o: state.h default.map3270
+map3270.o: /home/nick/src/211bsd.git/stage/usr/include/sys/ttydev.h state.h
+map3270.o: default.map3270
 ectype.o: ectype.c ectype.h
 tn3270.o: tn3270.c /home/nick/src/211bsd.git/stage/usr/include/sys/types.h
 tn3270.o: /home/nick/src/211bsd.git/stage/usr/include/sys/select.h
@@ -162,7 +161,7 @@ mset.o: /home/nick/src/211bsd.git/stage/usr/include/stdio.h
 mset.o: /home/nick/src/211bsd.git/stage/usr/include/sgtty.h
 mset.o: /home/nick/src/211bsd.git/stage/usr/include/sys/ioctl.h
 mset.o: /home/nick/src/211bsd.git/stage/usr/include/sys/ttychars.h
-mset.o: /home/nick/src/211bsd.git/stage/usr/include/sys/ttydev.h state.h m4.out
+mset.o: /home/nick/src/211bsd.git/stage/usr/include/sys/ttydev.h state.h
 pdpbsubs.o: pdpbsubs.s
 
 # IF YOU PUT ANYTHING HERE IT WILL GO AWAY
index 0a96c2d..598374a 100644 (file)
@@ -1,5 +1,5 @@
 char *libF77_id[] = {
-       "@(#)libF77.a   Jan  7 22:22:33 2017",
+       "@(#)libF77.a   Jan 11 03:18:38 2017",
        "@(#)abort_.c   5.1     6/7/85",
        "@(#)besj0_.c   5.1     6/7/85",
        "@(#)besj1_.c   5.1     6/7/85",
index 624f720..a8cdf26 100644 (file)
@@ -161,7 +161,5 @@ res_debug.o: /home/nick/src/211bsd.git/stage/usr/include/sys/types.h
 res_debug.o: /home/nick/src/211bsd.git/stage/usr/include/netinet/in.h
 res_debug.o: /home/nick/src/211bsd.git/stage/usr/include/stdio.h
 res_debug.o: /home/nick/src/211bsd.git/stage/usr/include/arpa/nameser.h res.h
-commands.o: commands.c /home/nick/src/211bsd.git/stage/usr/include/stdio.h
-commands.o: res.h
 
 # IF YOU PUT ANYTHING HERE IT WILL GO AWAY