diff -Naur basename.c.old basename.c
|
old
|
new
|
|
| 18 | 18 | |
| 19 | 19 | /* This function strips device/directory information from |
| 20 | 20 | a pathname and returns just the plain filename */ |
| 21 | | void basename (pathname, fname) |
| | 21 | void mybasename (pathname, fname) |
| 22 | 22 | char *pathname; |
| 23 | 23 | char fname[]; |
| 24 | 24 | { |
diff -Naur bsd.c.old bsd.c
|
old
|
new
|
|
| 74 | 74 | #define SEC_IN_DAY (24L * 60L * 60L) |
| 75 | 75 | #define INV_VALUE (SEC_IN_DAY + 1L) |
| 76 | 76 | static long retval = INV_VALUE; /* cache, init to impossible value */ |
| 77 | | #ifndef __386BSD__ |
| 78 | 77 | struct timeval tp; |
| 79 | 78 | struct timezone tzp; |
| 80 | | #else |
| 81 | | time_t lt; |
| 82 | | struct tm *tm; |
| 83 | | #endif |
| 84 | 79 | if (retval != INV_VALUE) /* if have cached value, return it */ |
| 85 | 80 | return retval; |
| 86 | | #ifndef __386BSD__ |
| 87 | 81 | gettimeofday (&tp, &tzp); /* specific to 4.3BSD */ |
| 88 | 82 | /* return (tzp.tz_minuteswest * 60); */ /* old incorrect code */ |
| 89 | 83 | /* Timezone fix thanks to Bill Davidsen <wedu@ge-crd.ARPA> */ |
| 90 | | /* !! - ache@hq.demos.su */ |
| 91 | | retval = tzp.tz_minuteswest * 60 - (tzp.tz_dsttime != 0) * 3600L; |
| 92 | | #else |
| 93 | | time(<); |
| 94 | | tm = localtime(<); |
| 95 | | retval = -tm->tm_gmtoff; |
| 96 | | #endif |
| | 84 | retval = tzp.tz_minuteswest * 60 - tzp.tz_dsttime * 3600L; |
| 97 | 85 | return retval; |
| 98 | 86 | } |
| 99 | 87 | |
diff -Naur decode.c.old decode.c
|
old
|
new
|
|
| 27 | 27 | */ |
| 28 | 28 | |
| 29 | 29 | int decode(count, buffer) |
| 30 | | uint count; |
| 31 | | uchar *buffer; |
| | 30 | my_uint count; |
| | 31 | uchar buffer[]; |
| 32 | 32 | /* The calling function must keep the number of |
| 33 | 33 | bytes to be processed. This function decodes |
| 34 | 34 | either 'count' bytes or 'DICSIZ' bytes, whichever |
| … |
… |
|
| 37 | 37 | Call decode_start() once for each new file |
| 38 | 38 | before calling this function. */ |
| 39 | 39 | { |
| 40 | | static uint i; |
| 41 | | uint r, c; |
| | 40 | static my_uint i; |
| | 41 | my_uint r, c; |
| 42 | 42 | |
| 43 | 43 | r = 0; |
| 44 | 44 | while (--j >= 0) { |
diff -Naur encode.c.old encode.c
|
old
|
new
|
|
| 5 | 5 | Adapted from "ar" archiver written by Haruhiko Okumura. |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | | #ifdef ANSI_HDRS |
| 9 | | # include <stdlib.h> |
| 10 | | # include <string.h> |
| 11 | | #endif |
| 12 | | |
| 13 | 8 | #include "options.h" |
| 14 | 9 | #include "zoo.h" |
| 15 | 10 | #include "ar.h" |
| … |
… |
|
| 20 | 15 | |
| 21 | 16 | #include <assert.h> |
| 22 | 17 | |
| | 18 | #ifdef ANSI_HDRS |
| | 19 | # include <stdlib.h> |
| | 20 | # include <string.h> |
| | 21 | #endif |
| | 22 | |
| 23 | 23 | #include "errors.i" |
| 24 | 24 | |
| 25 | 25 | FILE *lzh_infile; |
diff -Naur huf.c.old huf.c
|
old
|
new
|
|
| 5 | 5 | |
| 6 | 6 | Adapted from "ar" archiver written by Haruhiko Okumura. |
| 7 | 7 | ***********************************************************/ |
| 8 | | #ifdef ANSI_HDRS |
| 9 | | # include <stdlib.h> |
| 10 | | #endif |
| 11 | | |
| 12 | 8 | #include "options.h" |
| 13 | 9 | #include "zoo.h" |
| 14 | 10 | #include "ar.h" |
| … |
… |
|
| 17 | 13 | |
| 18 | 14 | extern void prterror(); |
| 19 | 15 | |
| | 16 | #ifdef ANSI_HDRS |
| | 17 | # include <stdlib.h> |
| | 18 | #endif |
| | 19 | |
| 20 | 20 | #define NP (DICBIT + 1) |
| 21 | 21 | #define NT (CODE_BIT + 3) |
| 22 | 22 | #define PBIT 4 /* smallest integer such that (1U << PBIT) > NP */ |
diff -Naur lzd.c.old lzd.c
|
old
|
new
|
|
| 59 | 59 | extern unsigned int filt_lzd_word; |
| 60 | 60 | #endif /* FILTER */ |
| 61 | 61 | |
| 62 | | void xwr_dchar PARMS ((int)); |
| | 62 | void xwr_dchar PARMS ((char)); |
| 63 | 63 | static int firstchar PARMS ((int)); |
| 64 | 64 | static void cbfill PARMS ((void)); |
| 65 | 65 | |
diff -Naur lzh.c.old lzh.c
|
old
|
new
|
|
| 45 | 45 | |
| 46 | 46 | decode_start(); |
| 47 | 47 | while (!decoded) { |
| 48 | | n = decode((uint) DICSIZ, (uchar *)out_buf_adr); /* n = count of chars decoded */ |
| | 48 | n = decode((my_uint) DICSIZ, out_buf_adr); /* n = count of chars decoded */ |
| 49 | 49 | #ifdef COUNT_BYTES |
| 50 | 50 | bytes_decoded += n; /*debug*/ |
| 51 | 51 | #endif |
| 52 | 52 | #ifdef CHECK_BREAK |
| 53 | 53 | check_break(); |
| 54 | 54 | #endif |
| 55 | | fwrite_crc((uchar *)out_buf_adr, n, outfile); |
| | 55 | fwrite_crc(out_buf_adr, n, outfile); |
| 56 | 56 | #ifdef SHOW_DOTS |
| 57 | 57 | (void) putc('.', stderr); |
| 58 | 58 | (void) fflush(stderr); |
diff -Naur lzh.h.old lzh.h
|
old
|
new
|
|
| 34 | 34 | #define CBIT 9 /* $\lfloor \log_2 NC \rfloor + 1$ */ |
| 35 | 35 | #define CODE_BIT 16 /* codeword length */ |
| 36 | 36 | |
| 37 | | extern ushort left[], right[]; |
| | 37 | extern my_ushort left[], right[]; |
diff -Naur makefile.old makefile
|
old
|
new
|
|
| 18 | 18 | |
| 19 | 19 | MAKE = make # needed for some systems e.g. older BSD |
| 20 | 20 | |
| 21 | | CC = cc |
| | 21 | CC = gcc |
| 22 | 22 | CFLAGS = |
| 23 | 23 | MODEL = |
| 24 | 24 | EXTRA = -DBIG_MEM -DNDEBUG |
| 25 | 25 | LINTFLAGS = -DLINT |
| 26 | | OPTIM = -O |
| 27 | | DESTDIR = /usr/local/bin |
| | 26 | OPTIM = -O2 |
| | 27 | DESTDIR = /boot/common |
| | 28 | BINDIR = $(DESTDIR)/bin |
| | 29 | MANDIR = $(DESTDIR)/man/man1 |
| | 30 | |
| 28 | 31 | |
| 29 | 32 | #List of all object files created for Zoo |
| 30 | 33 | ZOOOBJS = addbfcrc.o addfname.o basename.o comment.o crcdefs.o \ |
| … |
… |
|
| 50 | 53 | @echo "generic: generic **IX environment, minimal functionlity" |
| 51 | 54 | @echo "bsd: 4.3BSD or reasonable equivalent" |
| 52 | 55 | @echo "bsdansi: 4.3BSD with ANSI C" |
| | 56 | @echo "haiku: Haiku" |
| 53 | 57 | @echo "ultrix: ULTRIX 4.1" |
| 54 | 58 | @echo "convex: Convex C200 series" |
| 55 | 59 | @echo "sysv: System V Release 2 or 3; or SCO Xenix" |
| … |
… |
|
| 68 | 72 | |
| 69 | 73 | # install alpha zoo as "tzoo" |
| 70 | 74 | install: |
| 71 | | mv zoo $(DESTDIR)/tzoo |
| | 75 | mv zoo $(BINDIR)/tzoo |
| 72 | 76 | |
| 73 | 77 | # install beta zoo as "bzoo" |
| 74 | 78 | inst_beta: |
| 75 | | mv zoo $(DESTDIR)/bzoo |
| | 79 | mv zoo $(BINDIR)/bzoo |
| 76 | 80 | |
| 77 | 81 | # install production zoo as "zoo" |
| 78 | 82 | inst_prod: |
| 79 | | mv zoo $(DESTDIR)/zoo |
| 80 | | |
| | 83 | cp zoo fiz $(BINDIR) |
| | 84 | cp zoo.1 fiz.1 $(MANDIR) |
| | 85 | |
| 81 | 86 | # executable targets |
| 82 | 87 | TARGETS = zoo fiz |
| 83 | 88 | |
| … |
… |
|
| 106 | 111 | convex: |
| 107 | 112 | $(MAKE) CFLAGS="-c $(OPTIM) -DBSD4_3 -DANSI_HDRS" $(TARGETS) |
| 108 | 113 | |
| | 114 | # Haiku |
| | 115 | haiku: |
| | 116 | $(MAKE) CFLAGS="-c $(OPTIM) -DSYS_V -DANSI_HDRS -DHAVE_MKDIR" $(TARGETS) |
| | 117 | |
| 109 | 118 | # SysV.2, V.3, SCO Xenix |
| 110 | 119 | sysv: |
| 111 | 120 | $(MAKE) CFLAGS="-c $(OPTIM) -DSYS_V" $(TARGETS) |
| … |
… |
|
| 189 | 198 | # DO NOT DELETE THIS LINE -- it marks the beginning of this dependency list |
| 190 | 199 | |
| 191 | 200 | addbfcrc.o: options.h |
| 192 | | addfname.o: /usr/include/stdio.h options.h various.h zoo.h zoofns.h zooio.h |
| | 201 | addfname.o: options.h various.h zoo.h zoofns.h zooio.h |
| 193 | 202 | addfname.o: zoomem.h |
| 194 | | basename.o: /usr/include/stdio.h assert.h debug.h options.h parse.h various.h |
| | 203 | basename.o: assert.h debug.h options.h parse.h various.h |
| 195 | 204 | basename.o: zoo.h zoofns.h zooio.h |
| 196 | | bsd.o: /usr/include/sys/stat.h /usr/include/sys/time.h |
| 197 | | bsd.o: /usr/include/sys/types.h nixmode.i nixtime.i |
| 198 | | comment.o: /usr/include/signal.h /usr/include/stdio.h |
| 199 | | comment.o: /usr/include/sys/signal.h errors.i options.h portable.h various.h |
| | 205 | bsd.o: nixmode.i nixtime.i |
| | 206 | comment.o: errors.i options.h portable.h various.h |
| 200 | 207 | comment.o: zoo.h zoofns.h zooio.h |
| 201 | 208 | crcdefs.o: options.h |
| 202 | | decode.o: /usr/include/stdio.h ar.h lzh.h options.h zoo.h |
| 203 | | encode.o: /usr/include/assert.h /usr/include/stdio.h ar.h errors.i lzh.h |
| | 209 | decode.o: ar.h lzh.h options.h zoo.h |
| | 210 | encode.o: ar.h errors.i lzh.h |
| 204 | 211 | encode.o: options.h zoo.h |
| 205 | | fiz.o: /usr/include/stdio.h options.h portable.h various.h zoo.h zoofns.h |
| | 212 | fiz.o: options.h portable.h various.h zoo.h zoofns.h |
| 206 | 213 | fiz.o: zooio.h |
| 207 | | generic.o: /usr/include/sys/stat.h /usr/include/sys/types.h |
| 208 | | generic.o: /usr/include/time.h nixmode.i nixtime.i |
| 209 | | getfile.o: /usr/include/stdio.h options.h various.h zoo.h zoofns.h zooio.h |
| | 214 | generic.o: nixmode.i nixtime.i |
| | 215 | getfile.o: options.h various.h zoo.h zoofns.h zooio.h |
| 210 | 216 | getfile.o: zoomem.h |
| 211 | | huf.o: /usr/include/stdio.h ar.h errors.i lzh.h options.h zoo.h |
| 212 | | io.o: /usr/include/stdio.h ar.h errors.i lzh.h options.h portable.h zoo.h |
| | 217 | huf.o: ar.h errors.i lzh.h options.h zoo.h |
| | 218 | io.o: ar.h errors.i lzh.h options.h portable.h zoo.h |
| 213 | 219 | io.o: zooio.h |
| 214 | | lzc.o: /usr/include/stdio.h assert.h debug.h lzconst.h options.h various.h |
| | 220 | lzc.o: assert.h debug.h lzconst.h options.h various.h |
| 215 | 221 | lzc.o: zoo.h zoofns.h zooio.h zoomem.h |
| 216 | | lzd.o: /usr/include/stdio.h assert.h debug.h lzconst.h options.h various.h |
| | 222 | lzd.o: assert.h debug.h lzconst.h options.h various.h |
| 217 | 223 | lzd.o: zoo.h zoofns.h zooio.h zoomem.h |
| 218 | | lzh.o: /usr/include/stdio.h ar.h errors.i options.h zoo.h |
| 219 | | machine.o: /usr/include/stdio.h options.h various.h zoo.h zoofns.h zooio.h |
| 220 | | makelist.o: /usr/include/stdio.h assert.h debug.h errors.i options.h |
| | 224 | lzh.o: ar.h errors.i options.h zoo.h |
| | 225 | machine.o: options.h various.h zoo.h zoofns.h zooio.h |
| | 226 | makelist.o: assert.h debug.h errors.i options.h |
| 221 | 227 | makelist.o: portable.h various.h zoo.h zoofns.h zooio.h |
| 222 | | maketbl.o: /usr/include/stdio.h ar.h lzh.h options.h zoo.h |
| 223 | | maketree.o: /usr/include/stdio.h ar.h lzh.h options.h zoo.h |
| 224 | | misc.o: /usr/include/signal.h /usr/include/stdio.h /usr/include/sys/signal.h |
| | 228 | maketbl.o: ar.h lzh.h options.h zoo.h |
| | 229 | maketree.o: ar.h lzh.h options.h zoo.h |
| 225 | 230 | misc.o: errors.i options.h portable.h various.h zoo.h zoofns.h zooio.h |
| 226 | | misc2.o: /usr/include/stdio.h errors.i options.h portable.h various.h zoo.h |
| | 231 | misc2.o: errors.i options.h portable.h various.h zoo.h |
| 227 | 232 | misc2.o: zoofns.h zooio.h zoomem.h |
| 228 | | msdos.o: /usr/include/stdio.h errors.i options.h zoo.h zoofns.h zooio.h |
| 229 | | needed.o: /usr/include/stdio.h debug.h options.h portable.h various.h zoo.h |
| | 233 | msdos.o: errors.i options.h zoo.h zoofns.h zooio.h |
| | 234 | needed.o: debug.h options.h portable.h various.h zoo.h |
| 230 | 235 | needed.o: zoofns.h zooio.h |
| 231 | | nextfile.o: /usr/include/stdio.h options.h various.h zoo.h |
| 232 | | options.o: /usr/include/stdio.h errors.i options.h various.h zoo.h zoofns.h |
| | 236 | nextfile.o: options.h various.h zoo.h |
| | 237 | options.o: errors.i options.h various.h zoo.h zoofns.h |
| 233 | 238 | options.o: zooio.h |
| 234 | | parse.o: /usr/include/stdio.h assert.h options.h parse.h various.h zoo.h |
| | 239 | parse.o: assert.h options.h parse.h various.h zoo.h |
| 235 | 240 | parse.o: zoofns.h zooio.h |
| 236 | | portable.o: /usr/include/stdio.h assert.h debug.h machine.h options.h |
| | 241 | portable.o: assert.h debug.h machine.h options.h |
| 237 | 242 | portable.o: portable.h various.h zoo.h zoofns.h zooio.h |
| 238 | | prterror.o: /usr/include/stdio.h /usr/include/varargs.h options.h various.h |
| | 243 | prterror.o: options.h various.h |
| 239 | 244 | prterror.o: zoofns.h zooio.h |
| 240 | | sysv.o: /usr/include/sys/stat.h /usr/include/sys/types.h /usr/include/time.h |
| 241 | 245 | sysv.o: nixmode.i nixtime.i |
| 242 | | turboc.o: /usr/include/signal.h /usr/include/stdio.h /usr/include/sys/signal.h |
| 243 | | vms.o: /usr/include/time.h |
| 244 | | vmstime.o: /usr/include/stdio.h |
| 245 | | zoo.o: /usr/include/stdio.h errors.i options.h various.h zoo.h zoofns.h |
| | 246 | zoo.o: errors.i options.h various.h zoo.h zoofns.h |
| 246 | 247 | zoo.o: zooio.h zoomem.h |
| 247 | | zooadd.o: /usr/include/stdio.h debug.h errors.i options.h parse.h portable.h |
| | 248 | zooadd.o: debug.h errors.i options.h parse.h portable.h |
| 248 | 249 | zooadd.o: various.h zoo.h zoofns.h zooio.h zoomem.h |
| 249 | | zooadd2.o: /usr/include/stdio.h assert.h debug.h errors.i options.h parse.h |
| | 250 | zooadd2.o: assert.h debug.h errors.i options.h parse.h |
| 250 | 251 | zooadd2.o: various.h zoo.h zoofns.h zooio.h |
| 251 | | zoodel.o: /usr/include/signal.h /usr/include/stdio.h /usr/include/sys/signal.h |
| 252 | 252 | zoodel.o: errors.i options.h portable.h various.h zoo.h zoofns.h zooio.h |
| 253 | | zooext.o: /usr/include/signal.h /usr/include/stdio.h /usr/include/sys/signal.h |
| 254 | 253 | zooext.o: errors.i machine.h options.h parse.h portable.h various.h zoo.h |
| 255 | 254 | zooext.o: zoofns.h zooio.h |
| 256 | 255 | zoofilt.o: options.h |
| 257 | | zoolist.o: /usr/include/stdio.h errors.i options.h portable.h various.h zoo.h |
| | 256 | zoolist.o: errors.i options.h portable.h various.h zoo.h |
| 258 | 257 | zoolist.o: zoofns.h zooio.h zoomem.h |
| 259 | | zoopack.o: /usr/include/signal.h /usr/include/stdio.h |
| 260 | | zoopack.o: /usr/include/sys/signal.h errors.i options.h portable.h various.h |
| | 258 | zoopack.o: errors.i options.h portable.h various.h |
| 261 | 259 | zoopack.o: zoo.h zoofns.h zooio.h |
diff -Naur maketbl.c.old maketbl.c
|
old
|
new
|
|
| 16 | 16 | int nchar; |
| 17 | 17 | uchar bitlen[]; |
| 18 | 18 | int tablebits; |
| 19 | | ushort table[]; |
| | 19 | my_ushort table[]; |
| 20 | 20 | { |
| 21 | | ushort count[17], weight[17], start[18], *p; |
| 22 | | uint i, k, len, ch, jutbits, avail, nextcode, mask; |
| | 21 | my_ushort count[17], weight[17], start[18], *p; |
| | 22 | my_uint i, k, len, ch, jutbits, avail, nextcode, mask; |
| 23 | 23 | |
| 24 | 24 | for (i = 1; i <= 16; i++) count[i] = 0; |
| 25 | 25 | for (i = 0; i < nchar; i++) count[bitlen[i]]++; |
| … |
… |
|
| 27 | 27 | start[1] = 0; |
| 28 | 28 | for (i = 1; i <= 16; i++) |
| 29 | 29 | start[i + 1] = start[i] + (count[i] << (16 - i)); |
| 30 | | if (start[17] != (ushort)((unsigned) 1 << 16)) |
| | 30 | if (start[17] != (my_ushort)((unsigned) 1 << 16)) |
| 31 | 31 | prterror('f', "Bad decode table\n"); |
| 32 | 32 | |
| 33 | 33 | jutbits = 16 - tablebits; |
| … |
… |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | i = start[tablebits + 1] >> jutbits; |
| 44 | | if (i != (ushort)((unsigned) 1 << 16)) { |
| | 44 | if (i != (my_ushort)((unsigned) 1 << 16)) { |
| 45 | 45 | k = 1 << tablebits; |
| 46 | 46 | while (i != k) table[i++] = 0; |
| 47 | 47 | } |
diff -Naur maketree.c.old maketree.c
|
old
|
new
|
|
| 12 | 12 | |
| 13 | 13 | static int n, heapsize; |
| 14 | 14 | static short heap[NC + 1]; |
| 15 | | static ushort *freq, *sortptr, len_cnt[17]; |
| | 15 | static my_ushort *freq, *sortptr, len_cnt[17]; |
| 16 | 16 | static uchar *len; |
| 17 | 17 | |
| 18 | 18 | static void count_len(i) /* call with i = root */ |
| … |
… |
|
| 33 | 33 | int root; |
| 34 | 34 | { |
| 35 | 35 | int i, k; |
| 36 | | uint cum; |
| | 36 | my_uint cum; |
| 37 | 37 | |
| 38 | 38 | for (i = 0; i <= 16; i++) len_cnt[i] = 0; |
| 39 | 39 | count_len(root); |
| … |
… |
|
| 75 | 75 | static void make_code(j, length, code) |
| 76 | 76 | int j; |
| 77 | 77 | uchar length[]; |
| 78 | | ushort code[]; |
| | 78 | my_ushort code[]; |
| 79 | 79 | { |
| 80 | 80 | int i; |
| 81 | | ushort start[18]; |
| | 81 | my_ushort start[18]; |
| 82 | 82 | |
| 83 | 83 | start[1] = 0; |
| 84 | 84 | for (i = 1; i <= 16; i++) |
| … |
… |
|
| 88 | 88 | |
| 89 | 89 | int make_tree(nparm, freqparm, lenparm, codeparm) |
| 90 | 90 | int nparm; |
| 91 | | ushort freqparm[]; |
| | 91 | my_ushort freqparm[]; |
| 92 | 92 | uchar lenparm[]; |
| 93 | | ushort codeparm[]; |
| | 93 | my_ushort codeparm[]; |
| 94 | 94 | /* make tree, calculate len[], return root */ |
| 95 | 95 | { |
| 96 | 96 | int i, j, k, avail; |
diff -Naur options.h.old options.h
|
old
|
new
|
|
| 31 | 31 | #define GETTZ |
| 32 | 32 | #define FATTR |
| 33 | 33 | #define T_SIGNAL void |
| 34 | | #define VARARGS |
| | 34 | #define STDARG |
| 35 | 35 | #define NEED_MEMMOVE |
| 36 | 36 | /* #define NEED_MEMCPY */ |
| 37 | 37 | #define T_UINT16 unsigned short /* must be 16 bit unsigned */ |
| … |
… |
|
| 73 | 73 | /* #define UNBUF_LIMIT 512 */ |
| 74 | 74 | #define T_SIGNAL void |
| 75 | 75 | #define DIRECT_CONVERT |
| | 76 | #define STDARG |
| 76 | 77 | #define CHECK_BREAK |
| 77 | 78 | #define check_break kbhit |
| 78 | 79 | #define HAVE_ISATTY |
| … |
… |
|
| 88 | 89 | /***********************************************************************/ |
| 89 | 90 | |
| 90 | 91 | #ifdef BSD4_3 |
| | 92 | #define NOSTRCHR /* not really needed for 4.3BSD */ |
| 91 | 93 | #define FILTER |
| 92 | 94 | #define IO_MACROS |
| 93 | 95 | #define EXISTS(f) (access(f, 00) == 0) |
| … |
… |
|
| 101 | 103 | #define SETBUF |
| 102 | 104 | #define GETTZ |
| 103 | 105 | #define FATTR |
| 104 | | #ifdef __STDC__ |
| 105 | | #ifndef ANSI_HDRS |
| 106 | | #define ANSI_HDRS |
| 107 | | #endif |
| 108 | | #define T_SIGNAL void |
| 109 | | #define STDARG |
| 110 | | #define ANSI_PROTO |
| 111 | | #define VOIDPTR void * |
| 112 | | #else |
| 113 | | #define NOSTRCHR /* not really needed for 4.3BSD */ |
| 114 | 106 | #define T_SIGNAL int |
| 115 | 107 | #define VARARGS |
| 116 | 108 | #define NEED_MEMMOVE |
| 117 | | #define NEED_VPRINTF /* older BSDs only; newer ones have vprintf */ |
| 118 | | #endif |
| 119 | 109 | #define T_UINT16 unsigned short /* must be 16 bit unsigned */ |
| 120 | 110 | #define HAVE_ISATTY |
| | 111 | #define NEED_VPRINTF /* older BSDs only; newer ones have vprintf */ |
| 121 | 112 | #endif /* BSD4_3 */ |
| 122 | 113 | |
| 123 | 114 | /* Ultrix 4.1 */ |
diff -Naur prterror.c.old prterror.c
|
old
|
new
|
|
| 23 | 23 | # include <ctype.h> /* for isdigit() */ |
| 24 | 24 | #endif |
| 25 | 25 | |
| 26 | | #ifdef STDARG |
| 27 | 26 | # include <stdarg.h> |
| 28 | | #else |
| 29 | | # ifdef VARARGS |
| 30 | | # include <varargs.h> |
| 31 | | # else |
| 32 | | # include "MUST DEFINE STDARG OR VARARGS" |
| 33 | | # endif |
| 34 | | #endif |
| 35 | 27 | |
| 36 | 28 | #ifdef NEED_VPRINTF |
| 37 | 29 | static int zvfprintf(); |
| … |
… |
|
| 115 | 107 | char could_not_open[] = "Could not open %s.\n"; |
| 116 | 108 | #endif |
| 117 | 109 | |
| 118 | | #ifdef STDARG |
| 119 | | void prterror(int level, char *format, ...) |
| 120 | | #else |
| 121 | | /*VARARGS*/ |
| 122 | | void prterror(va_alist) |
| 123 | | va_dcl |
| 124 | | #endif |
| | 110 | void prterror(level, format, a, b, c, d) |
| | 111 | register int level; |
| | 112 | char *format, *a, *b, *c, *d; |
| 125 | 113 | { |
| 126 | | va_list args; |
| 127 | 114 | char string[120]; /* local format string */ |
| 128 | | #ifdef VARARGS |
| 129 | | int level; |
| 130 | | char *format; |
| 131 | | #endif |
| 132 | | |
| 133 | | #ifdef STDARG |
| 134 | | va_start(args, format); |
| 135 | | #else |
| 136 | | va_start(args); |
| 137 | | level = va_arg(args, int); |
| 138 | | format = va_arg(args, char *); |
| 139 | | #endif |
| 140 | | |
| 141 | 115 | *string = '\0'; /* get a null string to begin with */ |
| 142 | 116 | |
| 143 | 117 | #ifdef OOZ |
| … |
… |
|
| 149 | 123 | switch (level) { |
| 150 | 124 | case 'M': *string = '\0'; /* fall through to 'm' */ |
| 151 | 125 | case 'm': if (quiet) return; break; |
| 152 | | case 'w': |
| | 126 | case 'w': |
| 153 | 127 | if (quiet > 1) return; |
| 154 | 128 | strcat (string, "WARNING: "); break; |
| 155 | 129 | case 'e': |
| … |
… |
|
| 163 | 137 | strcat (string, format); /* just append supplied format string */ |
| 164 | 138 | |
| 165 | 139 | /* and print the whole thing */ |
| 166 | | #ifdef NEED_VPRINTF |
| 167 | | (void) zvfprintf(stdout, string, args); |
| 168 | | #else |
| 169 | | (void) vprintf(string, args); |
| 170 | | #endif |
| 171 | | fflush (stdout); |
| | 140 | printf (string, a, b, c, d); /* and print the whole thing */ |
| | 141 | fflush (stdout); |
| 172 | 142 | |
| 173 | 143 | if (level == 'f') /* and abort on fatal error 'f' but not 'F' */ |
| 174 | 144 | zooexit (1); |
diff -Naur sysv.c.old sysv.c
|
old
|
new
|
|
| 129 | 129 | exists by the name of the needed directory. |
| 130 | 130 | */ |
| 131 | 131 | |
| | 132 | #ifndef HAVE_MKDIR |
| 132 | 133 | int mkdir(dirname) |
| 133 | 134 | char *dirname; |
| 134 | 135 | { |
| … |
… |
|
| 140 | 141 | } |
| 141 | 142 | return (0); |
| 142 | 143 | } |
| | 144 | #endif |
| 143 | 145 | |
| 144 | 146 | /* No file truncate system call in older System V. If yours has one, |
| 145 | 147 | add it here -- see bsd.c for example. It's ok for zootrunc to be |
diff -Naur zoo.c.old zoo.c
|
old
|
new
|
|
| 225 | 225 | if (cmd != NONE) { |
| 226 | 226 | switch (cmd) { |
| 227 | 227 | |
| 228 | | case ADD: zooadd (zooname, filecount, &argv[3], "ahP"); break; |
| 229 | | case FRESHEN: zooadd (zooname, filecount, &argv[3], "ahuP"); break; |
| 230 | | case UPDATE: zooadd (zooname, filecount, &argv[3], "ahunP"); break; |
| 231 | | case MOVE: zooadd (zooname, filecount, &argv[3], "ahMP"); break; |
| | 228 | case ADD: zooadd (zooname, filecount, &argv[3], "aP:"); break; |
| | 229 | case FRESHEN: zooadd (zooname, filecount, &argv[3], "auP:"); break; |
| | 230 | case UPDATE: zooadd (zooname, filecount, &argv[3], "aunP:"); break; |
| | 231 | case MOVE: zooadd (zooname, filecount, &argv[3], "aMP:"); break; |
| 232 | 232 | |
| 233 | 233 | case EXTRACT: zooext (zooname, "x"); break; |
| 234 | 234 | case TEST: zooext (zooname, "xNd"); break; |
| 235 | 235 | case PRINT: zooext (zooname, "xp"); break; |
| 236 | 236 | |
| 237 | 237 | case DELETE: zoodel (zooname, "DP",1); break; |
| 238 | | case LIST: zoolist (&argv[2], "Vm", argc-2); break; |
| | 238 | case LIST: zoolist (&argv[2], "VC", argc-2); break; |
| 239 | 239 | case COMMENT: comment (zooname, "c"); break; |
| 240 | 240 | default: goto show_usage; |
| 241 | 241 | } |
diff -Naur zoo.h.old zoo.h
|
old
|
new
|
|
| 1 | 1 | /* derived from: zoo.h 2.16 88/01/27 23:21:36 */ |
| 2 | 2 | |
| 3 | | #ifndef ZOO_H |
| 4 | | |
| 5 | | #define ZOO_H |
| 6 | | |
| 7 | 3 | /* |
| 8 | 4 | The contents of this file are hereby released to the public domain. |
| 9 | 5 | |
| … |
… |
|
| 131 | 127 | char fname[FNAMESIZE]; /* filename */ |
| 132 | 128 | |
| 133 | 129 | int var_dir_len; /* length of variable part of dir entry */ |
| 134 | | char tz; /* timezone where file was archived */ |
| | 130 | uchar tz; /* timezone where file was archived */ |
| 135 | 131 | unsigned int dir_crc; /* CRC of directory entry */ |
| 136 | 132 | |
| 137 | 133 | /* fields for variable part of directory entry follow */ |
| … |
… |
|
| 244 | 240 | #define MAXGEN 0x0f |
| 245 | 241 | /* version mask to prune down to correct size on large-word machines */ |
| 246 | 242 | #define VER_MASK 0xffff |
| 247 | | |
| 248 | | #endif /* ZOO_H */ |
diff -Naur zoo.man.old zoo.man
|
old
|
new
|
|
| 121 | 121 | Novice Equivalent |
| 122 | 122 | Command Description Expert Command |
| 123 | 123 | ____________________________________________________________ |
| 124 | | -add add files to archive ahP |
| | 124 | -add add files to archive aP |
| 125 | 125 | -extract extract files from archive x |
| 126 | | -move move files to archive ahMP |
| | 126 | -move move files to archive aMP |
| 127 | 127 | -test test archive integrity xNd |
| 128 | 128 | -print extract files to standard output xp |
| 129 | 129 | -delete delete files from archive DP |
| 130 | | -list list archive contents Vm |
| 131 | | -update add new or newer files ahunP |
| 132 | | -freshen by add newer files ahuP |
| | 130 | -list list archive contents VC |
| | 131 | -update add new or newer files aunP |
| | 132 | -freshen by add newer files auP |
| 133 | 133 | -comment add comments to files c |
| 134 | 134 | |
| 135 | 135 | Expert commands |
diff -Naur zooadd.c.old zooadd.c
|
old
|
new
|
|
| 34 | 34 | int *, int *, int *, int *, int *, int *, int *, int *)); |
| 35 | 35 | int ver_too_high PARMS ((struct zoo_header *)); |
| 36 | 36 | void get_comment PARMS ((struct direntry *, ZOOFILE, char *)); |
| 37 | | #ifndef PORTABLE |
| 38 | 37 | void copyfields PARMS ((struct direntry *, struct tiny_header *)); |
| 39 | | #endif |
| 40 | 38 | void storefname PARMS ((struct direntry *, char *, int)); |
| 41 | 39 | char *choosefname PARMS ((struct direntry *)); |
| 42 | 40 | |
| … |
… |
|
| 134 | 132 | |
| 135 | 133 | if (zoo_file == NOFILE) |
| 136 | 134 | prterror ('f', could_not_open, zoo_path); |
| 137 | | basename(zoo_path, zoo_fname); /* get basename of archive */ |
| | 135 | mybasename(zoo_path, zoo_fname); /* get basename of archive */ |
| 138 | 136 | rootname (zoo_path, zoo_bak); /* name without extension */ |
| 139 | 137 | strcat (zoo_bak, BACKUP_EXT); /* name of backup of this archive */ |
| 140 | 138 | |
| … |
… |
|
| 224 | 222 | break; |
| 225 | 223 | } |
| 226 | 224 | |
| 227 | | basename (this_path, this_fname); /* get just filename for later */ |
| | 225 | mybasename (this_path, this_fname); /* get just filename for later */ |
| 228 | 226 | |
| 229 | 227 | this_file = zooopen(this_path, Z_READ); |
| 230 | 228 | if (this_file == NOFILE) { |
diff -Naur zooadd2.c.old zooadd2.c
|
old
|
new
|
|
| 263 | 263 | direntry->zoo_tag = ZOO_TAG; |
| 264 | 264 | direntry->type = 2; /* type is now 2 */ |
| 265 | 265 | #ifdef GETTZ |
| 266 | | direntry->tz = gettz() / (15 * 60); /* seconds => 15-min units */ |
| | 266 | direntry->tz = (uchar) (gettz() / (15 * 60)); /* seconds => 15-min units */ |
| 267 | 267 | #else |
| 268 | 268 | direntry->tz = NO_TZ; /* timezone unknown */ |
| 269 | 269 | #endif |
diff -Naur zooext.c.old zooext.c
|
old
|
new
|
|
| 626 | 626 | |
| 627 | 627 | /* Ctrl_c() is called if ^C is hit while a file is being extracted. |
| 628 | 628 | It closes the files, deletes it, and exits. */ |
| 629 | | T_SIGNAL ctrl_c(int foo) |
| | 629 | T_SIGNAL ctrl_c() |
| 630 | 630 | { |
| 631 | 631 | #ifndef NOSIGNAL |
| 632 | 632 | signal (SIGINT, SIG_IGN); /* ignore any more */ |
diff -Naur zoofns.h.old zoofns.h
|
old
|
new
|
|
| 42 | 42 | int cfactor PARMS ((long, long)); |
| 43 | 43 | int chname PARMS ((char *, char *)); |
| 44 | 44 | int cmpnum PARMS ((unsigned int, unsigned int, unsigned int, unsigned int)); |
| 45 | | T_SIGNAL ctrl_c PARMS ((int)); |
| | 45 | T_SIGNAL ctrl_c PARMS ((void)); |
| 46 | 46 | int exists PARMS ((char *)); |
| 47 | 47 | int getfile PARMS ((ZOOFILE, ZOOFILE, long, int)); |
| 48 | 48 | int getutime PARMS ((char *, unsigned *, unsigned *)); |
| 49 | 49 | int gettime PARMS ((ZOOFILE, unsigned *, unsigned *)); |
| 50 | | T_SIGNAL handle_break PARMS ((int)); |
| | 50 | T_SIGNAL handle_break PARMS ((void)); |
| 51 | 51 | |
| 52 | 52 | #ifdef USE_ASCII |
| 53 | 53 | int isupper PARMS ((int)); |
| … |
… |
|
| 85 | 85 | void addfname PARMS ((char *, long, unsigned int, unsigned int, |
| 86 | 86 | unsigned, unsigned)); |
| 87 | 87 | void add_version PARMS ((char *, struct direntry *)); |
| 88 | | void basename PARMS ((char *, char [])); |
| | 88 | void mybasename PARMS ((char *, char [])); |
| 89 | 89 | void break_off PARMS ((void)); |
| 90 | 90 | void close_file PARMS ((ZOOFILE)); |
| 91 | 91 | void comment PARMS ((char *, char *)); |
diff -Naur zooio.h.old zooio.h
|
old
|
new
|
|
| 12 | 12 | #define OK_STDIO |
| 13 | 13 | #endif |
| 14 | 14 | |
| 15 | | #include "zoo.h" |
| 16 | | |
| 17 | 15 | #ifndef PARMS |
| 18 | 16 | #ifdef LINT_ARGS |
| 19 | 17 | #define PARMS(x) x |
diff -Naur zoopack.c.old zoopack.c
|
old
|
new
|
|
| 171 | 171 | } else { |
| 172 | 172 | strcpy (temp_file, xes); |
| 173 | 173 | } |
| 174 | | mktemp (temp_file); /* ... and make unique */ |
| | 174 | mkstemp (temp_file); /* ... and make unique */ |
| 175 | 175 | new_file = zoocreate (temp_file); |
| 176 | 176 | if (new_file == NOFILE) |
| 177 | 177 | prterror ('f', "Could not create temporary file %s.\n", temp_file); |
| … |
… |
|
| 388 | 388 | |
| 389 | 389 | /* handle_break() */ |
| 390 | 390 | /* Sets break_hit to 1 when called */ |
| 391 | | T_SIGNAL handle_break(int foo) |
| | 391 | T_SIGNAL handle_break() |
| 392 | 392 | { |
| 393 | 393 | #ifndef NOSIGNAL |
| 394 | 394 | signal (SIGINT, SIG_IGN); /* ignore future control ^Cs for now */ |