Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!hellgate.utah.edu!helios.ee.lbl.gov!pasteur!cory.Berkeley.EDU!fadden From: fadden@cory.Berkeley.EDU (Andy McFadden) Newsgroups: comp.binaries.apple2 Subject: NuLib v2.1.1 NuFX archiver (UNIX/APW) shar format 1/5 Message-ID: <19355@pasteur.Berkeley.EDU> Date: 9 Nov 89 09:16:02 GMT Sender: news@pasteur.Berkeley.EDU Reply-To: fadden@cory.Berkeley.EDU (Andy McFadden) Organization: University of California, Berkeley Lines: 1191 Make sure you get the documentation (separate posting), and of course, the other four shar files. If you aren't using UNIX, you can try "unshar.c", but you may end up cutting and pasting. If there is sufficient demand I will post a ShrinkIt + BinSCII version of the APW sources. Part 1/5 of NuLib. ----- #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create: # README # NOTES # Benchmarks # Makefile # make.apw # linkcom # msdos.mak # apwerr.h # crc.h # nuadd.h # nublu.h # nudefs.h # nuetc.h # nuext.h # nupak.h # nupdel.h # nuread.h # nuview.h # This archive created: Thu Nov 9 01:05:06 1989 # By: Andy McFadden () export PATH; PATH=/bin:/usr/bin:$PATH echo shar: "extracting 'README'" '(925 characters)' if test -f 'README' then echo shar: "will not over-write existing file 'README'" else cat << \!Funky!Stuff! > 'README' NuLib v2.1 README (05-Nov-89) While I have done extensive testing on NuLib, there are certainly a number of places where bugs could lurk. So, I'm asking that you don't distribute this sources beyond the Usenet community for now. This is only the second wide release; the first was back in August, when I first distributed this as NuARC. Since then, dozens of features have been added, including ShrinkIt uncompression, Binary II support, and full support for the UNIX operating system. Still to come are ShrinkIt compression, a more complete MS-DOS version, resource fork handling, and various other compression methods. Please send bug reports, ideas, or gripes to fadden@cory.berkeley.edu, or to one of the addresses mentioned in the documentation or under the "-hw" option. Things to come: - CRLF translations while adding files - ShrinkIt compression - Ability to manipulate the newer ShrinkIt (v3.0) archives !Funky!Stuff! fi # end of overwriting check echo shar: "extracting 'NOTES'" '(3409 characters)' if test -f 'NOTES' then echo shar: "will not over-write existing file 'NOTES'" else cat << \!Funky!Stuff! > 'NOTES' Programming notes (05-Nov-89) ----- Name: What started out as a NuFX viewer turned into a full-blown archiver. It went from NuView to NuARC, which was reasonable... until I spoke to Andy Nicholas. Apparently he'd been warned against using the name NuARC, so I had to pick a new one. "CShrink" seemed the most rational, since it is coded entirely in C and is meant to complement ShrinkIt. However, L&L now owns the name "ShrinkIt", so I switched over to NuLib. Sigh. ----- Excuses: The code is written to be portable first, efficient second. If you see a way to retain portability across a *wide* range of machines (from a //gs to a Cray) but increase efficiency, please let me know. Because of the way this was developed, I haven't exactly followed top-down programming practices. It shows. Sigh. Some of the procedures are rather long. Good progamming practice dictates that no procedure should be longer than your screen; my screen (a Sun-3/50) has 62 lines at the moment. This is certainly no excuse for procedures in excess of 150 lines, but I have tried to break things down into pieces within the procedures themselves. Some program-wide globals are used; most are boolean values or some special control variables that have to be visible across several files. Probably the worst is "onebyt *pakbuf", which was used so that I didn't have to keep malloc()ing a 64K buffer every few calls. It should be malloc()ed ONLY by routines called directly from main(), and should be free()d at the end of those procedures (which should cause execution to go back to main()). Another bad one is tmpNameBuf. I was worried about having multiple 1K buffers filling static storage (or the stack), so I made this... it is intended to be *very* temporary; don't make any calls to other NuLib procedures and expect it to survive. The P option (print) is something of a hack. I just sort of stuck it into extract (it's the same thing, except to stdout instead of a file), but I had to bypass some stuff... It can get messy, but it works. This program is still under development... ----- #ifdefs are generally structured as follows: #ifdef UNIX /* all UNIX systems come first */ # ifdef BSD43 ... # endif # ifdef SYSV ... # endif #else /* followed by micros, running GS/OS, MS-DOS, HFS, ... */ # ifdef APW ... # endif # ifdef MDOS ... # endif # ifndef APW /* if nothing else is defined... */ # ifndef MSDOS /* this is included so that somebody doing a port */ /* +PORT+ */ ... /* can easily figure out what needs to be altered */ # endif # endif #endif Things that need to be altered when porting between systems are tagged with "/* +PORT+ */" ----- #includes should be in this order: #include "nudefs.h" #include <...> #include "..." In ALL cases, nudefs.h should come first. Generally speaking it is a good idea to have the system includes before any NuLib ones. ----- UNIX doesn't really have a create_time field; it has accessed, modified, and "changed". Modified gets reset when the data gets modified; changed gets reset by chmod, chown, link, mknod, rename, unlink, utimes, write, and truncate. Anyway, the "modified" field is set what it should be, but I'm going to let the "changed" and "accessed" fields take care of themselves (in other words, I don't intend to modify them... besides, you can't change the "changed" field anyway). !Funky!Stuff! fi # end of overwriting check echo shar: "extracting 'Benchmarks'" '(1057 characters)' if test -f 'Benchmarks' then echo shar: "will not over-write existing file 'Benchmarks'" else cat << \!Funky!Stuff! > 'Benchmarks' Some benchmarks for NuLib: Uncompressing Moria GS (from 320K to 577K): NuLib, APW C version, running on a //gs 12 minutes Shrinkit v2.1, running on a //gs 1 minute 42 seconds NuLib on a moderately loaded VAX 11/780 1 minute 15 seconds NuLib on a partially loaded Sun 3/50 37 seconds NuLib on an Apollo workstation (all by my lonesome) 12 seconds On the Sun 3/50, approximately 12 seconds was devoted to disk access, with the remaining time for computation. On the Apollo, I was able to extract (uncompressed) the whole 577K file in less than 1 second. I'm not sure how things panned out on the VAX, but about 40 people were on at the time. Interestingly enough, 16-bit UNIX compress works faster than NuLib does. The reason for this is that the compression code in NuLib actually makes two passes, one to undo the LZW compression, and the other to undo non-repeat compression. Was it worth it do to both kinds? For Moria it was; even though "uncompress" ran faster, ShrinkIt's 12-bit LZW packed the file smaller than compress's 16-bit LZW. !Funky!Stuff! fi # end of overwriting check echo shar: "extracting 'Makefile'" '(1261 characters)' if test -f 'Makefile' then echo shar: "will not over-write existing file 'Makefile'" else cat << \!Funky!Stuff! > 'Makefile' # # UNIX Makefile for NuLib # # To make a smaller executable, you can exclude the Binary II routines # by setting CFLAGS= -DNO_BLU HDRS=nudefs.h nuread.h nuview.h nuadd.h nuext.h nupdel.h nupak.h nuetc.h\ nublu.h SRCS=numain.c nuread.c nuview.c nuadd.c nuext.c nupdel.c nupak.c nuetc.c\ nublu.c nushk.c nusq.c OBJS=numain.o nuread.o nuview.o nuadd.o nuext.o nupdel.o nupak.o nuetc.o\ nublu.o nushk.o nusq.o #CFLAGS=-g CFLAGS=-O LIBS= CC=cc nulib: ${OBJS} ${CC} ${CFLAGS} ${OBJS} -o nulib ${LIBS} numain.o: numain.c nudefs.h nuread.h nuview.h nuadd.h nuext.h nupdel.h nublu.h\ nuetc.h nuread.o: nuread.c nudefs.h nuread.h nupak.h nuetc.h crc.h nuview.o: nuview.c nudefs.h nuview.h nuread.h nuetc.h nuadd.o: nuadd.c nudefs.h nuadd.h nuread.h nuadd.h nupak.h nuetc.h nuext.o: nuext.c nudefs.h nuext.h nuread.h nuext.h nupak.h nuetc.h nupdel.o: nupdel.c nudefs.h nupdel.h nuread.h nuadd.h nupak.h nupdel.h nuetc.h nupak.o: nupak.c nudefs.h nupak.h nuetc.h nublu.o: nublu.c nudefs.h nublu.h nuview.h nuetc.h nushk.o: nushk.c nudefs.h nupak.h nusq.o: nusq.c nudefs.h nupak.h nuetc.o: nuetc.c nudefs.h nuetc.h shar: xshar -v -c -osh.files/nulib -l40 README NOTES Benchmarks Makefile \ make.apw msdos.mak linkcom *.h *.c !Funky!Stuff! fi # end of overwriting check echo shar: "extracting 'make.apw'" '(630 characters)' if test -f 'make.apw' then echo shar: "will not over-write existing file 'make.apw'" else cat << \!Funky!Stuff! > 'make.apw' * * NuLib AGE script (A pseudo-makefile for APW and ORCA) * for file in numain nuread nuview nuadd nuext nupdel nupak nuetc nublu nushk nusq age obj/{file}.root {file}.c if {age} != 0 echo compiling {file}.c delete obj/{file}.root compile {file}.c keep=obj/{file} end end * Once everything is compiled, I test the final * program file against the object modules that build it. * If linking is required, it is performed next followed * by a series of other statements to complete it: age cshk obj/=.root purge if {age} != 0 delete nulib prefix obj alink linkcom prefix .. end !Funky!Stuff! fi # end of overwriting check echo shar: "extracting 'linkcom'" '(2119 characters)' if test -f 'linkcom' then echo shar: "will not over-write existing file 'linkcom'" else cat << \!Funky!Stuff! > 'linkcom' ; APW LinkEd command file for NuLib ; ; Does not search for segments with blank load segment names. ; Does not search files for DIRECT segments (only the CLIB). ; Does not search any libraries other than 2/clib. keep ../nulib * This is the main code segment (type = code) segment/$00 main loadselect 2/start.root main loadselect numain.root main loadselect nuread.root main loadselect nuetc.root main loadselect nuview.root main loadselect nuadd.root main loadselect nuext.root main loadselect nupdel.root main library/loadselect 2/clib main * This contains compression/Binary II code (type = dynamic) segment/dynamic Compress loadselect nupak.root main loadselect nublu.root main loadselect nushk.root main loadselect nusq.root main library/loadselect 2/clib main * This contains all global definitions (type = private data) segment/$41 Globals loadselect 2/start.root ~globals loadselect numain.root ~globals loadselect nuread.root ~globals loadselect nuetc.root ~globals loadselect nuview.root ~globals loadselect nuadd.root ~globals loadselect nuext.root ~globals loadselect nupdel.root ~globals loadselect nupak.root ~globals loadselect nublu.root ~globals loadselect nushk.root ~globals loadselect nusq.root ~globals library/loadselect 2/clib ~globals * This holds all arrays (type = private data) segment/$41 Arrays loadselect 2/start.root ~arrays loadselect numain.root ~arrays loadselect nuread.root ~arrays loadselect nuetc.root ~arrays loadselect nuview.root ~arrays loadselect nuadd.root ~arrays loadselect nuext.root ~arrays loadselect nupdel.root ~arrays loadselect nupak.root ~arrays loadselect nublu.root ~arrays loadselect nushk.root ~arrays loadselect nusq.root ~arrays library/loadselect 2/clib ~arrays * This has direct page stuff, like the stack segment/$12 Direct (type = direct-page/stack) library/loadselect 2/clib DIRECT list on * One other segment, SEGJPTBL, appears here... !Funky!Stuff! fi # end of overwriting check echo shar: "extracting 'msdos.mak'" '(1923 characters)' if test -f 'msdos.mak' then echo shar: "will not over-write existing file 'msdos.mak'" else cat << \!Funky!Stuff! > 'msdos.mak' /**** SHK-DOS.MAK ****/ LLIBS_G = LLIBS_D = /NOD:LLIBCE LLIBCER LLIBS_R = /NOD:LLIBCE LLIBCER PROJ = SHRINK LFLAGS_R = /NOF LFLAGS_D = /CO /INC /NOF LFLAGS_G = /NOI /NOE ILINK = ilink LINK = link CFLAGS_R = /Ox CFLAGS_D = /qc /Zi /Zr /Gi /Od CFLAGS_G = /AL /W2 CC = cl DEBUG = 0 DEFS = LIBS = OBJS = $(OBJS_C) $(OBJS_EXT) OBJS_C = $(CS_EXT:.c=.obj) OBJS_EXT = ..\..\pmsdk\lib\setargv.obj CS_EXT = nuadd.c nublu.c nuetc.c nuext.c numain.c nupak.c nupdel.c nuread.c \ nushk.c nuview.c nusq.c all: SHK-DOS.exe nuadd.obj: nuadd.c nudefs.h nuread.h nuadd.h nupak.h nuetc.h nublu.obj: nublu.c nudefs.h nuview.h nuadd.h nuetc.h nuetc.obj: nuetc.c nudefs.h apwerr.h nuetc.h nuext.obj: nuext.c nudefs.h nuread.h nuext.h nupak.h nuetc.h numain.obj: numain.c nudefs.h nuread.h nuview.h nuadd.h nuext.h nupdel.h \ nublu.h nuetc.h nupak.obj: nupak.c nudefs.h nupak.h nuetc.h nupdel.obj: nupdel.c nudefs.h nuread.h nuadd.h nupak.h nupdel.h nuetc.h nuread.obj: nuread.c nudefs.h nuread.h nupak.h nuetc.h nushk.obj: nushk.c nudefs.h nuread.h nupak.h nuview.obj: nuview.c nudefs.h nuview.h nuread.h nuetc.h nusq.obj: nusq.c nudefs.h nuread.h nupak.h SHK-DOS.exe: $(OBJS) $(LIBS) $(DEFS) !IF $(DEBUG) echo > NUL @<<$(PROJ).crf $(OBJS: = +^ ),$@,,$(LLIBS_G) $(LLIBS_D) $(LIBS),$(DEFS) $(LFLAGS_G) $(LFLAGS_D); << $(ILINK) -a -e "$(LINK) @$(PROJ).crf" $@ !ELSE echo > NUL @<<$(PROJ).crf $(OBJS: = +^ ),$@,,$(LLIBS_G) $(LLIBS_R) $(LIBS),$(DEFS) $(LFLAGS_G) $(LFLAGS_R); << $(ILINK) -a -e "$(LINK) @$(PROJ).crf" $@ !ENDIF .c.obj: !IF $(DEBUG) $(CC) /c $(CFLAGS_G) $(CFLAGS_D) /Fo$*.obj $*.c !ELSE $(CC) /c $(CFLAGS_G) $(CFLAGS_R) /Fo$*.obj $*.c !ENDIF run: SHK-DOS.exe $(PROJ) $(RUNFLAGS) debug: SHK-DOS.exe CVP $(CVPFLAGS) $(PROJ) $(RUNFLAGS) !Funky!Stuff! fi # end of overwriting check echo shar: "extracting 'apwerr.h'" '(6759 characters)' if test -f 'apwerr.h' then echo shar: "will not over-write existing file 'apwerr.h'" else cat << \!Funky!Stuff! > 'apwerr.h' /* * apwerr.h - text versions of APW and ProDOS 16 error codes * ERROR() didn't cut it, and I'm trying to separate things from the shell. * * By Andy McFadden (fadden@cory.berkeley.edu) * NuLib v2.1 November 1989 Freeware (distribute, don't sell) */ /* APW-specific UNIX-like errors */ /* [ this is derived from: ] errno.h -- error return codes Copyright American Telephone & Telegraph Modified and used with permission, Apple Computer Inc. Copyright Apple Computer Inc. 1985, 1986, 1987 All rights reserved. */ /* @(#)errno.h 2.1 */ /* 3.0 SID # 1.3 */ #define sys_nerr 35 /* err must be < Max APW Err */ static char *sys_errlist[sys_nerr] = { /* 0 (no err) */ "[ call successful ]", /* 1 EPERM */ "permission denied", /* 2 ENOENT */ "no such file or directory", /* 3 ENORSRC */ "no such resource", /* 4 EINTR */ "interrupted system call", /* 5 EIO */ "I/O error", /* 6 ENXIO */ "no such device or address", /* 7 E2BIG */ "insufficient space for return argument", /* 8 ENOEXEC */ "exec format error", /* 9 EBADF */ "bad file number", /* 10 ECHILD */ "no children", /* 11 EAGAIN */ "no more processes", /* 12 ENOMEM */ "not enough memory", /* 13 EACCES */ "permission denied", /* 14 EFAULT */ "bad address", /* 15 ENOTBLK */ "block device required", /* 16 EBUSY */ "mount device busy", /* 17 EEXIST */ "file exists", /* 18 EXDEV */ "cross-device link", /* 19 ENODEV */ "no such device", /* 20 ENOTDIR */ "not a directory", /* 21 EISDIR */ "is a directory", /* 22 EINVAL */ "invalid argument", /* 23 ENFILE */ "file table overflow", /* 24 EMFILE */ "too many open files", /* 25 ENOTTY */ "not a typewriter (sorry)", /* 26 ETXTBSY */ "text file busy", /* 27 EFBIG */ "file too large", /* 28 ENOSPC */ "no space left on device", /* 29 ESPIPE */ "illegal seek", /* 30 EROFS */ "read only file system", /* 31 EMLINK */ "too many links", /* 32 EPIPE */ "broken pipe", /* 33 EDOM */ "math arg out of domain of func", /* 34 ERANGE */ "math result not representable" }; /* ProDOS errors */ /* [ This is derived from: ] /******************************************** ; File: ProDos.h ; ; ; Copyright Apple Computer, Inc. 1986, 1987 ; All Rights Reserved ; ********************************************/ #define MPErr 0x61 /* err must be < Max ProDOS Err # */ static char *ProDOSErr[MPErr] = { /* 00 (no error) */ "[ ProDOS call successful ]", /* 01 invalidCallNum */ "invalid call number / (fatal) unclaimed intr", /* 02 */ "", /* 03 */ "", /* 04 */ "(ProDOS 8 invalid parameter count)", /* 05 badPBlockPtr */ "call pointer out of bounds", /* 06 pdosActiveErr */ "ProDOS is active", /* 07 pdosBusyErr */ "ProDOS is busy", /* 08 */ "", /* 09 */ "", /* 0a vcbUnusable */ "(fatal) VCB is unusable", /* 0b fcbUnusable */ "(fatal) FCB is unusable", /* 0c badBlockZero */ "(fatal) block zero allocated illegally", /* 0d shdwInterruptErr */ "(fatal) interrupt occurred while I/O shadowing off", /* 0e */ "", /* 0f */ "", /* 10 devNotFound */ "device not found", /* 11 badDevRefNum */ "invalid device ref# / (fatal) wrong OS version", /* 12 */ "", /* 13 */ "", /* 14 */ "", /* 15 */ "", /* 16 */ "", /* 17 */ "", /* 18 */ "", /* 19 */ "", /* 1a */ "", /* 1b */ "", /* 1c */ "", /* 1d */ "", /* 1e */ "", /* 1f */ "", /* 20 badReqCode */ "invalid request code", /* 21 */ "", /* 22 */ "", /* 23 */ "", /* 24 */ "", /* 25 intTableFull */ "interrupt table full", /* 26 invalidOperation */ "invalid operation", /* 27 ioError */ "I/O error", /* 28 noDevConnect */ "no device connected", /* 29 */ "", /* 2a */ "", /* 2b writeProtectErr */ "write protect error", /* 2c */ "", /* 2d */ "", /* 2e diskSwitchErr */ "disk switched error", /* 2f */ "device not online", /* 30 */ "device-specific err $30", /* 31 */ "device-specific err $31", /* 32 */ "device-specific err $32", /* 33 */ "device-specific err $33", /* 34 */ "device-specific err $34", /* 35 */ "device-specific err $35", /* 36 */ "device-specific err $36", /* 37 */ "device-specific err $37", /* 38 */ "device-specific err $38", /* 39 */ "device-specific err $39", /* 3a */ "device-specific err $3a", /* 3b */ "device-specific err $3b", /* 3c */ "device-specific err $3c", /* 3d */ "device-specific err $3d", /* 3e */ "device-specific err $3e", /* 3f */ "device-specific err $3f", /* 40 badPathName */ "invalid pathname syntax", /* 41 */ "", /* 42 fcbFullErr */ "FCB full error (too many files open)", /* 43 badFileRefNum */ "invalid file reference number", /* 44 pathNotFound */ "path not found", /* 45 volumeNotFound */ "volume not found", /* 46 fileNotFound */ "file not found", /* 47 dupFileName */ "duplicate file name", /* 48 volumeFullErr */ "volume full error", /* 49 dirFullErr */ "directory full error", /* 4a versionErr */ "version error (incompatible file format)", /* 4b badStoreType */ "unsupported (or incorrect) storage type", /* 4c eofEncountered */ "end-of-file encountered", /* 4d positionRangeErr */ "position out of range", /* 4e accessErr */ "access not allowed", /* 4f */ "", /* 50 fileOpenErr */ "file already open", /* 51 dirDamaged */ "directory structure is damaged (file count?)", /* 52 badVolType */ "unsupported volume type", /* 53 paramRangeErr */ "parameter out of range", /* 54 memoryFullErr */ "out of memory", /* 55 vcbFullErr */ "VCB full error", /* 56 */ "(ProDOS 8 bad buffer address)", /* 57 dupVolumeErr */ "duplicate volume error", /* 58 notBlkDevErr */ "not a block device", /* 59 invalidLevel */ "invalid level", /* 5a */ "block number out of range (bad vol bitmap?)", /* 5b */ "illegal pathname change", /* 5c */ "not an executable file", /* 5d */ "file system not available", /* 5e */ "cannot deallocate /RAM", /* 5f */ "return stack overflow", /* 60 */ "data unavailable" }; !Funky!Stuff! fi # end of overwriting check echo shar: "extracting 'crc.h'" '(3321 characters)' if test -f 'crc.h' then echo shar: "will not over-write existing file 'crc.h'" else cat << \!Funky!Stuff! > 'crc.h' /* * crc.h - tables for fast computation of 16-bit CRCS * * By Andy McFadden (fadden@cory.berkeley.edu) * NuLib v2.1 November 1989 Freeware (distribute, don't sell) */ /* * updcrc macro derived from article Copyright (C) 1986 Stephen Satchell. * NOTE: First srgument must be in range 0 to 255. * Second argument is referenced twice. * * Programmers may incorporate any or all code into their programs, * giving proper credit within the source. Publication of the * source routines is permitted so long as proper credit is given * to Stephen Satchell, Satchell Evaluations and Chuck Forsberg, * Omen Technology. */ /*#define updcrc(cp, crc) ( crctab[((crc >> 8) & 255)] ^ (crc << 8) ^ cp)*/ #define updcrc(cp, crc) ( (crctab[((crc >> 8) & 0xFF) ^ cp] ^ (crc << 8)) & 0xFFFF) /* crctab calculated by Mark G. Mendel, Network Systems Corporation */ static unsigned short crctab[256] = { 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12, 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256, 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 }; !Funky!Stuff! fi # end of overwriting check echo shar: "extracting 'nuadd.h'" '(950 characters)' if test -f 'nuadd.h' then echo shar: "will not over-write existing file 'nuadd.h'" else cat << \!Funky!Stuff! > 'nuadd.h' /* * nuadd.h - declarations for nuadd.c * * By Andy McFadden (fadden@cory.berkeley.edu) * NuLib v2.1 November 1989 Freeware (distribute, don't sell) */ /* information is copied from file-dependent structures (FileRec) to here */ typedef struct { char *pathname; /* as much of the path as we need to know */ char *store_name; /* what name the file will be stored under */ fourbyt eof; /* length of file */ fourbyt fAccess; /* was Word */ fourbyt fileType; /* was Word */ fourbyt auxType; twobyt storageType; Time create_dt; /* Time = TimeRec = 8 bytes in misctool.h/nuread.h */ Time mod_dt; twobyt fileSysID; /* these two are non-standard */ twobyt fileSysInfo; int marked; /* application specific */ } file_info; #define MAXARGS 255 /* max #of files specified on command line; signed int */ extern void NuAdd(), AddFile(); extern onebyt *MakeMHblock(); extern int EvalArgs(); !Funky!Stuff! fi # end of overwriting check echo shar: "extracting 'nublu.h'" '(182 characters)' if test -f 'nublu.h' then echo shar: "will not over-write existing file 'nublu.h'" else cat << \!Funky!Stuff! > 'nublu.h' /* * nublu.h - declarations for nublu.c * * By Andy McFadden (fadden@cory.berkeley.edu) * NuLib v2.1 November 1989 Freeware (distribute, don't sell) */ extern void NuBNY(); !Funky!Stuff! fi # end of overwriting check echo shar: "extracting 'nudefs.h'" '(3283 characters)' if test -f 'nudefs.h' then echo shar: "will not over-write existing file 'nudefs.h'" else cat << \!Funky!Stuff! > 'nudefs.h' /* * nudefs.h - system-dependent typdefs and #defines for all CShrink files, * plus extern declarations for global variables (allocated in * numain.c). * * IMPORTANT: This file must be first on the list of #includes, since some * include files will be processed based on these #defines * * By Andy McFadden (fadden@cory.berkeley.edu) * NuLib v2.1 November 1989 Freeware (distribute, don't sell) */ /* SYSTEM DEPENDENCIES */ typedef unsigned char onebyt; typedef unsigned short twobyt; typedef unsigned long fourbyt; /* byte ordering; TRUE if high byte is first (68xxx), else FALSE (65xxx) */ extern int HiLo; /* actually part of numain.c */ /* Setup for Apple //gs APW */ /* [ "APW" is automatically defined by the compiler ] */ /* Setup for MS-DOS machines (80xxx based: IBM PC) */ /* [ "MSDOS" is defined by the compiler [MS C5.1 anyway] ] */ /* Setup for other microcomputers (Macintosh, Amiga) */ /* ??? */ /* Setup for BSD UNIX systems */ #define UNIX #define BSD43 /* #define VAX */ /* Setup for other UNIX systems */ /* #define UNIX */ /* #define SYSV (or whatever) */ /* #define VAX */ /* use table lookups to get CRCs */ #define CRC_TAB /* * Some global defs */ /* errno wasn't defined in on some systems... */ #ifndef MSDOS extern int errno; #endif /* Maximum file name length that we intend to handle (watch stack size!) */ #define MAXFILENAME 1024 /* file operations */ #define S_ABS 0 /* seek absolute */ #define S_REL 1 /* seek relative */ #define S_END 2 /* seek from end */ #ifdef UNIX /* stuff for open() */ # define WPERMS 0644 /* read/write for owner, read only for others */ # define O_BINARY 0 /* for non-UNIX open(); easier than #ifdefs */ #else # ifdef APW # define WPERMS 0666 /* read/write for all; this may not work for some */ # endif # ifdef MSDOS # define S_IREAD 0000400 /* read permission, owner */ # define S_IWRITE 0000200 /* write permission, owner */ # define WPERMS S_IREAD | S_IWRITE # endif # ifndef WPERMS /* other system */ # define WPERMS 0666 /* +PORT+ */ # endif #endif /*UNIX*/ /* Time structure; same as TimeRec from misctool.h */ /* one-byte entries should not have alignment problems... */ typedef struct { onebyt second; onebyt minute; onebyt hour; onebyt year; onebyt day; onebyt month; onebyt extra; onebyt weekDay; } Time; /* * global to entire program */ extern int HiLo; /* byte ordering; FALSE on low-first (65816) */ extern int verbose; /* BOOLEAN: print verbose? */ extern int interact; /* BOOLEAN: interactive when overwriting? */ extern int dopack; /* BOOLEAN: do we want to pack/unpack? */ extern int doSubdir; /* BOOLEAN: expand subdirectories? */ extern int doExpand; /* BOOLEAN: expand archived filenames? */ extern int transfrom; /* how to do CR<->LF translation? (-1 = none) */ extern int transto; extern int packMethod; /* how to pack a file (thread_format) */ extern fourbyt defFileType; /* default file type */ extern fourbyt defAuxType; /* default aux type */ extern onebyt *pakbuf; /* used by compression routines; created once to */ /* eliminate overhead involved in malloc()ing a 64K buffer */ extern char *prgName; /* for errors; don't like argv[0] */ !Funky!Stuff! fi # end of overwriting check echo shar: "extracting 'nuetc.h'" '(1194 characters)' if test -f 'nuetc.h' then echo shar: "will not over-write existing file 'nuetc.h'" else cat << \!Funky!Stuff! > 'nuetc.h' /* * nuetc.h - declarations for nuetc.c * * (this will be included by almost all source files; it should come last) * * By Andy McFadden (fadden@cory.berkeley.edu) * NuLib v2.1 November 1989 Freeware (distribute, don't sell) */ /* define these if they haven't been already */ #ifndef TRUE typedef int BOOLEAN; # define TRUE 1 # define FALSE 0 #endif #ifdef UNIX # ifdef BSD43 extern char *index(); /* BSD version */ extern char *rindex(); # define INDEX index # define RINDEX rindex # else extern char *strchr(); /* AT&T version */ extern char *strrchr(); # define INDEX strchr # define RINDEX strrchr # endif #else extern char *strchr(); /* APW, MSC */ extern char *strrchr(); # define INDEX strchr # define RINDEX strrchr #endif extern char tmpNameBuf[]; /* external function declarations */ extern void Fatal(), Quit(); extern void free(); extern char *Malloc(); #ifdef APW extern void ToolErrChk(), perror(); #endif extern int strcasecmp(), strncasecmp(); extern void ArcfiCreate(), Rename(); extern BOOLEAN Exists(); extern char *MakeTemp(); extern void ExpandTime(); extern long ReduceTime(); extern Time *GetTime(); !Funky!Stuff! fi # end of overwriting check echo shar: "extracting 'nuext.h'" '(251 characters)' if test -f 'nuext.h' then echo shar: "will not over-write existing file 'nuext.h'" else cat << \!Funky!Stuff! > 'nuext.h' /* * nuext.h - declarations for nuext.c * * By Andy McFadden (fadden@cory.berkeley.edu) * NuLib v2.1 November 1989 Freeware (distribute, don't sell) */ #define MAXDEPTH 64 /* max subdir depth we will unpack */ extern void NuExtract(); !Funky!Stuff! fi # end of overwriting check echo shar: "extracting 'nupak.h'" '(880 characters)' if test -f 'nupak.h' then echo shar: "will not over-write existing file 'nupak.h'" else cat << \!Funky!Stuff! > 'nupak.h' /* * nupak.h - declarations for nupak.c * * This has function declarations for all of the pack routines; that way we * don't have to include .h files for all of the pack code. * * By Andy McFadden (fadden@cory.berkeley.edu) * NuLib v2.1 November 1989 Freeware (distribute, don't sell) */ /* Pack/unpack buffer size; should be as big as read() & malloc() can take */ /* Note: must be AT LEAST 8200 bytes or things may break */ /* Bad things could happen if it's less than 12K */ #define PAKBUFSIZ 0xff80 extern long packedSize; extern onebyt lastseen; extern twobyt PackFile(); extern int UnpackFile(); /* BOOLEAN */ extern unsigned int crlf(); extern void Spin(), FCopy(); extern long pak_SHK(); /* pack P8 ShrinkIt format, in nushk.c */ extern void unpak_SQU(); /* unsqueeze, in nusq.c */ extern void unpak_SHK(); /* unShrink, in nushk.c */ !Funky!Stuff! fi # end of overwriting check echo shar: "extracting 'nupdel.h'" '(205 characters)' if test -f 'nupdel.h' then echo shar: "will not over-write existing file 'nupdel.h'" else cat << \!Funky!Stuff! > 'nupdel.h' /* * nupdel.h - declarations for NuDelete * * By Andy McFadden (fadden@cory.berkeley.edu) * NuLib v2.1 November 1989 Freeware (distribute, don't sell) */ extern void NuDelete(), NuUpdate(); !Funky!Stuff! fi # end of overwriting check echo shar: "extracting 'nuread.h'" '(3897 characters)' if test -f 'nuread.h' then echo shar: "will not over-write existing file 'nuread.h'" else cat << \!Funky!Stuff! > 'nuread.h' /* * nuread.h - linked list structures used for holding NuFX header data, * and structure definitions for archive innards * * (this will be included by all source files which access NuFX archives) * * By Andy McFadden (fadden@cory.berkeley.edu) * NuLib v2.1 November 1989 Freeware (distribute, don't sell) */ /* The NuFX record format version we output, and the maximum we can extract */ #define OURVERS 0 #define MAXVERS 0 /* "NuFile" in alternating ASCII */ static onebyt MasterID[7] = { 0x4e, 0xf5, 0x46, 0xe9, 0x6c, 0xe5, 0x0 }; /* "NuFX" in alternating ASCII */ static onebyt RecordID[5] = { 0x4e, 0xf5, 0x46, 0xd8, 0x0 }; /* * Structure definitions for NuFX innards */ /* master header block */ typedef struct { onebyt ID[6]; twobyt master_crc; fourbyt total_records; Time arc_create_when; Time arc_mod_when; onebyt reserved[20]; } MHblock; #define MHsize 48 /* this should not change */ /* record header block */ typedef struct { onebyt ID[4]; twobyt header_crc; twobyt attrib_count; twobyt version_number; fourbyt total_threads; twobyt file_sys_id; twobyt file_sys_info; /* (hi-bit) sparse | fs_sep (lo-bit) */ fourbyt access; fourbyt file_type; fourbyt extra_type; twobyt storage_type; Time create_when; Time mod_when; Time archive_when; /* future expansion here... */ } RHblock; #define RHsize 56 /* sizeof(RHblock) should work, but might not */ #define ATTSIZE 64 /* default attrib_count when creating ( > RHsize!) */ /* * This buffer must be able to contain three things (not all at once): * - The master header block (size = MHsize) * - The record header block (size = RHsize) * - Attributes not specified in the RHblock (attrib_count - RHsize - 2) * * Currently, it only needs to be 56 bytes. Since it is allocated as local * storage only once during execution, making it reasonably large should * not cause any problems in performance but will make the program stable * if it encounters an archive with a drastically expanded RHblock. */ #define RECBUFSIZ 256 /* thread record */ typedef struct { twobyt thread_class; twobyt thread_format; twobyt thread_kind; twobyt reserved; fourbyt thread_eof; fourbyt comp_thread_eof; } THblock; #define THsize 16 /* this should not change */ /* * Definitions for the linked lists * A linked list of Record headers, with linked lists of Threads attached */ /* thread nodes */ typedef struct TNode_s { THblock *THptr; /* points to thread info */ long fileposn; /* absolute position of this thread in the file */ struct TNode_s *TNext; /* points to next thread node */ } TNode; /* record nodes */ typedef struct RNode_s { RHblock *RHptr; /* points to the record header block */ char *filename; /* filename of record */ short namelen; /* length of filename (safer than strlen()) */ TNode *TNodePtr; /* points to first thread node */ fourbyt unc_len; /* total uncompressed length of all threads */ fourbyt comp_len; /* total compressed length of all threads */ struct RNode_s *RNext; /* points to next record node */ } RNode; /* head of list */ typedef struct { char *arc_name; /* filename of archive */ MHblock *MHptr; /* points to master header */ RNode *RNodePtr; /* points to first record node */ long nextposn; /* abs. position in file to put next record (for ADD) */ } ListHdr; /* * function declarations */ extern ListHdr *NuRead(); /* read archive info into memory */ extern void NuTest(); /* archive integrity check */ extern twobyt CalcCRC(); /* calculate a CRC on a range of bytes */ extern char *PrintDate(); /* print a date from a (Time *) struct */ extern void BCopy(); /* copy bytes: *src, *dest, num, order? */ extern void HiSwap(); /* swap bytes (maybe): *ptr, src_index, dst_index */ !Funky!Stuff! fi # end of overwriting check echo shar: "extracting 'nuview.h'" '(588 characters)' if test -f 'nuview.h' then echo shar: "will not over-write existing file 'nuview.h'" else cat << \!Funky!Stuff! > 'nuview.h' /* * nuview.h - declarations for nuview.c * * By Andy McFadden (fadden@cory.berkeley.edu) * NuLib v2.1 November 1989 Freeware (distribute, don't sell) */ typedef enum { NAMEONLY, PROSHK, FULL } outtype; /* constant string declarations */ extern char *unknownStr; extern char *WD[]; extern char *MO[]; #define TCn 4 extern char *TC[]; #define TKn 3 extern char *TK[][TKn]; #define TFn 3 extern char *TF[]; #define QTFn 3 extern char *QTF[]; #define FIDn 12 extern char *FID[]; #define STn 14 extern char *ST[]; extern char *FT[]; extern void NuView(); extern char *PrintDate(); !Funky!Stuff! fi # end of overwriting check exit 0 # End of shell archive