pax_global_header00006660000000000000000000000064140244317600014513gustar00rootroot0000000000000052 comment=cb3077968b2d9bbfab3289dd6a7bc0d1b643eb68 nspark-1.7.8B2+git20210317.cb30779/000077500000000000000000000000001402443176000156065ustar00rootroot00000000000000nspark-1.7.8B2+git20210317.cb30779/.gitignore000066400000000000000000000005311402443176000175750ustar00rootroot00000000000000*.a *.o *.obj *.exe *.map *.lib nspark sqsh testpack # CMake temp files CMakeCache.txt CMakeFiles/ cmake_install.cmake install_manifest.txt Makefile # Ninja build files .ninja_deps .ninja_log build.ninja rules.ninja # MSVC project files win32/Debug win32/Release Debug Release nspark.dir/ nspark.*sdf nspark.sln *.vcxproj* *.suo *.ilk *.pdb nspark-1.7.8B2+git20210317.cb30779/BUGS000066400000000000000000000003051402443176000162670ustar00rootroot00000000000000 These are bugs I know about but haven't fixed yet. * The DOS version (and the Windows NT version for that matter) do not time/date stamp directories. (But neither do any other unpackers.) nspark-1.7.8B2+git20210317.cb30779/CHANGES000066400000000000000000000122761402443176000166110ustar00rootroot00000000000000 1.2.4 7th Oct 92 1st public release. 1.2.5 9th Oct 92 Fixed bug in misc.c::riscos_path() that caused nspark to core dump under SCO UNIX. 1.2.6 19th Oct 92 Added -x option as an alternative to -u. Changed unix.c::filestamp() so that timelocal(3) is only used for SunOS, and mktime(3) is used for all other flavours of UNIX. 1.2.7 23rd Oct 92 Minor cosmetic changes... I should really leave this thing alone. 1.2.8 6th Nov 92 Fixed function definition for unarc.c::prompt_user() (was defined the ANSI C way). Fixed io.c::read_header() so it doesn't read the load/exec/attr fields if the archive isn't an Archimedes archive. Corrected comments in compress.c about what crunch and squash methods were. Slight change to algorithm in crc.c::calccrc(), though no functional changes made. 1.2.9 9th Nov 92 compress.c: Moved offset and size from getcode() into global scope so that uncompress() can re-initialise them each time it is called. pack.c/pack.h: Added putc_init() to initialise the static variables used by putc_ncr(). 1.2.10 12th Nov 92 Fixed bug with realloc() size in misc.c: uplevel(). (reported by arb@comp.lancs.ac.uk). 1.2.11 7th Dec 92 Reformatted all source files using Emacs C-Mode (4- space tabs etc.). Slight change to unarc.c::unarc() logic when printing file details during unarchiving. 1.3Beta 8th Dec 92 Added -a option to allow filetypes to be appended to filenames as they are unarchived. This is to allow Acorn <-> UNIX NFS to work correctly. (requested by dhmyrdal@pvv.unit.no) 1.3 9th Dec 92 Changed -a option to -T, made filetypes append in lowercase hex rather than uppercase. 1.3.1 9th Dec 92 Changed ret from int in io.c::check_stream(). #ifdef'd out write_halfword() and write_word() in io.c/io.h . 1.3.2 22nd Dec 92 misc.c: Changed #include to #include 1.4 23rd Dec 92 unarc.c: added total-printing if in verbose mode. NEW MAINTAINER: Andrew Brooks, arb@comp.lancs.ac.uk. 1.5 5th Mar 93 Added code to compile on RISC OS: mkfiles/acorn, acorn.c, changes to io.c, unarc.c, main.c, io.h to add prototypes needed. 1.6 20th Aug 93 main.c: Add -C option to convert filenames to lowercase io.c: allow top-bit-set characters in RISCOS filenames. compress.c, unarc.c: prevent output if in quiet mode. 1.7 20th Aug 93 Added code to read headers from ArcFS archives. Changes to io.c, unarc.c, mkfiles. Added arcfs.[ch] WARNING: Code is unfinished: only the list option (-l) can be used (and timestamps will be incorrect). Trying to test or extract from the archive will fail, and probably dump core. Please add the necessary code if you can, I don't have time at the moment. 1.7.1 4th Mar 94 Fixed many bugs in ArcFS code: changes to unarc.c, compress.c also. Still no timestamps, and files extracted are too long by a few null bytes for some reason (complen is too large, but why?), so CRC fails. 1.7.2 26th Oct 94 Fixed date and time conversion for ArcFS archives. Added manual pages supplied by Duncan (?) (m91dps@ecs.oxford.ac.uk). 1.7.2a 9th Nov 94 Altered unix makefile to call ./mkendian not mkendian as suggested by Tom Tromey (tromey@busco.lanl.gov). Added rename scripts for RISC OS/UNIX. 1.7.3 12th Dec 94 Finally fix ArcFS archive extraction, fixes in arcfs.c, unarc.c, io.c and crc.c. Modifications to manual pages to correct errors and add new details. 1.7.4 6th Jan 95 Added Windows NT and Alpha support by Alun Jones (auj@aber.ac.uk). Restructured directories and added executables for RISC OS, Sun OS 4.1.3 and Solaris 2.3. Added executables for Linux, MIPS and Alpha supplied by Alun Jones. Updated manual pages for new file formats. Added text versions of manual pages for those without nroff. 1.7.5 25th Jan 95 Bug fixes in compress.c, thanks to all who reported the problem. Included binaries that report version 1.7.4 should not be exhibit the bug as it was caused by a last-minute source change (mae culpa!). 1.7.6 01th Aug 95 DOS port. (Beta by Bob Brand, bob@wop.wtb.tue.nl, or B.A.Brand@wtb.tue.nl, addresses valid until at least Oct 1st, 1996), fido: 2:2801/208.2. Removed floating point operation in arcfs.c::arcfs_read_header(). Made htab[] and codetab[] arrays in compress.c dynamically allocated arrays (DOS version only!). Made misc.c::basename() insensitive for null- pointers. (IRIX's strlen() and a few other string- functions coredump on null-pointers. Should not happen under normal execution. But it can happen in the DOS version running under DOS 2.x.) Renamed io.h to sparkio.h (conflict with Borland C/C++ io.h). Removed `Does not support DOS' from BUGS file. Added `Does not time/date stamp directories under DOS or WINNT' to BUGS file. Included executables for SGI IRIX 4.x and 5.x. 1.7.7 17th March 1999 -I option Mark Usher, marku@magnet.at The -I option has been added to extract the individual files with an extra .inf file that contains the information relevant to that file. This should help people who use BBC emulators to read the files into disc images. The WinNT directory has been changed to Win32. nspark-1.7.8B2+git20210317.cb30779/CMakeLists.txt000066400000000000000000000025561402443176000203560ustar00rootroot00000000000000cmake_minimum_required (VERSION 2.4) project (nspark C) SET(NSPARK_LIB_SOURCE arcfs.c compress.c crc.c date.c error.c garble.c io.c misc.c pack.c store.c) if (WIN32) add_definitions (-DWINNT) add_definitions (-D_CRT_SECURE_NO_WARNINGS) SET(NSPARK_OS_SOURCE winnt.c) elseif (RISCOS) add_definitions (-DRISCOS) SET(NSPARK_OS_SOURCE acorn.c) # FIXME: The following command requires CMake 2.8.12, while our current minimum is 2.4 add_compile_options(-mlibscl) SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -mlibscl") elseif (UNIX) add_definitions (-DPOSIX) SET(NSPARK_OS_SOURCE unix.c) endif () if (CMAKE_COMPILER_IS_GNUCC) set(CMAKE_C_FLAGS "-Wall") endif (CMAKE_COMPILER_IS_GNUCC) add_library (nsparklib ${NSPARK_LIB_SOURCE} ${NSPARK_OS_SOURCE}) add_executable (nspark arc.c main.c unarc.c) target_link_libraries (nspark LINK_PUBLIC nsparklib) install (TARGETS nspark DESTINATION bin) add_executable (sqsh sqshmain.c unarc.c) target_link_libraries (sqsh LINK_PUBLIC nsparklib) install (TARGETS sqsh DESTINATION bin) if (UNIX) add_subdirectory (testprog) endif (UNIX) install(FILES ${CMAKE_SOURCE_DIR}/man/nspark.1 DESTINATION share/man/man1) install(FILES ${CMAKE_SOURCE_DIR}/man/sqsh.1 DESTINATION share/man/man1) install(FILES ${CMAKE_SOURCE_DIR}/man/arcfs.5 DESTINATION share/man/man5) install(FILES ${CMAKE_SOURCE_DIR}/man/spark.5 DESTINATION share/man/man5) nspark-1.7.8B2+git20210317.cb30779/COMPILING000066400000000000000000000020501402443176000170470ustar00rootroot00000000000000Build with makefiles on Unix, Windows and RISC OS =================================================== To compile on Windows with Microsoft Visual Studio: Open a Microsoft Visual Studio command prompt nmake -f win32\makefile To compile on Windows with MinGW: mingw32-make -f makefile.gcc SYSTYPE=WINNT To compile on Unix: make -f makefile.gcc To compile on RISC OS: make -f makefile.gcc SYSTYPE=RISCOS Build with cmake ================== To compile on Windows with Microsoft Visual Studo: Open a Microsoft Visual Studio command prompt mkdir build cd build cmake .. cmake --build . --config Release To compile on Windows with MinGW: mkdir -p build cd build cmake -G "MinGW Makefiles" .. cmake --build . To compile on Unix: mkdir -p build cd build cmake .. cmake --build . If you are using another compiler suite then get cmake to generate the correct makefiles Build on MSDOS ================= Tested with Borland C 3.1 copy nspark\msdos\nspark.prj to nspark then, from the nspark directory, run: bc31 /b nspark.prj nspark-1.7.8B2+git20210317.cb30779/Makefile.gcc000066400000000000000000000106451402443176000200070ustar00rootroot00000000000000# # nspark makefile # # $Header: makefile 1.30 92/12/23 $ # # SYSTYPE: POSIX, RISCOS, WINNT # SYSTYPE= POSIX INSTALLDIR= /usr/local CC = gcc INSTALL = install -c -m 0644 INSTALL_S = install -c -s -m 0755 INSTALL_D = install -d # Under System V uncomment the following lines # INSTALL = cp # INSTALL_S = strip # INSTALL_D = mkdir # --- You shouldn't need to edit below this line --- BACKUPFILE = $${HOME}/tmp/nspark.zip CDEFINES = -I. -O CMISC = -D$(SYSTYPE) CFLAGS = $(CDEFINES) $(CMISC) -Wall -Werror LIBS = PROG = nspark$(EXE) SQSH = sqsh$(EXE) TESTPACK = testprog/testpack$(EXE) SRCS = store.c pack.c compress.c crc.c \ io.c error.c misc.c date.c arcfs.c garble.c HDRS = store.h pack.h compress.h crc.h \ nsparkio.h error.h misc.h date.h os.h spark.h arcfs.h garble.h version.h NSPARKSRCS = main.c arc.c unarc.c NSPARKHDRS = main.h arc.h unarc.h SQSHSRCS = sqshmain.c unarc.c SQSHHDRS = unarc.h TESTPACKSRCS = testprog/pack.c EXE = OBJ = .o ifeq (${SYSTYPE},RISCOS) OS_SRCS = acorn.c CFLAGS += -mlibscl LIBS += -mlibscl endif ifeq (${SYSTYPE},POSIX) OS_SRCS = unix.c # BB: For SGI systems fitted with a MIPS R4000 or better, add -mips2 to CFLAGS. CFLAGS += # BB: For SGI systems use LIBS -lc_s -s. LIBS += endif ifeq (${SYSTYPE},WINNT) EXE = .exe OBJ = .obj OS_SRCS = winnt.c endif OBJS = $(SRCS:.c=$(OBJ)) NSPARKOBJS = $(NSPARKSRCS:.c=$(OBJ)) SQSHOBJS = $(SQSHSRCS:.c=$(OBJ)) TESTPACKOBJS = $(TESTPACKSRCS:.c=$(OBJ)) OS_OBJS = $(OS_SRCS:.c=$(OBJ)) ALL_SRCS = $(SRCS) $(NSPARKSRCS) $(SQSHSRCS) $(TESTPACKSRCS) posix.c acorn.c msdos.c winnt.c ALL_HDRS = $(HDRS) $(NSPARKHDRS) $(SQSHHDRS) .DEFAULT: $(CC) -c $< all: $(PROG) $(TESTPACK) $(SQSH) $(TESTPACK): $(OBJS) $(OS_OBJS) $(TESTPACKOBJS) $(CC) -o $@ $^ $(LIBS) $(PROG): $(OBJS) $(OS_OBJS) $(NSPARKOBJS) $(CC) -o $@ $^ $(LIBS) $(SQSH): $(OBJS) $(OS_OBJS) $(SQSHOBJS) $(CC) -o $@ $^ $(LIBS) install: $(PROG) $(SQSH) $(INSTALL_D) "$(INSTALLDIR)/bin" $(INSTALL_S) $(PROG) $(INSTALLDIR)/bin $(INSTALL_S) $(SQSH) $(INSTALLDIR)/bin $(INSTALL_D) "$(INSTALLDIR)/share/man/man1" $(INSTALL) man/nspark.1 $(INSTALLDIR)/share/man/man1 $(INSTALL) man/sqsh.1 $(INSTALLDIR)/share/man/man1 $(INSTALL_D) "$(INSTALLDIR)/share/man/man5" $(INSTALL) man/arcfs.5 $(INSTALLDIR)/share/man/man5 $(INSTALL) man/spark.5 $(INSTALLDIR)/share/man/man5 depend: $(SRCS) $(HDRS) $(NSPARKSRCS) $(NSPARKHDRS) $(SQSHSRCS) $(SQSHHDRS) makedepend -w200 -f Makefile.gcc -o '$$(OBJ)' $(CDEFINES) -D$(SYSTYPE) -- $(ALL_SRCS) sed -f nosysdep.sed -i Makefile.gcc makedepend -w200 -f win32/MAKEFILE -o '$$(OBJ)' $(CDEFINES) -DWINNT -- $(ALL_SRCS) sed -f nosysdep.sed -i win32/MAKEFILE rm -f Makefile.gcc.bak win32/MAKEFILE.bak tags: $(SRCS) $(HDRS) ctags $(SRCS) $(HDRS) clean: rm -f $(PROG) $(TESTPACK) $(SQSH) $(OBJS) $(NSPARKOBJS) $(TESTPACKOBJS) $(SQSHOBJS) rm -f a.out core *~ backup: clean (cd ..; zip -r9y $(BACKUPFILE) nspark) TMPDIR = $$HOME/tmp DISTLEAF = nspark-$(VERSION) DISTDIR = $(TMPDIR)/$(DISTLEAF) dist: clean $(SRCS) $(HDRS) rm -f RCS/rel-$(VERSION) makerel makefile *.c *.h > RCS/rel-$(VERSION) chmod 444 RCS/rel-$(VERSION) mkdir $(DISTDIR) cp *.c *.h nosysdep.sed README BUGS CHANGES makefile $(DISTDIR) mkdir $(DISTDIR)/mkfiles cp mkfiles/* $(DISTDIR)/mkfiles (cd $(TMPDIR); tar cf - $(DISTLEAF) | compress > $(DISTLEAF).tar.Z) (cd $(TMPDIR); rm -rf $(DISTLEAF)) %$(OBJ): %.c $(CC) $(CFLAGS) -c -o $@ $< # DO NOT DELETE THIS LINE -- make depend depends on it. store$(OBJ): spark.h main.h crc.h garble.h store$(OBJ): nsparkio.h pack$(OBJ): spark.h main.h crc.h garble.h pack$(OBJ): nsparkio.h pack.h compress$(OBJ): spark.h pack.h compress$(OBJ): main.h crc.h garble.h nsparkio.h arcfs.h crc$(OBJ): spark.h main.h arcfs.h io$(OBJ): spark.h main.h error.h arcfs.h nsparkio.h error$(OBJ): error.h misc$(OBJ): spark.h main.h date.h misc.h date$(OBJ): spark.h arcfs$(OBJ): spark.h arcfs.h nsparkio.h misc.h garble$(OBJ): garble.h spark.h main$(OBJ): spark.h nsparkio.h error.h misc.h arc.h unarc.h garble.h version.h arc$(OBJ): spark.h error.h unarc$(OBJ): spark.h store.h pack.h compress.h main.h nsparkio.h unarc$(OBJ): misc.h os.h error.h unarc$(OBJ): crc.h arcfs.h sqshmain$(OBJ): spark.h arcfs.h unarc.h unarc$(OBJ): spark.h store.h pack.h compress.h main.h nsparkio.h unarc$(OBJ): misc.h os.h error.h unarc$(OBJ): crc.h arcfs.h testprog/pack$(OBJ): spark.h crc.h nsparkio.h pack.h arcfs.h garble.h spark.h acorn$(OBJ): spark.h date.h msdos$(OBJ): spark.h date.h msdos$(OBJ): os.h winnt$(OBJ): spark.h date.h nspark-1.7.8B2+git20210317.cb30779/Makefile.wat000066400000000000000000000027651402443176000200520ustar00rootroot00000000000000SYSTYPE = WINNT CC = wcc386 SRCS= store.c pack.c compress.c crc.c & io.c error.c misc.c date.c arcfs.c garble.c HDRS= store.h pack.h compress.h crc.h & nsparkio.h error.h misc.h date.h os.h spark.h arcfs.h garble.h version.h NSPARKSRCS = main.c arc.c unarc.c NSPARKHDRS = main.h arc.h unarc.h SQSHSRCS = sqshmain.c unarc.c SQSHHDRS = unarc.h EXE = .exe OBJ = .obj !ifeq SYSTYPE WINNT CFLAGS += -bt=nt OS_SRCS = winnt.c system = nt !endif !ifeq SYSTYPE MSDOS CFLAGS += -D__MSDOS__ -bt=dos -mc OS_SRCS = msdos.c system = dos CC=wcc !endif !ifeq SYSTYPE MSDOS32 CFLAGS += -D__MSDOS__ -bt=dos OS_SRCS = msdos.c system = dos4g !endif OBJS = $(SRCS:.c=$(OBJ)) NSPARKOBJS = $(NSPARKSRCS:.c=$(OBJ)) SQSHOBJS = $(SQSHSRCS:.c=$(OBJ)) OS_OBJS = $(OS_SRCS:.c=$(OBJ)) CFLAGS += -zq -oaxt -d0 -wx -fo=$(OBJ) -D$(SYSTYPE) all: nspark$(EXE) sqsh$(EXE) nspark$(EXE) : nspark.lnk wlink @$? sqsh$(EXE) : sqsh.lnk wlink @$? nspark.lnk : $(OBJS) $(OS_OBJS) $(NSPARKOBJS) %create $@ @%append $@ debug all @%append $@ name $* @%append $@ op map, quiet @%append $@ system $(system) @for %i in ($?) do @%append $@ file %i sqsh.lnk : $(OBJS) $(OS_OBJS) $(SQSHOBJS) %create sqsh.lnk @%append $@ debug all @%append $@ name $* @%append $@ op map, quiet @%append $@ system $(system) @for %i in ($?) do @%append $@ file %i .EXTENSIONS: .EXTENSIONS: $(EXE) $(OBJ) .c .h .c:$(CDIR) .c$(OBJ) : $(CC) $(CFLAGS) $[* clean: .symbolic rm -f *$(EXE) *$(OBJ) *.err *.lnk *.exp *.map nspark-1.7.8B2+git20210317.cb30779/README000066400000000000000000000063541402443176000164760ustar00rootroot00000000000000 nspark - New Spark unarchiver ============================= THIS PROGRAM IS *FREE* -- YOU MAY DO WHAT YOU LIKE WITH IT AS LONG AS THIS FILE REMAINS INTACT, AND YOU DO NOT MAKE ANY MONEY FROM IT! IF YOU MAKE IMPROVEMENTS TO THIS PROGRAM THEN PLEASE SEND A COPY OF THE SOURCES TO THE MAINTAINER OF THAT VERSION OF THE PROGRAM. nspark is a rewritten version of !Spark for UNIX. The original version of spark (sometimes known as "cark") was based upon the BASIC program "bark", written by David Pilling, and was improved and fixed by the following people: Philip Colmer (pcolmer@acorn.co.uk), Alun Jones (auj@uk.ac.aber), Andy Duplain (duplain@rtf.bt.co.uk), Martin Percival (martin@thed.uk22.bull.com), Denis Howe (dbh@doc.ic.ac.uk). I decided to re-write the program to add functionality and make it easier to port to other Operating Systems (such as MSDOS and even RISC OS :-). The new version has the following enhancements: o Supports all archive methods used by !Spark 1 and 2. The old version didn't support "Squashing" and used to handle "Compressed" archives by using the UNIX uncompress program. The new version supports both these and has them built-in, allowing easier porting to other OS's. o Supports Cyclic Redundancy Checking (CRC). The integrity of an archive can now be checked without having to unarchive it. o Supports verbose option to allow archive file details to be displayed (time/date or exec/load address, size, type). o Supports selective file unarchiving, so the whole archive needn't be unarchived if not all the files are wanted). o Supports user-prompting before overwriting a file, allowing the user to either (1) overwrite the file, (2) overwrite all the files, (3) unarchive the file to a different name, or (4) not to unarchive the file at all. o Supports file-stamping so the date and time of the file, when unarchived, matches the date and time it was archived (not 4.2BSD or SysV.2 as these systems lack vital library functions). I have not included support for creating !Spark archives, and I am not really sure if I need to as: (1) !Spark for RISC OS is cheap (#5.99 from David Pilling), (2) !SparkPlug can unpack archives created with zip (which is available in source form for UNIX, VMS and MSDOS), and (3) it's a lot of work. Let me know what you think. To compile nspark; copy the relevant makefile from the "mkfiles" directory, and rename it "Makefile" or "makefile", edit it to suite C compiler preference, change the "SYSTYPE" variable setting, etc, then simply type "make" (or "nmake" or "amu" or whatever). There are some problems with nspark if it is compiled with gcc v2 (it core dumps). To fix this try recompiling everything ("make clean" first) with "-O" off, and if nspark still won't work try adding "-fno-builtin" after "gcc" in the "CC" line, then recompile. I have had some strange problems with optimisation in gcc v2, for example basename() in misc.c core dumps (looking at the assembler gcc v2 produced I can see why!). Please send bug reports/suggestions etc to the maintainer of the particular version of nspark you are using (the maintainer's e-mail address can be found using the -V option). Enjoy. -- Andy Duplain, BT Customer Systems, Brighton, UK. (duplain@btcs.bt.co.uk). October 1992. nspark-1.7.8B2+git20210317.cb30779/README.TOO000066400000000000000000000043631402443176000171340ustar00rootroot00000000000000Changes since version 1.7.7 =========================== Nspark now handles garbles archives. Version 1.7.7 ============= An extra option has been added -I to accomodate the extraction of files with a .inf file which contains the filename, load, exec addresses etc. This is to help users of BBC emulators that need the .inf file to create disc images. The WinNT directory has been renamed to Win32 and there is a compiled version there. I have not compiled any of the other versions with the new changes including the executable in the msdos directory. Mark Usher marku@magnet.at http://members.magnet.at/marku/bbc.htm Version 1.7.6 dos-beta ====================== The DOS port of nspark. First read the README file. This archive contains the sources and executable for the DOS part of nspark. This is a beta version. The maintainer of nspark (Andrew Brooks, arb@comp.lancs.ac.uk) has not yet responded to messages informing him of this port. So until he does, please report problems to me. (Address follows below). More information about the DOS port can be found in the directory msdos. The DOS executable supplied is the version compiled with Borland C/C++ 3.1. I chose this version because the run-time libraries of version 3.1 are about 20k smaller than those of 4.02. The code produced for the actual program is about equal. The executable is compressed using PKLITE 1.50. The ready-compiled binaries in the directories unix/mips-ultrix42, unix/sunos4.1.3, unix/linux, unix/osf1.v2.1, unix/solaris2.3 and winnt are the same as with version 1.7.5 of nspark. I do not have access to any of these machines/OSes, so I cannot recompile nspark on any of those machines. The executables in directories riscos, unix/SGI-IRIX_4.x and unix/SGI-IRIX_5.x are compiled from the ,new' 1.7.6 sources. The IRIX 4 version is compiled for the MIPS R3000 processor family. It will also run on machines running IRIX 5.x or the 64 bits IRIX 6.x (fitted with MIPS R8000 processors). The IRIX 5.x version is compiled for the MIPS R4000 processor family. It will also run under IRIX 6.x, but not under IRIX 4.x or on machines fitted with MIPS R3000 processors. Bob Brand, bob@wop.wtb.tue.nl or B.A.Brand@wtb.tue.nl (Addresses should be valid at least until Oct. 1st, 1996). fido: 2:2801/208.2 nspark-1.7.8B2+git20210317.cb30779/acorn.c000066400000000000000000000043401402443176000170550ustar00rootroot00000000000000 /* * Operating System specific function (Acorn) * * $Header: acorn.c 1.1 93/03/05 $ * $Log: acorn.c,v $ * Revision 1.1 93/03/05 14:34:04 arb * Initial revision * */ #include "spark.h" #include "date.h" #include "kernel.h" #include "swis.h" /* * return the length of a file */ Word filesize(char *pathname) { int rc; _kernel_osfile_block osblock; rc = _kernel_osfile(17, pathname, &osblock); if (rc == _kernel_ERROR) return (0); /* Bit 1 is set if a file, bit 2 if a directory, both if image file */ if (rc & 1) return ((Word) osblock.start); else return (0); } /* * test for the existance of a file or directory */ Ftype exist(char *pathname) { int rc; _kernel_osfile_block osblock; rc = _kernel_osfile(17, pathname, &osblock); if (rc == _kernel_ERROR) return (NOEXIST); /* assumes error was because file doesn't exist... could be wrong! */ if (rc & 1) return (ISFILE); /* might not be a regular file... (eg. image) */ if (rc & 2) return (ISDIR); else return (NOEXIST); } /* * make a directory */ int makedir(char *pathname) { int rc; _kernel_osfile_block osblock; osblock.start = 0; /* Default number of entries */ rc = _kernel_osfile(8, pathname, &osblock); if (rc == _kernel_ERROR) return (-1); /* Should set errno */ else return (0); } /* * stamp a file with date and time */ int filestamp(Header *header, char *filename) { int rc; _kernel_osfile_block osblock; if ((header->load & (Word) 0xfff00000) != (Word) 0xfff00000) return (0); /* not a timestamp */ osblock.load = header->load; osblock.exec = header->exec; osblock.end = header->attr; rc = _kernel_osfile(1, filename, &osblock); if (rc == _kernel_ERROR) return (-1); else return (0); } /* * read byte from stream (only one line from stdin supported) */ int read(int fd, void *buffer, int len) { _kernel_swi_regs regs; int carry; if (fd != 0) /* Only stdin, sorry! */ return (0); regs.r[0] = (int) buffer; regs.r[1] = len; regs.r[2] = 1; /* Low/high values to store */ regs.r[3] = 255; if (_kernel_swi_c(OS_ReadLine, ®s, ®s, &carry)) return (-1); /* Error occurred */ if (carry) return (-1); /* Escape pressed */ return (regs.r[1]); /* Return number of bytes read */ } nspark-1.7.8B2+git20210317.cb30779/arc.c000066400000000000000000000005271402443176000165230ustar00rootroot00000000000000 /* * archive files * * $Header: arc.c 1.2 92/12/07 $ * $Log: arc.c,v $ * Revision 1.2 92/12/07 17:17:07 duplain * reformatted source. * * Revision 1.1 92/09/29 18:02:05 duplain * Initial revision * */ #include "spark.h" #include "error.h" int do_arc() { error("archiving not supported in this version"); return (99); } nspark-1.7.8B2+git20210317.cb30779/arc.h000066400000000000000000000003541402443176000165260ustar00rootroot00000000000000/* * archive function prototypes * * $Header: arc.h 1.1 92/09/29 $ * $Log: arc.h,v $ * Revision 1.1 92/09/29 18:02:29 duplain * Initial revision * */ #ifndef __ARC_H #define __ARC_H int do_arc(void); #endif /* __ARC_H */ nspark-1.7.8B2+git20210317.cb30779/arcfs.c000066400000000000000000000175301402443176000170560ustar00rootroot00000000000000 /* * Handle ArcFS format archives * * Author: Andrew Brooks, arb@comp.lancs.ac.uk * * $Header: arcfs.c 1.5 95/08/01 $ * $Log: arcfs.c,v $ * Revision 1.5 95/08/01 xx:xx:xx BB * Fixes for Borland C/C++ * Removed use of floating point routines. * * Revision 1.4 95/01/06 11:58:45 arb * Fixes for Alpha. * * Revision 1.3 94/12/12 17:25:25 arb * Fixes for writesize. * * Revision 1.2 94/10/26 15:06:35 arb * Fixed date and time conversion. * * Revision 1.1 94/02/28 21:41:23 arb * Fixed header, fixed include ordering, fixed directory check, * added seek to start of compressed data, fixed maxbits, ... * ie. got the thing working at last! * * Revision 1.0 93/08/20 12:40:15 arb * Initial revision */ #include #include #include #include #include "spark.h" #ifdef POSIX #include #endif /* POSIX */ #include "arcfs.h" #include "nsparkio.h" #include "misc.h" #include "error.h" #ifndef SEEK_SET #define SEEK_SET 0 #endif /* * Public flag to indicate whether the current archive is ArcFS format */ int arcfs = 0; /* * Public number of compression bits, used in compress.c */ int arcfs_maxbits = 0; /* * Public size of file being extracted, used in io.c, crc.c */ long writesize; long crcsize; /* * ArcFS header list element */ struct arcfs_header_s { struct arcfs_header_s *next; Byte maxbits; Byte is_dir; Byte info_byte; Word info_word; Word seek; Header *header; }; typedef struct arcfs_header_s *arcfs_header; /* * Info byte */ #define AFS_ENDDIR 0 #define AFS_DELETED 1 #define AFS_STORE 0x82 #define AFS_PACK 0x83 #define AFS_CRUNCH 0x88 #define AFS_COMPRESS 0xFF /* * Static data */ static int arcfs_initialised = 0; static arcfs_header header_list = NULL; static arcfs_header header_ptr = NULL; /* * Convert RISC OS time to UNIX time. * RISC OS time is five bytes of centiseconds since 1900. * UNIX time is seconds since 1970. * MSB of RISC OS time is LSB of `load' plus `exec'. */ /* BB added extra prototype for Borland C/C++ */ struct tm * rotm(Word load, Word exec) { Word low, high; time_t t; high = (load & 0xff) - 0x33l; low = exec - 0x6e996a00l; if (low > exec) { high--; } /* BB changed constant in next line to long */ /* cast to Word, then time_t as date stamps will all be 32 bits and time_t * might be 64 bits */ t = (time_t)(Word)(high * 42949673L + low / 100L); t -= (high / 25); return (localtime(&t)); } /* * Convert RISC OS time to SPARK time */ /* BB added extra prototype for Borland C/C++ */ void arcfs_fixtime(Header *hdr) { /* BB next line commented out, variable ti never used */ /* time_t ti; */ struct tm *tim; /* Convert to UNIX time first (as it is easy) */ tim = rotm(hdr->load, hdr->exec); /* Convert UNIX time to SPARK time */ hdr->date = (tim->tm_year - 80) << 9; hdr->date |= (tim->tm_mon + 1) << 5; hdr->date |= (tim->tm_mday); hdr->time = (tim->tm_hour) << 11; hdr->time |= (tim->tm_min) << 5; hdr->time |= tim->tm_sec / 2; } /* * Read ArcFS header */ Header * arcfs_read_header(FILE *ifp) { static Header null_header; static Word data_start; Word header_length = 0; Header *header; Word version; Word i; Byte info_byte, name[12]; Word length, load, exec, attr, complen, info_word; arcfs_header header_prev = NULL; int j; /* Return next header from list */ if (arcfs_initialised) { /* If end of list return an empty header structure to indicate EOF */ if (header_ptr == NULL) return (&null_header); /* Return next header in list */ header = header_ptr->header; /* Seek to start of compressed data */ if ((!header_ptr->is_dir) && (fseek(ifp, (long) header_ptr->seek, SEEK_SET))) { error("Cannot seek compressed data in this file"); return (&null_header); } /* Set up number of compression bits */ arcfs_maxbits = header_ptr->maxbits; /*if (header_ptr->is_dir) header = &null_header; */ header_ptr = header_ptr->next; return (header); } /* Header list not constructed yet, so read all headers from file */ arcfs_initialised = 1; memset((char *) &null_header, '\0', sizeof(null_header)); null_header.comptype = 0; header_length = read_word(ifp); data_start = read_word(ifp); if ((version = read_word(ifp)) > 40) { /* BB removed floating point routines from next line This saves linking the floating point routines under DOS which yields quite a reduction in executable size. And it removes the need to have the FPE present under RISC OS. */ /* error("Archive created by a newer version of ArcFS (%.2f)",((float)version)/100); */ error("Archive created by a newer version of ArcFS (%d.%02d)", version / 100, version % 100); return (&null_header); } read_word(ifp); /* read/write version */ if ((version = read_word(ifp)) > 0) { error("Archive format %d not understood", version); return (&null_header); } for (i = 0; i < 17; i++) read_word(ifp); /* reserved */ /* Read list of headers */ for (i = 0; i < header_length / 36; i++) { /* Create list item */ header = (Header *) malloc(sizeof(Header)); header_ptr = (arcfs_header) malloc(sizeof(struct arcfs_header_s)); if ((header == NULL) || (header_ptr == NULL)) { error("Out of memory"); return (&null_header); } /* Read ArcFS file header */ info_byte = read_byte(ifp); for (j = 0; j < 11; j++) { name[j] = read_byte(ifp); if (name[j] == PATHSEP) name[j] = '_'; if (name[j] < ' ' || name[j] > '~') name[j] = '\0'; } name[j] = '\0'; length = read_word(ifp); load = read_word(ifp); exec = read_word(ifp); attr = read_word(ifp); complen = read_word(ifp); info_word = read_word(ifp); /* Examine, and create nspark header */ if (info_byte == AFS_DELETED) { free(header); free(header_ptr); continue; } /* BB changed next line for Borland C/C++ 4 */ /* header_ptr->is_dir = (info_word >> 31); */ #ifdef __MSDOS__ header_ptr->is_dir = (Halfword) (info_word >> 31); #else header_ptr->is_dir = (info_word >> 31); #endif header_ptr->info_byte = info_byte; header_ptr->info_word = info_word; /* BB changed next line for Borland C/C++ 4 */ /* header_ptr->maxbits = (attr & 0xff00) >> 8; */ #ifdef __MSDOS__ header_ptr->maxbits = (Halfword) (attr & 0xff00) >> 8; #else header_ptr->maxbits = (attr & 0xff00) >> 8; #endif /* BB changed constant in next line to long. */ header_ptr->seek = (info_word & 0x7fffffffL) + data_start; header->comptype = info_byte; strcpy(header->name, (char *) name); header->complen = complen; header->date = 0; header->time = 0; header->crc = (Halfword) (attr >> 16); header->origlen = length; header->load = load; header->exec = exec; header->attr = attr & 0xff; arcfs_fixtime(header); if (info_byte == AFS_ENDDIR) { /* Just return comptype == 0 */ *header = null_header; header_ptr->is_dir = 0; header_ptr->seek = 0; } /* If it is an ArcFS directory then convert to a Spark directory */ if (header_ptr->is_dir) { /* Make sure filetype is DDC */ header->comptype = CT_NOTCOMP2; /* BB changed constant in next line to long. */ header->load = 0xfffddcffL; } /* Add list item to list */ /* Doing it here ensures that deleted items are not added */ header_ptr->header = header; if (header_list == NULL) header_list = header_ptr; else header_prev->next = header_ptr; header_prev = header_ptr; #ifdef DEBUGGING print_header(header); #endif } /* Return first element */ header_ptr = header_list; header = header_ptr->header; /* Seek to start of data for first element */ if ((!header_ptr->is_dir) && (fseek(ifp, (long) header_ptr->seek, SEEK_SET))) { error("Cannot seek compressed data in this file"); return (&null_header); } /* Set up number of compression bits */ arcfs_maxbits = header_ptr->maxbits; /*if (header_ptr->is_dir) header = &null_header; */ header_ptr = header_ptr->next; return (header); } nspark-1.7.8B2+git20210317.cb30779/arcfs.h000066400000000000000000000007501402443176000170570ustar00rootroot00000000000000/* * ArcFS support * (C) 1993 Andrew Brooks, arb@comp.lancs.ac.uk */ #ifndef __ARCFS_H #define __ARCFS_H /* * Flag to indicate whether the current archive is ArcFS format */ extern int arcfs; /* * Number of bits of compression */ extern int arcfs_maxbits; /* * Original size of file being extracted */ extern long writesize; extern long crcsize; /* * Read ArcFS header */ Header *arcfs_read_header(FILE *ifp); void arcfs_fixtime(Header *hdr); #endif /* __ARCFS_H */ nspark-1.7.8B2+git20210317.cb30779/compress.c000066400000000000000000000270011402443176000176050ustar00rootroot00000000000000 /* * compress/uncompress archive * * Authors: Spencer W. Thomas (decvax!utah-cs!thomas) * Jim McKie (decvax!mcvax!jim) * Steve Davies (decvax!vax135!petsd!peora!srd) * Ken Turkowski (decvax!decwrl!turtlevax!ken) * James A. Woods (decvax!ihnp4!ames!jaw) * Joe Orost (decvax!vax135!petsd!joe) * * NOTE: these functions also support "squash" (which is just a * 13-bit compress), and "crunch" (which is a 12-bit compress * with additional run-length encoding). AJD * * $Header: compress.c 1.11 95/08/01 $ * $Log: compress.c,v $ * Revision 1.11 95/08/01 xx:xx:xx BB * Quite a few changes for Borland C/C++ * Made htab and codetab arrays dynamic. * (Compile with -DBB_HUGE_STATIC_ARRAYS if you DO want these * huge static arrays in your executable.) * Changed pointers to normalized or huge pointers because * arrays span more than 64k. * Changed a few types from int to long because 32bits integers * are needed. * * Revision 1.10 95/01/25 12:49:43 arb * Bug fixes caused by 1.9 * * Revision 1.9 95/01/06 12:00:06 arb * Fixes for Alpha. * * Revision 1.8 94/02/28 23:57:55 arb * Fixed number of compression bits for ArcFS format archives * * Revision 1.7 93/08/20 11:35:20 arb * Prevent printing of "uncompressed" etc. if quiet flag is set * * Revision 1.6 92/12/07 17:17:28 duplain * reformatted source. * * Revision 1.5 92/11/09 14:48:00 duplain * Initialised offset and size from getcode() each time uncompress() called. * * Revision 1.4 92/11/02 11:43:14 duplain * Correct comment about crunch/squash in header. * * Revision 1.3 92/10/23 14:08:13 duplain * Minor changes to printf's at end of uncompress. * * Revision 1.2 92/10/01 11:20:19 duplain * Added check for EOF. * * Revision 1.1 92/09/29 18:02:14 duplain * Initial revision * */ #include #include #include "spark.h" #include "pack.h" #include "main.h" #include "crc.h" #include "garble.h" #include "error.h" /* BB changed next line because of conflict with Borland's io.h */ /* #include "io.h" */ #include "nsparkio.h" #include "arcfs.h" #if defined(__MSDOS__) && !defined(MSDOS32) #ifdef __WATCOMC__ #include #define farcalloc halloc #else #include /* for farcalloc() */ #endif #else #define farcalloc calloc #endif /* __MSDOS__ */ #define PBITS 16 #define CRUNCHBITS 12 #define SQUASHBITS 13 #define COMPRESSBITS 16 /* BB changed constant in next line to long: 16bits 65536 == 0 ! */ #define HSIZE 65536L #define INIT_BITS 9 /* initial number of bits/code */ /* BB changed next macros. * Arrays htab and codetab both exceed 64k. To prevent wraparound at the 64k boundary, normalized or huge pointers have to be used. Since subscripts are 16 bit ints under the Borland compiler, subscripts have to be made explicitely long. And finally COMPRESSBITS == 16, but 1 << 16 == 0 for 16 bits integers! */ /* #define MAXCODE(n_bits) ((1 << (n_bits)) - 1) */ /* #define htabof(i) htab[i] */ /* #define codetabof(i) codetab[i] */ /* #define tab_prefixof(i) codetabof(i) */ /* #define tab_suffixof(i) ((char_type *)(htab))[i] */ /* #define de_stack ((char_type *)&tab_suffixof(1<complen; if (type == SQUASH) maxbits = SQUASHBITS; else if (type == UNIX_COMPRESS) { /* Read the unix compress header */ read_byte(ifp); read_byte(ifp); maxbits = read_byte(ifp) & 0x1f; readsize -= 3; } else { if (arcfs) { maxbits = arcfs_maxbits; ungarble('\0'); // Need to consume one byte of password. } else { maxbits = read_byte(ifp); readsize--; } } maxmaxcode = MAXCODE(maxbits); /* * As above, initialize the first 256 entries in the table. */ maxcode = MAXCODE(n_bits = INIT_BITS); for (code = 255; code >= 0; code--) { tab_prefixof(code) = 0; tab_suffixof(code) = (char_type) code; } free_ent = FIRST; finchar = oldcode = getcode(ifp); if (oldcode == -1) /* EOF already? */ goto compress_exit; /* Get out of here */ /* first code must be 8 bits = char */ if (type == CRUNCH) { putc_init(); /* BB changed next line for Borland C/C++ 4 */ putc_ncr(ofp, (Byte) finchar); } else { /* BB changed next three lines for Borland C/C++ 4 */ if (!testing) write_byte(ofp, (Byte) finchar); calccrc((Byte) finchar); } stackp = de_stack; while ((code = getcode(ifp)) != -1) { if (check_stream(ifp) != FNOERR) break; if (code == CLEAR) { for (code = 255; code >= 0; code--) tab_prefixof(code) = 0; clear_flg = 1; free_ent = FIRST - 1; if ((code = getcode(ifp)) == -1) /* O, untimely death! */ break; } incode = code; /* * Special case for KwKwK string. */ if (code >= free_ent) { /* BB changed next line for Borland C/C++ 4 */ *stackp++ = (char_type) finchar; code = oldcode; } /* * Generate output characters in reverse order */ while (code >= 256) { if ((char NSHUGE *)(stackp+1) > (char NSHUGE *)(&htab[0] + HSIZE)) { error("%s: uncompress: corrupt or garbled archive file", ourname); exit(1); } *stackp++ = tab_suffixof(code); code = tab_prefixof(code); } if ((char NSHUGE *)(stackp+1) > (char NSHUGE *)(&htab[0] + HSIZE)) { error("%s: uncompress: corrupt or garbled archive file", ourname); exit(1); } /* BB changed next line for Borland C/C++ 4 */ /* *stackp++ = finchar = tab_suffixof(code); */ finchar = tab_suffixof(code); *stackp++ = (char_type) finchar; /* * And put them out in forward order */ while (stackp > de_stack) { stackp--; if (type == CRUNCH) putc_ncr(ofp, *stackp); else { if (!testing) write_byte(ofp, *stackp); calccrc(*stackp); } } /* * Generate the new entry. */ if ((code = free_ent) < maxmaxcode) { /* BB changed next two lines for Borland C/C++ 4 */ tab_prefixof(code) = (unsigned short) oldcode; tab_suffixof(code) = (char_type) finchar; free_ent = code + 1; } /* * Remember previous code. */ oldcode = incode; } compress_exit: if (check_stream(ifp) == FRWERR) return (RERR); if (!testing && check_stream(ofp) == FRWERR) return (WERR); if ((Halfword) crc != header->crc) return (CRCERR); if (testing) switch (type) { case COMPRESS: case UNIX_COMPRESS: message = "OK (compressed)"; break; case CRUNCH: message = "OK (crunched)"; break; case SQUASH: message = "OK (squashed)"; break; default: message = "internal error"; break; } else switch (type) { case COMPRESS: case UNIX_COMPRESS: message = "uncompressed"; break; case CRUNCH: message = "uncrunched"; break; case SQUASH: message = "unsquashed"; break; default: message = "internal error"; break; } if (!quiet) msg("%s", message); return (NOERR); } /* * Read one code from the input. If EOF, return -1. */ static code_int getcode(FILE *ifp) { register code_int code; static char_type buf[COMPRESSBITS]; register int r_off, bits; size_t i; /* BB changed next line. We are doing pointer-artithmatics and that can be dangerous if other than normalized (huge) pointers are being used. */ register char_type NSHUGE *bp = buf; if (clear_flg > 0 || offset >= size || free_ent > maxcode) { /* * If the next entry will be too big for the current code * size, then we must increase the size. This implies * reading a new buffer full, too. */ if (free_ent > maxcode) { n_bits++; maxcode = n_bits == maxbits ? maxmaxcode : MAXCODE(n_bits); } if (clear_flg > 0) { maxcode = MAXCODE(n_bits = INIT_BITS); clear_flg = 0; } if (readsize == 0) return (-1); /* BB added cast to next line */ size = readsize < n_bits ? (size_t) readsize : n_bits; size = fread(buf, 1, size, ifp); if (size == 0) return (-1); /* end of file */ for (i = 0; i < size; i++) { buf[i] = ungarble(buf[i]); } readsize -= size; offset = 0; /* Round size down to integral number of codes */ size = (size << 3) - (n_bits - 1); } r_off = (int)offset; bits = n_bits; /* * Get to the first byte. */ bp += (r_off >> 3); r_off &= 7; /* Get first part (low order bits) */ code = (*bp++ >> r_off); bits -= (8 - r_off); r_off = 8 - r_off; /* now, offset into code word */ /* Get any 8 bit parts in the middle (<=1 for up to 16 bits). */ if (bits >= 8) { code |= *bp++ << r_off; r_off += 8; bits -= 8; } /* high order bits. */ code |= (*bp & rmask[bits]) << r_off; offset += n_bits; return (code); } nspark-1.7.8B2+git20210317.cb30779/compress.h000066400000000000000000000005071402443176000176140ustar00rootroot00000000000000/* * compress/uncompress function prototypes * * $Header: compress.h 1.1 92/09/29 $ * $Log: compress.h,v $ * Revision 1.1 92/09/29 18:02:30 duplain * Initial revision * */ #ifndef __COMPRESS_H #define __COMPRESS_H Status uncompress(Header *header, FILE *ifp, FILE *ofp, CompType type); #endif /* __COMPRESS_H */ nspark-1.7.8B2+git20210317.cb30779/crc.c000066400000000000000000000104011402443176000165150ustar00rootroot00000000000000 /* * calculate Cyclic Redundancy Check * * Algorithm by: David Schwaderer, Published in PC Tech Journal April 1985. * * $Header: crc.c 1.6 95/07/13 $ * $Log: crc.c,v $ * Revision 1.6 95/07/13 xx:xx:xx BB * Minor change for use with Borland C/C++ 1,3 and 4 * * Revision 1.5 94/12/12 17:32:03 arb * Added support for ArcFS outputsize checking * * Revision 1.4 92/12/07 17:17:39 duplain * reformatted source. * * Revision 1.3 92/11/06 12:05:55 duplain * Credit author of algorithm, now I know his name. * * Revision 1.2 92/11/06 11:56:47 duplain * Slight change to CRC calculation code, no functional changes. * * Revision 1.1 92/09/29 18:02:16 duplain * Initial revision * */ #include #include "spark.h" #include "main.h" #include "arcfs.h" Word crc; static Word crctable[256] = { 0x00000000, 0x0000c0c1, 0x0000c181, 0x00000140, 0x0000c301, 0x000003c0, 0x00000280, 0x0000c241, 0x0000c601, 0x000006c0, 0x00000780, 0x0000c741, 0x00000500, 0x0000c5c1, 0x0000c481, 0x00000440, 0x0000cc01, 0x00000cc0, 0x00000d80, 0x0000cd41, 0x00000f00, 0x0000cfc1, 0x0000ce81, 0x00000e40, 0x00000a00, 0x0000cac1, 0x0000cb81, 0x00000b40, 0x0000c901, 0x000009c0, 0x00000880, 0x0000c841, 0x0000d801, 0x000018c0, 0x00001980, 0x0000d941, 0x00001b00, 0x0000dbc1, 0x0000da81, 0x00001a40, 0x00001e00, 0x0000dec1, 0x0000df81, 0x00001f40, 0x0000dd01, 0x00001dc0, 0x00001c80, 0x0000dc41, 0x00001400, 0x0000d4c1, 0x0000d581, 0x00001540, 0x0000d701, 0x000017c0, 0x00001680, 0x0000d641, 0x0000d201, 0x000012c0, 0x00001380, 0x0000d341, 0x00001100, 0x0000d1c1, 0x0000d081, 0x00001040, 0x0000f001, 0x000030c0, 0x00003180, 0x0000f141, 0x00003300, 0x0000f3c1, 0x0000f281, 0x00003240, 0x00003600, 0x0000f6c1, 0x0000f781, 0x00003740, 0x0000f501, 0x000035c0, 0x00003480, 0x0000f441, 0x00003c00, 0x0000fcc1, 0x0000fd81, 0x00003d40, 0x0000ff01, 0x00003fc0, 0x00003e80, 0x0000fe41, 0x0000fa01, 0x00003ac0, 0x00003b80, 0x0000fb41, 0x00003900, 0x0000f9c1, 0x0000f881, 0x00003840, 0x00002800, 0x0000e8c1, 0x0000e981, 0x00002940, 0x0000eb01, 0x00002bc0, 0x00002a80, 0x0000ea41, 0x0000ee01, 0x00002ec0, 0x00002f80, 0x0000ef41, 0x00002d00, 0x0000edc1, 0x0000ec81, 0x00002c40, 0x0000e401, 0x000024c0, 0x00002580, 0x0000e541, 0x00002700, 0x0000e7c1, 0x0000e681, 0x00002640, 0x00002200, 0x0000e2c1, 0x0000e381, 0x00002340, 0x0000e101, 0x000021c0, 0x00002080, 0x0000e041, 0x0000a001, 0x000060c0, 0x00006180, 0x0000a141, 0x00006300, 0x0000a3c1, 0x0000a281, 0x00006240, 0x00006600, 0x0000a6c1, 0x0000a781, 0x00006740, 0x0000a501, 0x000065c0, 0x00006480, 0x0000a441, 0x00006c00, 0x0000acc1, 0x0000ad81, 0x00006d40, 0x0000af01, 0x00006fc0, 0x00006e80, 0x0000ae41, 0x0000aa01, 0x00006ac0, 0x00006b80, 0x0000ab41, 0x00006900, 0x0000a9c1, 0x0000a881, 0x00006840, 0x00007800, 0x0000b8c1, 0x0000b981, 0x00007940, 0x0000bb01, 0x00007bc0, 0x00007a80, 0x0000ba41, 0x0000be01, 0x00007ec0, 0x00007f80, 0x0000bf41, 0x00007d00, 0x0000bdc1, 0x0000bc81, 0x00007c40, 0x0000b401, 0x000074c0, 0x00007580, 0x0000b541, 0x00007700, 0x0000b7c1, 0x0000b681, 0x00007640, 0x00007200, 0x0000b2c1, 0x0000b381, 0x00007340, 0x0000b101, 0x000071c0, 0x00007080, 0x0000b041, 0x00005000, 0x000090c1, 0x00009181, 0x00005140, 0x00009301, 0x000053c0, 0x00005280, 0x00009241, 0x00009601, 0x000056c0, 0x00005780, 0x00009741, 0x00005500, 0x000095c1, 0x00009481, 0x00005440, 0x00009c01, 0x00005cc0, 0x00005d80, 0x00009d41, 0x00005f00, 0x00009fc1, 0x00009e81, 0x00005e40, 0x00005a00, 0x00009ac1, 0x00009b81, 0x00005b40, 0x00009901, 0x000059c0, 0x00005880, 0x00009841, 0x00008801, 0x000048c0, 0x00004980, 0x00008941, 0x00004b00, 0x00008bc1, 0x00008a81, 0x00004a40, 0x00004e00, 0x00008ec1, 0x00008f81, 0x00004f40, 0x00008d01, 0x00004dc0, 0x00004c80, 0x00008c41, 0x00004400, 0x000084c1, 0x00008581, 0x00004540, 0x00008701, 0x000047c0, 0x00004680, 0x00008641, 0x00008201, 0x000042c0, 0x00004380, 0x00008341, 0x00004100, 0x000081c1, 0x00008081, 0x00004040 }; void calccrc(Byte byte) { if (crcsize-- > 0) /* BB added cast to next line to stop Borland compiler from complaining */ /* crc = ((crc >> 8) & 0xff) ^ crctable[(crc ^ byte) & 0xff]; */ #ifdef __MSDOS__ crc = ((crc >> 8) & 0xff) ^ crctable[(int) ((crc ^ byte) & 0xff)]; #else crc = ((crc >> 8) & 0xff) ^ crctable[(crc ^ byte) & 0xff]; #endif /* __MSDOS__ */ } nspark-1.7.8B2+git20210317.cb30779/crc.h000066400000000000000000000004271402443176000165310ustar00rootroot00000000000000/* * Cyclic Redundancy Checking function prototypes * * $Header: crc.h 1.1 92/09/29 $ * $Log: crc.h,v $ * Revision 1.1 92/09/29 18:02:32 duplain * Initial revision * */ #ifndef __CRC_H #define __CRC_H extern Word crc; void calccrc(Byte byte); #endif /* __CRC_H */ nspark-1.7.8B2+git20210317.cb30779/date.c000066400000000000000000000021451402443176000166710ustar00rootroot00000000000000 /* * manipulate date types * * $Header: date.c 1.4 92/12/07 $ * $Log: date.c,v $ * Revision 1.4 92/12/07 17:17:47 duplain * reformatted source. * * Revision 1.3 92/11/06 12:43:06 duplain * Removed check for "time-stamped header" in makedate(). * * Revision 1.2 92/10/06 12:12:10 duplain * Fixed makedate(). * * Revision 1.1 92/09/29 18:02:17 duplain * Initial revision * */ #include #include "spark.h" static char *monthnames[12] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; /* * Build date structure from load and exec fields */ Date * makedate(Header *header) { static Date date; register Halfword arcdate = header->date; register Halfword arctime = header->time; date.second = (arctime & 0x1f) * 2; date.minute = (arctime >> 5) & 0x3f; date.hour = (arctime >> 11) & 0x1f; date.day = arcdate & 0x1f; date.month = (arcdate >> 5) & 0x0f; date.year = ((arcdate >> 9) & 0x7f) + 80; return (&date); } char * monthname(int month) { if (month > 0 && month < 13) return (monthnames[month - 1]); else return ("XXX"); } nspark-1.7.8B2+git20210317.cb30779/date.h000066400000000000000000000006141402443176000166750ustar00rootroot00000000000000/* * manipulate date function prototypes * * $Header: date.h 1.2 92/10/23 $ * $Log: date.h,v $ * Revision 1.2 92/10/23 14:09:57 duplain * Removed "days_to_month" function prototype. * * Revision 1.1 92/09/29 18:02:33 duplain * Initial revision * */ #ifndef __DATE_H #define __DATE_H Date *makedate(Header *header); char *monthname(int month); #endif /* __DATE_H */ nspark-1.7.8B2+git20210317.cb30779/error.c000066400000000000000000000016271402443176000171110ustar00rootroot00000000000000 /* * report errors and warnings * * $Header: error.c 1.2 92/12/07 $ * $Log: error.c,v $ * Revision 1.2 92/12/07 17:18:02 duplain * reformatted source. * * Revision 1.1 92/09/29 18:02:18 duplain * Initial revision * */ #include #include "error.h" #include "main.h" extern char *ourname; /* in main.c */ void msg(char *fmt, ...) { va_list ap; va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); } void debug(char *fmt, ...) { #ifdef DEBUGGING va_list ap; if (!debugging) return; va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); #endif /* DEBUGGING */ } void error(char *fmt, ...) { va_list ap; va_start(ap, fmt); vfprintf(stderr, fmt, ap); putc('\n', stderr); va_end(ap); } void warning(char *fmt, ...) { va_list ap; va_start(ap, fmt); fprintf(stderr, "%s warning: ", ourname); vfprintf(stderr, fmt, ap); putc('\n', stderr); va_end(ap); } nspark-1.7.8B2+git20210317.cb30779/error.h000066400000000000000000000007401402443176000171110ustar00rootroot00000000000000/* * error/warning report function prototypes * * $Header: error.h 1.2 92/12/07 $ * $Log: error.h,v $ * Revision 1.2 92/12/07 17:25:36 duplain * Changed include files from "xxxarg.h" to . * * Revision 1.1 92/09/29 18:02:34 duplain * Initial revision * */ #ifndef __ERROR_H #define __ERROR_H #include void msg(char *fmt, ...); void debug(char *fmt, ...); void error(char *fmt, ...); void warning(char *fmt, ...); #endif /* __ERROR_H */ nspark-1.7.8B2+git20210317.cb30779/garble.c000066400000000000000000000005731402443176000172130ustar00rootroot00000000000000#include "garble.h" static char *password; static char *passp; void set_password(char *p) { password = p; } void init_garble() { passp = password; } Byte ungarble(Byte byte) { if (password) { byte ^= *passp++; if (!*passp) { passp = password; } } return byte; } Byte garble(Byte byte) { /* Garble and ungarble are the same thing */ return ungarble(byte); } nspark-1.7.8B2+git20210317.cb30779/garble.h000066400000000000000000000002441402443176000172130ustar00rootroot00000000000000#ifndef GARBLE_H #define GARBLE_H #include "spark.h" void set_password(char *p); void init_garble(void); Byte ungarble(Byte byte); Byte garble(Byte byte); #endif nspark-1.7.8B2+git20210317.cb30779/io.c000066400000000000000000000131271402443176000163650ustar00rootroot00000000000000 /* * file input/output * * $Header: io.c 1.14 95/08/01 $ * $Log: io.c,v $ * Revision 1.14 95/08/01 xx:xx:xx BB * Fixed for Borland C/C++ * * Revision 1.13 94/12/12 17:30:45 arb * Added code for ArcFS outputsize checking * * Revision 1.12 93/08/20 12:31:20 arb * Added code for ArcFS archive headers * * Revision 1.11 93/08/20 10:30:50 arb * Added code for -C option to convert filenames to lowercase * * Revision 1.10 93/08/20 10:30:51 arb * Changed read_header() to allow top-bit-set characters in RISCOS filenames * * Revision 1.9 93/03/05 14:44:02 arb * Added for RISCOS, needed for memset * * Revision 1.8 92/12/09 11:40:30 duplain * Changed ret in check_stream() from type int. #ifdef'd out write_halfword() * and write_word(). * * Revision 1.7 92/12/07 17:18:25 duplain * reformatted source. * * Revision 1.6 92/11/04 16:57:49 duplain * Changed read_header() so it doesn't read the load/exec/attr fields if * PC archive file. * * Revision 1.5 92/10/07 10:36:56 duplain * Changed order of function so no need to include "io.h" (gcc * complained on some platforms). * * Revision 1.4 92/10/05 11:01:07 duplain * Recoded write_word() and write_halfword(). read_header() now clears the * header structure prior to reading data into it. * * Revision 1.3 92/10/02 17:41:49 duplain * Fixed read_header() so it returns immediately if comptype & 0x7f == 0. * * Revision 1.2 92/10/01 11:20:32 duplain * Moved reading of STARTBYTE to unarc.c . * * Revision 1.1 92/09/29 18:02:19 duplain * Initial revision * */ #include #include #include #include "spark.h" #include "main.h" #include "error.h" #include "arcfs.h" #ifdef RISCOS /* next line RISC OS only */ #define isascii(x) 1 #endif /* RISCOS */ #include "nsparkio.h" /* * check for EOF or write/read errors on stream. */ Ferror check_stream(FILE *fp) { Ferror ret = FNOERR; if (feof(fp)) ret = FEND; else if (ferror(fp)) ret = FRWERR; if (ret != FNOERR) clearerr(fp); return (ret); } /* * read a byte from the input stream. */ Byte read_byte(FILE *ifp) { return ((Byte) getc(ifp)); } /* * read a little-endian 2-byte halfword from the input stream. */ Halfword read_halfword(FILE *ifp) { union { Halfword h; Byte b[sizeof(Halfword)]; } ret; if (fread((char *) &ret.h, 1, sizeof(Halfword), ifp)!=sizeof(Halfword)) { error("Read error!"); } #if defined(__MSDOS__) /* MSDOS reads bytes in the correct order. Save a bit of time * by returning the value */ return (ret.h); #else /* Ensure the data is in the correct order */ return (ret.b[0] | ret.b[1] << 8); #endif } /* * read a little-endian 4-byte word from the input stream. */ Word read_word(FILE *ifp) { union { Word w; Byte b[sizeof(Word)]; } ret; if (fread((char *) &ret.w, 1, sizeof(Word), ifp)!=sizeof(Word)) { error("Read error!"); } #if defined(__MSDOS__) /* MSDOS reads bytes in the correct order. Save a bit of time * by returning the value */ return (ret.w); #else /* Ensure the data is in the correct order */ return (ret.b[0] | (ret.b[1] << 8) | (ret.b[2] << 16) | (ret.b[3] << 24)); #endif } /* * write a byte to the output stream. */ void write_byte(FILE *ofp, Byte byte) { if (writesize-- > 0) putc((int) byte, ofp); } #ifdef notyet /* * write a little-endian 2-byte halfword to the output stream. */ void write_halfword(FILE *ofp, Halfword halfword) { write_byte(ofp, halfword & 0xff); write_byte(ofp, (halfword >> 8) & 0xff); } /* * write a little-endian 4-byte word to the output stream. */ void write_word(FILE *ofp, Word word) { write_byte(ofp, word & 0xff); write_byte(ofp, (word >> 8) & 0xff); write_byte(ofp, (word >> 16) & 0xff); write_byte(ofp, (word >> 24) & 0xff); } #endif /* notyet */ /* * read a compression-header from the file */ Header * read_header(FILE *ifp) { static Header header; register int i; register char *cptr; Byte byte; memset((char *) &header, '\0', sizeof(header)); if (arcfs) return (arcfs_read_header(ifp)); header.comptype = read_byte(ifp); if (!(header.comptype & ~ARCHPACK)) return (&header); /* EOF */ for (i = 0, cptr = header.name; i <= 12; i++, cptr++) { byte = read_byte(ifp); #ifdef RISCOS if (byte < ' ') #else if (byte < ' ' || byte > '~') #endif byte = '\0'; else if (byte == PATHSEP) /* illegal in filename */ byte = '_'; *cptr = byte; } *cptr = '\0'; /* null terminate */ if (singlecase) { for (i = 0, cptr = header.name; i <= 12; i++, cptr++) if (isascii(*cptr) && isupper(*cptr)) *cptr = tolower(*cptr); } header.complen = read_word(ifp); header.date = read_halfword(ifp); header.time = read_halfword(ifp); header.crc = read_halfword(ifp); if ((header.comptype & ~ARCHPACK) > CT_NOTCOMP) header.origlen = read_word(ifp); else header.origlen = header.complen; if (header.comptype & ARCHPACK) { header.load = read_word(ifp); header.exec = read_word(ifp); header.attr = read_word(ifp); } if (check_stream(ifp) == FRWERR) return (NULL); return (&header); } Status read_sqsh_header(FILE *fp, SqshHeader *header) { if (fread(header->magic, 1, 4, fp) != 4) { return RERR; } if (strncmp(header->magic, "SQSH", 4) != 0) { error("Not a RISC OS squash file"); return RERR; } header->origlen = read_word(fp); header->load = read_word(fp); header->exec = read_word(fp); header->reserved = read_word(fp); return NOERR; } void sqsh_header_to_header(SqshHeader *sqsh_header, Header *header) { header->load = sqsh_header->load; header->exec = sqsh_header->exec; header->origlen = sqsh_header->origlen; arcfs_fixtime(header); } nspark-1.7.8B2+git20210317.cb30779/main.c000066400000000000000000000165721402443176000167110ustar00rootroot00000000000000 /* * main function * * Revision 1.12 99/03/17 MU * added the option -i to extract with .inf files * Also added the .inf extension to the default logfile name for MSDOS * * $Header: main.c 1.11 95/08/01 $ * $Log: main.c,v $ * Revision 1.11 95/08/01 xx:xx:xx BB * Fixed for Borland C/C++ * Added / as command line switch option for DOS * * Revision 1.10 93/08/20 12:39:28 arb * Added support for ArcFS archive detection * * Revision 1.9 93/08/20 10:30:50 arb * Added -C option for "convert filenames to lowercase" * * Revision 1.8 93/03/05 15:40:32 arb * Added for RISCOS, needed for exit() * * Revision 1.7 92/12/09 09:43:03 duplain * Changed "-a" option to "-T". * * Revision 1.6 92/12/08 10:19:30 duplain * Added -a option for "append filetype". * * Revision 1.5 92/12/07 17:18:42 duplain * reformatted source. * * Revision 1.4 92/10/19 09:33:09 duplain * Added -x as an alternative to -u. * * Revision 1.3 92/10/01 11:21:39 duplain * Added -R option. * * Revision 1.2 92/09/30 10:27:29 duplain * Added logfile option and processing. * * Revision 1.1 92/09/29 18:02:20 duplain * Initial revision * */ #include #include #include #include #include "spark.h" /* BB changed next line */ /* #include "io.h" */ #include "nsparkio.h" #include "error.h" #include "misc.h" #include "arc.h" #include "unarc.h" #include "garble.h" #include "version.h" char *ourname; /* program name */ char *archive; /* name of archive file */ /* MU changed the default log filename for MSDOS */ #ifdef __MSDOS__ char *logfile = "settypes.inf"; /* default name for log file */ #else /* */ char *logfile = "settypes"; /* default name for log file */ #endif /* */ char **files; /* optional file arguments */ unsigned char unarc = 0; /* -u or -x or I */ unsigned char inffiles = 0; /* I */ unsigned char quiet = 0; /* -q */ unsigned char verbose = 0; /* -v */ unsigned char testing = 0; /* -t */ unsigned char listing = 0; /* -l */ unsigned char force = 0; /* -f */ unsigned char stamp = 1; /* -s */ unsigned char to_stdout = 0; /* -c */ unsigned char retry = 0; /* -R */ unsigned char apptype = 0; /* -T */ unsigned char singlecase = 0; /* -C */ #ifdef DEBUGGING unsigned char debugging = 0; /* -D */ #endif /* DEBUGGING */ void usage(void); int do_unarc(void); int do_arc(void); int main(int argc, char *argv[]) { register int i; /* BB extra switch indicator for command line parsing DOS allows switches like /a/b/c which enters as one `word' in argv. */ #ifdef __MSDOS__ int nextmaybeaswitch; #endif /* */ #ifdef DEBUGGING /* * check types are defined correctly for this machine (or compiler ???) */ if (sizeof(Word) != 4) { error("Word size != 4"); exit(1); } if (sizeof(Halfword) != 2) { error("Halfword size != 2"); exit(1); } if (sizeof(Byte) != 1) { error("Byte size != 1"); exit(1); } #endif /* DEBUGGING */ ourname = basename(*argv++); /* BB cosmetics for DOS: Strip extention .exe (or .com if somebody would like to compile nspark to a .com) from the ourname string. And convert it to lowercase. That way it looks better than ``NSPARK.EXE: error ...''. */ #ifdef __MSDOS__ /* For DOS prior to 3.0, argv[0] contains the NULL pointer. So substitute a `default'. */ if (!ourname) ourname = "nspark"; /* NB: stricmp == strcmpi == strcasecmp */ if (stricmp(&ourname[strlen(ourname) - 4], ".com") == 0 || stricmp(&ourname[strlen(ourname) - 4], ".exe") == 0) { /* We cannot write a '\0' into ourname because it points to argv[0]. And that may be in a read-only data segment. */ char *newname, *cp; if ((newname = (char *) malloc(strlen(ourname)) - 3) != NULL) { strncpy(newname, ourname, strlen(ourname) - 4); newname[strlen(ourname) - 4] = '\0'; ourname = newname; /* Allocated space will be released automatically at exit */ for (cp = ourname; *cp; cp++) if (isascii(*cp) && isupper(*cp)) *cp = tolower(*cp); } } #endif /* __MSDOS__ */ argc--; /* * parse args (can't use getopt() 'cos not all C libraries have it) */ while (argc) { int donext = 0; char *arg = *argv; /* BB changed next line */ /* if (*arg == '-') { */ #ifdef __MSDOS__ if (*arg == '-' || *arg == '/') { #else /* */ if (*arg == '-') { #endif /* __MSDOS__ */ char c; #ifdef __MSDOS__ /* BB first char following a switch may not be another switch */ nextmaybeaswitch = 0; #endif /* __MSDOS__ */ while (!donext && !isspace(c = *++arg) && c) { switch (c) { case 'u': case 'x': unarc = 1; break; case 't': testing++; unarc = 1; /* implied */ break; case 'l': listing++; unarc = 1; /* implied */ break; case 'q': quiet = 1; break; case 'v': verbose = 1; break; case 'c': to_stdout = 1; break; case 'f': force = 1; break; case 's': stamp = 0; break; case 'R': retry = 1; break; case 'V': fprintf(stderr, "%s v%s - maintained by %s - PUBLIC DOMAIN\n", ourname, VERSION, MAINTAINER); break; case 'T': apptype = 1; logfile = NULL; break; case 'C': singlecase = 1; break; case 'L': if (!apptype) { if (*++arg) logfile = arg; else if (--argc) logfile = *++argv; else usage(); } donext++; break; #ifdef DEBUGGING case 'D': debugging = 1; break; #endif /* DEBUGGING */ #ifdef __MSDOS__ /* BB DOS allows switches like /a/b/c */ case '/': if (nextmaybeaswitch && arg[1] != '/') break; else /* fall through to error message */ ; #endif /* __MSDOS__ */ case 'I': unarc = 1; inffiles = 1; break; case 'p': if (*++arg) set_password(arg); else if (--argc) set_password(*++argv); else usage(); donext++; break; default: error("unknown option '%c'", c); exit(1); } #ifdef __MSDOS__ /* BB We've had a valid switch, next char may be a / again */ nextmaybeaswitch = 1; #endif /* __MSDOS__ */ } argv++; argc--; } else break; } if (!argc) usage(); archive = *argv++; files = argv; if (unarc) i = do_unarc(); else i = do_arc(); exit(i); /* BB added next line */ return 0; /* Keep compiler happy. */ } /* * display program usage and exit */ void usage() { fprintf(stderr, "usage: %s [options] archive [file ... file]\n", ourname); fprintf(stderr, " where options are:\n"); fprintf(stderr, " -u or -x unarchive -t test archive integrity\n"); fprintf(stderr, " -l list archive contents -q quiet\n"); fprintf(stderr, " -f force file overwrite -s no filestamp\n"); fprintf(stderr, " -v verbose -V display version number\n"); fprintf(stderr, " -R retry if archive corrupt -L set logfile name\n"); fprintf(stderr, " -T append filetype to name -C create lowercase filenames\n"); /* MU added instuctions for the -I option */ fprintf(stderr, " -I unarchive with .inf files -p set password\n"); fprintf(stderr, " -c extract files to stdout\n"); exit(1); } nspark-1.7.8B2+git20210317.cb30779/main.h000066400000000000000000000021401402443176000167000ustar00rootroot00000000000000/* * global variable declarations * * $Header: main.h 1.4 92/12/08 $ * $Log: main.h,v $ * Revision 1.5 93/08/20 11:35:10 arb * Added reference to singlecase variable. * * Revision 1.4 92/12/08 10:19:54 duplain * Added reference to apptype variable. * * Revision 1.3 92/10/01 11:21:57 duplain * Added reference to retry variable. * * Revision 1.3 99/03/17 MU * Added inffiles * * Revision 1.2 92/09/30 10:27:42 duplain * Added logfile. * * Revision 1.1 92/09/29 18:02:36 duplain * Initial revision * */ #ifndef __MAIN_H #define __MAIN_H extern char *ourname; extern char *archive; extern char *logfile; extern char **files; extern unsigned char unarc; extern unsigned char inffiles; extern unsigned char quiet; extern unsigned char verbose; extern unsigned char testing; extern unsigned char listing; extern unsigned char force; extern unsigned char stamp; extern unsigned char retry; extern unsigned char apptype; extern unsigned char singlecase; extern unsigned char to_stdout; #ifdef DEBUGGING extern unsigned char debugging; #endif /* DEBUGGING */ #endif /* __MAIN_H */ nspark-1.7.8B2+git20210317.cb30779/man/000077500000000000000000000000001402443176000163615ustar00rootroot00000000000000nspark-1.7.8B2+git20210317.cb30779/man/arcfs.5000066400000000000000000000075031402443176000175520ustar00rootroot00000000000000.TH ARCFS 5 .SH NAME ArcFS \- Archive file format for the RISC OS ArcFS filesystem .SH CONVENTIONS Strings are given in ASCII with C-style escapes. No terminating \0 is present if not explicitly included. Words are 32 bit little-endian numbers. Half words are 16 bit little-endian numbers. This document describes format version 0, for ArcFS minimum versions 0.40 and 1.00, and version 0a, for ArcFS minimum versions 0.58 and 2.17. .SH FORMAT The file consists of a file header, a sequence of archive headers, then a sequence of compressed files. .SH FILE HEADER .I File string signature .br The string "Archive" followed by a zero byte. .I Header length .br Length of header info in bytes, one word, multiple of 36. .I Data offset .br Offset, in bytes, into archive at which data starts, one word. .I Read-only version .br Minimum read-only version required, multiplied by 100, one word. .I Read-write version .br Minimum read--write version required, multiplied by 100, one word. .I Reserved .br Reserved for future use, 68 bytes. .SH ARCHIVE HEADER The last header starts at 60+length of headers and ends at 96+length of headers. The format of each header is as follows. .I Info byte .br Object information byte, show compression method used: .nf 0x00 end of directory marker 0x01 object has been deleted 0x82 stored 0x83 packed 0x88 crunched 0xFF compressed .fi .I File name .br File name, 11 bytes. .I Full length .br Original file length, or 0xFFFFFFFF for a directory), one word. .I Load address .br Load address of the file, or 0xFFFFFFdd for a directory), one word. .I Exec address .br Exec address of the file, or 0xdddddddd for a directory), one word. File load and execution address may contain a filetype and datestamp as normal. Directories can be date-stamped, the number of centiseconds since the 1st January 1900 when the directory was created are given by &dddddddddd contained in the directory's load and execution addresses as shown above. Archives converted from spark(5) format using ArcConv will have the same full length, compressed length, load address and execute address as they had in the Spark archive. .I Attributes .br Attributes of the file, one word. Contains the number of bits compression for crunch and compress format files and the least significant bytes contains the standard RISC OS information on file access. .I Compressed length .br Length of compressed data, or 0xFFFFFFFF for a directory, one word. .I Information word .br The top bit (definitively) indicates whether the object is a file or a directory, 0 for a file, 1 for a directory. In the case of a file, the least significant 31 bits show the offset from the start of data at which the file data can be found. In the case of a directory, the least significant 31 bits show the offset from the start of headers (96) at which the next object in this directory can be found, the following object being the first in the sub-directory. .SH FORMAT VERSION 0a This archive format is backwards compatible with versions 0.40 and 1.00, the only difference being that there is a block of catalogue information immediately prior to the start of each file's data as described below. Note that this information is there to aid the recovery of most files in the event of archive corruption and is not used by ArcFS. Note, also that Compact and Autocompact in release versions 1.09, 2.02 and 2.11 will compact out the catalogue information blocks, so try to avoid writing to new archives with old versions of ArcFS. .nf .I Marker A marker to indicate the start of a file, the string "FileData", not terminated. .I Info byte .br One byte, as above. .I Leaf name .br The file name, 11 bytes. .I Full length .br One word, as above. .I Load address .br One word, as above. .I Exec address .br One word, as above. .I Attributes .br One word, as above. .SH SEE ALSO spark(5), nspark(1) nspark-1.7.8B2+git20210317.cb30779/man/arcfs5.txt000066400000000000000000000121701402443176000203060ustar00rootroot00000000000000 ARCFS(5) FILE FORMATS ARCFS(5) NAME ArcFS - Archive file format for the RISC OS ArcFS filesystem CONVENTIONS Strings are given in ASCII with C-style escapes. No ter- minating is present if not explicitly included. Words are 32 bit little-endian numbers. Half words are 16 bit little-endian numbers. This document describes format version 0, for ArcFS minimum versions 0.40 and 1.00, and version 0a, for ArcFS minimum versions 0.58 and 2.17. FORMAT The file consists of a file header, a sequence of archive headers, then a sequence of compressed files. FILE HEADER _F_i_l_e _s_t_r_i_n_g _s_i_g_n_a_t_u_r_e The string "Archive" followed by a zero byte. _H_e_a_d_e_r _l_e_n_g_t_h Length of header info in bytes, one word, multiple of 36. _D_a_t_a _o_f_f_s_e_t Offset, in bytes, into archive at which data starts, one word. _R_e_a_d-_o_n_l_y _v_e_r_s_i_o_n Minimum read-only version required, multiplied by 100, one word. _R_e_a_d-_w_r_i_t_e _v_e_r_s_i_o_n Minimum read--write version required, multiplied by 100, one word. _R_e_s_e_r_v_e_d Reserved for future use, 68 bytes. ARCHIVE HEADER The last header starts at 60+length of headers and ends at 96+length of headers. The format of each header is as fol- lows. _I_n_f_o _b_y_t_e Object information byte, show compression method used: 0x00 end of directory marker Sun Release 4.1 Last change: 1 ARCFS(5) FILE FORMATS ARCFS(5) 0x01 object has been deleted 0x82 stored 0x83 packed 0x88 crunched 0xFF compressed _F_i_l_e _n_a_m_e File name, 11 bytes. _F_u_l_l _l_e_n_g_t_h Original file length, or 0xFFFFFFFF for a directory), one word. _L_o_a_d _a_d_d_r_e_s_s Load address of the file, or 0xFFFFFFdd for a directory), one word. _E_x_e_c _a_d_d_r_e_s_s Exec address of the file, or 0xdddddddd for a directory), one word. File load and execution address may contain a filetype and datestamp as normal. Directories can be date-stamped, the number of centiseconds since the 1st January 1900 when the directory was created are given by &dddddddddd contained in the directory's load and execution addresses as shown above. Archives converted from spark(5) format using ArcConv will have the same full length, compressed length, load address and execute address as they had in the Spark archive. _A_t_t_r_i_b_u_t_e_s Attributes of the file, one word. Contains the number of bits compression for crunch and compress format files and the least significant bytes contains the standard RISC OS information on file access. _C_o_m_p_r_e_s_s_e_d _l_e_n_g_t_h Length of compressed data, or 0xFFFFFFFF for a directory, one word. _I_n_f_o_r_m_a_t_i_o_n _w_o_r_d The top bit (definitively) indicates whether the object is a file or a directory, 0 for a file, 1 for a directory. In the case of a file, the least significant 31 bits show the offset from the start of data at which the file data can be found. In the case of a directory, the least significant 31 bits Sun Release 4.1 Last change: 2 ARCFS(5) FILE FORMATS ARCFS(5) show the offset from the start of headers (96) at which the next object in this directory can be found, the following object being the first in the sub-directory. FORMAT VERSION 0a This archive format is backwards compatible with versions 0.40 and 1.00, the only difference being that there is a block of catalogue information immediately prior to the start of each file's data as described below. Note that this information is there to aid the recovery of most files in the event of archive corruption and is not used by ArcFS. Note, also that Compact and Autocompact in release versions 1.09, 2.02 and 2.11 will compact out the catalogue informa- tion blocks, so try to avoid writing to new archives with old versions of ArcFS. _M_a_r_k_e_r A marker to indicate the start of a file, the string "FileData", not terminated. _I_n_f_o _b_y_t_e One byte, as above. _L_e_a_f _n_a_m_e The file name, 11 bytes. _F_u_l_l _l_e_n_g_t_h One word, as above. _L_o_a_d _a_d_d_r_e_s_s One word, as above. _E_x_e_c _a_d_d_r_e_s_s One word, as above. _A_t_t_r_i_b_u_t_e_s One word, as above. SEE ALSO spark(5), nspark(1) Sun Release 4.1 Last change: 3 nspark-1.7.8B2+git20210317.cb30779/man/nspark.1000066400000000000000000000074021402443176000177440ustar00rootroot00000000000000.TH NSPARK 1 "\*(V)" "USER COMMANDS" .SH NAME nspark \- unpack Archimedes archives .SH SYNOPSIS .B nspark [ .B options ] archive [ .B file ... ] .SH DESCRIPTION The current version of .B nspark is 1.7.8 .B Nspark can unpack the specified Archimedes-format .B archive, list its contents or tests its integrity. Nspark's main features are: o Supports all archive methods used by !Spark 1 and 2. The old version didn't support "Squashing" and used to handle "Compressed" archives by using the UNIX uncompress program. The new version supports both these and has them built-in, allowing easier porting to other OS's. o Supports ArcFS format archives. o Supports Cyclic Redundancy Checking (CRC). The integrity of an archive can now be checked without having to unarchive it. o Supports verbose option to allow archive file details to be displayed (time/date or exec/load address, size, type). o Supports selective file unarchiving, so the whole archive needn't be unarchived if not all the files are wanted). o Supports user-prompting before overwriting a file, allowing the user to either (1) overwrite the file, (2) overwrite all the files, (3) unarchive the file to a different name, or (4) not to unarchive the file at all. o Supports file-stamping so the date and time of the file, when unarchived, matches the date and time it was archived (not 4.2BSD or SysV.2 as these systems lack vital library functions). I have not included support for creating !Spark archives, and I am not really sure if I need to as: (1) !Spark for RISC OS is cheap (#5.99 from David Pilling), (2) !SparkPlug can unpack archives created with zip (which is available in source form for UNIX, VMS and MSDOS), and (3) it's a lot of work. Let me know what you think. .I Options: .IP "-x" 10 Extract the given .B file, or all files if none are specified. .IP "-u" 10 Equivalent to -x. .IP "-t" 10 Test archive integrity by simulating extraction and checking the CRCs (Cyclic Redundancy Checks). .IP "-l" 10 List archive contents. .IP "-q" 10 Quiet. Displays less information when listing, testing or extracting. .IP "-f" 10 Force file overwrite if a file already exists with the same name as the one being extracted. If not using -f then you are prompted whether you want to overwrite the original, skip this file, give it a different name, or overwrite this and all others that already exist. .IP "-s" 10 No filestamp. Does not set the timestamp when extracting files. .IP "-v" 10 Verbose. Gives full details when listing or extracting archives. .IP "-p" 10 Password. Specifies the password used to garble the archive. .IP "-R" 10 Retry if archive is corrupt. If a bad header is found then nspark will search the archive until another header if found, rather than giving up. .IP "-L" 10 Set name of log file to .B name. .IP "-T" 10 Append file type to name, in the same way as Tar or NFS. For example Text files (filetype &FFF) have ,fff appended when extracted. .IP "-C" 10 Create lowercase filenames. Useful on machines where the case of filenames is significant (eg. UNIX), this option forces all extracted filenames to be lowercase. .IP "-V" 10 Display version number. .SH BUGS The DOS version does not time/date stamp directories. .SH NOTES .B Nspark is in the public domain. It is currently being maintained by James Woodcock (james_woodcock@yahoo.co.uk). .SH SEE ALSO arcfs(5), spark(5). .SH AUTHOR Andy Duplain, BT Customer Systems, Brighton, UK. (duplain@btcs.bt.co.uk) .SH CONTRIBUTORS Improvements from version 1.5, including ArcFS support, by Andrew Brooks (arb@compl.ancs.ac.uk). Manual pages originally supplied by Duncan (m91dps@ecs.oxford.ac.uk). Suggestions for improvement by Tom Tromey (tromey@busco.lanl.gov). Windows NT support by Alun Jones (auj@aber.ac.uk). Previously maintained by arb (arb@comp.lancs.ac.uk). nspark-1.7.8B2+git20210317.cb30779/man/nspark1.txt000066400000000000000000000114061402443176000205030ustar00rootroot00000000000000NSPARK(1) NSPARK(1) NNAAMMEE nspark - unpack Archimedes archives SSYYNNOOPPSSIISS nnssppaarrkk [ ooppttiioonnss ] archive [ ffiillee ...... ] DDEESSCCRRIIPPTTIIOONN The current version of nnssppaarrkk is 1.7.8 NNssppaarrkk can unpack the specified Archimedes-format aarrcchhiivvee,, list its contents or tests its integrity. Nspark's main features are: o Supports all archive methods used by !Spark 1 and 2. The old version didn't support "Squashing" and used to handle "Compressed" archives by using the UNIX uncompress program. The new version supports both these and has them built-in, allowing easier porting to other OS's. o Supports ArcFS format archives. o Supports Cyclic Redundancy Checking (CRC). The integrity of an archive can now be checked without having to unarchive it. o Supports verbose option to allow archive file details to be displayed (time/date or exec/load address, size, type). o Supports selective file unarchiving, so the whole archive needn't be unarchived if not all the files are wanted). o Supports user-prompting before overwriting a file, allowing the user to either (1) overwrite the file, (2) overwrite all the files, (3) unarchive the file to a different name, or (4) not to unarchive the file at all. o Supports file-stamping so the date and time of the file, when unar- chived, matches the date and time it was archived (not 4.2BSD or SysV.2 as these systems lack vital library functions). I have not included support for creating !Spark archives, and I am not really sure if I need to as: (1) !Spark for RISC OS is cheap (#5.99 from David Pilling), (2) !SparkPlug can unpack archives created with zip (which is available in source form for UNIX, VMS and MSDOS), and (3) it's a lot of work. Let me know what you think. _O_p_t_i_o_n_s_: -x Extract the given ffiillee,, or all files if none are specified. -u Equivalent to -x. -t Test archive integrity by simulating extraction and checking the CRCs (Cyclic Redundancy Checks). -l List archive contents. -q Quiet. Displays less information when listing, testing or extracting. -f Force file overwrite if a file already exists with the same name as the one being extracted. If not using -f then you are prompted whether you want to overwrite the original, skip this file, give it a different name, or overwrite this and all others that already exist. -s No filestamp. Does not set the timestamp when extracting files. -v Verbose. Gives full details when listing or extracting archives. -p Password. Specifies the password used to garble the archive. -R Retry if archive is corrupt. If a bad header is found then nspark will search the archive until another header if found, rather than giving up. -L Set name of log file to nnaammee.. -T Append file type to name, in the same way as Tar or NFS. For example Text files (filetype &FFF) have ,fff appended when extracted. -C Create lowercase filenames. Useful on machines where the case of filenames is significant (eg. UNIX), this option forces all extracted filenames to be lowercase. -V Display version number. BBUUGGSS The DOS version does not time/date stamp directories. NNOOTTEESS NNssppaarrkk is in the public domain. It is currently being maintained by James Woodcock (james_woodcock@yahoo.co.uk). SSEEEE AALLSSOO arcfs(5), spark(5). AAUUTTHHOORR Andy Duplain, BT Customer Systems, Brighton, UK. (duplain@btcs.bt.co.uk) CCOONNTTRRIIBBUUTTOORRSS Improvements from version 1.5, including ArcFS support, by Andrew Brooks (arb@compl.ancs.ac.uk). Manual pages originally supplied by Duncan (m91dps@ecs.oxford.ac.uk). Suggestions for improvement by Tom Tromey (tromey@busco.lanl.gov). Windows NT support by Alun Jones (auj@aber.ac.uk). Previously maintained by arb (arb@comp.lancs.ac.uk). USER COMMANDS NSPARK(1) nspark-1.7.8B2+git20210317.cb30779/man/spark.5000066400000000000000000000052771402443176000176020ustar00rootroot00000000000000.TH SPARK(5) .SH NAME spark \- Archive file format for RISC OS version of the PC archiver Arc .SH CONVENTIONS Strings are given in ASCII with C-style escapes. No terminating \0 is present if not explicitily included. Words are 32 bit little-endian numbers. Half words are 16 bit little-endian numbers. .SH FORMAT An archive file consists of a sequence of archive marker, archive header and file data, ie. marker1, header1, data1, marker2, header2, data2, etc. The archive marker is a single byte of value 0x1a (26). The archive finishes with an archive marker followed by a zero byte. .I Header version number .br This tells you how the file data is stored and how many bytes there are in the header. The header version numbers for the PC, are detailed below. An Archimedes header version number is identical to the corresponding PC number except it has bit 7 set. .nf 1 Old style, no compression 2 New style, no compression 3 Compression of repeated characters only (RLE) 4 As 3 plus Huffman Squeezing 5 Lempel-Ziv packing of repeated strings (old style) 6 Lempel-Ziv packing of repeated strings (new style) 7 Lempel-Ziv Welch packing with improved hash function 8 Dynamic Lempel-Ziv packing with adaptive reset 9 PKARC style squashing 127 Un*x compression .fi .I Filename .br 14 bytes of name, zero terminated. .I Compressed length .br Compressed data length, one word. .I Date .br One half-word, date. .nf year = (date >> 9) & 0x7f; month = (date >> 5) & 0x0f; day = date & 0x1f; .fi .I Time .br One half-word, time. .nf hour = (time >> 11) & 0x1f; minute = (time >> 5) & 0x3f; second = (time & 0x1f) * 2; .fi The time and date fields are always filled in. If the file has a load and exec address, these are the time and date when the file was added to the archive otherwise, they are derived from the Archimedes datestamp. In all extract operations on Archimedes format archives, the contents of the load and exec fields take precedence. .I CRC .br One half-word, Cyclic Redundancy Check. .I Original file length .br Original file length, one word, only present if header type greater than 1. .I Load address .br Load address of the file, one word, only present if bit-7 of the header version number is set. .I Exec address .br Exec address of the file, one word, only present if bit-7 of the header version number is set. .I Attributes .br Attributes of the file, one word, only present if bit-7 of the header version number is set. .I Compressed data... .br Directories are stored as non-compressed archives within archives, ie. their load address & 0xffffff00=0xfffddc. .SH COMPATIBILITY PC and Archimedes formats may be mixed in one archive for use on the Archimedes. .SH SEE ALSO arcfs(5), nspark(1) nspark-1.7.8B2+git20210317.cb30779/man/spark5.txt000066400000000000000000000070521402443176000203330ustar00rootroot00000000000000 SPARK(5)() MISC. REFERENCE MANUAL PAGES SPARK(5)() NAME spark - Archive file format for RISC OS version of the PC archiver Arc CONVENTIONS Strings are given in ASCII with C-style escapes. No ter- minating is present if not explicitily included. Words are 32 bit little-endian numbers. Half words are 16 bit little-endian numbers. FORMAT An archive file consists of a sequence of archive marker, archive header and file data, ie. marker1, header1, data1, marker2, header2, data2, etc. The archive marker is a sin- gle byte of value 0x1a (26). The archive finishes with an archive marker followed by a zero byte. _H_e_a_d_e_r _v_e_r_s_i_o_n _n_u_m_b_e_r This tells you how the file data is stored and how many bytes there are in the header. The header version numbers for the PC, are detailed below. An Archimedes header version number is identical to the corresponding PC number except it has bit 7 set. 1 Old style, no compression 2 New style, no compression 3 Compression of repeated characters only (RLE) 4 As 3 plus Huffman Squeezing 5 Lempel-Ziv packing of repeated strings (old style) 6 Lempel-Ziv packing of repeated strings (new style) 7 Lempel-Ziv Welch packing with improved hash function 8 Dynamic Lempel-Ziv packing with adaptive reset 9 PKARC style squashing 127 Un*x compression _F_i_l_e_n_a_m_e 14 bytes of name, zero terminated. _C_o_m_p_r_e_s_s_e_d _l_e_n_g_t_h Compressed data length, one word. _D_a_t_e One half-word, date. year = (date >> 9) & 0x7f; month = (date >> 5) & 0x0f; day = date & 0x1f; _T_i_m_e One half-word, time. hour = (time >> 11) & 0x1f; Sun Release 4.1 Last change: 1 SPARK(5)() MISC. REFERENCE MANUAL PAGES SPARK(5)() minute = (time >> 5) & 0x3f; second = (time & 0x1f) * 2; The time and date fields are always filled in. If the file has a load and exec address, these are the time and date when the file was added to the archive otherwise, they are derived from the Archimedes datestamp. In all extract opera- tions on Archimedes format archives, the contents of the load and exec fields take precedence. _C_R_C One half-word, Cyclic Redundancy Check. _O_r_i_g_i_n_a_l _f_i_l_e _l_e_n_g_t_h Original file length, one word, only present if header type greater than 1. _L_o_a_d _a_d_d_r_e_s_s Load address of the file, one word, only present if bit-7 of the header version number is set. _E_x_e_c _a_d_d_r_e_s_s Exec address of the file, one word, only present if bit-7 of the header version number is set. _A_t_t_r_i_b_u_t_e_s Attributes of the file, one word, only present if bit-7 of the header version number is set. _C_o_m_p_r_e_s_s_e_d _d_a_t_a... Directories are stored as non-compressed archives within archives, ie. their load address & 0xffffff00=0xfffddc. COMPATIBILITY PC and Archimedes formats may be mixed in one archive for use on the Archimedes. SEE ALSO arcfs(5), nspark(1) Sun Release 4.1 Last change: 2 nspark-1.7.8B2+git20210317.cb30779/man/sqsh.1000066400000000000000000000012061402443176000174200ustar00rootroot00000000000000.TH SQSH 1 "2021-03-05" "USER COMMANDS" .SH NAME sqsh \- decompress RISC OS Squash files .SH SYNOPSIS .B sqsh .RI [ options ] file .SH DESCRIPTION .B sqsh can unpack files created by the RISC OS Squash utility. .SH OPTIONS .IP "-c" 10 Decompress to stdout. .IP "-f" 10 Force file overwrite if a file already exists with the same name as the one being extracted. If not using -f then you are prompted whether you want to overwrite the original, skip this file, give it a different name, or overwrite this and all others that already exist. .IP "-s" 10 No filestamp. Does not set the timestamp when extracting files. .SH SEE ALSO .BR nspark(1) nspark-1.7.8B2+git20210317.cb30779/misc.c000066400000000000000000000172501402443176000167120ustar00rootroot00000000000000 /* * miscellaneous functions * * Revision 1.14 99/03/17 MU * Also capitilised the hexadecimal output strings. * * $Header: misc.c 1.12 95/08/01 $ * $Log: misc.c,v $ * Revision 1.13 95/08/01 xx:xx:xx BB * Fixed for Borland C/C++ * Made inlist() case insensitive (DOS only) because DOS filenames are case * insensitive. * Made basename safe for null-strings. * * Revision 1.12 92/12/22 09:54:29 duplain * Changed #include to #include . * * Revision 1.11 92/12/09 09:42:36 duplain * Simplified append_type(). Changed append_type() to append lowercase types. * * Revision 1.10 92/12/08 10:20:07 duplain * Added append_type(). * * Revision 1.9 92/12/07 17:18:58 duplain * reformatted source. * * Revision 1.8 92/11/12 09:03:30 duplain * Fixed bug with realloc() size in uplevel(). * * Revision 1.7 92/11/06 12:42:28 duplain * Changed print_details() so it supports PC archive headers correctly. * * Revision 1.6 92/11/04 16:56:14 duplain * Added check for PC archive header in print_header(). * * Revision 1.5 92/10/09 18:06:58 duplain * Added "+1" to malloc() call in riscos_path()... SCO UNIX was quiet right * to core dump :-) * * Revision 1.4 92/10/07 10:56:39 duplain * Added check for SYSV2 when including . Made riscos_path() compile * for non-RISCOS systems only. * * Revision 1.3 92/10/06 12:12:29 duplain * Removed reference to date->csecond in print_details(). * * Revision 1.2 92/09/30 10:26:58 duplain * Fixed basename(). Added riscos_path(). * * Revision 1.1 92/09/29 18:02:21 duplain * Initial revision * */ #include #include #include #include "spark.h" #include "main.h" #include "date.h" #include "misc.h" #include "error.h" /* * return last element in pathname */ char * basename(char *s) { /* BB changed next line to cope with null-pointers. (IRIX's strlen() produces a coredump when s == NULL). */ /* char *cptr = s + strlen(s); */ char *cptr; if (!s) return NULL; cptr = s + strlen(s); while (cptr > s) { if (*cptr == PATHSEP) return (++cptr); cptr--; } return (s); } #if defined(RISCOS) #define DOTARC "_arc" #define DOT '_' #else /* not RISCOS */ #define DOTARC ".arc" #define DOT '.' #endif /* RISCOS */ /* * append ".arc" ("_arc" in RISCOS) to a string, if an extension doesn't * already exist, and return the new string. */ char * name_dot_arc(char *s) { static char *newname = NULL; /* * check that there's room for the extension */ if (strlen(basename(s)) + sizeof(DOTARC) - 1 > FILENAMELEN) return (s); /* * free previous allocation (hope it's finished with :-/) */ if (newname) free(newname); newname = malloc(strlen(s) + sizeof(DOTARC)); if (!newname) return (s); /* don't complain */ strcpy(newname, s); strcat(newname, DOTARC); return (newname); } /* * turn a local-host pathname into a RISC OS path */ #ifndef RISCOS char * riscos_path(register char *s) { static char *riscosname = NULL; register char *cptr; if (riscosname) free(riscosname); riscosname = malloc(strlen(s) + 1); if (!riscosname) return (NULL); for (cptr = riscosname; *s; s++, cptr++) if (*s == PATHSEP) *cptr = '.'; else *cptr = *s; *cptr = '\0'; return (riscosname); } #endif /* RISC OS */ static char *pathname = NULL; /* * uplevel() and downlevel() maintain the pathname as directories are found * within the archive */ char * uplevel() { register char *cptr; register int olen, nlen; if (!pathname) return (NULL); olen = strlen(pathname); cptr = pathname + olen - 1; while (cptr > pathname) if (*cptr == PATHSEP) { *cptr = '\0'; break; } else cptr--; if (cptr == pathname) { free(pathname); pathname = NULL; } else { nlen = strlen(pathname); if (nlen < olen) pathname = realloc(pathname, nlen + 1); } return (pathname); } char * downlevel(char *filename) { register int len, flen; if (!pathname) len = 0; else len = strlen(pathname); flen = strlen(filename); if (!len) { pathname = malloc(flen + 1); if (pathname) strcpy(pathname, filename); } else { pathname = realloc(pathname, len + flen + 2); if (pathname) { strcat(pathname, PATHSEPSTR); strcat(pathname, filename); } } return (pathname); } char * get_comp_desc(Byte comptype) { switch (comptype & ~ARCHPACK) { case CT_NOTCOMP: case CT_NOTCOMP2: return "Stored"; case CT_PACK: return "Packed"; case CT_CRUNCH: return "Crunched"; case CT_SQUASH: return "Squashed"; case CT_COMP: return "Compressed"; default: return "Unknown"; } return "Unknown"; } /* * print archive file details (size, data and time) */ void print_details(Header *header) { Date *date; if (!header) return; if (header->comptype & ARCHPACK) { /* Archimedes archive header */ /* BB changed constants in next line to long */ if ((header->load & (Word) 0xfff00000l) == (Word) 0xfff00000l) { /* time stamp valid */ date = makedate(header); msg("%8ld %02d-%s-%04d %02d:%02d:%02d &%03X %s", (long)header->origlen, date->day, monthname(date->month), date->year + 1900, date->hour, date->minute, date->second, (header->load >> 8) & 0xfff, get_comp_desc(header->comptype)); } else { /* load/exec only */ /* BB added long to first format in next line. Header.origlen is a Word (i.e. a long) */ #ifdef __MSDOS__ msg("%8ld &%08lX &%08lX ---- %s", header->origlen, #else msg("%8d &%08lX &%08lX ---- %s", header->origlen, #endif /* __MSDOS__ */ (long)header->load, (long)header->exec, get_comp_desc(header->comptype)); } } else { /* PC archive header */ date = makedate(header); msg("%8ld %02d-%s-%02d %02d:%02d:%02d ---- %s", (long)header->origlen, date->day, monthname(date->month), date->year + 1900, date->hour, date->minute, date->second, get_comp_desc(header->comptype)); } } /* * Test if the given filename matches any of the names specified in the * command line "files list". This function is also used to test if a given * pathname is contained in the any of the names given in the "files list". * * Returns non-zero if filename matches, or no "files list" exists. */ int inlist(char *filename) { register int len = strlen(filename); register char **filelist = files; if (!*filelist) return (1); /* no "files list" */ while (*filelist) #ifdef __MSDOS__ if (strnicmp(filename, *filelist++, len) == 0) #else if (strncmp(filename, *filelist++, len) == 0) #endif /* __MSDOS__ */ return (1); return (0); } /* * append the file's type to the end if it's name * (this function assumes that enough storage is available in the argument * "filename" to store the additional characters ",XXX") */ /* BB: For DOS, a comma is of no use. So changed that into a dot. */ int append_type(Header *header, char *filename) { char append[sizeof(",xxx")]; /* BB changed constants in next line to long. */ if ((header->load & (Word) 0xfff00000l) == (Word) 0xfff00000l) { /* valid time-stamp */ #ifdef __MSDOS__ sprintf(append, ".%03X", (header->load >> 8) & 0xfff); #else sprintf(append, ",%03X", (header->load >> 8) & 0xfff); #endif /* __MSDOS__ */ strcat(filename, append); return (0); } return (-1); } #ifdef DEBUGGING /* * print archive file header info */ void print_header(Header *header) { if (!header) return; debug("comptype=0X%X name=%s complen=%lu date=0X%X time=0X%X\n", header->comptype, header->name, header->complen, header->date, header->time); debug("crc=0X%X origlen=%lu load=0X%lX exec=0X%lX attr=0x%lX\n", header->crc, header->origlen, header->load, header->exec, header->attr); } #endif /* DEBUGGING */ nspark-1.7.8B2+git20210317.cb30779/misc.h000066400000000000000000000015771402443176000167240ustar00rootroot00000000000000/* * miscellaneous function prototypes * * $Header: misc.h 1.4 92/12/08 $ * $Log: misc.h,v $ * Revision 1.4 92/12/08 10:20:19 duplain * Added append_type() prototype. * * Revision 1.3 92/10/07 10:57:23 duplain * Added "#define riscos_path" for RISCOS systems. * * Revision 1.2 92/09/30 10:27:19 duplain * Added riscos_path(). * * Revision 1.1 92/09/29 18:02:38 duplain * Initial revision * */ #ifndef __MISC_H #define __MISC_H char *basename(char *s); char *name_dot_arc(char *s); #ifndef RISCOS char *riscos_path(char *s); #else /* RISC OS */ #define riscos_path(s) s #endif /* not RISC OS */ char *uplevel(void); char *downlevel(char *filename); void print_details(Header *header); int inlist(char *filename); int append_type(Header *header, char *filename); #ifdef DEBUGGING void print_header(Header *header); #endif /* DEBUGGING */ #endif /* __MISC_H */ nspark-1.7.8B2+git20210317.cb30779/msdos.c000066400000000000000000000040611402443176000171000ustar00rootroot00000000000000 /* * Operating System specific function (DOS) * * $Header: msdos.c 1.0 95/07/21 $ * $Log: msdos.c,v $ * Revision 1.0 95/07/21 xx:xx:xx BB * Initial revision, based on winnt.c. * */ #include "spark.h" #include "date.h" #include #ifdef __WATCOMC__ #include #else #include #endif #include #include #include /* for memset */ #include "os.h" /* * return the length of a file */ Word filesize(char *pathname) { struct stat statb; if (stat(pathname, &statb) < 0) return 0; return (Word) statb.st_size;; } /* * test for the existance of a file or directory */ Ftype exist(char *pathname) { struct stat statb; if (stat(pathname, &statb) < 0) return NOEXIST; if (statb.st_mode & S_IFDIR) return ISDIR; return (ISFILE); } /* * make a directory */ int makedir(char *pathname) { return mkdir(pathname); } /* * stamp a file with date and time */ int filestamp(Header *header, char *filename) { Date *date; struct tm tm; struct utimbuf utimbuf; time_t filetime; /* BB: DOS utime() cannot stamp directories. It could be done by directly editing the directory entries (simulate a disc editor) but since e.g. pkunzip does not stamp extracted directories either, I did not bother and kept the next line from winnt.c. ``It is left as an exercice to the interested reader.'' NB: Do not forget to stamp the . entry in the directory itself! */ if (exist(filename) == ISDIR) return (0); if ((header->load & (Word) 0xfff00000UL) != (Word) 0xfff00000UL) return (0); /* not a timestamp */ memset((char *) &tm, '\0', sizeof(tm)); /* Borland C/C++ 4 is `a bit fuzzy' about the next line 8-( */ /* if (!(date = makedate(header))) */ if ((date = makedate(header)) == 0) return (-1); tm.tm_sec = date->second; tm.tm_min = date->minute; tm.tm_hour = date->hour; tm.tm_mday = date->day; tm.tm_mon = date->month - 1; tm.tm_year = date->year; filetime = mktime(&tm); utimbuf.actime = filetime; utimbuf.modtime = filetime; return (utime(filename, &utimbuf)); } nspark-1.7.8B2+git20210317.cb30779/msdos/000077500000000000000000000000001402443176000167335ustar00rootroot00000000000000nspark-1.7.8B2+git20210317.cb30779/msdos/README000066400000000000000000000227061402443176000176220ustar00rootroot00000000000000nspark 1.7.6 dos-beta ===================== The DOS port of nspark. Read the README file in the nspark directory first. Requirements: DOS 2.0 or higher, 3.31 or higher recommended 450k of free memory. Changes with respect to the other versions: The DOS version of nspark recognizes / as a command switch as well as the unix/RISC OS -. (In fact -x/v is a valid sequence of switches, as is /x -v though /x-v is not.) Filenames for extraction are made case insensitive, but there is no conversion to the DOS 8.3 characters convention. I.e. nspark -x archive.spk SomeFiles/Text is the same as nspark /x archive.spk somefiles/text but not as: nspark /x archive.spk somefile/text (though files would end up in the same directory `somefile'). Contents of this directory: README : this text nspark.exe : the DOS executable makefile : generic makefile, derived from the general makefile with provisions for use of PKLITE or LZEXE to compress the generated executable. makefile.bor : makefile for Borland C/C++ derived from nspark.prj (Preferably use this version in stead of makefile and optionally apply PKLITE or LZEXE by hand.) nspark.prj : Borland 3.1 project file nspark.ide : Borland 4 project file alt/compress.c : alternative version of compress.c (see below) alt/haspragm.c : test whether #pragma startup is supported (called by makefile). alt/makefile.bor: makefile for alternative version alt/nspark.prj : Borland 3.1 project file for alternative version alt/nspark.ide : Borland 4 project file for alternative version Compilation/porting: The current version has been compiled with Borland C/C++ versions 1, 3.1 and 4.02. I do not have access to a Microsoft C/C++ compiler, so I cannot test whether it will compile with that compiler too. Some changes will probably be necessary. All changes for DOS are enclosed by the preprocessor macro __MSDOS__ (predefined by the Borland preprocessor). This makes things more transparent than when it was enclosed by #if defined(__BORLANDC__) || defined(__TURBOC__)/#endif pairs. So compile with -D__MSDOS__ if your compiler does not predefine this macro. These changes only apply for 16 bits compilers. See below for 32 bits/protected mode compilers. (Hardly any changes are necessary in that case.) Note that the paths in the makefiles are likely to be wrong for other computers than my own. So change those before compiling. Or change the configuration files into response files and use separate turboc.cfg and tlink.cfg files. (The disadvantage of the latter is that there may be more options specified in the .cfg files that are not needed/unwanted for nspark.) Things to look for when compiling: Names of header files: io.h is a header file under Borland C/C++. And it is needed for this application because it contains the read() function. The original nspark also had a header file io.h. This would not be a problem (#include "io.h" and #include can happily coexist) but for the fact that both headers define the macro __IO_H to indicate that they have been `seen'. So I changed the name to nsparkio.h. The same problem may occur for os.h with other compilers. Memory model: The supplied version is compiled under the compact memory model. It is recommended to use either the compact or the large memory model, because of the amount of dynamic data. (There is not so much code, therefore the compact model is most suited.) Because farcalloc() is used to allocate the large arrays for the tables needed in uncompress(), the program could be compiled using the small and medium memory model, but this restricts the space for filenames and pathnames. Though the manual states that farcalloc() cannot not be used with the tiny memory model, it IS possible to compile the program in .COM format. And though it saves a few kbytes on the size of the executable, it restricts the available space for dynamic data even more. 16 bit vs. 32 bit: DOS integers are 16 bit! That means that 32768 == 65536 == (1 << 16) == 0. The result of a constant being considered 0 can be hard to spot. So use long or unsigned long constants when appropriate: 32768L != 0 != 65536UL etc. ...printf() and ...scanf() format specifiers should also be long when appropriate. long l; /* ... */ printf("%d",l); will only print the value of the lower two bytes of l and the other two will appear in the next %d. I.e.: long l,m; /* ... */ printf("%d %d\n",l,m); and: printf("%d %d\n", (int) l, *(int*) ((char *)&l + 2) ); produce the same output. (m is never used.) Use %ld or %lu. Again, the effect in e.g. a ...scanf() can be very hard to spot. Characters are passed to functions as integers. This produced quite a lot of warnings (`conversion may loose significant digits') in the uncompress() routines where code_ints (longs) are used to represent character data. A cast solves this, but these warnings may point to bigger problems. Segmented pointers and pointer arithmetic: DOS pointers consist of two parts: a segment and an offset. (The absolute address is obtained by segment * 16 + offset.) Both parts are 16 bit quantities. Under `normal' operations, pointer arithmetic is restricted to the offset part. This means that a pointer (or an array for that matter) can only accommodate 64k of memory. I.e.: double * dp ; /* ... */ dp == &dp[8192]; and &dp[1] == &dp[8193]; etc. (Large numbers? uncompress() uses unsigned long htab[65536L]; or 256k of memory for one array!) This can be overcome by using normalized or `huge' pointers. With these pointers, the segment part gets updated every time the offset becomes greater than 16 (or less than 0). The drawback obviously is some loss in speed. Also, when comparing or subtracting two pointers, both should either come from the same array or be normalized, otherwise the results of pointer arithmetic are undefined. Static arrays: Under the Borland compiler, static arrays are REALLY static. That is, they are part of the executable. The function uncompress() in nspark uses two large static arrays for the uncompression process. Were these static (as in the unix versions), the executable would contain 384k of `empty space'. So I changed that to dynamically allocated arrays. If you DO want these static arrays, compile with the macro BB_HUGE_STATIC_ARRAYS defined. (See compress.c). Compression afterwards with e.g. PKLITE or LZEXE is highly recommended in this case. To correspond more to the unix way of dynamically allocating static arrays, there is an alternative form of compress.c in the directory alt. In that version the memory is allocated by a function that is called before main() itself by using #pragma startup. I do not expect that all compilers support this pragma, so I added it as an alternative. The program haspragm.c is compiled and called in the accompanying makefile to verify that this pragma really is present. The advantage of this approach is that a lack of memory is spotted before anything else happens. Otherwise the program may already have produced some output before it spots the lack of memory. This can be confusing for the user. The executable supplied is compiled with this alternative form. 32 bits & protected mode. The present version is a 16 bit version. It should run on all DOS machines with sufficient memory. When compiling a protected mode version with a 32 bits compiler (like djgpp, the DOS port of the gnu compiler), hardly any porting is needed. But you end up with a version that will only run on 386 systems or better. Bugs/problems/improvements: Bugs: None that I know of at the moment. Problems: DOS does not allow easy time/date stamping of directories. (To do so would mean editing the directory `file' itself, i.e. emulating the action of a disc editor.) Since no other archivers I know of do time/date stamp newly created directories and utilities like Norton FD or DR-DOS's TOUCH cannot do so either, I did not bother to implement this. ``It is left as an exercise for the interested reader.'' NB: If you DO want to implement this, do not forget to stamp the . entry inside the directory itself and the .. entry in any subdirectories as well! Unlike unix, these are no (pseudo) links but separate entries. Improvements: Use of XMS/EMS for the code tables used by uncompress(). This would allow the program to run when there is less conventional memory present. But I think it is more useful to compile a 32 bits protected mode version right away. (You do not need the changes made to accommodate 16 bits `oddities' in that case.) Bob Brand bob@wop.wtb.tue.nl or B.A.Brand@wtb.tue.nl (addresses valid until at least Oct. 1st, 1996) nspark-1.7.8B2+git20210317.cb30779/msdos/alt/000077500000000000000000000000001402443176000175135ustar00rootroot00000000000000nspark-1.7.8B2+git20210317.cb30779/msdos/alt/compress.c000066400000000000000000000406331402443176000215200ustar00rootroot00000000000000/* * compress/uncompress archive * * Authors: Spencer W. Thomas (decvax!utah-cs!thomas) * Jim McKie (decvax!mcvax!jim) * Steve Davies (decvax!vax135!petsd!peora!srd) * Ken Turkowski (decvax!decwrl!turtlevax!ken) * James A. Woods (decvax!ihnp4!ames!jaw) * Joe Orost (decvax!vax135!petsd!joe) * * NOTE: these functions also support "squash" (which is just a * 13-bit compress), and "crunch" (which is a 12-bit compress * with additional run-length encoding). AJD * * $Header: compress.c 1.11 95/08/01 $ * $Log: compress.c,v $ * Revision 1.11 95/08/01 xx:xx:xx BB * Quite a few changes for Borland C/C++ * Made htab and codetab arrays dynamic. * (Compile with -DBB_HUGE_STATIC_ARRAYS if you DO want these * huge static arrays in your executable.) * Changed pointers to normalized or huge pointers because * arrays span more than 64k. * Changed a few types from int to long because 32bits integers * are needed. * This alternative version: allocate arrays before start of * main() with #pragma startup. * * Revision 1.10 95/01/25 12:49:43 arb * Bug fixes caused by 1.9 * * Revision 1.9 95/01/06 12:00:06 arb * Fixes for Alpha. * * Revision 1.8 94/02/28 23:57:55 arb * Fixed number of compression bits for ArcFS format archives * * Revision 1.7 93/08/20 11:35:20 arb * Prevent printing of "uncompressed" etc. if quiet flag is set * * Revision 1.6 92/12/07 17:17:28 duplain * reformatted source. * * Revision 1.5 92/11/09 14:48:00 duplain * Initialised offset and size from getcode() each time uncompress() called. * * Revision 1.4 92/11/02 11:43:14 duplain * Correct comment about crunch/squash in header. * * Revision 1.3 92/10/23 14:08:13 duplain * Minor changes to printf's at end of uncompress. * * Revision 1.2 92/10/01 11:20:19 duplain * Added check for EOF. * * Revision 1.1 92/09/29 18:02:14 duplain * Initial revision * */ #include #include "spark.h" #include "pack.h" #include "main.h" #include "crc.h" /* BB changed next line because of conflict with Borland's io.h */ /* #include "io.h" */ #ifdef __MSDOS__ #include "nsparkio.h" #else #include "io.h" #endif /* __MSDOS__ */ #include "arcfs.h" #include "error.h" #ifdef __MSDOS__ #include /* for farcalloc() */ #include /* for exit() */ #endif /* __MSDOS__ */ #define PBITS 16 #define CRUNCHBITS 12 #define SQUASHBITS 13 #define COMPRESSBITS 16 /* BB changed constant in next line to long: 16bits 65536 == 0 ! */ #define HSIZE 65536L #define INIT_BITS 9 /* initial number of bits/code */ /* BB changed next macros. * Arrays htab and codetab both exceed 64k. To prevent wraparound at the 64k boundary, normalized or huge pointers have to be used. Since subscripts are 16 bit ints under the Borland compiler, subscripts have to be made explicitely long. And finally COMPRESSBITS == 16, but 1 << 16 == 0 for 16 bits integers! */ /* #define MAXCODE(n_bits) ((1 << (n_bits)) - 1) */ /* #define htabof(i) htab[i] */ /* #define codetabof(i) codetab[i] */ /* #define tab_prefixof(i) codetabof(i) */ /* #define tab_suffixof(i) ((char_type *)(htab))[i] */ /* #define de_stack ((char_type *)&tab_suffixof(1< #include #include #include "misc.h" /* * BB: The best place to allocate memory for the table arrays is * before the main programme starts. * Otherwise the programme may already have produced some output, * especially when the -v flag has been set. It may be confusing * for the user when the `out of memory' message follows after * the programme seems to work. * Under the Borland C/C++ compiler, the #pragma startup * allows a function to be called before startup. Other compilers * need not have this #pragma. * The accompanying makefile builds a small testfile that builds * the headerfile haspragm.h that does or does not define * the macro BB_HAS_PRAGMA_STARTUP. * Note that char * _argv[]; is a global variable with the same * contents as argv in the header of main(). It may not be present * on other compilers than the Borland compiler. */ static void allocatetables() { if ( ! htab ) htab = (count_int huge *) farcalloc(HSIZE,sizeof(count_int)); if ( ! codetab ) codetab = (unsigned short huge *) farcalloc(HSIZE,sizeof(unsigned short)); if ( ! htab || ! codetab ) { /* Tricky! _argv may not exist for other compilers. */ char * name = basename(_argv[0]); /* DOS prior to version 3 has the null string in _argv[0]. Substitute default. */ if (!name) name = "nspark"; /* NB: stricmp == strcmpi == strcasecmp */ if (stricmp(&name[strlen(name)-4],".com") == 0 || stricmp(&name[strlen(name)-4],".exe") == 0 ) { /* We cannot write a '\0' into name because it points to _argv[0]. And that may be in a read-only data segment. */ char * newname,* cp; if ((newname = (char *) malloc(strlen(name))-3) != NULL) { strncpy(newname,name,strlen(name)-4); newname[strlen(name)-4] = '\0'; name = newname; /* Allocated space will be released automatically at exit */ for (cp = name; *cp; cp++) if (isascii(*cp) && isupper(*cp)) *cp = tolower(*cp); } } error("%s: not enough memory", name); exit (1); } } #pragma startup allocatetables #endif /* __BORLANDC__ || __TURBOC__ || BB_HAS_PRAGMA_STARTUP */ #endif /* __MSDOS__ && !BB_HUGE_STATIC_ARRAYS */ Status uncompress(header, ifp, ofp, type) Header *header; FILE *ifp, *ofp; CompType type; { /* BB changed next line. stackp points to huge pointers. */ /* register char_type *stackp; */ #ifdef __MSDOS__ register char_type huge *stackp; #else register char_type *stackp; #endif /* __MSDOS__ */ /* BB changed next line. Since code_ints should be longs on 16bits machines and this int gets assigned from and to code_ints, it should be a long as well. */ /* register int finchar; */ #ifdef __MSDOS__ register long finchar; #else register int finchar; #endif /* __MSDOS__ */ register code_int code, oldcode, incode; char *message; #if defined(__MSDOS__) && !defined(BB_HUGE_STATIC_ARRAYS) /* BB: Allocate here (when programme may already have produced output) if #pragma startup is not present in this C compiler. */ #if !defined(__BORLANDC__) && !defined(__TURBOC__) && \ !defined(BB_HAS_PRAGMA_STARTUP) if ( ! htab ) htab = (count_int huge *) farcalloc(HSIZE,sizeof(count_int)); if ( ! codetab ) codetab = (unsigned short huge *) farcalloc(HSIZE,sizeof(unsigned short)); if ( ! htab || ! codetab ) { error("%s: compress: out of memory",ourname); exit (1); } #else /* !__BORLANDC__ && !__TURBOC__ && !BB_HAS_PRAGMA_STARTUP */ /* Check allocation when we're debugging (should never get here!) */ #ifdef DEBUGGING if (!htab || !codetab) { error("%s: compress: Something went wrong allocating memory", ourname); exit(1); } #endif /* DEBUGGING */ #endif /* !__BORLANDC__ && !__TURBOC__ && !BB_HAS_PRAGMA_STARTUP */ #endif /* __MSDOS__ && ! BB_HUGE_STATIC_ARRAYS */ crc = 0; clear_flg = 0; offset = 0; size = 0; readsize = header->complen; if (type == SQUASH) maxbits = SQUASHBITS; else { if (arcfs) maxbits = arcfs_maxbits; else { maxbits = read_byte(ifp); readsize--; } } maxmaxcode = 1 << maxbits; /* * As above, initialize the first 256 entries in the table. */ maxcode = MAXCODE(n_bits = INIT_BITS); for (code = 255; code >= 0; code--) { tab_prefixof(code) = 0; tab_suffixof(code) = (char_type) code; } free_ent = FIRST; finchar = oldcode = getcode(ifp); if (oldcode == -1) /* EOF already? */ goto compress_exit; /* Get out of here */ /* first code must be 8 bits = char */ if (type == CRUNCH) { putc_init(); /* BB changed next line for Borland C/C++ 4 */ /* putc_ncr(ofp, finchar); */ #ifdef __MSDOS__ putc_ncr(ofp, (Byte) finchar); #else putc_ncr(ofp, finchar); #endif /* __MSDOS__ */ } else { /* BB changed next three lines for Borland C/C++ 4 */ /* if (!testing) */ /* write_byte(ofp, finchar); */ /* calccrc(finchar); */ /* (Could be neater) */ #ifdef __MSDOS__ if (!testing) write_byte(ofp, (Byte) finchar); calccrc((Byte) finchar); #else if (!testing) write_byte(ofp, finchar); calccrc(finchar); #endif /* __MSDOS__ */ } stackp = de_stack; while ((code = getcode(ifp)) != -1) { if (check_stream(ifp) != FNOERR) break; if (code == CLEAR) { for (code = 255; code >= 0; code--) tab_prefixof(code) = 0; clear_flg = 1; free_ent = FIRST - 1; if ((code = getcode(ifp)) == -1) /* O, untimely death! */ break; } incode = code; /* * Special case for KwKwK string. */ if (code >= free_ent) { /* BB changed next line for Borland C/C++ 4 */ /* *stackp++ = finchar; */ #ifdef __MSDOS__ *stackp++ = (char_type) finchar; #else *stackp++ = finchar; #endif code = oldcode; } /* * Generate output characters in reverse order */ while (code >= 256) { *stackp++ = tab_suffixof(code); code = tab_prefixof(code); } /* BB changed next line for Borland C/C++ 4 */ /* *stackp++ = finchar = tab_suffixof(code); */ #ifdef __MSDOS__ finchar = tab_suffixof(code); *stackp++ = (char_type) finchar; #else *stackp++ = finchar = tab_suffixof(code); #endif /* * And put them out in forward order */ while (stackp > de_stack) { stackp--; if (type == CRUNCH) putc_ncr(ofp, *stackp); else { if (!testing) write_byte(ofp, *stackp); calccrc(*stackp); } } /* * Generate the new entry. */ if ((code = free_ent) < maxmaxcode) { /* BB changed next two lines for Borland C/C++ 4 */ /* tab_prefixof(code) = oldcode; */ /* tab_suffixof(code) = finchar; */ #ifdef __MSDOS__ tab_prefixof(code) = (unsigned short) oldcode; tab_suffixof(code) = (char_type) finchar; #else tab_prefixof(code) = oldcode; tab_suffixof(code) = finchar; #endif /* __MSDOS__ */ free_ent = code + 1; } /* * Remember previous code. */ oldcode = incode; } compress_exit: if (check_stream(ifp) == FRWERR) return (RERR); if (!testing && check_stream(ofp) == FRWERR) return (WERR); if ((Halfword)crc != header->crc) return (CRCERR); if (testing) switch(type) { case COMPRESS: message = "OK (compressed)"; break; case CRUNCH: message = "OK (crunched)"; break; case SQUASH: message = "OK (squashed)"; break; default: message = "internal error"; break; } else switch(type) { case COMPRESS: message = "uncompressed"; break; case CRUNCH: message = "uncrunched"; break; case SQUASH: message = "unsquashed"; break; default: message = "internal error"; break; } if (!quiet) msg(message); return (NOERR); } /* * Read one code from the input. If EOF, return -1. */ static code_int getcode(ifp) FILE *ifp; { register code_int code; static char_type buf[COMPRESSBITS]; register int r_off, bits; /* BB changed next line. We are doing pointer-artithmatics and that can be dangerous if other than normalized (huge) pointers are being used. */ /* register char_type *bp = buf; */ #ifdef __MSDOS__ register char_type huge *bp = buf; #else register char_type *bp = buf; #endif /* __MSDOS__ */ if (clear_flg > 0 || offset >= size || free_ent > maxcode) { /* * If the next entry will be too big for the current code * size, then we must increase the size. This implies * reading a new buffer full, too. */ if (free_ent > maxcode) { n_bits++; maxcode = n_bits == maxbits ? maxmaxcode : MAXCODE(n_bits); } if (clear_flg > 0) { maxcode = MAXCODE(n_bits = INIT_BITS); clear_flg = 0; } if (readsize == 0) return (-1); /* BB added cast to next line */ /* size = readsize < n_bits ? readsize : n_bits; */ #ifdef __MSDOS__ size = readsize < n_bits ? (size_t) readsize : n_bits; #else size = readsize < n_bits ? readsize : n_bits; #endif /* __MSDOS__ */ size = fread(buf, 1, size, ifp); if (size <= 0) return (-1); /* end of file */ readsize -= size; offset = 0; /* Round size down to integral number of codes */ size = (size << 3) - (n_bits - 1); } r_off = offset; bits = n_bits; /* * Get to the first byte. */ bp += (r_off >> 3); r_off &= 7; /* Get first part (low order bits) */ code = (*bp++ >> r_off); bits -= (8 - r_off); r_off = 8 - r_off; /* now, offset into code word */ /* Get any 8 bit parts in the middle (<=1 for up to 16 bits). */ if (bits >= 8) { code |= *bp++ << r_off; r_off += 8; bits -= 8; } /* high order bits. */ code |= (*bp & rmask[bits]) << r_off; offset += n_bits; return (code); } nspark-1.7.8B2+git20210317.cb30779/msdos/alt/haspragm.c000066400000000000000000000011221402443176000214550ustar00rootroot00000000000000/* * Check whether #pragma startup is supported. * * $Header: haspragm.c 1.0 95/07/26 $ * $Log: haspragm.c,v $ * Revision 1.0 95/07/26 xx:xx:xx BB * Initial revision. */ #include #include int haspragma = 0; void dotest() { haspragma = 1; } #pragma startup dotest int main() { printf( "/*\n" " * haspragm.h\n" " */\n" "#ifndef __BB_HAS_PRAGMA_H__\n" "#define __BB_HAS_PRAGMA_H__\n"); if (haspragma) printf("#define BB_HAS_PRAGMA_STARTUP\n"); printf("#endif /* __BB_HAS_PRAGMA_H__ */\n"); return 0; } nspark-1.7.8B2+git20210317.cb30779/msdos/alt/makefile.bor000066400000000000000000000040251402443176000217750ustar00rootroot00000000000000.AUTODEPEND # *Translator Definitions* CC = bcc +NSPARK.CFG TASM = TASM TLIB = tlib TLINK = tlink LIBPATH = H:\BC402\LIB INCLUDEPATH = H:\BC402\INCLUDE # *Implicit Rules* .c.obj: $(CC) -c {$< } .cpp.obj: $(CC) -c {$< } # *List Macros* EXE_dependencies = \ arc.obj \ arcfs.obj \ compress.obj \ crc.obj \ date.obj \ error.obj \ io.obj \ main.obj \ misc.obj \ msdos.obj \ pack.obj \ store.obj \ unarc.obj # *Explicit Rules* nspark.exe: nspark.cfg $(EXE_dependencies) $(TLINK) /x/c/P-/L$(LIBPATH) @&&| c0c.obj+ arc.obj+ arcfs.obj+ compress.obj+ crc.obj+ date.obj+ error.obj+ io.obj+ main.obj+ misc.obj+ msdos.obj+ pack.obj+ store.obj+ unarc.obj nspark # no map file cc.lib | # *Individual File Dependencies* arc.obj: nspark.cfg arc.c $(CC) -UMSDOS -c arc.c arcfs.obj: nspark.cfg arcfs.c $(CC) -UMSDOS -c arcfs.c compress.obj: nspark.cfg haspragma.h alt\compress.c $(CC) -UMSDOS -c alt\compress.c haspragma.h: nspark.cfg haspragm.com haspragm.com > haspragm.h del haspragm.com # very Borland specific! haspragm.com: nspark.cfg alt\haspragm.c bcc -mt -lt -I$(INCLUDEPATH) -L$(LIBPATH) -ehaspragm alt\haspragm.c crc.obj: nspark.cfg crc.c $(CC) -UMSDOS -c crc.c date.obj: nspark.cfg date.c $(CC) -UMSDOS -c date.c error.obj: nspark.cfg error.c $(CC) -UMSDOS -c error.c io.obj: nspark.cfg io.c $(CC) -UMSDOS -c io.c main.obj: nspark.cfg main.c $(CC) -UMSDOS -c main.c misc.obj: nspark.cfg misc.c $(CC) -UMSDOS -c misc.c msdos.obj: nspark.cfg msdos.c $(CC) -UMSDOS -c msdos.c pack.obj: nspark.cfg pack.c $(CC) -UMSDOS -c pack.c store.obj: nspark.cfg store.c $(CC) -UMSDOS -c store.c unarc.obj: nspark.cfg unarc.c $(CC) -UMSDOS -c unarc.c # *Compiler Configuration File* nspark.cfg: nspark.mak copy &&| -mc -a -f- -w+ -O2 -k- -d -vi- -H=NSPARK.SYM -I$(INCLUDEPATH) -L$(LIBPATH) -DMSDOS3;VERSION="1.7.6_dos-beta";MAINTAINER="bob@wop.wtb.tue.nl_(this_beta_only)" | nspark.cfg nspark-1.7.8B2+git20210317.cb30779/msdos/alt/nspark.ide000066400000000000000000000720341402443176000215020ustar00rootroot00000000000000Borland C++ Project File o(b(T"6* 6                                 ! " # $ % & ' ( )  nsparkA$ARC.Cefault c0cef..def.rtf .h.hrc.rhx.inc.asi.obj .lib.res.apx(StripAutoDepends,Remove &AutoDepends@)Remove all [AutoDepend] nodes from a node.cpp.rcl .exe.dll(.cM.cas.asm$ [Internal]8$TASM $IMPLIB(<"$NOSWAP $CAP MSG(HC312MSG) $EDNAME .hlp.hpjt\$NOSWAP $CAP MSG(BORL2MSG.DLL) +$RSP(-I$INC -D1;$DEF -o$OUTNAME) $NAME($EDNAME)$EXT($EDNAME).iW$ARGS $EDNAME.kb.dlg.txt tdw.exe($TD $EXENAME $ARG(&Turbo Debugger<%Turbo Debugger on current target node,$TD -l $EXENAME $ARGb.exe4-m"goto_line $LINE" $EDNAME$ workshop.exe(-I$INC $EDNAME.ico.bmp.mnu.str.cur.fonICON BITMAPc DIALOG[MENU$ STRINGTABLEL CURSORC$ ACCELERATOR;FONT: -I$INC+ $OUTNAME grep.comP7-n+ $NOSWAP$CAP MSG(GREP2MSG.DLL)$PROMPT void $SELNODES$ winsight.exe$ winspctr.exedM$SAVE CUR$NOSWAP $CAP MSG(BORL2MSG.DLL) $EDNAME $NAME($OUTNAME)$EXT($OUTNAME).ckb  OwlCovert$ owlcvt.exe(ConvertOWL1SourceL3+$RSP($OWLCVT) $SELNODES $CAP MSG(BORL2MSG) $NOSWAPL4Convert currently selected nodes from OWL 1 to OWL 2$ ASFN:nspark1 tex58 cc0unarcstorepackmsdosmiscmainioerrordatecrc$ alt\compressarcfsarcDoDo  SPARK.H: ERROR.H)  CPROTO.H0H:\BC402\INCLUDE\STDARG.H0 H:\BC402\INCLUDE\_DEFS.H( AutoDepReference  ARCFS.C0  H:\BC402\INCLUDE\STDIO.H0  H:\BC402\INCLUDE\_NFILE.H0  H:\BC402\INCLUDE\_NULL.H0 H:\BC402\INCLUDE\TIME.H0 H:\BC402\INCLUDE\STDLIB.H0 H:\BC402\INCLUDE\STRING.H ARCFS.H$  NSPARKIO.H MISC.H$  COMPRESS.C} PACK.Ht  MAIN.Hl CRC.H0 H:\BC402\INCLUDE\ALLOC.H CRC.C$ DATE.C  ERROR.CQ IO.C0 H:\BC402\INCLUDE\CTYPE.H  MAIN.C6 ARC.H  UNARC.H'  MISC.C  DATE.H  MSDOS.C4 H:\BC402\INCLUDE\SYS\STAT.H 4 H:\BC402\INCLUDE\SYS/TYPES.H 0 H:\BC402\INCLUDE\DIR.H0 H:\BC402\INCLUDE\UTIME.H OS.H ! PACK.C " STORE.Cy # UNARC.Cq $ STORE.Hi$%  COMPRESS.H,& H:\BC402\INCLUDE\IO.H ' nspalt(( ALT\COMPRESS.C0) H:\BC402\INCLUDE\DOS.H(^~.Jf6b.Jf:">Zz2N " > Z v  2 V r " F j . V  2 N j .Jf>nFv&Jj6Zz"BbJf 6V~="6"""w$4F""P@`h$' v"l ,O %& $#  2-3./"4*5*6*7*8*9*:*;*<*=*>*?*y*z*dvxu|byk[hefgcd]^zws{m~o}qns  @      Ft{q ,  OD 5.H:\BC402\INCLUDE/ H:\BC402\LIB nspark.csm ,  O\ Nsd , OD6s ,O s ,O$  ,O$  ,O   ,O,3__DEBUG=2;__TRACE;__WARN , O `h$lNgO  `h$mgd  O  % ,! "O"3MSDOS3 VERSION="1.7.6 dos beta" MAINTAINER="bob@wop.wtb.tue.nl (this beta only)" s  @      Ft{qd`h$# o `h$$pJ`h$%q`h$&r`h$'s`h$(t`h$)u`h$*v`h$+w`h(, x|`h$-y`h$.z`h$/{`h$0|g1 2O@24@le~b@  @ g3 4Ox4l@  Y @  @  @  @  @ e @  @  ~b ~ ~"5 g4};hg6 7O7t@ Y @  @  @  @ e ~b ~ ~ ~ ~ @  @ g8 9OX9L@  Wl @  @  @  @ e ~ ~bg: ;O@;4@ `l @  @  @  @ eg< =OP=D@ il @  @  @  @ ~b@ g> ?O?t@ Z @  @  @  @  @ e ~~b@  ~ @  ~g@ AOA@ Y @  @  @  @  @ e ~b~@  ~ ~ ~ @  @ gB COpCd@  [ @  @  @  @ eb ~ @  @  ~ ~gD EOxEl@  |e ~b @  @  @  @  @  @  @  @  ~gF GOhG\@ ! (Z @  @  @  @ e ~ ~b ~ ~gH IO`IT@ " Y @  @  @  @ e ~ ~b ~gJ KOK@# B[ @  @  @  @  @ e$ ~b ~% ~ ~ ~& @  ~ ~~@  ~ ~ @ gL MOM( &_ @  @  @  @ e ~b ~ ~ ~ ~ @  @  @ ) @  @  ~4Pl 80P|<h $ H d | < `  8 \ 8T(D`Tp8d $Xt(\|"6  4U$4U$,6-T.-/ F! T0-1 .!T2-3 /!T4-5"T6-78-$T-(F! 4U$ 96(-T ;-<=gF# & T >-?@hF#hw$ g&) T A-BCiF$ *T D-EF`F$ +TG-HIkF# , TJ-KLjF# - 4U$MR6/-TO-PQa-"w$g#.TR-STb-"04U$Uv62-TW-XYQFS14U$_"7/4-Ta-bcc/"34U$i7/7TklmeF#5 4U$n7/9oTpoqrd/$84U${7/<|T}|~lF$:4U$d7/>eTfeghF$=4U$7/@-T --?T!--A4U$"7/F-T#-0F"B4U$$7/H-T%-A$G4U$&7/JT'1&IT(&K4U$)R7/MT*F)LT+F)NT,F)O4U$-> 7/_T.P-PT/ -`4U$0 7/bT10a4U$2 7/d-T3-2c4U$4v 7/eX5 44U$6: 7/fT7 64U$8 7/gT9 84U$:Z 7/i[T;Z[]^1F$:h,4U$< 7/kT=F$<j(Lplh40Pt@d0T D d T t @ 0 $xh Z"6~ - ++      !"#$%&'()*+,^4#^43w$^4^4 lw$^4 #^4^4#w$^4 ^4 #^4 ^4 ^4 w$^4w$^4.^4^4!# ^4".^46# w$^4$.w$^46%#w$ ^4'w$ ^46#^4^4;#^4^4C#;^4D.^4E#^4Q.^4R.^4 S.^4!T.^4" U.^4#V.^4$W.^4%X.^4&Y.^4'Z.^4([.^4)\.^4*].^4+$^.^4,BvFzJ~NR"V&Z*^. b Pi(fb"6- :   !(d(~"6- V#$%&'()*+,-./0(b(|F"6("hD  O hD!O5nO hD $ O ΄hD < #O hD   ` $O hD  \  %O ĄhD    &O hD  'O hDt (O hD )O hD8 *O hD0\ +O hD< ,O hD -O hDh .O a&hD  /O phD!!"0O "e(lx ,p|0t<\$h0P\62"6- c :6"6  c 62"6-    "6"'6 n  "$&)-02468:< :6"6  W JF"6 * #*+,W62"6 VJF"6'6 *JF"6 *    Wb^"6 B     #%*+,W62"6 W:6"6 #W62"6 W62"6 W:6"6 #>:"6  W62"6 W>:"6 W>:"6 ./:6"6 W62"6 W62"6 62"6 WRN"6 2 !%'(3 JF"6 * W!b^"6 B!    #*+,=W"RN"6 2"#*+,./W#RN"6, 2# !%'(/W$NJ"6 .$%./W%fb"6W, F%     #%*+,&B>"6 "&W':6"6 '  V(JF"6'6 *(    )>:"6 W5 )*>:"6 *+>:"6 +,>:"6 ,->:"6 -.>:"6W, .V/:6"6'6 /062"6 0162"6 1V262"6R'6 2362"6 3V462"6'6 4562"6 5W6FB"6 &6#*+,V762"6'6 78:6"6 8V962"6'6 9:62"6 :W;JF"6 *;#*+,1V<62"6'6 <=:6"6 =V>62"6n'6 >?:6"6 ?V@:6"6&'6 @ !A:6"6 ABb^"6 BB  WC:6"6 C#;WD:6"6 D#.WE62"6 E#VF62"6j'6 F#GFB"6 &GVH62"6:'6 H%I:6"6 IVJ:6"6'6 J'(K:6"6 KLNJ"6 .LVM>:"6'6 M*+,NNJ"6 .NONJ"6 .OP"6 dP !"#$%&'()*+WQ:6"6 Q./WR:6"6 R./WS62"6 S.WT62"6 T.WU:6"6 U./WV62"6 V.WW62"6 W.WX62"6 X.WY62"6 Y.WZ62"6 Z.W[62"6 [.W\62"6 \.W]62"6 ].W^62"6 ^.V_:6"6'6 _./`NJ"6 .`"a62"6 aVb62"6R- b1c62"6 cVd62"6- d3Ve62"6- e5Vf62"6V - f7Vg62"6 - g9h62"6 hVi62"6 - i;j62"6 jVk62"6 - k=l:6"6z- lm62"6 mcn62"66- n!o62"6w+ op62"6jw+ p q62"6F q r62"6z r s62"6 st62"6 tu62"6  uv62"6G" vw62"6G" wx62"6  xy62"6G" yz:6"6.W5 zL{62"6.3 {|62"63 |!=}"6O}--e b  @   @   @   @    @  @  ~ ~ ~  ~ ~ ~ @      @            ! " # $ % & ( &_) @ 8 ($"6(5,..\:? *IfIJP6 Q:DQ6zQR:BRJR6RJ SJVSbS6S:(T6^T6T:T> U6BU>U>U:U6.V6dV6VRVJ6WbWRWRY>2Z>pZ>Z>Z>*[:d[6[6[6\6<\6r\6\F\6$]:^]6]6]J^6J^:^6^:^:._:h_b_:`:>`6t`6`F`6&a:`a:a:aN"b>`bNbNbc:c:c6*d6`d:d6d6e6g6tg6g6g6h6Lh6h6h6h6$i6Zi:i6i6j66j6lj6j6j6k6Dk6zk6k6k6l6Rl:l6l6l nspark-1.7.8B2+git20210317.cb30779/msdos/alt/nspark.prj000066400000000000000000000207431402443176000215340ustar00rootroot00000000000000Turbo C Project File  2R           d      "#$%&'+k[]^bcdefghmnoqsuvwxyz{|}~-D.H:\BORLANDC\INCLUDE;H:\BORLANDC\CLASSLIB\INCLUDE/H:\BORLANDC\LIB;H:\BORLANDC\CLASSLIB\LIB03212521003MSDOS3;VERSION="1.7.6 dos-beta";MAINTAINER="bob@wop.wtb.tue.nl (this beta only)"ta only!)"4*5*6*7*8*9*:*;*<*=*>*?*@V/D/t/v moreflop.spa DrawFiles\A3000PowerAD32767E8192FC.CPPG3  ~GREPgrep-n+ $MEM(128) $NOSWAP $PROMPT $CAP MSG(GREP2MSG)void *.c ~Turbo AssemblerTASM/MX /ZI /O $TASMTurbo ~Debuggertd$EXENAMETurbo ~Profilertprof$EXENAMER~esource CompilerRC$RC~Import LibrarianIMPLIB$IMPLIBTLIBTLIBPRJNAME -+ NAME5W(ARC.C\TESTS\NSPARK\ARC.C YYARCFS.CESTS\NSPARK\ARCFS.C 9|'ALT\COMPRESS.CPARK\ALT\COMPRESS.C  ]VwCRC.C\TESTS\NSPARK\CRC.C `p=DATE.CTESTS\NSPARK\DATE.C aNERROR.CESTS\NSPARK\ERROR.C  d*IO.CB\TESTS\NSPARK\IO.C#fQMAIN.CTESTS\NSPARK\MAIN.C'hsZMISC.CTESTS\NSPARK\MISC.C*jAhMSDOS.CESTS\NSPARK\MSDOS.C0k}zPACK.CTESTS\NSPARK\PACK.C !"2mISTORE.CESTS\NSPARK\STORE.C#$%4rj =UNARC.CESTS\NSPARK\UNARC.C&'( UjhCRC.CSS.CS Vj8DATE.CS.CS#tXXXRK.MAKS Vj5ERROR.CAKS VjIO.C.CA6<uh[MeE#th\Q0%@6dE$^Q)zz&_ @@ @ @e~b~~~~@@"@:@@~e~@H:\BORLANDC\INCLUDE\DOS.H&_ALT\COMPRESS.C5B[ @@ @ @"@e6~b~7~~~8@~/~~@~~@@~/~@H:\BORLANDC\INCLUDE\IO.H~COMPRESS.H~STORE.HB[UNARC.C 3Y @@ @ @e~~b~@ @YSTORE.C 1(Z @@ @ @e~~b~~@(ZPACK.C+|e)~b,@@-@@.@@ @/~ ([ +|~OS.H@H:\BORLANDC\INCLUDE\UTIME.H@H:\BORLANDC\INCLUDE\DIR.H@H:\BORLANDC\INCLUDE\SYS\STAT.H|MSDOS.C([ @@ @ @eb~@@)~~.H~ARC.HYMAI~DATE.H[MISC.C$Y @@ @ @"@e~b~@~%~&~@@@"@e~~UNARC.H~ARC.HYMAIN.C!Z @@ @ @"@e~~b@~@~e~@H:\BORLANDC\INCLUDE\CTYPE.HZIO.C il @@ @ @~b@NCLUDE\ALLOC.HilERROR.C`l @@ @ @eWl `lDATE.C Wl @@ @ @e~~b@@ @WlCRC.C@H:\BORLANDC\INCLUDE\ALLOC.H~CRC.H~MAIN.H~PACK.H~MISC.H Y @@ @ @@e@@~b~~ESS.C)-#~NSPARKIO.H~ARCFS.H@H:\BORLANDC\INCLUDE\STRING.H@H:\BORLANDC\INCLUDE\STDLIB.H@H:\BORLANDC\INCLUDE\TIME.H@H:\BORLANDC\INCLUDE\_NULL.H@H:\BORLANDC\INCLUDE\_NFILE.H@H:\BORLANDC\INCLUDE\STDIO.HYARCFS.C@H:\BORLANDC\INCLUDE\_DEFS.H@H:\BORLANDC\INCLUDE\STDARG.Hle~b@@bCPROTO.H~ERROR.HeSPARK.HlARC.C7)TUVwvumlkcbaYXWT-UMSDOS-UMSDOS-UMSDOS-UMSDOS-UMSDOS-UMSDOS-UMSDOS-UMSDOS-UMSDOS-UMSDOS-UMSDOS-UMSDOSnspark-1.7.8B2+git20210317.cb30779/msdos/makefile000066400000000000000000000064241402443176000204410ustar00rootroot00000000000000# # NOTE: NSPARK DOESN'T WORK UNDER MS-DOS RIGHT NOW... COMPRESS.C NEEDS # CALLS TO VMALLOC() ET AL TO ALLOW DATA AREAS > 64KB TO BE ALLOCATED. # # nspark makefile (MSDOS, Microsoft V7.0 C Compiler) # # SYSTYPE: MSDOS2, MSDOS3, MSDOS4, MSDOS5, MSDOS6, MSDOS7. # SYSTYPE= MSDOS3 # using DRDOS 6 == API level 3.31 INSTALLDIR= d:\util # BB added next two lines NAME = nspark CONFIGFILE = $(NAME).cfg # Borland C/C++ CC=BCC +$(CONFIGFILE) LD=TLINK # Change the next two lines to your own local settings. # # If you want to use the settings in your turboc.cfg file, # remove LIBPATH and INCLUDEPATH from the definition of # $(CONFIGFILE) and change the above definition for CC # to CC=BCC @$(CONFIGFILE). (Not recommended since there may # be other unwanted options set in turboc.cfg.) LIBPATH = H:\BORLANDC\LIB INCLUDEPATH = H:\BORLANDC\INCLUDE # Uncomment ONE of the next two lines when you have PKLITE or LZEXE. # pklite: optionally add -e to options if you have the professional # version. COMPRESS = d:\util\pklite -b # COMPRESS = d:\util\lzexe # --- You shouldn't need to edit below this line --- # BB: But only if you are using Borland C/C++! # NB: Spaces are not allowed in -D arguments. VERSION= 1.7.6_dos-beta MAINTAINER= bob@wop.wtb.tue.nl_(this_beta_only!) # BB commented out next three lines for Borland C/C++: use response file #CDEFINES= -mc -a -f- -w+ -O2 -k- -d -v- -vi- -H=$(NAME).SYM -UMSDOS #CMISC= -DVERSION="$(VERSION)" -DMAINTAINER="$(MAINTAINER)" -D$(SYSTYPE) #CFLAGS= $(CDEFINES) $(CMISC) # Borland C/C++ uses TLINK. LDFLAGS= /x/c/P- # BB changed next line #PROG= nspark.exe PROG= $(NAME).exe SRCS= main.c arc.c unarc.c store.c pack.c compress.c crc.c \ io.c error.c misc.c date.c msdos.c arcfs.c HDRS= main.h arc.h unarc.h store.h pack.h compress.h crc.h \ io.h error.h misc.h date.h os.h spark.h arcfs.h OBJS= main.obj arc.obj unarc.obj store.obj pack.obj compress.obj crc.obj \ io.obj error.obj misc.obj date.obj msdos.obj arcfs.obj LIBS= # BB overrule default implicite rule. .c.obj: $(CC) -c {$< } # BB changed next line #all: $(PROG) .AUTODEPEND: all: $(CONFIGFILE) $(PROG) $(PROG): $(CONFIGFILE) $(OBJS) # BB commented out next line # set LINK=$(LDFLAGS) # BB changed next line # $(LD) $(OBJS), $(PROG); $(LD) $(LDFLAGS) @&&| c0c.obj+ # Using compact memory model arc.obj+ arcfs.obj+ compress.obj+ crc.obj+ date.obj+ error.obj+ io.obj+ main.obj+ misc.obj+ msdos.obj+ pack.obj+ store.obj+ unarc.obj $(NAME) # no map file cc.lib # using compact memory model | !ifdef COMPRESS # create directory uncompr for uncompressed .exe if not exist uncompr\nul md uncompr copy $(PROG) uncompr\$(PROG) $(COMPRESS) $(PROG) !endif $(CONFIGFILE): makefile copy &&| -mc # using compact memory model -a -f- -w+ -O2 -k- -d -v- -vi- -H=$(NAME).SYM # BB remove next two lines when you are using a turboc.cfg file. # and change CC to BCC @$(CONFIGFILE). -I$(INCLUDEPATH) -L$(LIBPATH) -DMSDOS3 -DVERSION="$(VERSION)" -DMAINTAINER="$(MAINTAINER)" -UMSDOS | $(CONFIGFILE) install: $(PROG) copy $(PROG) $(INSTALLDIR) clean: del $(PROG) del *.obj del *.bak del *.map del mklog # BB added next four lines del *.bk? del $(CONFIGFILE) del $(NAME).sym del *.$$$ nspark-1.7.8B2+git20210317.cb30779/msdos/makefile.bor000066400000000000000000000034401402443176000212150ustar00rootroot00000000000000.AUTODEPEND # *Translator Definitions* CC = bcc +NSPARK.CFG TASM = TASM TLIB = tlib TLINK = tlink LIBPATH = H:\BC402\LIB INCLUDEPATH = H:\BC402\INCLUDE # *Implicit Rules* .c.obj: $(CC) -c {$< } .cpp.obj: $(CC) -c {$< } # *List Macros* EXE_dependencies = \ arc.obj \ arcfs.obj \ compress.obj \ crc.obj \ date.obj \ error.obj \ io.obj \ main.obj \ misc.obj \ msdos.obj \ pack.obj \ store.obj \ unarc.obj # *Explicit Rules* nspark.exe: nspark.cfg $(EXE_dependencies) $(TLINK) /x/c/P-/L$(LIBPATH) @&&| c0c.obj+ arc.obj+ arcfs.obj+ compress.obj+ crc.obj+ date.obj+ error.obj+ io.obj+ main.obj+ misc.obj+ msdos.obj+ pack.obj+ store.obj+ unarc.obj nspark # no map file cc.lib | # *Individual File Dependencies* arc.obj: nspark.cfg arc.c $(CC) -UMSDOS -c arc.c arcfs.obj: nspark.cfg arcfs.c $(CC) -UMSDOS -c arcfs.c compress.obj: nspark.cfg compress.c $(CC) -UMSDOS -c compress.c crc.obj: nspark.cfg crc.c $(CC) -UMSDOS -c crc.c date.obj: nspark.cfg date.c $(CC) -UMSDOS -c date.c error.obj: nspark.cfg error.c $(CC) -UMSDOS -c error.c io.obj: nspark.cfg io.c $(CC) -UMSDOS -c io.c main.obj: nspark.cfg main.c $(CC) -UMSDOS -c main.c misc.obj: nspark.cfg misc.c $(CC) -UMSDOS -c misc.c msdos.obj: nspark.cfg msdos.c $(CC) -UMSDOS -c msdos.c pack.obj: nspark.cfg pack.c $(CC) -UMSDOS -c pack.c store.obj: nspark.cfg store.c $(CC) -UMSDOS -c store.c unarc.obj: nspark.cfg unarc.c $(CC) -UMSDOS -c unarc.c # *Compiler Configuration File* nspark.cfg: nspark.mak copy &&| -mc -a -f- -w+ -O2 -k- -d -vi- -H=NSPARK.SYM -I$(INCLUDEPATH) -L$(LIBPATH) -DMSDOS3;VERSION="1.7.6_dos-beta";MAINTAINER="bob@wop.wtb.tue.nl_(this_beta_only)" | nspark.cfg nspark-1.7.8B2+git20210317.cb30779/msdos/nspark.ide000066400000000000000000000713361402443176000207260ustar00rootroot00000000000000Borland C++ Project File ζn(b(t&N =~) *                                 ! " # $ % &  nsparkA$ARC.Cefault c0cef..def.rtf .h.hrc.rhx.inc.asi.obj .lib.res.apx(StripAutoDepends,Remove &AutoDepends@)Remove all [AutoDepend] nodes from a node.cpp.rcl .exe.dll.cM.cas.asm$ [Internal]8$TASM $IMPLIB(<"$NOSWAP $CAP MSG(HC312MSG) $EDNAME .hlp.hpjt\$NOSWAP $CAP MSG(BORL2MSG.DLL) +$RSP(-I$INC -D1;$DEF -o$OUTNAME) $NAME($EDNAME)$EXT($EDNAME).iW$ARGS $EDNAME.kb.dlg.txt tdw.exe($TD $EXENAME $ARG(&Turbo Debugger<%Turbo Debugger on current target node,$TD -l $EXENAME $ARGb.exe4-m"goto_line $LINE" $EDNAME$ workshop.exe(-I$INC $EDNAME.ico.bmp.mnu.str.cur.fonICON BITMAPc DIALOG[MENU$ STRINGTABLEL CURSORC$ ACCELERATOR;FONT: -I$INC+ $OUTNAME grep.comP7-n+ $NOSWAP$CAP MSG(GREP2MSG.DLL)$PROMPT void $SELNODES$ winsight.exe$ winspctr.exedM$SAVE CUR$NOSWAP $CAP MSG(BORL2MSG.DLL) $EDNAME $NAME($OUTNAME)$EXT($OUTNAME).ckb  OwlCovert$ owlcvt.exe(ConvertOWL1SourceL3+$RSP($OWLCVT) $SELNODES $CAP MSG(BORL2MSG) $NOSWAPL4Convert currently selected nodes from OWL 1 to OWL 2$ ASFN:nspark1 tex58 cc0unarcstorepackmsdosmiscmainioerrordatecrc compressarcfsarcDoDo  SPARK.H: ERROR.H)  CPROTO.H0H:\BC402\INCLUDE\STDARG.H0  H:\BC402\INCLUDE\_DEFS.H( AutoDepReference  ARCFS.C0  H:\BC402\INCLUDE\STDIO.H0  H:\BC402\INCLUDE\_NFILE.H0  H:\BC402\INCLUDE\_NULL.H0 H:\BC402\INCLUDE\TIME.H0 H:\BC402\INCLUDE\STDLIB.H0 H:\BC402\INCLUDE\STRING.H ARCFS.H$  NSPARKIO.H MISC.H$  COMPRESS.C} PACK.Ht  MAIN.Hl CRC.H0 H:\BC402\INCLUDE\ALLOC.H CRC.C$ DATE.C  ERROR.CQ IO.C0 H:\BC402\INCLUDE\CTYPE.H  MAIN.C6 ARC.H  UNARC.H'  MISC.C  DATE.H  MSDOS.C4 H:\BC402\INCLUDE\SYS\STAT.H 4 H:\BC402\INCLUDE\SYS/TYPES.H 0 H:\BC402\INCLUDE\DIR.H0 H:\BC402\INCLUDE\UTIME.H OS.H ! PACK.C " STORE.Cy # UNARC.Cq $ STORE.Hi$%  COMPRESS.H,& H:\BC402\INCLUDE\IO.H(Rr">Zv*V">Z~.2Nn&Bv 2 N j  & J f  : ^ " J  & B ^ z ">Zz.^6f:Z~ &Jj2Rr :Vv=X =")"))":4)F"'5P)@`h$vD"Fl) ,)O %& $#  2-3./"4*5*6*7*8*9*:*;*<*=*>*?*y*z*dvxu|byk[hefgcd]^zws{m~o}qns  @      Ft{q , ) OD 5.H:\BC402\INCLUDE/ H:\BC402\LIB nspark.csm ,  O\ Nsd , OD6s ,O s ,O$  ,O$  ,O   ,O,3__DEBUG=2;__TRACE;__WARN , O `h$lNDgO  `h$mDgd ) O  % ,! )"O"3MSDOS3 VERSION="1.7.6 dos beta" MAINTAINER="bob@wop.wtb.tue.nl (this beta only)" s  @      Ft{qd`h$# oD `h$$pJD`h$%qD`h$&rD`h$'sD`h$(tD`h$)uD`h$*vD`h$+wD`h(, xD|`h$-yD`h$.zD`h$/{D`h$0|Dg1 &)2O@24@le~b@  @ g3 )4Ox4l@  Y @  @  @  @  @ e @  @  ~b ~ ~"50 G});hg6 )7O7t@ Y @  @  @  @ e ~b ~ ~ ~ ~ @  @ g8 F)9OX9L@  Wl @  @  @  @ e ~ ~bg: );O@;4@ `l @  @  @  @ eg< ^)=OP=D@ il @  @  @  @ ~b@ g> )?O?t@ Z @  @  @  @  @ e ~~b@  ~ @  ~g@ )AOA@ Y @  @  @  @  @ e ~b~@  ~ ~ ~ @  @ gB j)COpCd@  [ @  @  @  @ eb ~ @  @  ~ ~gD )EOxEl@  |e ~b @  @  @  @  @  @  @  @  ~gF 2)GOhG\@ ! (Z @  @  @  @ e ~ ~b ~ ~gH )IO`IT@ " Y @  @  @  @ e ~ ~b ~gJ )KOK@# B[ @  @  @  @  @ e$ ~b ~% ~ ~ ~& @  ~ ~~@  ~ ~ @ 4Pl 80P|<h $ H d | < `  8 \ 8T(D`Tp8d $(\| =6 D4U$4U$,=-T.-/ F! T0-1 .!T2-3 /!T4-5"T6-78-$T-(F! 4U$ 9=(-T ;-<=gF# & T >-?@hF#h: o))D T A-BCiF$ *T D-EF`F$ +TG-HIkF# , TJ-KLjF# - 4U$Mr=/-TO-PQa-":2.TR-STb-"04U$UC2-TW-XYQFS14U$_RC4-Ta-bcc/"34U$iC7TklmeF#5 4U$nC9oTpoqrd/$84U${C<|T}|~lF$:4U$dC>eTfeghF$=4U$C@-T --?T!--A4U$"CF-T#-0F"B4U$$CH-T%-A$G4U$&CJT'1&IT(&K4U$).CMT*F)LT+F)NT,F)O4U$- C_T.P-PT/ -`4U$0* CbT10a4U$2 Cd-T3-2c4U$4j CeX5 44U$6N CfT7 64U$8 CgT9 84U$:Z Ci[T;Z[]^1F$:h,4U$< CkT=F$<j(Lplh40Pt@d0T D d T t @ 0 $xh Z =Z6 ++      !"#$%&'()*+,^4#^43:^4^4 l:^4 #^4^4#:^4 ^4 #^4 ^4 ^4 :^4:^4.^4^4!# ^4".^4=# :^4$.:^4=%#: ^4': ^46#^4^4;#^4^4C#;^4D.^4E#^4Q.^4R.^4 S.^4!T.^4" U.^4#V.^4$W.^4%X.^4&Y.^4'Z.^4([.^4)\.^4*].^4+$^.^4,BvFzJ~NR"V&Z*^. b Pi(fb =/3) :   !(d(~ =6) V#$%&'()*+,-./0(b(|F =(FEhD)_: O hDF!)7GnO hD` F$ )O Rz `hD < )#O hD   ` )$O hD   F  )%O @zHhD   F  )&O 2zvyhD F  )'O 'z4ghD F )(O zJYhD F ))O  zQhD F8 )*O x*hD@ F\ )+O xMhD` F ),O xp<hD F )-O wxVvhD F ).O lxhD F  )/O zXhD!! F")0O "Nx((lx ,p|0t<\$h0P\62 =n6 c :6 =  c 62 =Z6     ="6 n  "$&)-02468:< :6 =  W JF = * #*+,W62 = VJF =6 *JF = *    Wb^ = B     #%*+,W62 = W:6 = #W62 = W62 = W:6 = #>: =  W62 = W>: = W>: = ./:6 = W62 = W62 = 62 = WRN = 2 !%'(3 JF = * W!b^ = B!    #*+,=W"RN = 2"#*+,./W#RN =V'G 2# !%'(/W$NJ = .$%./W%fb =b) F%     #%*+,&B> = "&W':6 = '  V(JF =6 *(    )>: =) )*>: = *+>: = +,>: = ,->: = -.>: =n. .V/:6 =6 /062 = 0162 = 1V262 =R6 2362 = 3V462 =6 4562 = 5W6FB = &6#*+,V762 =6 78:6 = 8V962 =6 9:62 = :W;JF = *;#*+,1V<62 =6 <=:6 = =V>62 =n6 >?:6 = ?V@:6 =&6 @ !A:6 = ABb^ = BB  WC:6 = C#;WD:6 = D#.WE62 = E#VF62 =j6 F#GFB = &GVH62 =:6 H%I:6 = IVJ:6 =6 J'(K:6 = KLNJ = .LVM>: =6 M*+,NNJ = .NONJ = .OP = dP !"#$%&'()*+WQ:6 = Q./WR:6 = R./WS62 = S.WT62 = T.WU:6 = U./WV62 = V.WW62 = W.WX62 = X.WY62 = Y.WZ62 = Z.W[62 = [.W\62 = \.W]62 = ].W^62 = ^.V_:6 =6 _./`NJ = .`"a62 = aVb62 =R5 b1c62 = cVd62 =5 d3Ve62 =5 e5Vf62 =V 5 f7Vg62 = 5 g9h62 = hVi62 = 5 i;j62 = jVk62 = 5 k=l:6 =.6 lm:6 =.@ mJcn62 =6 n!o62 =@ op62 =B@ p q:6 =@ q Hr:6 =@ r Fs:6 =J@ sDt:6 =@ tBu:6 = @ u@v:6 = @ v>w:6 = @ w<x:6 = @ x:y:6 =J @ y8z:6 =& @ z6{:6 =F @ {3|:6 = @ |!1=} =O}++                                      ! " # $ % & 8 ($ =f)5,t-\= GfBHHO6O:O6,PP:PJ>Q6tQJQJRbjR6R:R6S6FS:S>S6S>2T>pT:T6T6U6LURUJUbJVRVRVNX>X>"Y>`Y>Y>Y:Z6LZ6Z6Z6Z6$[6Z[F[6[:\6F\6|\J\6\:6]6l]:]:]:^b|^:^:^6&_6\_F_6_:`:L`:`N`>aN`aNa2b:lb:b6b6c:Lc6c6c6c6$d6Zd6d6d6d62e:leNe6e6&f6\f6f6f6f64g6jg6g6g6 h:Fh:h6h6h6"i:\i:i:i: j:Dj:~j:j:j:,k:fk:k:k nspark-1.7.8B2+git20210317.cb30779/msdos/nspark.prj000066400000000000000000000207611402443176000207540ustar00rootroot00000000000000Turbo C Project File  2R           d      "#$%&'+k[]^bcdefghmnoqsuvwxyz{|}~-D.C:\BC31\INCLUDEUDE;H:\BORLANDC\CLASSLIB\INCLUDE/C:\BC31\LIBLIB;H:\BORLANDC\CLASSLIB\LIB03212521003MSDOS3;VERSION="1.7.6 dos-beta";MAINTAINER="bob@wop.wtb.tue.nl (this beta only)"ta only!)"4*5*6*7*8*9*:*;*<*=*>*?*@V/D/t/v moreflop.spa DrawFiles\A3000PowerAD32767E8192FC.CPPG3YD  ~GREPgrep-n+ $MEM(128) $NOSWAP $PROMPT $CAP MSG(GREP2MSG)void *.c ~Turbo AssemblerTASM/MX /ZI /O $TASMTurbo ~Debuggertd$EXENAMETurbo ~Profilertprof$EXENAMER~esource CompilerRC$RC~Import LibrarianIMPLIB$IMPLIBTLIBTLIBPRJNAME -+ NAME5TYDh%GARBLE.CSPARK\GARBLE.C)*+YD(ARC.C\TESTS\NSPARK\ARC.C YDWARCFS.CESTS\NSPARK\ARCFS.CYDCOMPRESS.CS\NSPARK\COMPRESS.C YDVsCRC.C\TESTS\NSPARK\CRC.C YDp7DATE.CTESTS\NSPARK\DATE.C YD 3ERROR.CESTS\NSPARK\ERROR.C"YD*IO.CB\TESTS\NSPARK\IO.C%YDm_MAIN.CTESTS\NSPARK\MAIN.C)YDMISC.CTESTS\NSPARK\MISC.C,YDAiMSDOS.CESTS\NSPARK\MSDOS.C2YDPACK.CTESTS\NSPARK\PACK.C !"4YDLSTORE.CESTS\NSPARK\STORE.C#$%6YD% T|UNARC.CESTS\NSPARK\UNARC.C&'( UjhCRC.CSS.CS Vj8DATE.CS.CS#tXXXRK.MAKS Vj5ERROR.CAKS VjIO.C.CA6<gG:xk[OT4)\R2."|\UzH;+z7VD @ @@@$@@VD8YDYD9YDVDYD:@YD1YDYD @YDYDYD:@YD1YD@..\..\BC31\INCLUDE\IO.HYDCOMPRESS.HYDSTORE.HVDUNARC.C 5VD @ @@@VDVDYDXDYD@@VDSTORE.C 3VD @ @@@VDVDYDXDYDYDMSDOVDPACK.CYDOS.H -VDVD+YD.@ @/@@0a @@1YDYDMa ..\..\BC31\INCLUDE\UTIME.H@..\..\BC31\INCLUDE\DIR.H@..\..\BC31\INCLUDE\SYS\STAT.HVDMSDOS.CYDDATE.H *YD@ @@@ @@VDVD+YDYD@YDMISC.C&YD @ @@@@$@VDYDYD @YD'YD(YDXD@@@$@VDYDUNARC.HYDARC.HYDMAIN.C#VD @ @@@$@@VDVDYD @YDYD@@VD@..\..\BC31\INCLUDE\CTYPE.HVDIO.C!VD @ @@@YD @@VDERROR.CVD @ @@@VDVD VDDATE.C VD @ @@@VDVDYDVD @ @@VDCRC.C@..\..\BC31\INCLUDE\ALLOC.HYD @ @@@@VDYDVDYDXDYDYD@@YDCRC.HVDMAIN.HYDPACK.HYDCOMPRESS.C VD @ @@@@@@VDYDYDYD VD YDMISC.HYDNSPARKIO.HYDARCFS.H@..\..\BC31\INCLUDE\STRING.H@..\..\BC31\INCLUDE\TIME.H@..\..\BC31\INCLUDE\STDLIB.H@..\..\BC31\INCLUDE\_NULL.H@..\..\BC31\INCLUDE\_NFILE.H@..\..\BC31\INCLUDE\STDIO.HVDARCFS.C@..\..\BC31\INCLUDE\_DEFS.HVDVDYD @ @@..\..\BC31\INCLUDE\STDARG.HYDERROR.HVDARC.CVDSPARK.HXDGARBLE.HVDGARBLE.CVDXDVDARBL7,\[Z~vutlkjba`_^]Z-UMSDOS-UMSDOS-UMSDOS-UMSDOS-UMSDOS-UMSDOS-UMSDOS-UMSDOS-UMSDOS-UMSDOS-UMSDOS-UMSDOSnspark-1.7.8B2+git20210317.cb30779/nosysdep.sed000066400000000000000000000003601402443176000201460ustar00rootroot00000000000000# Remove dependancies on system include files /[^ ]*$(OBJ)/s,/usr/include/[^ ]*[ ]*,,g /[^ ]*$(OBJ)/s,/usr/include/[^ ]*$,, /[^ ]*$(OBJ):/s,/usr/local/lib/[^ ]*[ ]*,,g /[^ ]*$(OBJ):/s,/usr/local/lib/[^ ]*$,, /[^ ]*$(OBJ):[ ]*$/d nspark-1.7.8B2+git20210317.cb30779/nsparkio.h000066400000000000000000000023041402443176000176040ustar00rootroot00000000000000/* * file input/output function prototypes * * BB changed name to nsparkio.h because of conflict with * Borland C++'s io.h * $Header: nsparkio.h 1.4 95/06/23 $ * $Log: nsparkio.h,v $ * * Revision 1.4 95/06/23 xx:xx:xx BB * Changed name to nsparkio.h for use with Borland C++ * * Revision 1.3 92/12/09 11:41:20 duplain * #ifdef'd out write_halfword() and write_word(). * * Revision 1.2 92/10/07 10:37:46 duplain * Changed order of function prototypes in line with io.c r1.5 . * * Revision 1.1 92/09/29 18:02:35 duplain * Initial revision * */ /* BB changed next two lines */ /* #ifndef __IO_H */ /* #define __IO_H */ #ifndef __NSPARKIO_H #define __NSPARKIO_H Ferror check_stream(FILE *fp); Byte read_byte(FILE *ifp); Halfword read_halfword(FILE *ifp); Word read_word(FILE *ifp); void write_byte(FILE *ofp, Byte byte); #ifdef notyet void write_halfword(FILE *ofp, Halfword halfword); void write_word(FILE *ofp, Word word); #endif /* notyet */ Header *read_header(FILE *ifp); Status read_sqsh_header(FILE *ifp, SqshHeader *sqsh_header); void sqsh_header_to_header(SqshHeader *sqsh_header, Header *Header); /* BB changed next line */ /* #endif */ /* __IO_H */ #endif /* __NSPARKIO_H */ nspark-1.7.8B2+git20210317.cb30779/os.h000066400000000000000000000012431402443176000164000ustar00rootroot00000000000000/* * Operating System specific function prototypes * * $Header: os.h 1.2 92/10/01 $ * $Log: os.h,v $ * Revision 1.3 93/03/05 15:37:24 arb * Added read() function prototype for RISCOS * * Revision 1.2 92/10/01 11:22:18 duplain * Added filesize() function prototype. * * Revision 1.1 92/09/29 18:02:39 duplain * Initial revision * */ #ifndef __OS_H #define __OS_H Word filesize(char *pathname); Ftype exist(char *pathname); int makedir(char *pathname); int filestamp(Header *header, char *filename); #ifdef RISCOS int read(int fd, void *buffer, int size); #endif #ifdef _MSC_VER #define read _read #define strdup _strdup #endif #endif /* __OS_H */ nspark-1.7.8B2+git20210317.cb30779/pack.c000066400000000000000000000065221402443176000166750ustar00rootroot00000000000000 /* * pack/unpack archive files * * $Header: pack.c 1.5 95/08/01 $ * $Log: pack.c,v $ * Revision 1.5 95/08/01 xx:xx:xx BB * Fixed for Borland C/C++ * * Revision 1.4 92/12/07 17:19:29 duplain * reformatted source. * * Revision 1.3 92/11/09 14:48:36 duplain * Added putc_init() to re-initialise variables. * * Revision 1.2 92/10/01 11:22:35 duplain * Added check for EOF. * * Revision 1.1 92/09/29 18:02:25 duplain * Initial revision * */ #include #include "spark.h" #include "main.h" #include "crc.h" #include "garble.h" #include "error.h" /* BB changed next line because of conflict with Borland's io.h */ /* #include "io.h" */ #include "nsparkio.h" #include "pack.h" static short running; static Word complen; void putc_init() { running = 0; } /* * write run-length encoding to output file */ void putc_ncr(FILE *ofp, Byte byte) { static Byte prevbyte; if (running) { if (!byte) { /* means write RUNMARK to output */ calccrc(RUNMARK); if (!testing) write_byte(ofp, RUNMARK); } else { /* BB changed next line */ /* Borland C++ is `a bit fuzzy' about next line */ /* while (--byte) { */ #ifdef __MSDOS__ while (--byte != 0) { #else while (--byte) { #endif calccrc(prevbyte); if (!testing) write_byte(ofp, prevbyte); } } running = 0; } else if (byte == RUNMARK) { running++; } else { prevbyte = byte; /* save in case next byte is RUNMARK */ calccrc(byte); if (!testing) write_byte(ofp, byte); } } Status unpack(Header *header, FILE *ifp, FILE *ofp) { register Word len = header->complen; init_garble(); crc = 0; putc_init(); while (len--) { if (check_stream(ifp) != FNOERR) break; putc_ncr(ofp, ungarble(read_byte(ifp))); } if (check_stream(ifp) == FRWERR) return (RERR); if (!testing && check_stream(ofp) == FRWERR) return (WERR); if ((Halfword) crc != header->crc) return (CRCERR); if (testing) msg("OK (packed)"); else msg("unpacked"); return (NOERR); } void write_ncr(FILE *ofp, Byte byte, int bytecount) { int i; if (bytecount > 1) { fputc((int)garble(byte), ofp); fputc((int)garble(RUNMARK), ofp); fputc((int)garble(bytecount), ofp); complen += 3; for (i = 0; i < bytecount; i++) { calccrc(byte); } } else { if (byte == RUNMARK) { calccrc(RUNMARK); fputc((int)garble(RUNMARK), ofp); fputc(garble(0), ofp); complen += 2; } else { calccrc(byte); fputc((int)garble(byte), ofp); complen += 1; } } } Status pack(Header *header, FILE *ifp, FILE *ofp) { register Word len = header->origlen; Byte prevbyte = '\0', byte; int bytecount = 0; init_garble(); complen = 0; crc = 0; prevbyte = read_byte(ifp); len--; bytecount = 1; while (len--) { byte = read_byte(ifp); if(prevbyte == RUNMARK) { write_ncr(ofp, prevbyte, 1); bytecount = 1; } else if (byte == prevbyte && bytecount < 254) { bytecount++; } else { write_ncr(ofp, prevbyte, bytecount); bytecount = 1; } prevbyte = byte; if (check_stream(ifp) != FNOERR) break; } write_ncr(ofp, prevbyte, bytecount); if (check_stream(ifp) == FRWERR) return (RERR); if (!testing && check_stream(ofp) == FRWERR) return (WERR); if (testing) msg("OK (packed)"); else msg("packed"); header->crc = (Halfword) crc; header->complen = complen; return (NOERR); } nspark-1.7.8B2+git20210317.cb30779/pack.h000066400000000000000000000007401402443176000166760ustar00rootroot00000000000000/* * pack/unpack function prototypes * * $Header: pack.h 1.2 92/11/09 $ * $Log: pack.h,v $ * Revision 1.2 92/11/09 14:49:02 duplain * Added putc_init() function prototype. * * Revision 1.1 92/09/29 18:02:40 duplain * Initial revision * */ #ifndef __PACK_H #define __PACK_H void putc_init(void); void putc_ncr(FILE *ofp, Byte byte); Status unpack(Header *header, FILE *ifp, FILE *ofp); Status pack(Header *header, FILE *ifp, FILE *ofp); #endif /* __PACK_H */ nspark-1.7.8B2+git20210317.cb30779/riscos/000077500000000000000000000000001402443176000171105ustar00rootroot00000000000000nspark-1.7.8B2+git20210317.cb30779/riscos/README000066400000000000000000000005271402443176000177740ustar00rootroot00000000000000nspark is an executable and should be set to type `Absolute' (&ff8) using the `Set Type' menu in the filer or by typing `settype nspark Absolute' from the command line. ren is an Obey/Command file for renaming the source code files into directories suitable for compilation on RISC OS. First you should create directories c, h and o. nspark-1.7.8B2+git20210317.cb30779/riscos/ren000066400000000000000000000015531402443176000176230ustar00rootroot00000000000000cdir c cdir h rename acorn/c c.acorn rename arc/c c.arc rename arc/h h.arc rename arcfs/c c.arcfs rename arcfs/h h.arcfs rename compress/c c.compress rename compress/h h.compress rename crc/c c.crc rename crc/h h.crc rename date/c c.date rename date/h h.date rename error/c c.error rename error/h h.error rename garble/c c.garble rename garble/h h.garble rename io/c c.io rename nsparkio/h h.nsparkio rename main/c c.main rename main/h h.main rename misc/c c.misc rename misc/h h.misc rename msdos/c c.msdos rename os/h h.os rename pack/c c.pack rename pack/h h.pack rename spark/h h.spark rename sqshmain/c c.sqshmain rename store/c c.store rename store/h h.store rename unarc/c c.unarc rename unarc/h h.unarc rename unix/c c.unix rename version/h h.version rename winnt/c c.winnt cdir testprog.c rename testprog.pack/c testprog.c.pack nspark-1.7.8B2+git20210317.cb30779/spark.h000066400000000000000000000110351402443176000170770ustar00rootroot00000000000000/* * defines types used in nspark * * $Header: spark.h 1.8 95/08/01 $ * $Log: spark.h,v $ * Revision 1.8 95/08/01 xx:xx:xx BB * Added MSDOS6 and MSDOS7 macros * * Revision 1.7 94/11/09 10:36:00 auj * Added Windows NT support. * * Revision 1.6 93/04/05 12:34:56 arb * Added RISC OS support. * * Revision 1.5 92/11/04 16:57:32 duplain * Completed CT_xxx types. * * Revision 1.4 92/10/23 14:06:57 duplain * Added test for Sys V.4 when defining Sys V file and path name lengths. * * Revision 1.3 92/10/06 12:22:11 duplain * Removed "days_since_1900" from struct date. * * Revision 1.2 92/09/30 10:28:13 duplain * Added W_OPENMODE and R_OPENMODE. * * Revision 1.1 92/09/29 18:02:41 duplain * Initial revision * */ #ifndef __SPARK_H #define __SPARK_H /* * globalise system-type defines... */ #if defined(RISCOS2) || defined(RISCOS3) #define RISCOS #endif /* BB changed next line */ /* #if defined(MSDOS2) || defined(MSDOS3) || defined(MSDOS4) || defined(MSDOS5) || defined(WINNT) */ #if defined(MSDOS2) || defined(MSDOS3) || defined(MSDOS4) || \ defined(MSDOS5) || defined(MSDOS6) || defined(MSDOS7) || \ defined(MSDOS32) || defined(WINNT) #define MSDOS #endif /* * "Word" must be a 4-byte type. * "Halfword" must be a 2-byte type. * "Byte" must be a 1-byte type. */ #if defined (MSDOS) && !defined(WINNT) && !defined(MSDOS32) typedef unsigned long Word; typedef unsigned int Halfword; typedef unsigned char Byte; #else /* not MSDOS */ typedef unsigned int Word; typedef unsigned short Halfword; typedef unsigned char Byte; #endif /* MSDOS */ /* * define the path seperator character, and file open mode string. */ #if defined(POSIX) #define PATHSEP '/' #define PATHSEPSTR "/" #define W_OPENMODE "w" #define R_OPENMODE "r" #endif #if defined(RISCOS) #define PATHSEP '.' #define PATHSEPSTR "." #define W_OPENMODE "w" #define R_OPENMODE "r" #endif #if defined(MSDOS) #if defined(WINNT) #define PATHSEP '/' /* Win NT uses \ as the seperator, but MSC allows /, so use that as it makes life easier in filename translation. */ #define PATHSEPSTR "/" #else #define PATHSEP '\\' #define PATHSEPSTR "\\" #endif #define W_OPENMODE "wb" #define R_OPENMODE "rb" #endif /* * define maximum filename and pathname length */ #if defined(POSIX) #define FILENAMELEN 256 #define PATHNAMELEN 1024 #endif #if defined (RISCOS) #define FILENAMELEN 10 #define PATHNAMELEN 256 #endif #if defined (MSDOS) #if defined (WINNT) #define FILENAMELEN 256 #define PATHNAMELEN 1024 #else #define FILENAMELEN 12 /* including dot */ #define PATHNAMELEN 256 #endif #endif /* * stream error enumeration */ typedef enum {FNOERR, FEND, FRWERR} Ferror; /* * file type */ typedef enum {NOEXIST, ISFILE, ISDIR } Ftype; /* * un-archiving status */ typedef enum {NOERR, RERR, WERR, CRCERR } Status; /* * compressed file header */ typedef struct { Byte comptype; /* compression type */ char name[14]; /* name of file */ Word complen; /* compressed length */ Halfword date; /* file creation date */ Halfword time; /* file creation time */ Halfword crc; /* Cyclic Redundancy Check */ Word origlen; /* original length */ Word load; /* load address */ Word exec; /* exec address */ Word attr; /* file attributes */ } Header; typedef struct { char magic[4]; /* Should be SQSH */ Word origlen; /* Original length */ Word load; /* load address */ Word exec; /* exec address */ Word reserved; /* For future use */ } SqshHeader; /* * universal date structure */ typedef struct { int second; int minute; int hour; int day; int month; int year; } Date; /* * compress type (passed to uncompress()) */ typedef enum { COMPRESS, SQUASH, CRUNCH, UNIX_COMPRESS } CompType; /* * compression types */ #define CT_NOTCOMP (Byte)0x01 /* not compressed (old) */ #define CT_NOTCOMP2 (Byte)0x02 /* not compressed (new) */ #define CT_PACK (Byte)0x03 /* run length */ #define CT_PACKSQUEEZE (Byte)0x04 /* run length + Huffman squeezing */ #define CT_LZOLD (Byte)0x05 /* Lempel-Ziv (old) */ #define CT_LZNEW (Byte)0x06 /* Lempel-Ziv (new) */ #define CT_LZW (Byte)0x07 /* Lempel-Ziv Welch */ #define CT_CRUNCH (Byte)0x08 /* Dynamic LZW with adaptive reset */ #define CT_SQUASH (Byte)0x09 /* PKARC squashing */ #define CT_COMP (Byte)0x7f /* UNIX compress */ /* * other spark defines */ #define STARTBYTE (Byte)0x1a /* start of archive marker */ #define RUNMARK (Byte)0x90 /* start of run (pack/unpack) */ #define ARCHPACK (Byte)0x80 /* bit-7 set in comptype if Archie */ #endif /* __SPARK_H */ nspark-1.7.8B2+git20210317.cb30779/sqshmain.c000066400000000000000000000025721402443176000176030ustar00rootroot00000000000000#include #include #include #include "spark.h" #include "arcfs.h" #include "unarc.h" #include "error.h" char *ourname; unsigned char apptype = 0; unsigned char force = 0; unsigned char inffiles = 0; unsigned char listing = 0; unsigned char testing = 0; unsigned char quiet = 1; unsigned char retry = 0; unsigned char singlecase = 0; unsigned char stamp = 1; unsigned char to_stdout = 0; unsigned char verbose = 0; char *archive = NULL; char **files = NULL; char *logfile = NULL; void usage() { fprintf(stderr, "sqsh: un-squashes RISC OS squashed files\n"); fprintf(stderr, "Usage: sqsh [options] \n"); fprintf(stderr, " where options are:\n"); fprintf(stderr, " -c output to stdout\n"); fprintf(stderr, " -f force file overwrite\n"); fprintf(stderr, " -s do not set timestamp of decompressed file\n"); exit(1); } int main(int argc, char *argv[]) { int r; int i; if (argc < 2) { usage(); } ourname = argv[0]; for (i = 1; i < argc; i++) { if (argv[i][0] == '-') { switch (argv[i][1]) { case 'c': to_stdout = 1; break; case 'f': force = 1; break; case 's': stamp = 0; break; } } else { break; } } if (i == argc) { usage(); } archive = argv[i]; r = do_unsquash(); if (r != 0 || writesize > 0) { error("Error unsquashing file"); } return r; } nspark-1.7.8B2+git20210317.cb30779/store.c000066400000000000000000000024201402443176000171040ustar00rootroot00000000000000 /* * store/unstore archive file * * $Header: store.c 1.5 95/08/01 $ * $Log: store.c,v $ * Revision 1.5 95/08/01 xx:xx:xx BB * Fixed for Borland C/C++ * * Revision 1.4 93/08/20 11:50:20 arb * Do not print "unstored" if in quiet mode * * Revision 1.3 92/12/07 17:19:39 duplain * reformatted source. * * Revision 1.2 92/10/01 11:22:46 duplain * Added check for EOF. * * Revision 1.1 92/09/29 18:02:26 duplain * Initial revision * */ #include #include "spark.h" #include "main.h" #include "crc.h" #include "garble.h" #include "error.h" /* BB changed next line because of conflict with Borland's io.h */ /* #include "io.h" */ #include "nsparkio.h" Status unstore(Header *header, FILE *ifp, FILE *ofp) { register Word len = header->complen; register Byte byte; init_garble(); crc = 0; while (len--) { if (check_stream(ifp) != FNOERR) break; byte = read_byte(ifp); byte = ungarble(byte); calccrc(byte); if (!testing) write_byte(ofp, byte); } if (check_stream(ifp) == FRWERR) return (RERR); if (!testing && check_stream(ofp) == FRWERR) return (WERR); if ((Halfword) crc != header->crc) return (CRCERR); if (testing) { if (!quiet) msg("OK (stored)"); } else if (!quiet) msg("unstored"); return (NOERR); } nspark-1.7.8B2+git20210317.cb30779/store.h000066400000000000000000000004401402443176000171110ustar00rootroot00000000000000/* * store/unstore function prototypes * * $Header: store.h 1.1 92/09/29 $ * $Log: store.h,v $ * Revision 1.1 92/09/29 18:02:42 duplain * Initial revision * */ #ifndef __STORE_H #define __STORE_H Status unstore(Header *header, FILE *ifp, FILE *ofp); #endif /* __STORE_H */ nspark-1.7.8B2+git20210317.cb30779/testprog/000077500000000000000000000000001402443176000174555ustar00rootroot00000000000000nspark-1.7.8B2+git20210317.cb30779/testprog/CMakeLists.txt000066400000000000000000000001131402443176000222100ustar00rootroot00000000000000add_executable(testpack pack.c) target_link_libraries (testpack nsparklib) nspark-1.7.8B2+git20210317.cb30779/testprog/pack.c000066400000000000000000000030771402443176000205460ustar00rootroot00000000000000#include #include #include #include "../spark.h" #include "../crc.h" #include "../nsparkio.h" #include "../pack.h" #include "../arcfs.h" #include "../garble.h" #include "../error.h" char **files = NULL; char *archive = NULL; char *ourname = NULL; unsigned char testing = 0; unsigned char quiet = 0; unsigned int singlecase = 0; int main(int argc, char *argv[]) { FILE *in, *out; Header header; int r; memset(&header, 0, sizeof(header)); set_password("james"); if (argc != 4) { fprintf(stderr, "usage: %s <-p|u> \n", argv[0]); exit(1); } in = fopen(argv[2], "r"); if (!in) { error("Failed to open %s for reading", argv[2]); exit(1); } out = fopen(argv[3], "w"); if (!out) { error("Failed to open %s for writing", argv[3]); } if (strcmp(argv[1], "-p") == 0) { fseek(in, 0, SEEK_END); header.origlen = ftell(in); fseek(in, 0, SEEK_SET); fwrite(&header, sizeof(header), 1, out); crcsize = header.origlen; pack(&header, in, out); fseek(out, 0, SEEK_SET); msg("\n"); fwrite(&header, sizeof(header), 1, out); msg("Original size = %d\n", header.origlen); msg("Compressed size = %d\n", header.complen); } else { if (fread(&header, sizeof(header), 1, in)!=sizeof(header)) { perror("Read failed!"); exit(1); } msg("Original size = %d\n", header.origlen); msg("Compressed size = %d\n", header.complen); crcsize = writesize = header.origlen; r = unpack(&header, in, out); if (r != NOERR) { error("Failed %d", r); } msg("\n"); } fclose(in); fclose(out); return 0; } nspark-1.7.8B2+git20210317.cb30779/tests/000077500000000000000000000000001402443176000167505ustar00rootroot00000000000000nspark-1.7.8B2+git20210317.cb30779/tests/compress,3fb000066400000000000000000000202741402443176000212020ustar00rootroot00000000000000ArchiveDT(dSoundPO BachFXVIbK`x^"Fanfare1bK`x^A<Giguees1bK`x^7 HandlMes1a}K`x^6dHandlMes1b K`x^t$ShostF1WW K`x^\08rRJWWWWSSBSB9BKci`cFileDataHandlMes1b K`x^,)&~vhcmds*slM3c%m#]hgjWz<naoerj=mMsG.N>zy!Wkq`heYpndq1MGkYBc`Km[4ijYc e|aNio,uE5e\qf*K8EQo=rHddqUluY:=rx)nR{m%sQok[C 3?imm}E0a5oL>h |Lc.T) ( /kWtŭ`T0T:$CY1il|JO;6zq^+1zȺsx^S&avgyqmrep0Q z*pqQe1bAh'@qaF0SGyq$y&}yk}`+;Yn p9Cv'8&0b&y,dr,d/|1l`f.!?`8cIq*?d{4p r,l*1ndGz!lX1zdV? dիh{mi}eKe+Kc+Mc%Mnc!Oc+Cc)Ic%OzjԷpGjGԻAj¤ۇceD~3F}jkAJseAJc0@jeE `+}3`e`e{Lݝ~Y]¥aiCBA~]d:Fnc)z3zd}k+@3mjkE0^r8Fu bGڀBu ީ`%s.@k2MeM$LeO X@>cj$ce LÿDc%Nkݳj[WlicUβ,ɮ:XbQk} PԤ+mJY`?ckW?o0GE?j9eŽǝgu'|e& \-i3ؤbcE`ezipuEj`fub1=h\ ]~~jm kwfA]u>GQ彫Y%e-#s;W dXxe?6FRhNjxmUJvcnpew6MI:AD%kao1 ۼLCWrWp-%wzil p3md].Y'\8TH, tE3Gǘ9S_{odor+1"CMys3;bwb]MGx )ooS|_&fc6doyPlYqt%qGucob}q*Yao7sܣpcC=w{. LOĘ(45((ڳsS4X`A2~X&|+)63[v\bq(A`CPaAhsF-me 4ϖfe)荔)%_J` DC bSxX$*@SHf!dj1l p}Bo7rLOC1@îa|%qmfa4?%m57?%">M{֯Gc騙0Ah&|,E_Q}]Ų -co؅Ag(/9̿7dgײmנ)n`W8ekni>JQC}d"an=ŀe}ͪ(Y,tN0 fDB#G nέǮ,ިľ.`&!H M=˞yQ$'HybLavt˵siW]4gBݎȷY4͌kS<~IbɹgkRCY*3eϣ{E[LK. MfqFrz=H]WLXi5wow1gz#kw KR`c19!:f,\^بKJTz-zo<&!g~P~#:1f(P"9Hs(^R{l`|-nky6c}_ a4$ LGLqVpx_5TS%q%EtO7%tKzeAaR%GIzAmRa`o>@Rv<3Fىhj\<eovzw~xle|Q=wbe-;O_5㟛"0;J)z\Eks;teT1Bizu'hOyeqoh',dw%lI%*"mQfmdnoNP`ebMEOhz &sku-euzla3bN IYaoqjg esFileDataBachFXVIbK`x^",)&~vhcmdsJasnY}a%mi]hEQbwdj!medjwmj@o.{H< jJ#_'܀Lid6n*BX rA+s[bo1[#}C oQ.} 23\G{˩9CzkG}nq,A`jUM注N`g@Fӎa'uNp'q`+dKg0XHNH0ܦ?{(}}Kߜ& A1fRx8)/6Y==#}wZg,*ABIo,*y}do79+:=в(:ɩ-aCKV(צ#/21^v/p7f&[GzuCb.` mS^[ݥZ ucSNem+:a{jhieqZmkSjcqAd18o%amesFileDataGiguees1bK`x^7,)&~vhcmd/tcD%mw#M/aMecjh{ja{HKAkejK!c٬`LduQnm:R1!L#gu1{8oJ8?kGh)I.DX|JK!z_dnI|3swBak:{=3aŠ-E+WV,dqhyyGtN?Bukwh[9*w ]'tx:J\AG8~BJkgUJay>JPvRzj*m$q)yzE^qrt{`+}9+`Evwԫ`+y;Jik`s:kÏzI@`'EӦykM'DN g(tC%2`wЫ@g K(K`wM+)4 gMHȴG*t 5h.M k穛iee?g7kK;p P z`e};.!Hah"jciwzkQ-r~A-dp~!-dpAdqzʳpmp~ eu~amesFileDataFanfare1bK`x^A,)&~vhcmdsJ!i%US`A]t3m%sJavsDadK`z#JYGC`̪u [-ig<#Ss('^5hbig HoF7}8(M_x ('{?pie}E:]iwdqYEVg? YMykchaSJErfSJs;on)yS0FIJE `|~-Lliz9btZfj`sPIS&oti(F qvW_c: D8G&j!2#wapuW#wwSd}Lu3f%cksr}`OKsqsC}Ҫi)Gsc-K0`dui2 ˆI2s3rhI{ /H hEܨH  c js|+L+GZTKXk ˄ [KGkGܛHKH[[EʳKշjezkQmrbehAdqvѼd dpuNamFileDataHandlMes1a}K`x^6,)&~vhcmdsJ~ aevHaksr2ustdj!medjkm{Hi:i@,-l%h]_Y?[?b`k}vKa2ңeiY%}Ki!ømTqTFj\B #cV)skC?>:ye G.G[T쇽ٷ6`{.!>>3am{~AŃIk`R)p}Rdq|iE#㵡+wwK5)'H}I!`b= rG !(}@n[%{Ӯ%Kc%xckCCLMcce h S,dUZ+{ vyӮMD3jew*esB7v77qAWv0/؆Hyb62>2p|MPi `  9OYvAfow6rMp+>0M@5|X\v$Mjpk}"ƆrxF2+xhc)yYGNciChc+yF9sE+ѧ$ @](ruP[26D  ̚DP+ňFȉ ʲd:N : &rm+3\s1@1r g CpM6MPvQVh`^ C)M.c+E0O}VyAIj6P)lk"3٭W _͟ \]D^KO}0}F"]XG&S&JSWP<A&p j}fFiWJ%J_2pgEjrdU 0k*wd%YPu+FFTYTU#׌ M?MmzkQmezoTewb1eubmtv5c3cusiamesFileDataShostF1WW K`x^\,)&~vhcmds*!~3!ae{H"eS`]4u,m%sJanYpM3Hm{C"/m AuϪIlv%i^>a'M?\,ZTzx##uCepeTO=}$h<bpNO ~ Vaj~JG0U ]:}B*{FS&<`*4ʎ7_@?zxjU^Rt-a@r 8Cb quiA[Y.8;6P2Q8d/pڶt iꗦSG;Q98ROX?eik3`osD&j`m2e2ߤ[bE " j rU#pTiw3LY6|{qTAABf1di4O5gEl3xusnÔe-0 j}ž~!@F'=UoJТpRhqsGB#(sAyf'd5k`eKzfYި5@bQWLXt><- n$a,'s!AcMs`Amf{aXFqևײFjcmesnspark-1.7.8B2+git20210317.cb30779/tests/crunch,3fb000066400000000000000000000203541402443176000206300ustar00rootroot00000000000000ArchiveDT(dSoundP= BachFXVIbK`x^"Fanfare1bK`x^A< Giguees1bK`x^7 HandlMes1a}K`x^6HandlMes1b K`x^$ShostF1b K`x^\8`BachFXVIbK`x^" FileDataHandlMes1b K`x^,)&~vhcmds*slM3c%m#e(C-tvaK9mashae#j!e;oa*EK@l"uSt}GfY'# zj=$BI!( D2ul#q^C#h k*?67FsɑC tFna#D%oRW4kh'mp:+7\SlfwP%Ey&t8'"K4i!iTGrp"i$asهh5`kzg(ɠ@}ò L+cTy66`*A,1' 9SI6mrqm=cAeoG oxl22nQ bAe!ٴq1"@Adzk@mAA) Pk}$@W-c)p}jEjsj}L]meh}ͬEqMCk~tip{Mm%}`%q3sbgE,dEjs^BF}j:ߠ,AEjִhCUaEEUF/U ܊<ߣd`k{]sXpf%mWIcٰa}•W@ reW>}ucm]@%j*3@iJeH3ciO1̔,ke~jm j w蜮eaK%U7".StC1dq&eCLc;)2Â@,AFI|*'mgf/xwgEoZ*eudw.au3W,jc+:h(ppn'rhenP։Y5fmpn|i$t6L/ IizJIrg-amzh@WkdqS;#`e,ߓ}*|viai_A ${#wbirb< "ʑr`~Ŵ&ًҦl7po?ljzkGckmdp3߇ac8 jAu2aى U$X<Ի6ƿ#?SZ +z&4ΈЬgeH){fRnj30anS콷C6Z8YF/(:ۑ28<$7dE>H,ϫmg fnxS/׿~k>T <ԪXEbGAvo} r Y_m+efOx2hh'uxqjYl6M&9xZ,NK]\]dh %hlOdSB&`@2L28@6N%:UMgz!,"EvЭʀ`T Z>oqyYwBNhOvUt`Y0_bsiJe}Sezg(4{ci @-X0$3r?uȤ3:z_B4ޞȱQ $]gҬu&ijRl~\Ų = <) 58yvЯAkyta܄pHf}KZCXӋH}jqg+`i*kMJ=5]Cask|k*EgkzmJAQgh-)alq3jg}rn!faji=eprlesFileDataBachFXVIbK`x^",)&~vhcmdsJasnY}a%mie(C-4o/qw\q5mashaejaa{{?/esHGmrleZpm-q;MC>[ %kb+kmcYA=jIe, T6E1nisz.IEtE[uCK ǻElLSn%rA {{B C"eer0| -Y(6:P%hIe\ sc1/Z]z8:mq[ k2宻]S](ׇfȗazwM2P2Tmh6d񯄵0rT/mgDQG7anmE n(_DeeyhE#h}sjc+Mcӊ`'50 JcgAJPh%`'Ӯ`%q`e>sceG`%{NIlËD(@e|IhSNxBM9p(e}I`+ӎhe8Ndx3 E})L`%uN` q`'}+0 ;eEh>H=HHo 2rEOpq9hZh}D{U+bD\q$2Ď֒:tRap|m+bcz s,AdsS|)7Vl6 p{B@DQ~'SweuhiKm}) xGֹD,7çLA)D3t%1~| {;`/xPM Fg1s2C|B#8yizg;hir+5qHs$B'J?t0LsӢdE0y2ܥP"4%`Suo)Y4:SM!3tcV-u.#d\ TH޲H5LP$(rT^>\};uGc4GkLDWc?&<\j= 2&ATvי8O^xq:f!ypk hoG!#ؾy "~%wZh'Ѱr[08=nd]9;/c1qƟ"p51d,IJ4!PμZaLDs+/w`}%soqdwa{sxi5bqjamFileDataGiguees1bK`x^7,)&~vhcmd/tcD#%aW0$Qh%sJans{a{zzk.sJjjeD# `.UT*]qq`(u'kqwf@1c?@=HY>˻% [H/CeU$tU1Go +,nI7cD/w`sm% CkatzGiO1l(uq^,fk}?ʁįr%Ln{-̳ΣpzGS]lΌ%J[ s8abbgelRfo]}aX<ӧzket{`+}9+`Ezw٫`+y;Zik`OguuhJ9 D`'EӶykM3HÎ wtCkagGN|(u#gMЛ99) 0ۯ4OΨ #ȷDh CsGxWdfIE=i 䇉I0GKwKdٗX\ikEJDW Wnks.`eu;NeePo1evf1mdv etb!dv-J-dsFileDataFanfare1bK`x^A,)&~vhcmdsJ!i%US`Aua-as^ej`es$aeSl`{omexcc ̠,X Vۦ[}>=n\g.Մ?#sI:ic3lA2Sgd_=h 5 $ 'k62X\0mdw"sM\kina~bU_-tk{%rkieGS"!d!piIflwvX^ _PA5%}QZ8fri}is`N=iWai-Lw!dey}+ cT1wje'ssvmkp?p*0 fp$lhp trKtO Gtw+`mOWp3NcmI2qOsI}jaiU2wK2hu?pjE,h(`H j lk| AJDDeE<+ (sӄxۼ(xx⼛jljձ|F{sNeelAp5ub#t*-dp -gsjamFileDataHandlMes1a}K`x^6,)&~vhcmdsJ~ aevHaknR{ERjtRq5mashae#jcI'as'm-{HLtZ`Ddlg !!qoi{eeuY%}Hi|Cudϐt3ySj[yqUs{CZ YL HlRTtY:k([3K> xO3uܫley{I-2`hlR-iO]l)uEjg"l!opN~9Dv%3X e[#cV-j}jG sjGeE}(d}뾦vdccMjLi l LCc0 c`+e\$ Cvj`eG;cG+˻6 O19p1)7p0VFKs2kYwp, fGݨKFƼwˌ{pU)vԵHAֽ`ѧ@`k rS @+bmSacgO vJr AIvKъkiiMLupd}p#L`! YX} cg m+Ž_M\7^@ޫOm03YM4MckAck&D DE`oyS>ku̼KG`g}٬fϴ|jf}P@N3Rj+@}js+H#Cw5Fd}[׸y}˵DmNA.z.oNXTCciuM29ubMlk>;uFk0@+Ew)%B "WP%ۼCí`@jgu&Qg˻/';^28Z>W'uāiT5%9o\y{|dAhy%I(Ajmp}wU63EZ\"<{t=LV90x.c&GKe3&L!A),tz]OV'əb$!qcorTÂkeoxe{Brh@j6qO?M麂nAah/aou_gif^*';PKo}iy"n7m3Ib4D?EUkkFr6SkfO-2WLMǝ/(A1 X4Iuڠka{xcmW.S0tske=err!mb`Mhmu*amnspark-1.7.8B2+git20210317.cb30779/tests/info.txt000066400000000000000000000000231402443176000204370ustar00rootroot00000000000000password is: james nspark-1.7.8B2+git20210317.cb30779/tests/pack,3fb000066400000000000000000000304721402443176000202660ustar00rootroot00000000000000ArchiveDT(dSoundPF2 BachFXVIbK`x^" Fanfare1bK`x^AGiguees1bK`x^7HandlMes1a}K`x^6&HandlMes1b K`x^ $ShostF1b K`x^\ $BachFXVIbK`x^" FileDataHandlMes1b K`x^'ggr*amg*amfk*amg9*ame5*ames*amg[*amd*ame_*amesjAmas6agek`ldrjAldrk`leSk`leSk`ldrk`leSj%|tbzqmEb{`|trzqmEbzpldrjA|ubzq}tcjAm9`kroVqYCmE@Y`\VrjA^VQXsgsJR}VR[ANEsJR~vrk`mE`k`lfrk`mE`hcogpkaMvrk`ndrkaMvpkr]UCjA^UCZRMTcjA\rtnemEd}P|tsJPzvqhaMtbYq}eS[R|drjA|T@XQmE@hBNDRKaMVqY`|d@haMVry`lf@haMTpic_fpiaMVry`\DRKaMTpycf@iaMTpib|f@iaMV`iRnvpjA\vBY@NDsJPltrkaMTb{pleS[bnfpjANfpicmEPKR\DsJR^g@YcmE`Yc~fpiaMVSYq\E@JaMVqxc_g@KaMVr[`~dbkaMvr[`\d`xaMVqXcngahaMtr{`~gaxaMvczq~uazaMvr{`^dbkaMVr{`|d@kaMVrK`Nd@kaMVqxc_gqhaMVqHc_gqhaMVqhcOgpkaMVrY`d kaM6q(c?g1haM618s_gAHaMVd}RleScndrjAfr[`mEk@ldsJ  aMvAxbleSYS]faxaMVrkb]usJRogpZQmE@kp|dsJv|vbzaMru}dmEdotypbjAxubzr}WcjA^g`kROWQjA^gAhROWajA\dbkPnfpjA^d`k`mEb[R_UsJrlVd{p|eS_eYagnUieS[bNg@kpleS[bnfBiboeS[bnfBiboeSY`ld@kbleSYp^eSj Zawng]sJldhcogqhcgsJmEs  ̥ڪ !% - 3     %   *- - %  3 * 84   9      * !'%*/ MS)G -   *-; -*-3j  3  1-3!% S   3j"4/:B%  % j %*(  3! -3!* 3 %3   3-3  3m -3m! -33)*8 ja m2* m m -%s % %* %J 3*/  * 3j! !3 * #4"   I  A !%! m  3a     s*aMeSjAm%s j *a  j!m % 3* 3! /m - -3!m   3     3   8 * %**-S 3# A- -% ")-m %*-e  *-e3j  ! -3!%*-3jJ)M  * !*-3  s - */3j3% -3EJMS   *  3<*%  3;!m -1! S)*-*%)-!!%* 3 / 3!%(-3!J) 1E  MSA  BIodsiaodqhcngwhdocqmcibtmfjbtmdngrjbi`ulmFileDataBachFXVIbK`x^"'ggr*amd*amg}*amd/*ame*ames*amd*amdS*ames*amesjAmas6a{ezq|uczaMtczq}ubkpleS{q}tczp|db{`mEbk`ltr{pltbkaMvbkr|vpkpnfsJr\EPIA^uBJaMTRJPLEBZq\TcjA\DSKAMDrK@LESjA\ESKAMDrK@\UcjA\ERK@LDBJAMTsJP|dbzq}ubzaMVqy`~uc[AMeS{pltbkPlDrK@leS[AMURK@]uB[AmEBiA_fqYCOFCZaMWQiBNg@ib^EQIaMVBKR\d@yc^vqjA^DSYPMTb{p|dsJr|tb{`|v`yr~eSyrlt`irogaibmE`xq~vcyp~vsJr}tbzp|t`ir~gsJrofpyq~u`zsvcxsmE`hrnv`hrovaycwsJrltbycw`kp|vqxsmE`kp|vqxs~db{rowajA~gaxrltbycogpkbleSy`|d`xc~wqjA\FqYroVRJPMEsJPNGQHC^tb{p|eSYAMDrK@NErJ@NDsJrw`xsvpysoeSyP\RDyV~eS}QMSCJWmEsJa-e+1=j   "8 ej =: 9 9  -: ,j<*<;48 *   8" <a3 a83$"8 *0(#T2(465+  ms ae3jm 3  js a-   < me  ea  ae a8m  ;<: XST2(4;4sj  3!aj* 8-4 3jm ej< ms*a  != ! -:5*-3 ) 32!%*-<3* !%*-3!%Jejm%**M3 3AE *-SAE*-3A   S!" S!% EJ% j!%s*X-8S3!T% %.*8 ;!%&*0 <'!$" $-$#<%*-% S %  3* !% 3!%*-3!)%3 ) 1:%3 ) 353% 9%#*---R- 1-3A% *-3! -%  3JM3J-<3A%*M3!%*MSh`mfsh`ogqicigvhgobqnfjbtmfjbvibnfpibnc{nspark-1.7.8B2+git20210317.cb30779/tests/store,3fb000066400000000000000000000307771402443176000205140ustar00rootroot00000000000000ArchiveDT(dSoundP6* BachFXVIbK`x^" Fanfare1bK`x^AGiguees1bK`x^7HandlMes1a}K`x^6}<HandlMes1b K`x^ $ShostF1 K`x^\ $FileDataHandlMes1b K`x^'ggr*amg*amfk*amg9*ame5*ames*amg[*amd*ame_*amesjAmas6agek`ldrjAldrk`leSk`leSk`ldrk`leSj%|tbzqmEb{`|trzqmEbzpldrjA|ubzq}tcjAm9`kroVqYCmE@Y`\VrjA^VQXsgsJR}VR[ANEsJR~vrk`mE`k`lfrk`mE`hcogpkaMvrk`ndrkaMvpkr]UCjA^UCZRMTcjA\rtnemEd}P|tsJPzvqhaMtbYq}eS[R|drjA|T@XQmE@hBNDRKaMVqY`|d@haMVry`lf@haMTpic_fpiaMVry`\DRKaMTpycf@iaMTpib|f@iaMV`iRnvpjA\vBY@NDsJPltrkaMTb{pleS[bnfpjANfpicmEPKR\DsJR^g@YcmE`Yc~fpiaMVSYq\E@JaMVqxc_g@KaMVr[`~dbkaMvr[`\d`xaMVqXcngahaMtr{`~gaxaMvczq~uazaMvr{`^dbkaMVr{`|d@kaMVrK`Nd@kaMVqxc_gqhaMVqHc_gqhaMVqhcOgpkaMVrY`d kaM6q(c?g1haM618s_gAHaMVd}RleScndrjAfr[`mEk@ldsJ  aMvAxbleSYS]faxaMVrkb]usJRogpZQmE@kp|dsJv|vbzaMru}dmEdotypbjAxubzr}WcjA^g`kROWQjA^gAhROWajA\dbkPnfpjA^d`k`mEb[R_UsJrlVd{p|eS_eYagnUieS[bNg@kpleS[bnfBiboeS[bnfBiboeSY`ld@kbleSYp^eSj Zawng]sJldhcogqhcgsJmEs  ̥ڪ !% - 3     %   *- - %  3 * 84   9      * !'%*/ MS)G -   *-; -*-3j  3  1-3!% S   3j"4/:B%  % j %*(  3! -3!* 3 %3   3-3  3m -3m! -33)*8 ja m2* m m -%s % %* %J 3*/  * 3j! !3 * #4"   I  A !%! m  3a     s*aMeSjAm%s j *a  j!m % 3* 3! /m - -3!m   3     3   8 * %**-S 3# A- -% ")-m %*-e  *-e3j  ! -3!%*-3jJ)M  * !*-3  s - */3j3% -3EJMS   *  3<*%  3;!m -1! S)*-*%)-!!%* 3 / 3!%(-3!J) 1E  MSA  BIodsiaodqhcngwhdocqmcibtmfjbtmdngrjbi`ulmFileDataBachFXVIbK`x^"'ggr*amd*amg}*amd/*ame*ames*amd*amdS*ames*amesjAmas6a{ezq|uczaMtczq}ubkpleS{q}tczp|db{`mEbk`ltr{pltbkaMvbkr|vpkpnfsJr\EPIA^uBJaMTRJPLEBZq\TcjA\DSKAMDrK@LESjA\ESKAMDrK@\UcjA\ERK@LDBJAMTsJP|dbzq}ubzaMVqy`~uc[AMeS{pltbkPlDrK@leS[AMURK@]uB[AmEBiA_fqYCOFCZaMWQiBNg@ib^EQIaMVBKR\d@yc^vqjA^DSYPMTb{p|dsJr|tb{`|v`yr~eSyrlt`irogaibmE`xq~vcyp~vsJr}tbzp|t`ir~gsJrofpyq~u`zsvcxsmE`hrnv`hrovaycwsJrltbycw`kp|vqxsmE`kp|vqxs~db{rowajA~gaxrltbycogpkbleSy`|d`xc~wqjA\FqYroVRJPMEsJPNGQHC^tb{p|eSYAMDrK@NErJ@NDsJrw`xsvpysoeSyP\RDyV~eS}QMSCJWmEsJa-e+1=j   "8 ej =: 9 9  -: ,j<*<;48 *   8" <a3 a83$"8 *0(#T2(465+  ms ae3jm 3  js a-   < me  ea  ae a8m  ;<: XST2(4;4sj  3!aj* 8-4 3jm ej< ms*a  != ! -:5*-3 ) 32!%*-<3* !%*-3!%Jejm%**M3 3AE *-SAE*-3A   S!" S!% EJ% j!%s*X-8S3!T% %.*8 ;!%&*0 <'!$" $-$#<%*-% S %  3* !% 3!%*-3!)%3 ) 1:%3 ) 353% 9%#*---R- 1-3A% *-3! -%  3JM3J-<3A%*M3!%*MSh`mfsh`ogqicigvhgobqnfjbtmfjbvibnfpibnc{nspark-1.7.8B2+git20210317.cb30779/unarc.c000066400000000000000000000350271402443176000170710ustar00rootroot00000000000000 /* * unarchive files * * Revision 1.21 99/03/17 MU * Added support for extraction with .inf files * Also capitilised the hexadecimal output strings. * * $Header: unarc.c 1.19 95/08/01 $ * $Log: unarc.c,v $ * Revision 1.20 95/08/01 xx:xx:xx BB * Fixed for Borland C/C++ * * Revision 1.19 94/12/12 17:29:30 arb * Added support for ArcFS writesize * * Revision 1.18 93/08/20 12:30:02 arb * Added support for ArcFS archive detection * * Revision 1.17 93/08/20 11:54:55 arb * Prevent printing of spaces and LF if in quiet mode * * Revision 1.16 93/03/05 14:45:43 arb * Added for RISCOS, needed for strcpy * * Revision 1.15 92/12/23 13:26:05 duplain * Added total-printing if in verbose mode. * * Revision 1.14 92/12/08 10:20:33 duplain * Added call to append_type() if apptype non zero. * * Revision 1.13 92/12/07 17:19:21 duplain * reformatted source. * * Revision 1.12 92/11/04 16:56:35 duplain * Added printing of CRC value if debugging. * * Revision 1.11 92/10/29 13:40:05 duplain * Fixed prompt_user function definition. * * Revision 1.10 92/10/23 14:31:28 duplain * Changed prompt_user() output text. * * Revision 1.9 92/10/06 12:17:49 duplain * Changed header used with verbose option. * * Revision 1.8 92/10/05 11:00:37 duplain * Recoded user-prompt when files already exists during unarchiving. * * Revision 1.7 92/10/02 17:41:14 duplain * Fix "end-of-subarchive" problem. * * Revision 1.6 92/10/02 10:03:20 duplain * Changed "OS_FILE" to "OS_File" for log file entry. * * Revision 1.5 92/10/01 13:39:30 duplain * Removed "goto do_retry" when header->complen > arcsize. * * Revision 1.4 92/10/01 12:17:16 duplain * Fixed calculation of archive file size when unpacking/testing. * * Revision 1.3 92/10/01 11:22:59 duplain * Added retry processing. * * Revision 1.2 92/09/30 10:27:51 duplain * Added logfile processing. * * Revision 1.1 92/09/29 18:02:27 duplain * Initial revision * */ #include #include #include #include "spark.h" #include "store.h" #include "pack.h" #include "compress.h" #include "main.h" /* BB changed next line because of conflict with Borland's io.h */ /* #include "io.h" */ #include "nsparkio.h" /* BB added next line */ #if defined(__MSDOS__) || defined(_WIN32) #include /* for read() */ #else #ifndef RISCOS #include #endif #endif /* __MSDOS__ */ #include #include "misc.h" #include "os.h" #include "error.h" #include "crc.h" #include "arcfs.h" char prompt_user(char *filename); char *get_newname(void); int do_unsquash() { SqshHeader sqsh_header; Header header; FILE *ifp, *ofp; Status r; long offset; long datastart; char *ofname = NULL; char *p; ifp = fopen(archive, "rb"); if (!ifp) { error("Can not open %s for reading\n", archive); return 1; } if (!to_stdout) { ofname = calloc(1, strlen(archive) + sizeof(",xxx")); /* Output filename is the same as the input filename with * the correct filetype appended */ strcpy(ofname, archive); /* Strip RISCOS filetype from output filename */ p = ofname + (strlen(ofname) - 4); if (*p == ',' || *p == '.') { *p = '\0'; } } r = read_sqsh_header(ifp, &sqsh_header); if (r != NOERR) { error("Invalid squash file"); return 1; } memset(&header, 0, sizeof(header)); datastart = ftell(ifp); fseek(ifp, 0, SEEK_END); offset = ftell(ifp); /* The uncompress code uses Spark entry header structures. * Use the squash header and other info to set up the Spark header * with needed info. */ header.complen = (Word)(offset - datastart); sqsh_header_to_header(&sqsh_header, &header); fseek(ifp, datastart, SEEK_SET); crcsize = 0; writesize = header.origlen; if (!to_stdout) { /* Append the correct filetype to the output filename */ append_type(&header, ofname); } if (!force && !to_stdout) { ofp = fopen(ofname, "rb"); if (ofp) { char c; char *newname; fclose(ofp); c = prompt_user(ofname); switch (c) { case 'n': exit(1); case 'r': newname = get_newname(); free(ofname); ofname = strdup(newname); break; case 'a': case 'y': /* overwrite file */ break; } } } if (to_stdout) { ofp = stdout; } else { ofp = fopen(ofname, "wb"); if (!ofp) { error("Can not open %s for writing\n", ofname); return 1; } } r = uncompress(&header, ifp, ofp, UNIX_COMPRESS); fclose(ifp); if (!to_stdout) { fclose(ofp); } if (r == NOERR) { if (stamp && !to_stdout) { filestamp(&header, ofname); } } else { error("Failed to decompress file"); return 1; } return 0; } int do_unarc() { FILE *ifp, *ofp = NULL, *lfp = NULL; Header *header = NULL; char *pathname = NULL; char fullname[PATHNAMELEN]; int level = 0, ret = 0, retrying = 0; Word arcsize; Word nbytes = 0; int nfiles = 0; Status status; ifp = fopen(archive, R_OPENMODE); if (!ifp) { ifp = fopen(name_dot_arc(archive), R_OPENMODE); if (!ifp) { if (!quiet) error("cannot open archive \"%s\"", archive); return (1); } archive = name_dot_arc(archive); } arcsize = filesize(archive); if (!arcsize && !quiet) { error("cannot get size of archive file"); fclose(ifp); return (1); } /* MU changed to accomodate the -I option */ if (!inffiles) { if (!testing && !listing && logfile) { lfp = fopen(logfile, W_OPENMODE); if (!lfp) warning("unable to open logfile \"%s\"", logfile); } } if (!quiet && verbose) { msg("filename size load/date exec/time type storage"); msg("-------- ---- ----------- --------- ---- -------"); } /* * read compressed files from archive until end of file... */ while (1) { static Header dirheader; Byte comptype, first; header = NULL; if ((arcfs == 0) && ((first = read_byte(ifp)) != STARTBYTE)) { if ((first == 'A') && (read_byte(ifp) == 'r') && (read_byte(ifp) == 'c') && (read_byte(ifp) == 'h') && (read_byte(ifp) == 'i') && (read_byte(ifp) == 'v') && (read_byte(ifp) == 'e') && (read_byte(ifp) == '\0')) { debug("ArcFS format archive\n"); arcfs = 1; } else break; } retry_loop: header = read_header(ifp); comptype = header->comptype & 0x7f; #ifdef DEBUGGING debug("archive file length = %ld level = %d\n", arcsize, level); print_header(header); #endif /* DEBUGGING */ /* * If this is a compress _file_ then check archive size against * compress-file length... */ if (comptype && !(comptype == CT_NOTCOMP2 && /* BB changed constants in next line to long */ (header->load & 0xffffff00l) == 0xfffddc00l)) { if (header->complen > arcsize) { debug("compressed len > archive file len"); header = NULL; break; } else arcsize -= header->complen; } if (!comptype) { /* end of archive ? */ if (!level) break; level--; /* * stamp directory now that all files have * been written into it */ if (!testing && !listing && !to_stdout && stamp && inlist(pathname)) if (filestamp(&dirheader, pathname) < 0 && !quiet) error("error stamping %s", pathname); pathname = uplevel(); continue; } /* * test for directory or file (file type = &DDC = archive) */ if (comptype == CT_NOTCOMP2 && /* BB changed constants in next line to long */ (header->load & 0xffffff00l) == 0xfffddc00l) { level++; pathname = downlevel(header->name); dirheader = *header; /* make copy of header */ /* * create directory */ if (!testing && !listing && !to_stdout && inlist(pathname)) switch (exist(pathname)) { case NOEXIST: if (makedir(pathname) < 0 && !quiet) { msg("error making %s... aborting", pathname); ret = 4; break; } break; case ISFILE: if (!quiet) msg("%s exists as a file... aborting", pathname); ret = 4; goto unarc_exit; case ISDIR: default: break; } } else { /* file */ if (pathname) sprintf(fullname, "%s%c%s", pathname, PATHSEP, header->name); else strcpy(fullname, header->name); if (!inlist(fullname)) { fseek(ifp, (long) header->complen, 1); continue; } /* * print the archive file details... */ if (!quiet) { msg("%-30s", fullname); if (verbose) print_details(header); } /* add to totals */ nbytes += header->origlen; nfiles++; if (listing) { /* if listing, nothing more to do */ if (!quiet) putc('\n', stderr); fseek(ifp, (long) header->complen, 1); continue; } else if (!quiet) putc(' ', stderr); /* * append the filetype to the name */ if (apptype && !to_stdout) append_type(header, fullname); /* * if actually unarchiving then check if the file already exists */ if (!testing && !to_stdout) { test_exist: switch (exist(fullname)) { case ISFILE: if (!force) { char c = prompt_user(fullname); if (c == 'a') force = 1; else if (c == 'n') { fseek(ifp, (long) header->complen, 1); continue; } else if (c == 'r') { char *newname = get_newname(); if (pathname) sprintf(fullname, "%s%c%s", pathname, PATHSEP, newname); else strcpy(fullname, newname); goto test_exist; } /* if (c == 'y') FALLTHROUGH */ } break; case ISDIR: if (!quiet) msg("exists as a directory... skipping"); continue; case NOEXIST: default: break; } ofp = fopen(fullname, W_OPENMODE); if (!ofp) { if (!quiet) msg("unable to create"); continue; } } else if (!testing) { ofp = stdout; } /* * do the unpacking */ crcsize = writesize = header->origlen; switch (comptype) { case CT_NOTCOMP: case CT_NOTCOMP2: status = unstore(header, ifp, ofp); break; case CT_CRUNCH: status = uncompress(header, ifp, ofp, CRUNCH); break; case CT_PACK: status = unpack(header, ifp, ofp); break; case CT_SQUASH: status = uncompress(header, ifp, ofp, SQUASH); break; case CT_COMP: status = uncompress(header, ifp, ofp, COMPRESS); break; default: error("unsupported archive type %d", comptype); if (retrying) goto do_retry; fseek(ifp, (long) header->complen, 1); continue; } if (!testing && !to_stdout && ofp) { fclose(ofp); ofp = NULL; } /* * check if unarchiving failed. * (RERR check is not in switch() because `break' * needs to escape from while()) */ if (status == RERR) { if (!quiet) error("error reading archive"); ret = 3; break; } switch (status) { case WERR: if (!quiet) msg("error writing file"); break; case CRCERR: if (!quiet) msg("failed CRC check"); /* BB changed format in next line to long hex */ /* debug(" calculated CRC=0x%x", crc); */ #ifdef __MSDOS__ debug(" calculated CRC=0X%lX", crc); #else debug(" calculated CRC=0X%X", crc); #endif /* __MSDOS__ */ break; case NOERR: if (!testing && !to_stdout && stamp) { if (filestamp(header, fullname) < 0 && !quiet) msg("\nerror stamping %s", fullname); } /* * XXX: if the filename has had it's filetype appended to * it, it may be longer than 10 characters long making this * file useless. We could truncate the filename but there is * no need to under UNIX... bit of a mismatch! */ if (!testing) { if (inffiles) { strcpy(logfile, fullname); strcat(logfile, ".inf"); lfp = fopen(logfile, W_OPENMODE); if (lfp) { /* // BASIC if ((header->load => 0xFFFFFB41) && (header->load <= 0xFFFFFB46)) { header->load = 0xFFFF1900; header->exec = 0xFFFF802B; } // *EXEC ie !BOOT if (header->load == 0xFFFFFE41) { header->load = 0x00000000; header->exec = 0xFFFFFFFF; } */ fprintf(lfp, "%s %08lX %08lX\n", riscos_path(fullname), (long)header->load, (long)header->exec); fclose(lfp); } } else { if (lfp) { fprintf(lfp, "SYS \"OS_File\", 1, \"%s\", &%08lX, &%08lX,, &%X\n", riscos_path(fullname), (long)header->load, (long)header->exec, header->attr); } } } break; default: break; } if (!quiet) putc('\n', stderr); if (ret) break; } } /* * find out why header wasn't found */ if (!header) switch (check_stream(ifp)) { case FNOERR: if (!quiet) msg("bad archive header"); if (retry && !listing) { msg("... retrying"); do_retry: retrying++; while (check_stream(ifp) == FNOERR) if (read_byte(ifp) == STARTBYTE) { Byte byte = read_byte(ifp); switch (byte & 0x7f) { case (CT_NOTCOMP): case (CT_NOTCOMP2): case (CT_CRUNCH): case (CT_PACK): case (CT_SQUASH): case (CT_COMP): ungetc((int) byte, ifp); goto retry_loop; /* NOTREACHED */ default: break; } } } else { retrying = 0; if (!quiet) putc('\n', stderr); } ret = 2; break; case FRWERR: if (!quiet) msg("error reading archive"); ret = 3; break; case FEND: default: break; } unarc_exit: if (verbose) msg("total of %ld bytes in %d files\n", (long)nbytes, nfiles); if (ofp && !to_stdout) fclose(ofp); if (lfp) fclose(lfp); if (ifp) fclose(ifp); return (ret); } /* * the file being extracted already exists, so ask user what to do... */ char prompt_user(char *filename) { int c; char buffer[80]; while (1) { fprintf(stderr, "\n\"%s\" exists, overwrite ? (Yes/No/All/Rename): ", filename); fflush(stderr); if (read(0, buffer, sizeof(buffer) - 1)<1) { c = 'n'; break; } if (isupper(*buffer)) c = tolower(*buffer); else c = *buffer; if (c == 'y' || c == 'n' || c == 'a' || c == 'r') break; } return (c); } /* * user wants to rename file, so get the leaf name of the new file... */ char * get_newname(void) { int c; static char buffer[80]; while (1) { fprintf(stderr, "enter new filename: "); fflush(stderr); c = read(0, buffer, sizeof(buffer) - 1); buffer[c ? c - 1 : 0] = '\0'; if (!*buffer) continue; for (c = 0; buffer[c]; c++) if (buffer[c] == PATHSEP) { msg("*** new file must extract into this directory ***"); continue; } return (buffer); } } nspark-1.7.8B2+git20210317.cb30779/unarc.h000066400000000000000000000004211402443176000170640ustar00rootroot00000000000000/* * unarchive function prototypes * * $Header: unarc.h 1.1 92/09/29 $ * $Log: unarc.h,v $ * Revision 1.1 92/09/29 18:02:43 duplain * Initial revision * */ #ifndef __UNARC_H #define __UNARC_H int do_unarc(void); int do_unsquash(void); #endif /* __UNARC_H */ nspark-1.7.8B2+git20210317.cb30779/unix.c000066400000000000000000000040451402443176000167400ustar00rootroot00000000000000 /* * Operating System specific function (UNIX) * * $Header: unix.c 1.6 94/12/13 $ * $Log: unix.c,v $ * Revision 1.6 94/12/13 11:36:31 arb * Changed use of timelocal() to SunOS 4 only... hope that's right! * * Revision 1.5 92/12/07 17:18:49 duplain * reformatted source. * * Revision 1.4 92/10/19 09:35:10 duplain * Changed use of timelocal() to SunOS only... hope that's right. * * Revision 1.3 92/10/06 12:12:51 duplain * Date/time conversion now done by mktime() or timelocal(). * * Revision 1.2 92/10/01 11:23:10 duplain * Added filesize(). * * Revision 1.1 92/09/29 18:02:28 duplain * Initial revision * */ #include #include #include #include #include #include #include "spark.h" #include "date.h" /* * return the length of a file */ Word filesize(char *pathname) { struct stat statb; if (stat(pathname, &statb) < 0) return (0); else return ((Word) statb.st_size); } /* * test for the existance of a file or directory */ Ftype exist(char *pathname) { struct stat statb; if (stat(pathname, &statb) < 0) return (NOEXIST); /* assumes error was because file doesn't exist... could be wrong! */ if (statb.st_mode & S_IFDIR) return (ISDIR); else return (ISFILE); /* might not be a regular file... */ } /* * make a directory */ int makedir(char *pathname) { return (mkdir(pathname, 0777)); } /* * stamp a file with date and time */ int filestamp(Header *header, char *filename) { Date *date; struct tm tm; struct utimbuf utimbuf; time_t filetime; if ((header->load & (Word) 0xfff00000) != (Word) 0xfff00000) return (0); /* not a timestamp */ memset((char *) &tm, '\0', sizeof(tm)); if (!(date = makedate(header))) return (-1); tm.tm_sec = date->second; tm.tm_min = date->minute; tm.tm_hour = date->hour; tm.tm_mday = date->day; tm.tm_mon = date->month - 1; tm.tm_year = date->year; filetime = mktime(&tm); utimbuf.actime = filetime; utimbuf.modtime = filetime; return (utime(filename, &utimbuf)); } nspark-1.7.8B2+git20210317.cb30779/version.h000066400000000000000000000002321402443176000174410ustar00rootroot00000000000000#ifndef VERSION #define VERSION "1.7.8B2" #endif /* VERSION */ #ifndef MAINTAINER #define MAINTAINER "james_woodcock@yahoo.co.uk" #endif /* MAINTAINER */ nspark-1.7.8B2+git20210317.cb30779/win32/000077500000000000000000000000001402443176000165505ustar00rootroot00000000000000nspark-1.7.8B2+git20210317.cb30779/win32/MAKEFILE000066400000000000000000000044031402443176000176510ustar00rootroot00000000000000# # nspark makefile (Windows NT, Microsoft V9.0 C Compiler) # # SYSTYPE: WINNT # SYSTYPE= WINNT INSTALLDIR= c:\msvc CC= cl # --- You shouldn't need to edit below this line --- CDEFINES= -I. #-DDEBUGGING # -Ox -Gs CMISC= -D$(SYSTYPE) CFLAGS= $(CDEFINES) $(CMISC) /O2 LIBS= LDFLAGS= PROG= nspark$(EXE) SQSH= sqsh$(EXE) SRCS= store.c pack.c compress.c crc.c \ io.c error.c misc.c date.c arcfs.c garble.c HDRS= store.h pack.h compress.h crc.h \ nsparkio.h error.h misc.h date.h os.h spark.h arcfs.h garble.h version.h NSPARKSRCS = main.c arc.c unarc.c NSPARKHDRS = main.h arc.h unarc.h SQSHSRCS = sqshmain.c unarc.c SQSHHDRS = unarc.h EXE = .exe OBJ = .obj OS_SRCS = winnt.c OBJS = $(SRCS:.c=.obj) NSPARKOBJS = $(NSPARKSRCS:.c=.obj) SQSHOBJS = $(SQSHSRCS:.c=.obj) OS_OBJS = $(OS_SRCS:.c=.obj) all: $(PROG) $(SQSH) $(PROG): $(OBJS) $(OS_OBJS) $(NSPARKOBJS) $(CC) /Fe$@ $** $(LIBS) $(SQSH): $(OBJS) $(OS_OBJS) $(SQSHOBJS) $(CC) /Fe$@ $** $(LIBS) install: $(PROG) $(SQSH) -mkdir $(INSTALLDIR)\bin copy $(PROG) $(INSTALLDIR)\bin copy $(SQSH) $(INSTALLDIR)\bin clean: del *$(EXE) del *$(OBJ) del *.bak del *.map del mklog # DO NOT DELETE THIS LINE -- make depend depends on it. store$(OBJ): spark.h main.h crc.h garble.h store$(OBJ): nsparkio.h pack$(OBJ): spark.h main.h crc.h garble.h pack$(OBJ): nsparkio.h pack.h compress$(OBJ): spark.h pack.h compress$(OBJ): main.h crc.h garble.h nsparkio.h arcfs.h crc$(OBJ): spark.h main.h arcfs.h io$(OBJ): spark.h main.h error.h arcfs.h nsparkio.h error$(OBJ): error.h misc$(OBJ): spark.h main.h date.h misc.h date$(OBJ): spark.h arcfs$(OBJ): spark.h arcfs.h nsparkio.h misc.h garble$(OBJ): garble.h spark.h main$(OBJ): spark.h nsparkio.h error.h misc.h arc.h unarc.h garble.h version.h arc$(OBJ): spark.h error.h unarc$(OBJ): spark.h store.h pack.h compress.h main.h nsparkio.h unarc$(OBJ): misc.h os.h error.h unarc$(OBJ): crc.h arcfs.h sqshmain$(OBJ): spark.h arcfs.h unarc.h unarc$(OBJ): spark.h store.h pack.h compress.h main.h nsparkio.h unarc$(OBJ): misc.h os.h error.h unarc$(OBJ): crc.h arcfs.h testprog/pack$(OBJ): spark.h crc.h nsparkio.h pack.h arcfs.h garble.h spark.h acorn$(OBJ): spark.h date.h msdos$(OBJ): spark.h date.h msdos$(OBJ): os.h winnt$(OBJ): spark.h date.h nspark-1.7.8B2+git20210317.cb30779/winnt.c000066400000000000000000000030101402443176000171030ustar00rootroot00000000000000 /* * Operating System specific function (Windows NT) * * $Header: winnt.c 1.0 94/11/09 $ * $Log: winnt.c,v $ * Revision 1.0 94/11/09 10:04:00 auj * Initial revision * */ #include "spark.h" #include "date.h" #include #include #include #include #include /* * return the length of a file */ Word filesize(char *pathname) { struct stat statb; if (stat(pathname, &statb) < 0) return 0; return (Word) statb.st_size;; } /* * test for the existance of a file or directory */ Ftype exist(char *pathname) { struct stat statb; if (stat(pathname, &statb) < 0) return NOEXIST; if (statb.st_mode & S_IFDIR) return ISDIR; return (ISFILE); } /* * make a directory */ int makedir(char *pathname) { return _mkdir(pathname); } /* * stamp a file with date and time */ int filestamp(Header *header, char *filename) { Date *date; struct tm tm; struct utimbuf utimbuf; time_t filetime; if (exist(filename) == ISDIR) return (0); /* Win NT appears not to allow stamping dirs. */ if ((header->load & (Word) 0xfff00000) != (Word) 0xfff00000) return (0); /* not a timestamp */ memset((char *) &tm, '\0', sizeof(tm)); if (!(date = makedate(header))) return (-1); tm.tm_sec = date->second; tm.tm_min = date->minute; tm.tm_hour = date->hour; tm.tm_mday = date->day; tm.tm_mon = date->month - 1; tm.tm_year = date->year; filetime = mktime(&tm); utimbuf.actime = filetime; utimbuf.modtime = filetime; return (utime(filename, &utimbuf)); }