Received: by NDSUVM1 (Mailer R2.07) id 6924; Tue, 22 May 90 21:43:10 CDT Date: Tue, 22 May 90 22:19:09 EDT Reply-To: Apple II List Sender: Apple II List From: Grant Delaney Subject: NuLib v2.2 (C NuFX archiver) source (UNIX/IIgs/MS-DOS) [01/06] To: "Steven E. Nelson" ---- Cut Here and unpack ---- #!/bin/sh # This is a shell archive (shar 3.21) # made 05/01/1990 05:22 UTC by fadden@avalanche.Berkeley.EDU # Source directory //tornado/accounts/fadden/nulib # # existing files will NOT be overwritten # # This shar contains: # length mode name # ------ ---------- ------------------------------------------ # 1440 -rw-r--r-- README # 5509 -rw-r--r-- Benchmarks # 1604 -rw-r--r-- Makefile # 621 -rw-r--r-- make.apw # 2119 -rw-r--r-- linkcom # 736 -rwxr-xr-x mkshk # 1440 -rw-r--r-- nulib.mak # 161 -rw-r--r-- nulib.lnk # 6756 -rw-r--r-- apwerr.h # 3318 -rw-r--r-- crc.h # 954 -rw-r--r-- nuadd.h # 179 -rw-r--r-- nublu.h # 3421 -rw-r--r-- nudefs.h # 1564 -rw-r--r-- nuetc.h # 248 -rw-r--r-- nuext.h # 877 -rw-r--r-- nupak.h # 202 -rw-r--r-- nupdel.h # 4181 -rw-r--r-- nuread.h # 585 -rw-r--r-- nuview.h # 21530 -rw-r--r-- nuadd.c # 11004 -rw-r--r-- nublu.c # 16151 -rw-r--r-- nuetc.c # 18526 -rw-r--r-- nuext.c # 15547 -rw-r--r-- numain.c # 12053 -rw-r--r-- nupak.c # 13973 -rw-r--r-- nupdel.c # 18568 -rw-r--r-- nuread.c # 18639 -rw-r--r-- nushk.c # 7088 -rw-r--r-- nusq.c # 14550 -rw-r--r-- nuview.c # if touch 2>&1 | fgrep '[-amc]' > /dev/null then TOUCH=touch else TOUCH=true fi # ============= README ============== if test X"$1" != X"-c" -a -f 'README'; then echo "File already exists: skipping 'README'" else echo "x - extracting README (Text)" sed 's/^X//' << 'SHAR_EOF' > README && XNuLib v2.2 README (30-Apr-90) XNuLib v2.1 README (05-Nov-89) X XThis is the third wide release; the first was back in August, when XI first distributed this as NuARC. The second, NuLib v2.1, was distributed Xback in November. X XAs you can see, it's been a while. X XNew items: X - Prints comments. X - Correctly handles ShrinkIt v3.0 archives. X - Unpacks disk archives to files (good for the UNIX Apple ][+ simulator). X - Fake compression (no real stuff yet) handles files that don't compress X (it used to store them as compressed whether or not they really did). X - Various minor changes/improvements. X XTo make the MS-DOS version, use the nulib.mak and nulib.lnk files X(supplied by Bruce Kahn). To make the APW version, put all the files in Xone directory, and make a subdirectory called "OBJ". Put the "linkcom" Xfile in OBJ, and then "make.apw". This will compile all the files. XWhen it finishes, change to OBJ and alink linkcom. (the makefile used Xto do this automatically, but with only 1.25MB of RAM you have to exit XAPW to completely flush all the memory used by the compiler, and Xand then restart APW and run the linker). X XIn both cases, be sure to modify "nudefs.h" first. X XPlease send bug reports, ideas, or gripes to fadden@cory.berkeley.edu, or to Xone of the addresses mentioned in the documentation or under the "-hw" Xoption. X XThings to come: X - Support for UNIX tar X - CRLF translations while adding files X - ShrinkIt compression X SHAR_EOF $TOUCH -am 0430175790 README && chmod 0644 README || echo "restore of README failed" set `wc -c README`;Wc_c=$1 if test "$Wc_c" != "1440"; then echo original size 1440, current size $Wc_c fi fi # ============= Benchmarks ============== if test X"$1" != X"-c" -a -f 'Benchmarks'; then echo "File already exists: skipping 'Benchmarks'" else echo "x - extracting Benchmarks (Text)" sed 's/^X//' << 'SHAR_EOF' > Benchmarks && XSome benchmarks for NuLib: X XUncompressing Moria GS (from 320K to 577K, ShrinkIt Type I LZW): X XProgram Run / Machine Used Run Time CPU Time X---------------------------------------------- -------------- -------------- XNuLib v2.1 (APW C), running on a //gs 12 min XShrinkIt v3.0.1, running on a //gs (HD) 2 min 03 sec XShrinkIt v3.0.1, running on a //gs (RAM disk) 1 min 21 sec XGS/ShrinkIt v1.0d3 (HD) XNuLib v2.2 on a lightly loaded VAX 11/750 1 min 33 sec 1 min 28.4 sec XNuLib v2.2 on a lightly loaded VAX 11/785 38 sec 34.0 sec XNuLib v2.2 on a lightly loaded Sun 3/50 17 sec 13.0 sec XNuLib v2.2 on an empty Apollo workstation 12 sec 11.5 sec XNuLib v2.2 on an empty DEC 3100 9 sec 2.6 sec XNuLib v2.2 on an empty Sun 4 7 sec 2.2 sec X X"Run Time" is total time from start to finish. "CPU Time" is CPU time Xactually used under a multiprogrammed OS (in this case, UNIX). X XThe hard drive (HD) used on the //gs is an AI InnerDrive 20. The results Xobtained from running on a RAM disk could almost be considered the CPU Xtime, but I've decided to keep them separate. X XDoing an uncompressed extract can produce remarkable results... like Xrunning to completion in less than one second on the Apollo (local disk). X XInterestingly enough, 16-bit UNIX uncompress works faster than NuLib does. XThe reason for this is that the compression code in NuLib actually makes Xtwo passes, one to undo the LZW compression, and the other to undo Xnon-repeat compression. Was it worth it do to both kinds? For Moria it Xwas; even though "uncompress" ran faster, ShrinkIt's 12-bit LZW packed Xthe file smaller than compress's 16-bit LZW. X X********** X XRaw data for benchmarks X XTimes on the //gs were from start to finish of compression, timed with a Xstop watch. X XAll tests were performed in verbose mode (i.e., the filename was printed Xas the file was extracted, etc). This is how I would expect it to be Xrun under "normal" conditions. It does add to the overhead, which Xyou can pull out by looking at the data below. X X/bin/csh time format appears to be (the man page is most unhelpful): Xuser_time system_time real_time cpu% ??+??k ??+??io page_faults+??w X Xuser_time is the time actually spent grinding along. This is what appears X in the "CPU time" column. Xsystem_time is for I/O (disk accesses, writing to terminal). Xreal_time is how long a stopwatch would show (user_time + system_time + X overhead starting/stopping NuLib + time spent running other processes X on a multiprogrammed OS like UNIX). This appears in the "Run Time" col. Xcpu% appears to be some kind of estimate of how much time was spent doing X useful work. XIf you don't know what a page fault is, don't worry about it. X XBoth cory and holden used the same copy of NuLib (not the *same* copy, Xbut they're identical), so any differences in speed can be attributed Xto the processor. X X***** holden.berkeley.edu, a VAX 11/750 ***** XScript started on Sun Mar 25 11:52:52 1990 X--- reading aliases...done Xholden 1 c184-cz% ls -s tmp/nulib X 68 tmp/nulib* Xholden 2 c184-cz% uptime X 11:52am up 26 days, 3:59, 4 users, load average: 0.31, 0.17, 0.13 Xholden 3 c184-cz% time tmp/nulib xv moria.shk XExtracting 'MORIA' (data)...unshrinking (I)...-\|/-done. X88.4u 3.3s 1:33 98% 83+252k 49+89io 9pf+0w Xholden 4 c184-cz% exit Xholden 5 c184-cz% Xscript done on Sun Mar 25 11:55:34 1990 X X***** cory.berkeley.edu, a VAX 11/785 ***** XScript started on Sun Mar 25 11:50:07 1990 X--- reading aliases...done Xcory 1 foo% ls -s ../bin/nulib X 68 ../bin/nulib* Xcory 2 foo% uptime X 11:50am up 2 days, 2:04, 6 users, load average: 0.55, 0.39, 0.27 Xcory 3 foo% time nulib xv moria.shk XExtracting 'MORIA' (data)...unshrinking (I)...-\|/-done. X34.0u 1.6s 0:37 95% 51+244k 46+82io 5pf+0w Xcory 4 foo% exit Xcory 5 foo% Xscript done on Sun Mar 25 11:51:29 1990 X X***** a Sun 3/50 ***** XScript started on Sat Apr 21 17:00:43 1990 Xux1:nulib% ls -s nulib X 64 nulib* Xux1:nulib% uptime X 5:01pm up 2 days, 10:06, 6 users, load average: 1.84, 1.66, 1.51 Xux1:nulib% time nulib xv moria.shk XExtracting 'MORIA' (data)...unshrinking (I)...-\|/-done. X13.0u 0.6s 0:17 76% 0+168k 1+78io 0pf+0w Xux1:nulib% exit Xux1:nulib% Xscript done on Sat Apr 21 17:02:33 1990 X X***** avalanche.berkeley.edu, an Apollo DN3500 ***** XScript started Sat Apr 21 17:04:53 1990 X--- reading aliases...done Xavalanche 1 nulib% ls -s nulib X 85 nulib* Xavalanche 2 nulib% uptime X 5:05pm up 1 day, 1:50, 3 users, load average: 0.06, 0.16, 0.00 Xavalanche 3 nulib% time nulib xv ../dwn/moria.shk XExtracting 'MORIA' (data)...unshrinking (I)...-\|/-done. X11.5u 2.6s 0:16 86% 0+0k 577+0io 0pf+0w Xavalanche 6 nulib% exit Xavalanche 7 nulib% XScript done Sat Apr 21 17:06:59 1990 X X***** a DEC 3100 ***** XScript started on Sat Apr 21 16:18:10 1990 Xvampire:nulib% ls -s nulib X 88 nulib* Xvampire:nulib% uptime X 4:18pm up 30 days, 5 hrs, 2 users, load average: 0.57, 0.25, 0.00 Xvampire:nulib% time nulib xv moria.shk XExtracting 'MORIA' (data)...unshrinking (I)...-\|/-done. X2.6u 0.5s 0:09 32% 163+404k 71+71io 3pf+0w Xvampire:nulib% exit Xvampire:nulib% Xscript done on Sat Apr 21 16:19:40 1990 X X***** a Sun 4 ***** XScript started on Sat Apr 21 16:23:47 1990 Xux5:nulib% ls -s nulib X 64 nulib* Xux5:nulib% uptime X 4:23pm up 2 days, 8:50, 7 users, load average: 0.15, 0.24, 0.03 Xux5:nulib% time nulib xv moria.shk XExtracting 'MORIA' (data)...unshrinking (I)...-\|/-done. X2.2u 0.2s 0:07 34% 0+368k 0+71io 0pf+0w Xux5:nulib% exit Xux5:nulib% Xscript done on Sat Apr 21 16:25:20 1990 X SHAR_EOF $TOUCH -am 0430221390 Benchmarks && chmod 0644 Benchmarks || echo "restore of Benchmarks failed" set `wc -c Benchmarks`;Wc_c=$1 if test "$Wc_c" != "5509"; then echo original size 5509, current size $Wc_c fi fi # ============= Makefile ============== if test X"$1" != X"-c" -a -f 'Makefile'; then echo "File already exists: skipping 'Makefile'" else echo "x - extracting Makefile (Text)" sed 's/^X//' << 'SHAR_EOF' > Makefile && X# X# UNIX Makefile for NuLib X# X X# To make a smaller executable, you can exclude the Binary II routines X# by setting CFLAGS= -DNO_BLU X XHDRS=nudefs.h nuread.h nuview.h nuadd.h nuext.h nupdel.h nupak.h nuetc.h \ X nublu.h XSRCS=numain.c nuread.c nuview.c nuadd.c nuext.c nupdel.c nupak.c nuetc.c \ X nublu.c nushk.c nusq.c XOBJS=numain.o nuread.o nuview.o nuadd.o nuext.o nupdel.o nupak.o nuetc.o \ X nublu.o nushk.o nusq.o XARCFILES=README Benchmarks Makefile make.apw linkcom mkshk nulib.mak \ X nulib.lnk *.h *.c X X# Select appropriate flag... -g for debugging, -O for optimized. X#CFLAGS=-g XCFLAGS=-O XLIBS= XCC=cc X Xnulib: ${OBJS} X ${CC} ${CFLAGS} ${OBJS} -o nulib ${LIBS} X Xnumain.o: numain.c nudefs.h nuread.h nuview.h nuadd.h nuext.h nupdel.h nublu.h \ X nuetc.h X Xnuread.o: nuread.c nudefs.h nuread.h nupak.h nuetc.h crc.h X Xnuview.o: nuview.c nudefs.h nuview.h nuread.h nuetc.h X Xnuadd.o: nuadd.c nudefs.h nuadd.h nuread.h nuadd.h nupak.h nuetc.h X Xnuext.o: nuext.c nudefs.h nuext.h nuread.h nuext.h nupak.h nuetc.h X Xnupdel.o: nupdel.c nudefs.h nupdel.h nuread.h nuadd.h nupak.h nupdel.h nuetc.h X Xnupak.o: nupak.c nudefs.h nupak.h nuetc.h X Xnublu.o: nublu.c nudefs.h nublu.h nuview.h nuetc.h X Xnushk.o: nushk.c nudefs.h nupak.h X Xnusq.o: nusq.c nudefs.h nupak.h X Xnuetc.o: nuetc.c nudefs.h nuetc.h X X# shar version 3.21 X# -x : don't overwrite existing X# -c : add "cut here" line at top X# -o : base name for output files X# -l50 : max size is 50kb, but don't split files X# -v : (not used) turn off verbose msgs Xshar: X shar3 -x -c -osh.files/nulib -l50 $(ARCFILES) X Xtar: X tar cvf nulib.tar $(ARCFILES) X SHAR_EOF $TOUCH -am 0430220090 Makefile && chmod 0644 Makefile || echo "restore of Makefile failed" set `wc -c Makefile`;Wc_c=$1 if test "$Wc_c" != "1604"; then echo original size 1604, current size $Wc_c fi fi # ============= make.apw ============== if test X"$1" != X"-c" -a -f 'make.apw'; then echo "File already exists: skipping 'make.apw'" else echo "x - extracting make.apw (Text)" sed 's/^X//' << 'SHAR_EOF' > make.apw && X* X* NuLib AGE script (A pseudo-makefile for APW and ORCA) X* X Xfor file in numain nuread nuview nuadd nuext nupdel nupak nuetc nublu nushk nu sq X age obj/{file}.root {file}.c X if {age} != 0 X echo compiling {file}.c X delete obj/{file}.root X compile {file}.c keep=obj/{file} X end Xend X X* Once everything is compiled, I test the final X* program file against the object modules that build it. X* If linking is required, it is performed next followed X* by a series of other statements to complete it: X Xage cshk obj/=.root Xpurge X* if {age} != 0 X* delete nulib X* prefix obj X* alink linkcom X* prefix .. X* end SHAR_EOF $TOUCH -am 0126202990 make.apw && chmod 0644 make.apw || echo "restore of make.apw failed" set `wc -c make.apw`;Wc_c=$1 if test "$Wc_c" != "621"; then echo original size 621, current size $Wc_c fi fi # ============= linkcom ============== if test X"$1" != X"-c" -a -f 'linkcom'; then echo "File already exists: skipping 'linkcom'" else echo "x - extracting linkcom (Text)" sed 's/^X//' << 'SHAR_EOF' > linkcom && X; APW LinkEd command file for NuLib X; X; Does not search for segments with blank load segment names. X; Does not search files for DIRECT segments (only the CLIB). X; Does not search any libraries other than 2/clib. X Xkeep ../nulib X X* This is the main code segment (type = code) Xsegment/$00 main X loadselect 2/start.root main X loadselect numain.root main X loadselect nuread.root main X loadselect nuetc.root main X loadselect nuview.root main X loadselect nuadd.root main X loadselect nuext.root main X loadselect nupdel.root main X library/loadselect 2/clib main X X* This contains compression/Binary II code (type = dynamic) Xsegment/dynamic Compress X loadselect nupak.root main X loadselect nublu.root main X loadselect nushk.root main X loadselect nusq.root main X library/loadselect 2/clib main X X* This contains all global definitions (type = private data) Xsegment/$41 Globals X loadselect 2/start.root ~globals X loadselect numain.root ~globals X loadselect nuread.root ~globals X loadselect nuetc.root ~globals X loadselect nuview.root ~globals X loadselect nuadd.root ~globals X loadselect nuext.root ~globals X loadselect nupdel.root ~globals X loadselect nupak.root ~globals X loadselect nublu.root ~globals X loadselect nushk.root ~globals X loadselect nusq.root ~globals X library/loadselect 2/clib ~globals X X* This holds all arrays (type = private data) Xsegment/$41 Arrays X loadselect 2/start.root ~arrays X loadselect numain.root ~arrays X loadselect nuread.root ~arrays X loadselect nuetc.root ~arrays X loadselect nuview.root ~arrays X loadselect nuadd.root ~arrays X loadselect nuext.root ~arrays X loadselect nupdel.root ~arrays X loadselect nupak.root ~arrays X loadselect nublu.root ~arrays X loadselect nushk.root ~arrays X loadselect nusq.root ~arrays X library/loadselect 2/clib ~arrays X X* This has direct page stuff, like the stack Xsegment/$12 Direct (type = direct-page/stack) X library/loadselect 2/clib DIRECT X Xlist on X* One other segment, SEGJPTBL, appears here... SHAR_EOF $TOUCH -am 1217135489 linkcom && chmod 0644 linkcom || echo "restore of linkcom failed" set `wc -c linkcom`;Wc_c=$1 if test "$Wc_c" != "2119"; then echo original size 2119, current size $Wc_c fi fi # ============= mkshk ============== if test X"$1" != X"-c" -a -f 'mkshk'; then echo "File already exists: skipping 'mkshk'" else echo "x - extracting mkshk (Text)" sed 's/^X//' << 'SHAR_EOF' > mkshk && X#! /bin/csh X# Make NuLib shk file for download. X# Puts a copy of the files (without tabs and linefeeds) in ./trans, and then X# adds them to "nulib.shk" X# X# ("detab" converts tabs to spaces, "lfstrip" converts LF -> CR) X# X# This is intended as an example; it may or may not work on your system. X Xecho "--- Converting tabs and linefeeds" Xforeach file (README Benchmarks Makefile make.apw linkcom .mak mkshk *.h *.c \ X nulib.mak nulib.lnk) X echo $file X detab $file >! nul.tmp X lfstrip nul.tmp trans/$file Xend X Xrm nul.tmp X Xcd trans Xnulib cvftxt/0000 nulib.shk README NOTES FIX Benchmarks Makefile msdos.mak Xnulib avfsrc/0006 nulib.shk make.apw mkshk Xnulib avfsrc/0009 nulib.shk linkcom Xnulib avfsrc/000a nulib.shk *.h *.c Xcd .. X SHAR_EOF $TOUCH -am 0430180390 mkshk && chmod 0755 mkshk || echo "restore of mkshk failed" set `wc -c mkshk`;Wc_c=$1 if test "$Wc_c" != "736"; then echo original size 736, current size $Wc_c fi fi # ============= nulib.mak ============== if test X"$1" != X"-c" -a -f 'nulib.mak'; then echo "File already exists: skipping 'nulib.mak'" else echo "x - extracting nulib.mak (Text)" sed 's/^X//' << 'SHAR_EOF' > nulib.mak && X # NuLib makefile for Microsoft C X #=================================================================== X # X # Standard command line definitions X # X #=================================================================== X X cp=cl /c /AL /W3 /Ot /Zpei X X #=================================================================== X # X # Default inference rules X # X #=================================================================== X X .c.obj: X $(cp) $*.c X X #=================================================================== X # X # Dependencies X # X #=================================================================== X X nuadd.obj: nuadd.c nudefs.h nuread.h nuview.h nuadd.h nupak.h nuetc.h X X nublu.obj: nublu.c nudefs.h nuview.h nuadd.h nupak.h nuetc.h X X nuetc.obj: nuetc.c nudefs.h apwerr.h nuetc.h X X nuext.obj: nuext.c nudefs.h nuread.h nuext.h nupak.h nuetc.h X X numain.obj: numain.c nudefs.h nuread.h nuview.h nuadd.h nuext.h nupdel.h \ X nublu.h nupak.h nuetc.h X X nupak.obj: nupak.c nudefs.h nupak.h nuetc.h X X nupdel.obj: nupdel.c nudefs.h nuread.h nuadd.h nupak.h nupdel.h nuetc.h X X nuread.obj: nuread.c nudefs.h crc.h nuread.h nupak.h nuetc.h X X nushk.obj: nushk.c nudefs.h nuread.h nupak.h nuetc.h X X nusq.obj: nusq.c nudefs.h nuetc.h X X nuview.obj: nuview.c X X NULIB.exe: nuadd.obj nublu.obj nuetc.obj nuext.obj numain.obj nupak.obj \ X nupdel.obj nuread.obj nushk.obj nusq.obj nuview.obj X link @NuLib.lnk X SHAR_EOF $TOUCH -am 0430175490 nulib.mak && chmod 0644 nulib.mak || echo "restore of nulib.mak failed" set `wc -c nulib.mak`;Wc_c=$1 if test "$Wc_c" != "1440"; then echo original size 1440, current size $Wc_c fi fi # ============= nulib.lnk ============== if test X"$1" != X"-c" -a -f 'nulib.lnk'; then echo "File already exists: skipping 'nulib.lnk'" else echo "x - extracting nulib.lnk (Text)" sed 's/^X//' << 'SHAR_EOF' > nulib.lnk && X nuadd.obj+nublu.obj+nuetc.obj+nuext.obj+numain.obj+nupak.obj+nupdel.obj+nurea d X .obj+nushk.obj+nusq.obj+nuview.obj X NuLib X NuLib/Map X /NOI /EXE /FAR /PACKC X ; X SHAR_EOF $TOUCH -am 0430175390 nulib.lnk && chmod 0644 nulib.lnk || echo "restore of nulib.lnk failed" set `wc -c nulib.lnk`;Wc_c=$1 if test "$Wc_c" != "161"; then echo original size 161, current size $Wc_c fi fi # ============= apwerr.h ============== if test X"$1" != X"-c" -a -f 'apwerr.h'; then echo "File already exists: skipping 'apwerr.h'" else echo "x - extracting apwerr.h (Text)" sed 's/^X//' << 'SHAR_EOF' > apwerr.h && X/* X * apwerr.h - text versions of APW and ProDOS 16 error codes X * ERROR() didn't cut it, and I'm trying to separate things from the shell. X * X * By Andy McFadden (fadden@cory.berkeley.edu) X * NuLib v2.2 April 1990 Freeware (distribute, don't sell) X */ X X/* APW-specific UNIX-like errors */ X X/* X [ this is derived from: ] X errno.h -- error return codes X X Copyright American Telephone & Telegraph X Modified and used with permission, Apple Computer Inc. X Copyright Apple Computer Inc. 1985, 1986, 1987 X All rights reserved. X*/ X/* @(#)errno.h 2.1 */ X/* 3.0 SID # 1.3 */ X X#define sys_nerr 35 /* err must be < Max APW Err */ Xstatic char *sys_errlist[sys_nerr] = { X /* 0 (no err) */ "[ call successful ]", X /* 1 EPERM */ "permission denied", X /* 2 ENOENT */ "no such file or directory", X /* 3 ENORSRC */ "no such resource", X /* 4 EINTR */ "interrupted system call", X /* 5 EIO */ "I/O error", X /* 6 ENXIO */ "no such device or address", X /* 7 E2BIG */ "insufficient space for return argument", X /* 8 ENOEXEC */ "exec format error", X /* 9 EBADF */ "bad file number", X /* 10 ECHILD */ "no children", X /* 11 EAGAIN */ "no more processes", X /* 12 ENOMEM */ "not enough memory", X /* 13 EACCES */ "permission denied", X /* 14 EFAULT */ "bad address", X /* 15 ENOTBLK */ "block device required", X /* 16 EBUSY */ "mount device busy", X /* 17 EEXIST */ "file exists", X /* 18 EXDEV */ "cross-device link", X /* 19 ENODEV */ "no such device", X /* 20 ENOTDIR */ "not a directory", X /* 21 EISDIR */ "is a directory", X /* 22 EINVAL */ "invalid argument", X /* 23 ENFILE */ "file table overflow", X /* 24 EMFILE */ "too many open files", X /* 25 ENOTTY */ "not a typewriter (sorry)", X /* 26 ETXTBSY */ "text file busy", X /* 27 EFBIG */ "file too large", X /* 28 ENOSPC */ "no space left on device", X /* 29 ESPIPE */ "illegal seek", X /* 30 EROFS */ "read only file system", X /* 31 EMLINK */ "too many links", X /* 32 EPIPE */ "broken pipe", X /* 33 EDOM */ "math arg out of domain of func", X /* 34 ERANGE */ "math result not representable" X}; X X X/* ProDOS errors */ X X/* [ This is derived from: ] X/******************************************** X; File: ProDos.h X; X; X; Copyright Apple Computer, Inc. 1986, 1987 X; All Rights Reserved X; X********************************************/ X X#define MPErr 0x61 /* err must be < Max ProDOS Err # */ Xstatic char *ProDOSErr[MPErr] = { X /* 00 (no error) */ "[ ProDOS call successful ]", X /* 01 invalidCallNum */ "invalid call number / (fatal) unclaimed intr", X /* 02 */ "", X /* 03 */ "", X /* 04 */ "(ProDOS 8 invalid parameter count)", X /* 05 badPBlockPtr */ "call pointer out of bounds", X /* 06 pdosActiveErr */ "ProDOS is active", X /* 07 pdosBusyErr */ "ProDOS is busy", X /* 08 */ "", X /* 09 */ "", X /* 0a vcbUnusable */ "(fatal) VCB is unusable", X /* 0b fcbUnusable */ "(fatal) FCB is unusable", X /* 0c badBlockZero */ "(fatal) block zero allocated illegally", X /* 0d shdwInterruptErr */ "(fatal) interrupt occurred while I/O shadowing off", X /* 0e */ "", X /* 0f */ "", X /* 10 devNotFound */ "device not found", X /* 11 badDevRefNum */ "invalid device ref# / (fatal) wrong OS version" , X /* 12 */ "", X /* 13 */ "", X /* 14 */ "", X /* 15 */ "", X /* 16 */ "", X /* 17 */ "", X /* 18 */ "", X /* 19 */ "", X /* 1a */ "", X /* 1b */ "", X /* 1c */ "", X /* 1d */ "", X /* 1e */ "", X /* 1f */ "", X /* 20 badReqCode */ "invalid request code", X /* 21 */ "", X /* 22 */ "", X /* 23 */ "", X /* 24 */ "", X /* 25 intTableFull */ "interrupt table full", X /* 26 invalidOperation */ "invalid operation", X /* 27 ioError */ "I/O error", X /* 28 noDevConnect */ "no device connected", X /* 29 */ "", X /* 2a */ "", X /* 2b writeProtectErr */ "write protect error", X /* 2c */ "", X /* 2d */ "", X /* 2e diskSwitchErr */ "disk switched error", X /* 2f */ "device not online", X /* 30 */ "device-specific err $30", X /* 31 */ "device-specific err $31", X /* 32 */ "device-specific err $32", X /* 33 */ "device-specific err $33", X /* 34 */ "device-specific err $34", X /* 35 */ "device-specific err $35", X /* 36 */ "device-specific err $36", X /* 37 */ "device-specific err $37", X /* 38 */ "device-specific err $38", X /* 39 */ "device-specific err $39", X /* 3a */ "device-specific err $3a", X /* 3b */ "device-specific err $3b", X /* 3c */ "device-specific err $3c", X /* 3d */ "device-specific err $3d", X /* 3e */ "device-specific err $3e", X /* 3f */ "device-specific err $3f", X /* 40 badPathName */ "invalid pathname syntax", X /* 41 */ "", X /* 42 fcbFullErr */ "FCB full error (too many files open)", X /* 43 badFileRefNum */ "invalid file reference number", X /* 44 pathNotFound */ "path not found", X /* 45 volumeNotFound */ "volume not found", X /* 46 fileNotFound */ "file not found", X /* 47 dupFileName */ "duplicate file name", X /* 48 volumeFullErr */ "volume full error", X /* 49 dirFullErr */ "directory full error", X /* 4a versionErr */ "version error (incompatible file format)", X /* 4b badStoreType */ "unsupported (or incorrect) storage type", X /* 4c eofEncountered */ "end-of-file encountered", X /* 4d positionRangeErr */ "position out of range", X /* 4e accessErr */ "access not allowed", X /* 4f */ "", X /* 50 fileOpenErr */ "file already open", X /* 51 dirDamaged */ "directory structure is damaged (file count?)", X /* 52 badVolType */ "unsupported volume type", X /* 53 paramRangeErr */ "parameter out of range", X /* 54 memoryFullErr */ "out of memory", X /* 55 vcbFullErr */ "VCB full error", X /* 56 */ "(ProDOS 8 bad buffer address)", X /* 57 dupVolumeErr */ "duplicate volume error", X /* 58 notBlkDevErr */ "not a block device", X /* 59 invalidLevel */ "invalid level", X X /* 5a */ "block number out of range (bad vol bitmap?)", X /* 5b */ "illegal pathname change", X /* 5c */ "not an executable file", X /* 5d */ "file system not available", X /* 5e */ "cannot deallocate /RAM", X /* 5f */ "return stack overflow", X /* 60 */ "data unavailable" X}; SHAR_EOF $TOUCH -am 0411221690 apwerr.h && chmod 0644 apwerr.h || echo "restore of apwerr.h failed" set `wc -c apwerr.h`;Wc_c=$1 if test "$Wc_c" != "6756"; then echo original size 6756, current size $Wc_c fi fi # ============= crc.h ============== if test X"$1" != X"-c" -a -f 'crc.h'; then echo "File already exists: skipping 'crc.h'" else echo "x - extracting crc.h (Text)" sed 's/^X//' << 'SHAR_EOF' > crc.h && X/* X * crc.h - tables for fast computation of 16-bit CRCS X * X * By Andy McFadden (fadden@cory.berkeley.edu) X * NuLib v2.2 April 1990 Freeware (distribute, don't sell) X */ X/* X * updcrc macro derived from article Copyright (C) 1986 Stephen Satchell. X * NOTE: First srgument must be in range 0 to 255. X * Second argument is referenced twice. X * X * Programmers may incorporate any or all code into their programs, X * giving proper credit within the source. Publication of the X * source routines is permitted so long as proper credit is given X * to Stephen Satchell, Satchell Evaluations and Chuck Forsberg, X * Omen Technology. X */ X X X/*#define updcrc(cp, crc) ( crctab[((crc >> 8) & 255)] ^ (crc << 8) ^ cp)*/ X#define updcrc(cp, crc) ( (crctab[((crc >> 8) & 0xFF) ^ cp] ^ (crc << 8)) & 0x FFFF) X X X/* crctab calculated by Mark G. Mendel, Network Systems Corporation */ Xstatic unsigned short crctab[256] = { X 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, X 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, X 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, X 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, X 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, X 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, X 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, X 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, X 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, X 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, X 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12, X 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, X 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, X 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, X 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, X 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, X 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, X 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, X 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, X 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256, X 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, X 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, X 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, X 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, X 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, X 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, X 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, X 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, X 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, X 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, X 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, X 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 X}; X SHAR_EOF $TOUCH -am 0411221690 crc.h && chmod 0644 crc.h || echo "restore of crc.h failed" set `wc -c crc.h`;Wc_c=$1 if test "$Wc_c" != "3318"; then echo original size 3318, current size $Wc_c fi fi # ============= nuadd.h ============== if test X"$1" != X"-c" -a -f 'nuadd.h'; then echo "File already exists: skipping 'nuadd.h'" else echo "x - extracting nuadd.h (Text)" sed 's/^X//' << 'SHAR_EOF' > nuadd.h && X/* X * nuadd.h - declarations for nuadd.c X * X * By Andy McFadden (fadden@cory.berkeley.edu) X * NuLib v2.2 April 1990 Freeware (distribute, don't sell) X */ X X/* information is copied from file-dependent structures (FileRec) to here */ Xtypedef struct { X char *pathname; /* as much of the path as we need to know */ X char *store_name; /* what name the file will be stored under */ X fourbyt eof; /* length of file */ X fourbyt fAccess; /* was Word */ X fourbyt fileType; /* was Word */ X fourbyt auxType; X twobyt storageType; X Time create_dt; /* Time = TimeRec = 8 bytes in misctool.h/nuread.h */ X Time mod_dt; X twobyt fileSysID; /* these two are non-standard */ X onebyt fileSysInfo; X int marked; /* application specific */ X} file_info; X X#define MAXARGS 255 /* max #of files specified on command line; signed int */ X Xextern void NuAdd(); Xextern long AddFile(); Xextern onebyt *MakeMHblock(); Xextern int EvalArgs(); X SHAR_EOF $TOUCH -am 0411221690 nuadd.h && chmod 0644 nuadd.h || echo "restore of nuadd.h failed" set `wc -c nuadd.h`;Wc_c=$1 if test "$Wc_c" != "954"; then echo original size 954, current size $Wc_c fi fi # ============= nublu.h ============== if test X"$1" != X"-c" -a -f 'nublu.h'; then echo "File already exists: skipping 'nublu.h'" else echo "x - extracting nublu.h (Text)" sed 's/^X//' << 'SHAR_EOF' > nublu.h && X/* X * nublu.h - declarations for nublu.c X * X * By Andy McFadden (fadden@cory.berkeley.edu) X * NuLib v2.2 April 1990 Freeware (distribute, don't sell) X */ X Xextern void NuBNY(); X SHAR_EOF $TOUCH -am 0411221690 nublu.h && chmod 0644 nublu.h || echo "restore of nublu.h failed" set `wc -c nublu.h`;Wc_c=$1 if test "$Wc_c" != "179"; then echo original size 179, current size $Wc_c fi fi # ============= nudefs.h ============== if test X"$1" != X"-c" -a -f 'nudefs.h'; then echo "File already exists: skipping 'nudefs.h'" else echo "x - extracting nudefs.h (Text)" sed 's/^X//' << 'SHAR_EOF' > nudefs.h && X/* X * nudefs.h - system-dependent typdefs and #defines for all NuLib files, X * plus extern declarations for global variables (allocated in X * numain.c). X * X * IMPORTANT: This file must be first on the list of #includes, since some X * include files will be processed based on these #defines X * X * By Andy McFadden (fadden@cory.berkeley.edu) X * NuLib v2.2 April 1990 Freeware (distribute, don't sell) X */ X X/* SYSTEM DEPENDENCIES */ Xtypedef unsigned char onebyt; Xtypedef unsigned short twobyt; Xtypedef unsigned long fourbyt; X X/* byte ordering; TRUE if high byte is first (68xxx), else FALSE (65xxx) */ Xextern int HiLo; /* actually part of numain.c */ X X/* Setup for Apple //gs APW */ X/* [ "APW" is automatically defined by the compiler ] */ X X/* Setup for MS-DOS machines (80xxx based: IBM PC) */ X/* [ "MSDOS" is defined by the compiler [MS C5.1 anyway] ] */ X X/* Setup for other microcomputers (Macintosh, Amiga) */ X/* ??? */ X X/* Setup for AIX */ X/* #define SYSV */ X/* #define BSD_INCLUDES */ X X/* Setup for BSD UNIX systems */ X#define UNIX X#define BSD43 X/* #define VAX */ X X/* Setup for AOS/VS @ DG */ X/* #define UNIX */ X/* #define DATAGENERAL */ X/* #define AOSVS */ X X/* Setup for other UNIX systems */ X/* #define UNIX */ X/* #define SYSV (or whatever) */ X X/* use table lookups to get CRCs */ X#define CRC_TAB X X/* X * Some global defs X */ X X/* errno wasn't defined in on some systems... */ X#ifndef MSDOS Xextern int errno; X#endif X X/* Maximum file name length that we intend to handle (watch stack size!) */ X#define MAXFILENAME 1024 X X/* file operations */ X#define S_ABS 0 /* seek absolute */ X#define S_REL 1 /* seek relative */ X#define S_END 2 /* seek from end */ X X#ifdef UNIX /* stuff for open() */ X# define WPERMS 0644 /* read/write for owner, read only for others */ X# define O_BINARY 0 /* for non-UNIX open(); easier than #ifdefs */ X#else X# ifdef APW X# define WPERMS 0666 /* read/write for all; this may not work for some */ X# endif X# ifdef MSDOS X# define S_IREAD 0000400 /* read permission, owner */ X# define S_IWRITE 0000200 /* write permission, owner */ X# define WPERMS S_IREAD | S_IWRITE X# endif X# ifndef WPERMS /* other system */ X# define WPERMS 0666 /* +PORT+ */ X# endif X#endif /*UNIX*/ X X/* Time structure; same as TimeRec from misctool.h */ X/* one-byte entries should not have alignment problems... */ Xtypedef struct { X onebyt second; X onebyt minute; X onebyt hour; X onebyt year; X onebyt day; X onebyt month; X onebyt extra; X onebyt weekDay; X} Time; X X X/* X * global to entire program X */ Xextern int HiLo; /* byte ordering; FALSE on low-first (65816) */ Xextern int verbose; /* BOOLEAN: print verbose? */ Xextern int interact; /* BOOLEAN: interactive when overwriting? */ Xextern int dopack; /* BOOLEAN: do we want to pack/unpack? */ Xextern int doSubdir; /* BOOLEAN: expand subdirectories? */ Xextern int doExpand; /* BOOLEAN: expand archived filenames? */ Xextern int transfrom; /* how to do CR<->LF translation? (-1 = none) */ Xextern int transto; Xextern int packMethod; /* how to pack a file (thread_format) */ Xextern fourbyt defFileType; /* default file type */ Xextern fourbyt defAuxType; /* default aux type */ Xextern onebyt *pakbuf; /* used by compression routines; created once to */ X /* eliminate overhead involved in malloc()ing a 64K buffer */ Xextern char *prgName; /* for errors; don't like argv[0] */ X SHAR_EOF $TOUCH -am 0430215890 nudefs.h && chmod 0644 nudefs.h || echo "restore of nudefs.h failed" set `wc -c nudefs.h`;Wc_c=$1 if test "$Wc_c" != "3421"; then echo original size 3421, current size $Wc_c fi fi # ============= nuetc.h ============== if test X"$1" != X"-c" -a -f 'nuetc.h'; then echo "File already exists: skipping 'nuetc.h'" else echo "x - extracting nuetc.h (Text)" sed 's/^X//' << 'SHAR_EOF' > nuetc.h && X/* X * nuetc.h - declarations for nuetc.c X * X * (this will be included by almost all source files; it should come last) X * X * By Andy McFadden (fadden@cory.berkeley.edu) X * NuLib v2.2 April 1990 Freeware (distribute, don't sell) X */ X X/* define these if they haven't been already */ X/* (this is more of a hassle than I expected... may need "boolean.h" :-) ) */ X#ifdef AOSVS /* BAK */ X# ifndef BOOLEAN /* BAK */ X typedef int BOOLEAN; /* BAK */ X# endif /* BAK */ X#endif /* BAK */ X X#ifndef TRUE X# ifndef AOSVS /* BAK */ X typedef int BOOLEAN; /* BAK */ X# endif /* BAK */ X# define TRUE 1 X# define FALSE 0 X#endif X X#ifdef UNIX X# ifdef BSD43 X extern char *index(); /* BSD version */ X extern char *rindex(); X# define INDEX(s, c) index(s, c) X# define RINDEX(s, c) rindex(s, c) X# else X extern char *strchr(); /* AT&T version */ X extern char *strrchr(); X# define INDEX(s, c) strchr(s, c) X# define RINDEX(s, c) strrchr(s, c) X# endif X#else X extern char *strchr(); /* APW, MSC */ X extern char *strrchr(); X# define INDEX(s, c) strchr(s, c) X# define RINDEX(s, c) strrchr(s, c) X#endif X Xextern char tmpNameBuf[]; X X/* external function declarations */ Xextern void Fatal(), X Quit(); Xextern void free(); Xextern char *Malloc(); X X#ifdef APW Xextern void ToolErrChk(), X perror(); X#endif X Xextern int strcasecmp(), X strncasecmp(); X Xextern void ArcfiCreate(), X Rename(); Xextern BOOLEAN Exists(); Xextern char *MakeTemp(); X Xextern void ExpandTime(); Xextern long ReduceTime(); Xextern Time *GetTime(); X SHAR_EOF $TOUCH -am 0430183090 nuetc.h && chmod 0644 nuetc.h || echo "restore of nuetc.h failed" set `wc -c nuetc.h`;Wc_c=$1 if test "$Wc_c" != "1564"; then echo original size 1564, current size $Wc_c fi fi # ============= nuext.h ============== if test X"$1" != X"-c" -a -f 'nuext.h'; then echo "File already exists: skipping 'nuext.h'" else echo "x - extracting nuext.h (Text)" sed 's/^X//' << 'SHAR_EOF' > nuext.h && X/* X * nuext.h - declarations for nuext.c X * X * By Andy McFadden (fadden@cory.berkeley.edu) X * NuLib v2.2 April 1990 Freeware (distribute, don't sell) X */ X X#define MAXDEPTH 64 /* max subdir depth we will unpack */ X Xextern void NuExtract(); X SHAR_EOF $TOUCH -am 0411221790 nuext.h && chmod 0644 nuext.h || echo "restore of nuext.h failed" set `wc -c nuext.h`;Wc_c=$1 if test "$Wc_c" != "248"; then echo original size 248, current size $Wc_c fi fi # ============= nupak.h ============== if test X"$1" != X"-c" -a -f 'nupak.h'; then echo "File already exists: skipping 'nupak.h'" else echo "x - extracting nupak.h (Text)" sed 's/^X//' << 'SHAR_EOF' > nupak.h && X/* X * nupak.h - declarations for nupak.c X * X * This has function declarations for all of the pack routines; that way we X * don't have to include .h files for all of the pack code. X * X * By Andy McFadden (fadden@cory.berkeley.edu) X * NuLib v2.2 April 1990 Freeware (distribute, don't sell) X */ X X/* Pack/unpack buffer size; should be as big as read() & malloc() can take */ X/* Note: must be AT LEAST 8200 bytes or things may break */ X/* Bad things could happen if it's less than 12K */ X#define PAKBUFSIZ 0xff80 X Xextern long packedSize; Xextern onebyt lastseen; X Xextern twobyt PackFile(); Xextern int UnpackFile(); /* BOOLEAN */ Xextern unsigned int crlf(); Xextern void Spin(), X FCopy(); X Xextern long pak_SHK(); /* pack P8 ShrinkIt format, in nushk.c */ Xextern void unpak_SQU(); /* unsqueeze, in nusq.c */ Xextern void unpak_SHK(); /* unShrink, in nushk.c */ X SHAR_EOF $TOUCH -am 0411221890 nupak.h && chmod 0644 nupak.h || echo "restore of nupak.h failed" set `wc -c nupak.h`;Wc_c=$1 if test "$Wc_c" != "877"; then echo original size 877, current size $Wc_c fi fi # ============= nupdel.h ============== if test X"$1" != X"-c" -a -f 'nupdel.h'; then echo "File already exists: skipping 'nupdel.h'" else echo "x - extracting nupdel.h (Text)" sed 's/^X//' << 'SHAR_EOF' > nupdel.h && X/* X * nupdel.h - declarations for NuDelete X * X * By Andy McFadden (fadden@cory.berkeley.edu) X * NuLib v2.2 April 1990 Freeware (distribute, don't sell) X */ X X Xextern void NuDelete(), X NuUpdate(); X SHAR_EOF $TOUCH -am 0411221890 nupdel.h && chmod 0644 nupdel.h || echo "restore of nupdel.h failed" set `wc -c nupdel.h`;Wc_c=$1 if test "$Wc_c" != "202"; then echo original size 202, current size $Wc_c fi fi # ============= nuread.h ============== if test X"$1" != X"-c" -a -f 'nuread.h'; then echo "File already exists: skipping 'nuread.h'" else echo "x - extracting nuread.h (Text)" sed 's/^X//' << 'SHAR_EOF' > nuread.h && X/* X * nuread.h - linked list structures used for holding NuFX header data, X * and structure definitions for archive innards X * X * (this will be included by all source files which access NuFX archives) X * X * By Andy McFadden (fadden@cory.berkeley.edu) X * NuLib v2.2 April 1990 Freeware (distribute, don't sell) X */ X X X/* The NuFX master format version we output, and the maximum we can extract */ X#define OURMVERS 2 X#define MAXMVERS 2 X X/* The NuFX record format version we output, and the maximum we can extract */ X#define OURVERS 0 X#define MAXVERS 2 X X/* "NuFile" in alternating ASCII */ Xstatic onebyt MasterID[7] = { 0x4e, 0xf5, 0x46, 0xe9, 0x6c, 0xe5, 0x0 }; X X/* "NuFX" in alternating ASCII */ Xstatic onebyt RecordID[5] = { 0x4e, 0xf5, 0x46, 0xd8, 0x0 }; X X X/* X * Structure definitions for NuFX innards X */ X X/* master header block */ Xtypedef struct { X onebyt ID[6]; X twobyt master_crc; X fourbyt total_records; X Time arc_create_when; X Time arc_mod_when; X twobyt master_version; X onebyt reserved1[8]; X fourbyt master_eof; X onebyt reserved2[6]; X} MHblock; X#define MHsize 48 /* this should not change */ X X/* record header block */ Xtypedef struct { X onebyt ID[4]; X twobyt header_crc; X twobyt attrib_count; X twobyt version_number; X twobyt total_threads; X twobyt reserved1; X twobyt file_sys_id; X onebyt file_sys_info; X onebyt reserved2; X fourbyt access; X fourbyt file_type; X fourbyt extra_type; X twobyt storage_type; X Time create_when; X Time mod_when; X Time archive_when; X twobyt option_size; X /* future expansion here... */ X} RHblock; X#define RHsize 58 /* sizeof(RHblock) should work, but might not */ X#define ATTSIZE 64 /* default attrib_count when creating new */ X X/* X * This buffer must be able to contain three things (not all at once): X * - The master header block (size = MHsize) X * - The record header block (size = RHsize) X * - Attributes not specified in the RHblock (attrib_count - RHsize - 2) X * X * Currently, it only needs to be 64 bytes. Since it is allocated as local X * storage only once during execution, making it reasonably large should X * not cause any problems in performance but will make the program stable X * if it encounters an archive with a drastically expanded RHblock. X */ X#define RECBUFSIZ 256 X X/* thread record */ Xtypedef struct { X twobyt thread_class; X twobyt thread_format; X twobyt thread_kind; X twobyt thread_crc; X fourbyt thread_eof; X fourbyt comp_thread_eof; X} THblock; X#define THsize 16 /* this should not change */ X X X/* X * Definitions for the linked lists X * A linked list of Record headers, with linked lists of Threads attached X */ X X/* thread nodes */ Xtypedef struct TNode_s { X THblock *THptr; /* points to thread info */ X long fileposn; /* absolute position of this thread in the file */ X struct TNode_s *TNext; /* points to next thread node */ X} TNode; X X/* record nodes */ Xtypedef struct RNode_s { X RHblock *RHptr; /* points to the record header block */ X char *filename; /* filename of record */ X twobyt filename_length; /* length of filename (as stored in record hdr) * / X twobyt real_fn_length; /* length of filename (actual) */ X TNode *TNodePtr; /* points to first thread node */ X fourbyt unc_len; /* total uncompressed length of all threads */ X fourbyt comp_len; /* total compressed length of all threads */ X struct RNode_s *RNext; /* points to next record node */ X} RNode; X X/* head of list */ Xtypedef struct { X char *arc_name; /* filename of archive */ X MHblock *MHptr; /* points to master header */ X RNode *RNodePtr; /* points to first record node */ X long nextposn; /* abs. position in file to put next record (for ADD) */ X} ListHdr; X X X/* X * function declarations X */ X Xextern ListHdr *NuRead(); /* read archive info into memory */ Xextern void NuTest(); /* archive integrity check */ Xextern twobyt CalcCRC(); /* calculate a CRC on a range of bytes */ Xextern char *PrintDate(); /* print a date from a (Time *) struct */ Xextern void BCopy(); /* copy bytes: *src, *dest, num, order? */ Xextern void HiSwap(); /* swap bytes (maybe): *ptr, src_index, dst_index */ SHAR_EOF $TOUCH -am 0411221890 nuread.h && chmod 0644 nuread.h || echo "restore of nuread.h failed" set `wc -c nuread.h`;Wc_c=$1 if test "$Wc_c" != "4181"; then echo original size 4181, current size $Wc_c fi fi # ============= nuview.h ============== if test X"$1" != X"-c" -a -f 'nuview.h'; then echo "File already exists: skipping 'nuview.h'" else echo "x - extracting nuview.h (Text)" sed 's/^X//' << 'SHAR_EOF' > nuview.h && X/* X * nuview.h - declarations for nuview.c X * X * By Andy McFadden (fadden@cory.berkeley.edu) X * NuLib v2.2 April 1990 Freeware (distribute, don't sell) X */ X Xtypedef enum { NAMEONLY, PROSHK, FULL } outtype; X X/* constant string declarations */ Xextern char *unknownStr; Xextern char *WD[]; Xextern char *MO[]; X#define TCn 4 Xextern char *TC[]; X#define TKn 3 Xextern char *TK[][TKn]; X#define TFn 6 Xextern char *TF[]; X#define QTFn 6 Xextern char *QTF[]; X#define FIDn 14 Xextern char *FID[]; X#define STn 14 Xextern char *ST[]; Xextern char *FT[]; X Xextern void NuView(); Xextern char *PrintDate(); X SHAR_EOF $TOUCH -am 0411221990 nuview.h && chmod 0644 nuview.h || echo "restore of nuview.h failed" set `wc -c nuview.h`;Wc_c=$1 if test "$Wc_c" != "585"; then echo original size 585, current size $Wc_c fi fi echo "End of part 1, continue with part 2" exit 0