wytze@gouldnl.UUCP (Wytze van der Raay) (03/09/89)
Here are a number of patches to make the recently posted zoo (2.01) usable on Gould UTX/32 systems (PowerNode and NP1). There are five files affected: misc.c, misc2.c and needed.c: work-around for a C compiler bug bsd.c: corrected implementation of the "gettz" routine; this may be of general use to BSD4.2 and BSD4.3-like systems makefile: added a number of features, most notably the automatic generation of dependencies (the distributed makefile was missing many, many dependencies ...) The code has been tested on UTX/32 2.0U06, UTX/32 2.1A and UTX/32 3.0E. Enjoy! ------------------------------------------------------------------- | Wytze van der Raay ...!hp4nl!gouldnl!wytze | | Gould European Unix Support Centre wytze@gouldnl.uucp | | Maarssenbroek, The Netherlands (USA) ...!gould!wraay | ------------------------------------------------------------------- *** misc.c.org Wed Mar 8 08:21:44 1989 --- misc.c Wed Mar 8 09:04:21 1989 *************** *** 123,129 **** --- 123,133 ---- #else strcat (result, dirname); #endif + #ifdef GOULD_PN /* ugly work around for C compiler bug */ + if (*lastptr(result) != '/') + #else if (*lastptr(result) != *PATH_CH) + #endif strcat(result, PATH_CH); } *** misc2.c.org Wed Mar 8 08:21:24 1989 --- misc2.c Wed Mar 8 09:06:01 1989 *************** *** 157,163 **** --- 157,167 ---- char *slashpos; if (path == NULL) return; + #ifdef GOULD_PN /* ugly work around for C compiler bug */ + while (*lastptr(path) == '/') /* remove trailing slashes */ + #else while (*lastptr(path) == *PATH_CH) /* remove trailing slashes */ + #endif *lastptr(path) = '\0'; if (*path == '\0') return; *** needed.c.org Wed Mar 8 08:21:34 1989 --- needed.c Wed Mar 8 09:07:25 1989 *************** *** 70,76 **** --- 70,80 ---- /* If the argument contains a slash, the match fails if the path prefixes don't match */ + #ifdef GOULD_PN /* ugly work around for C compiler bug */ + if (strchr(arg, '/') != NULL) { /* found slash */ + #else if (strchr(arg, *PATH_CH) != NULL) { /* found slash */ + #endif strcpy(arg_copy,arg); strcpy(path_copy,pathname); p = findlast(arg_copy, PATH_CH); *** bsd.c.org Wed Mar 8 08:20:37 1989 --- bsd.c Wed Mar 8 11:11:35 1989 *************** *** 83,88 **** --- 83,105 ---- /* Function gettz(), returns the offset from GMT in seconds */ long gettz() { + #ifdef gould /* use a less brain-damaged implementation than original zoo */ + static long offset = 0x7FFFFFFF; + struct timeval tp; + struct timezone tzp; + register struct tm *loctim; + extern struct tm *localtime(); + + if (offset != 0x7FFFFFFF) + return (offset); + gettimeofday (&tp, &tzp); + loctim = localtime(&tp.tv_sec); + #ifdef UTX2_0 /* traditional BSD4.2 system */ + return (offset = tzp.tz_minuteswest * 60 - loctim->tm_isdst * 3600L); + #else /* new timezone code; see ctime(3) and zic(8) */ + return (offset = -loctim->tm_gmtoff); + #endif + #else struct timeval tp; struct timezone tzp; gettimeofday (&tp, &tzp); /* specific to 4.3BSD */ *************** *** 90,95 **** --- 107,113 ---- /* return (tzp.tz_minuteswest * 60); */ /* old incorrect code */ /* Timezone fix thanks to Bill Davidsen <wedu@ge-crd.ARPA> */ return (tzp.tz_minuteswest * 60 - tzp.tz_dsttime * 3600L); + #endif } /* Standard UNIX-compatible time routines */ *** makefile.org Wed Mar 8 08:21:10 1989 --- makefile Wed Mar 8 10:55:14 1989 *************** *** 1,3 **** --- 1,8 ---- + # This makefile has been customized for Gould UTX/32. It removes the + # need for running the "mkbsd" script, and adds several nice features. + # Wytze van der Raay, Gould European Unix Support Centre, March 1989. + # The original makefile can be found under the name "makefile.org". + #-------------------------------------------------------------------- # @(#) makefile 2.2 88/01/27 19:37:59 #Make Zoo # *************** *** 21,28 **** # #"make lint" will probably not work. CC = cc ! cswitch = extra = -DBIG_MEM -DNDEBUG #List of all object files created for Zoo --- 26,38 ---- # #"make lint" will probably not work. + BINDIR = /usr/local + MANDIR = /usr/man/manl + VERSION = -DUTX`/usr/5bin/uname -v | tr . _` + CC = cc ! cswitch = -c -O -DBSD4_3 $(VERSION) ! ldswitch = -o $@ extra = -DBIG_MEM -DNDEBUG #List of all object files created for Zoo *************** *** 34,45 **** FIZOBJS = fiz.o addbfcrc.o portable.o crcdefs.o .c.o : $(CC) $(cswitch) $(extra) $*.c ! all : ERROR ! #doesn't work lint: $(ZOOOBJS) lint $(ZOOOBJS) --- 44,84 ---- FIZOBJS = fiz.o addbfcrc.o portable.o crcdefs.o + #List of all source files used for zoo and fiz (used by make depend) + ALLSRC = addbfcrc.c addfname.c basename.c comment.c crcdefs.c \ + getfile.c lzc.c lzd.c machine.c makelist.c misc.c misc2.c \ + nextfile.c needed.c options.c parse.c portable.c prterror.c \ + version.c zoo.c zooadd.c zooadd2.c zoodel.c zooext.c zoofilt.c \ + zoolist.c zoopack.c fiz.c + .c.o : $(CC) $(cswitch) $(extra) $*.c ! all : zoo fiz ! install: all ! install -m 755 zoo $(BINDIR)/zoo ! install -m 755 fiz $(BINDIR)/fiz ! install -c -m 444 zoo.1 $(MANDIR)/zoo.l ! install -c -m 444 fiz.1 $(MANDIR)/fiz.l ! ! depend: ! @echo Making dependency lists for header files ... ! $(CC) -M -E $(cswitch) $(extra) $(ALLSRC) | \ ! sed -e '/:$$/d' | \ ! awk ' { if ($$1 != prev) { print rec; rec = $$0; prev = $$1; } \ ! else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \ ! else rec = rec " " $$2 } } \ ! END { print rec } ' > makedep ! echo '/^# DO NOT DELETE THIS LINE/+1,$$d' >eddep ! echo '$$r makedep' >>eddep ! echo 'w' >>eddep ! cp -p makefile makefile.bak ! chmod u+w makefile ! ex - makefile < eddep ! chmod u-w makefile ! rm eddep makedep ! lint: $(ZOOOBJS) lint $(ZOOOBJS) *************** *** 52,113 **** clean : /bin/rm -f core a.out $(ZOOOBJS) $(FIZOBJS) ! lzd.o : lzd.c zoomem.h ! $(CC) $(cswitch) $(extra) $*.c ! lzc.o : lzc.c zoomem.h ! $(CC) $(cswitch) $(extra) $*.c ! ! addbfcrc.o : addbfcrc.c ! ! addfname.o : addfname.c ! ! basename.o : basename.c ! ! comment.c : zooio.h ! ! crcdefs.o : crcdefs.c ! ! getfile.o : getfile.c zoomem.h ! $(CC) $(cswitch) $(extra) $*.c ! ! machine.o : machine.c nixtime.i ! $(CC) $(cswitch) $(extra) $*.c ! ! makelist.o : makelist.c ! ! misc.c : zooio.h ! ! misc2.o : misc2.c zoomem.h ! $(CC) $(cswitch) $(extra) $*.c ! ! options.o : options.c ! ! nextfile.o : nextfile.c ! ! needed.o : needed.c ! ! parse.o : parse.c ! ! portable.o : portable.c ! ! prterror.o : prterror.c ! ! zoo.o : zoo.c zoomem.h errors.i ! $(CC) $(cswitch) $(extra) $*.c ! ! zooadd.c : zooio.h ! ! zooadd2.c : zooio.h ! ! zoodel.c : zooio.h ! ! zooext.o : zooext.c errors.i zooio.h ! $(CC) $(cswitch) $(extra) $*.c ! ! zoofilt.o : zoofilt.c zooio.h ! $(CC) $(cswitch) $(extra) $*.c ! ! zoolist.c : zooio.h ! ! zoopack.c : zooio.h --- 91,150 ---- clean : /bin/rm -f core a.out $(ZOOOBJS) $(FIZOBJS) ! # DO NOT DELETE THIS LINE ! addbfcrc.o: addbfcrc.c ./options.h ! addfname.o: addfname.c ./options.h ./zooio.h /usr/include/stdio.h ./various.h ! addfname.o: ./zoo.h ./zoofns.h ./zoomem.h ! basename.o: basename.c ./options.h ./zooio.h /usr/include/stdio.h ./zoo.h ! basename.o: ./parse.h ./various.h ./zoofns.h ./debug.h ./assert.h ! comment.o: comment.c ./options.h ./portable.h ./zooio.h /usr/include/stdio.h ! comment.o: ./various.h /usr/include/signal.h ./zoo.h ./zoofns.h ./errors.i ! crcdefs.o: crcdefs.c ./options.h ! getfile.o: getfile.c ./options.h ./zoo.h ./zooio.h /usr/include/stdio.h ! getfile.o: ./various.h ./zoofns.h ./zoomem.h ! lzc.o: lzc.c ./options.h ./zoo.h ./zooio.h /usr/include/stdio.h ./various.h ! lzc.o: ./zoofns.h ./zoomem.h ./debug.h ./assert.h ./lzconst.h ! lzd.o: lzd.c ./options.h ./zoo.h ./zooio.h /usr/include/stdio.h ./various.h ! lzd.o: ./zoofns.h ./zoomem.h ./debug.h ./assert.h ./lzconst.h ! machine.o: machine.c ./options.h ./zooio.h /usr/include/stdio.h ./zoo.h ! machine.o: ./zoofns.h ./various.h ./bsd.c /usr/include/sys/types.h ! machine.o: /usr/include/sys/stat.h /usr/include/sys/time.h /usr/include/time.h ! machine.o: ./nixtime.i ./nixmode.i ! makelist.o: makelist.c ./options.h ./portable.h ./errors.i ./zoo.h ./zooio.h ! makelist.o: /usr/include/stdio.h ./various.h ./zoofns.h ./assert.h ./debug.h ! misc.o: misc.c ./options.h ./zoo.h ./zooio.h /usr/include/stdio.h ./various.h ! misc.o: ./errors.i ./zoofns.h /usr/include/signal.h /usr/include/ctype.h ! misc2.o: misc2.c ./options.h ./portable.h ./zooio.h /usr/include/stdio.h ! misc2.o: ./various.h ./zoofns.h ./errors.i ./zoomem.h ./zoo.h ./mstime.i ! nextfile.o: nextfile.c ./options.h /usr/include/stdio.h ./various.h ./zoo.h ! needed.o: needed.c ./options.h ./zoo.h /usr/include/ctype.h ./zooio.h ! needed.o: /usr/include/stdio.h ./zoofns.h ./various.h ./debug.h ! options.o: options.c ./options.h ./zooio.h /usr/include/stdio.h ./various.h ! options.o: ./zoo.h ./zoofns.h ./errors.i ! parse.o: parse.c ./options.h ./zoo.h ./zooio.h /usr/include/stdio.h ./various.h ! parse.o: ./zoofns.h ./parse.h ./assert.h ! portable.o: portable.c ./options.h ./zooio.h /usr/include/stdio.h ./various.h ! portable.o: ./zoofns.h ./machine.h ./zoo.h ./debug.h ./assert.h ! portable.o: /usr/include/ctype.h ./portable.h ! prterror.o: prterror.c ./options.h /usr/include/stdio.h ./various.h ! version.o: version.c ! zoo.o: zoo.c ./options.h ./zooio.h /usr/include/stdio.h ./various.h ./zoo.h ! zoo.o: ./zoofns.h ./errors.i ./zoomem.h ! zooadd.o: zooadd.c ./options.h ./zoomem.h ./zoo.h ./zooio.h ! zooadd.o: /usr/include/stdio.h ./various.h ./parse.h ./debug.h ./portable.h ! zooadd.o: ./zoofns.h ./errors.i ! zooadd2.o: zooadd2.c ./options.h ./zoo.h /usr/include/stdio.h ./various.h ! zooadd2.o: ./zooio.h ./zoofns.h ./errors.i ./assert.h ./debug.h ./parse.h ! zoodel.o: zoodel.c ./options.h ./portable.h /usr/include/stdio.h ./various.h ! zoodel.o: ./zooio.h ./zoo.h ./zoofns.h ./errors.i /usr/include/signal.h ! zooext.o: zooext.c ./options.h ./zoo.h ./parse.h ./portable.h ./machine.h ! zooext.o: ./zooio.h /usr/include/stdio.h ./various.h /usr/include/signal.h ! zooext.o: ./zoofns.h ./errors.i ! zoofilt.o: zoofilt.c ./options.h ./zooio.h /usr/include/stdio.h ./errors.i ! zoolist.o: zoolist.c ./options.h ./portable.h ./zoomem.h ./zoo.h ./errors.i ! zoolist.o: ./zooio.h /usr/include/stdio.h ./various.h ./zoofns.h ! zoopack.o: zoopack.c ./options.h ./portable.h ./zooio.h /usr/include/stdio.h ! zoopack.o: ./various.h ./zoo.h ./zoofns.h ./errors.i /usr/include/signal.h ! fiz.o: fiz.c ./options.h ./zooio.h /usr/include/stdio.h ./various.h ./zoofns.h ! fiz.o: ./portable.h ./zoo.h -------------------------------------------------------------------------------- -- | Wytze van der Raay ...!hp4nl!gouldnl!wytze | | Gould European Unix Support Centre wytze@gouldnl.uucp | | Maarssenbroek, The Netherlands (USA) ...!gould!wraay |
guy@auspex.UUCP (Guy Harris) (03/11/89)
> corrected implementation of the "gettz" routine; > this may be of general use to BSD4.2 and BSD4.3-like systems Note that the "tm_gmtoff" field should be used on all systems that provide it. This includes SunOS 4.0 and later releases, and appears to include 4.3-tahoe as well. It may also include Mach, at least on the NeXT machine.