unace1.2b/000755 000000000001000630312400061275ustar unace1.2b/amiga/000755 000000000001000630312400072055ustar unace1.2b/amiga/smakefil000644 000000040100753154120000107260ustar ############################################################################## # # # Make file for the Amiga version of UNACE using SAS C. # # # # # # Rev 01 97/12/03 Wilfred van Velzen # # # ############################################################################## # # # To compile the Amiga version of UNACE with SAS C: # # # # Copy the files "smakefile" and "scoptions" to the directory with all the # # source files (*.c, *.h), and type "smake" on the commandline in a shell. # # # ############################################################################## OBJS= Uac_crc.o Globals.o Uac_crt.o Unace.o Uac_sys.o Uac_dcpr.o Uac_comm.o CDEFINES = DEF=AMIGA Unace: $(OBJS) sc link to Unace $(OBJS) Globals.o: Globals.c os.h acestruc.h unace.h declare.h portable.h Uac_crc.o: Uac_crc.c uac_crc.h declare.h os.h Uac_crt.o: Uac_crt.c os.h attribs.h globals.h uac_crt.h uac_sys.h unace.h \ acestruc.h declare.h portable.h Uac_comm.o: Uac_comm.c uac_dcpr.h uac_comm.h unace.h declare.h os.h Uac_dcpr.o: Uac_dcpr.c os.h globals.h portable.h uac_comm.h uac_crc.h \ uac_dcpr.h uac_sys.h unace.h acestruc.h declare.h Uac_sys.o: Uac_sys.c globals.h uac_sys.h unace.h acestruc.h declare.h \ portable.h os.h Unace.o: Unace.c os.h globals.h portable.h uac_comm.h uac_crc.h uac_crt.h \ uac_dcpr.h uac_sys.h unace.h acestruc.h declare.h .c.o: sc $(CDEFINES) $< # end of makefile unace1.2b/amiga/scoption000644 000000000470753154120000107770ustar OPTIMIZE VERBOSE NOICONS OPTIMIZERTIME unace1.2b/amiga/ppc/000755 000000000001000630312400077675ustar unace1.2b/amiga/ppc/smakefil000644 000000016640753154120000115240ustar # smakefile for UnACE for powerUP (TM) # 1998 by Andreas R. Kleinert CC = SCPPC OBJS = Uac_crc.o Globals.o Uac_crt.o Unace.o Uac_sys.o Uac_dcpr.o Uac_comm.o Unace: $(OBJS) ppc-amigaos-ld -r lib:c_ppc.o $(OBJS) LIB:scppc.a lib:end.o -o UnACE.elf Copy UnACE.elf / Globals.o: Globals.c os.h acestruc.h unace.h declare.h portable.h Uac_crc.o: Uac_crc.c uac_crc.h declare.h os.h Uac_crt.o: Uac_crt.c os.h attribs.h globals.h uac_crt.h uac_sys.h unace.h \ acestruc.h declare.h portable.h Uac_comm.o: Uac_comm.c uac_dcpr.h uac_comm.h unace.h declare.h os.h Uac_dcpr.o: Uac_dcpr.c os.h globals.h portable.h uac_comm.h uac_crc.h \ uac_dcpr.h uac_sys.h unace.h acestruc.h declare.h Uac_sys.o: Uac_sys.c globals.h uac_sys.h unace.h acestruc.h declare.h \ portable.h os.h Unace.o: Unace.c os.h globals.h portable.h uac_comm.h uac_crc.h uac_crt.h \ uac_dcpr.h uac_sys.h unace.h acestruc.h declare.h unace1.2b/amiga/ppc/scoption000644 000000003430753154120000115600ustar AUTOREGISTER PARMS=REGISTERS OPTIMIZE OPTGLOBAL OPTTIME OPTPEEP OPTSCHED OPTINLOCAL OPTINL OPTLOOP OPTRDEP=4 OPTDEP=4 OPTCOMP=4 STRUCTUREEQUIVALENCE STRINGMERGE NOSTACKCHECK NOICONS INCLUDEDIR=hlp:ppc/include DEFINE=AMIGA unace1.2b/amiga/readme.txt000644 000000012750753154120000112200ustar These are the make files for the Amiga version of UNACE. It contains a version without support for encrypted files, because of USA export restrictions for programs which have strong encryption. If you need an Amiga version that can handle .ACE files with encrypted files in the archive, an Amiga version with decryption routines is available from the homepage of Marcel Lemke (http://members.aol.com/mlemke6413/ace.html) on the World Wide Web. Note: This program needs a lot of memory (upto 1 Mega byte) to decompress some .ACE files. This depends on the used dictionary size (-d switch) when the archive was created. Wilfred van Velzen Fido : 2:280/464.12 Email: wilfred@aobh.xs4all.nl unace1.2b/pc/000755 000000000001000630312400065315ustar unace1.2b/pc/win/000755 000000000001000630312400073265ustar unace1.2b/pc/win/win16.wat000644 000000006560753154120000110260ustar SYSTEMN= WIN16 COMPNM = WATCOM_C CSYSTEM= WINDOWS COMP = wcc CFLAGS = -bt=$CSYSTEM -mc -zt -zq -wx -we -ot -d$COMPNM -d$SYSTEMN SYSTEM = WINDOWS LINK = wlink LFLAGS = op stack=8192 OBJS=unace.obj uac_sys.obj uac_crc.obj uac_dcpr.obj uac_comm.obj uac_crt.obj globals.obj .c.obj: .autodepend $COMP $CFLAGS $[*.c unace.exe: $OBJS set file_cmd=file {$(OBJS)} $LINK $FLAGS system $SYSTEM @file_cmd name unace set file_cmd= unace1.2b/pc/win/winnt.wat000644 000000006600753154120000112140ustar SYSTEMN = WINNT COMPNM = WATCOM_C CSYSTEM = NT COMP = wcc386 CFLAGS = -bt=$CSYSTEM -mf -5r -zt -zq -wx -we -ot -d$COMPNM -d$SYSTEMN SYSTEM = nt LINK = wlink LFLAGS = op stack=8192 OBJS=unace.obj uac_sys.obj uac_crc.obj uac_dcpr.obj uac_comm.obj uac_crt.obj globals.obj .c.obj: .autodepend $COMP $CFLAGS $[*.c unace.exe: $OBJS set file_cmd=file {$(OBJS)} $LINK $FLAGS system $SYSTEM @file_cmd name unace set file_cmd= unace1.2b/pc/win/winnt.bcc000644 000000003650753154120000111520ustar SYSTEMNM= WINNT COMPNM = BORLAND_C COMP = bcc CFLAGS = -3 -Ox -D$(COMPNM) -D$(SYSTEMNM) MODEL = l SYSTEM = CON32 FILES=unace.c uac_sys.c uac_crc.c uac_dcpr.c uac_comm.c uac_crt.c globals.c unace.exe: $(FILES) $(COMP) $(CFLAGS) $(FILES)unace1.2b/pc/win/win16.bcc000644 000000003650753154120000107570ustar SYSTEMNM= WIN16 COMPNM = BORLAND_C COMP = bcc CFLAGS = -3 -Ox -D$(COMPNM) -D$(SYSTEMNM) MODEL = l SYSTEM = WIN16 FILES=unace.c uac_sys.c uac_crc.c uac_dcpr.c uac_comm.c uac_crt.c globals.c unace.exe: $(FILES) $(COMP) $(CFLAGS) $(FILES)unace1.2b/pc/dos/000755 000000000001000630312400073165ustar unace1.2b/pc/dos/dos4g.wat000644 000000006620753154120000110670ustar SYSTEMN = DOS COMPNM = WATCOM_C CSYSTEM = DOS COMP = wcc386 CFLAGS = -bt=$CSYSTEM -mf -5r -zt -zq -wx -we -ot -d$COMPNM -d$SYSTEMN SYSTEM = dos4g LINK = wlink LFLAGS = op stack=8192 OBJS=unace.obj uac_sys.obj uac_crc.obj uac_dcpr.obj uac_comm.obj uac_crt.obj globals.obj .c.obj: .autodepend $COMP $CFLAGS $[*.c unace.exe: $OBJS set file_cmd=file {$(OBJS)} $LINK $FLAGS system $SYSTEM @file_cmd name unace set file_cmd= unace1.2b/pc/dos/pmodew.wat000644 000000006630753154120000113430ustar SYSTEMN = DOS COMPNM = WATCOM_C CSYSTEM = DOS COMP = wcc386 CFLAGS = -bt=$CSYSTEM -mf -5r -zt -zq -wx -we -ot -d$COMPNM -d$SYSTEMN SYSTEM = pmodew LINK = wlink LFLAGS = op stack=8192 OBJS=unace.obj uac_sys.obj uac_crc.obj uac_dcpr.obj uac_comm.obj uac_crt.obj globals.obj .c.obj: .autodepend $COMP $CFLAGS $[*.c unace.exe: $OBJS set file_cmd=file {$(OBJS)} $LINK $FLAGS system $SYSTEM @file_cmd name unace set file_cmd= unace1.2b/pc/dos/286.wat000644 000000006510753154120000103640ustar SYSTEMN = DOS COMPNM = WATCOM_C CSYSTEM = DOS COMP = wcc CFLAGS = -bt=$CSYSTEM -mc -zt -zq -wx -we -ot -d$COMPNM -d$SYSTEMN SYSTEM = 286 LINK = wlink LFLAGS = op stack=8192 OBJS=unace.obj uac_sys.obj uac_crc.obj uac_dcpr.obj uac_comm.obj uac_crt.obj globals.obj .c.obj: .autodepend $COMP $CFLAGS $[*.c unace.exe: $OBJS set file_cmd=file {$(OBJS)} $LINK $FLAGS system $SYSTEM @file_cmd name unace set file_cmd= unace1.2b/pc/dos/dos16.bcc000644 000000003630753154120000107350ustar SYSTEMNM= DOS COMPNM = BORLAND_C COMP = bcc CFLAGS = -3 -Ox -D$(COMPNM) -D$(SYSTEMNM) MODEL = l SYSTEM = DOS16 FILES=unace.c uac_sys.c uac_crc.c uac_dcpr.c uac_comm.c uac_crt.c globals.c unace.exe: $(FILES) $(COMP) $(CFLAGS) $(FILES)unace1.2b/unix/000755 000000000001000630312400071125ustar unace1.2b/unix/makefile000644 000000035700753154120000106270ustar # The unregistered unace GNU makefile # if you don't have GNU make or bash, then you should proly # remove the ifeq <-> endif statments, and configure CFLAGS yourself # # orig - chad hurwitz 3-11-98 churritz@cts.com # # -DCASEINSENSE is for people with case insensitive filesystems # OBJ = globals.o uac_comm.o uac_crc.o uac_crt.o uac_dcpr.o uac_sys.o unace.o SRC = globals.c uac_comm.c uac_crc.c uac_crt.c uac_dcpr.c uac_sys.c unace.c #CFLAGS = -dNOSTRICMP #for UNIX compilers not supporting stricmp() #CFLAGS = -dHI_LO_BYTE_ORDER #select correct byte order for your machine!! #CFLAGS = -Wall -O3 -s #-DNDEBUG #CFLAGS = -g -Wall -DMDEBUG #CFLAGS = -O3 -fno-strength-reduce -fomit-frame-pointer # These are for Linux CFLAGS = -O -g -Wall -dLO_HI_BYTE_ORDER CHALLOC = challoc.o CHALLOC = CHNEW = chnew.o challoc.o CC = gcc ifeq ($(OSTYPE), Linux) CFLAGS += -DUNIX -DCASEINSENSE else ifeq ($(OSTYPE), DOS) EXEEXT = .exe CFLAGS += -DDOS else CFLAGS += -DUNIX -DCASEINSENSE endif endif # not all systems require the math library #LIBS = -lm unace$(EXEEXT): $(OBJ) $(CHALLOC) gcc $(CFLAGS) -o $@ $^ $(LIBS) clean: rm -f *.o a.out core unace unace.exe dep: chmod a+rx ./gccmaked ./gccmaked -- $(CFLAGS) -- *.c* rm -f ?akefile.bak # DO NOT DELETE globals.o: globals.c os.h acestruc.h declare.h portable.h unace.h uac_comm.o: uac_comm.c globals.h acestruc.h declare.h portable.h os.h \ unace.h uac_dcpr.h uac_comm.h uac_crc.o: uac_crc.c uac_crc.h declare.h uac_crt.o: uac_crt.c os.h globals.h acestruc.h declare.h portable.h \ unace.h uac_crt.h uac_sys.h uac_dcpr.o: uac_dcpr.c os.h globals.h acestruc.h declare.h portable.h \ unace.h uac_comm.h uac_crc.h uac_dcpr.h uac_sys.h uac_sys.o: uac_sys.c os.h globals.h acestruc.h declare.h portable.h \ unace.h uac_sys.h unace.o: unace.c os.h globals.h acestruc.h declare.h portable.h \ unace.h uac_comm.h uac_crc.h uac_crt.h uac_dcpr.h uac_sys.h unace1.2b/unix/gccmaked000644 000000043320753154120000106050ustar #!/bin/sh # # makedepend which uses 'gcc -MM' # # $XFree86: xc/config/util/gccmdep.cpp,v 3.3 1996/02/25 01:16:15 dawes Exp $ # # Based on mdepend.cpp and code supplied by Hongjiu Lu # TMP=/tmp/mdep$$ CC="gcc" RM="rm -f" LN="ln -s" MV="mv -f" trap "$RM ${TMP}*; exit 1" 1 2 15 trap "$RM ${TMP}*; exit 0" 1 2 13 files= makefile= endmarker= magic_string='# DO NOT DELETE' append=n args= asmfiles= while [ $# != 0 ]; do if [ "$endmarker"x != x -a "$endmarker" = "$1" ]; then endmarker= else case "$1" in -D*|-I*) args="$args '$1'" ;; -g|-o) ;; *) if [ "$endmarker"x = x ]; then case $1 in # ignore these flags -w|-o|-cc) shift ;; -v) ;; -s) magic_string="$2" shift ;; -f-) makefile="-" ;; -f) makefile="$2" shift ;; --*) endmarker=`echo $1 | sed 's/^\-\-//'` if [ "$endmarker"x = x ]; then endmarker="--" fi ;; -a) append=y ;; -*) echo "Unknown option '$1' ignored" 1>&2 ;; *) files="$files $1" ;; esac fi ;; esac fi shift done if [ x"$files" = x ]; then # Nothing to do exit 0 fi case "$makefile" in '') if [ -r makefile ]; then makefile=makefile elif [ -r Makefile ]; then makefile=Makefile else echo 'no makefile or Makefile found' 1>&2 exit 1 fi ;; esac if [ X"$makefile" != X- ]; then if [ x"$append" = xn ]; then sed -e "/^$magic_string/,\$d" < $makefile > $TMP echo "$magic_string" >> $TMP else cp $makefile $TMP fi fi # need to link .s files to .S for i in $files; do case $i in *.s) dir=`dirname $i` base=`basename $i .s` (cd $dir; $RM ${base}.S; $LN ${base}.s ${base}.S) asmfiles="$asmfiles ${base}.S" ;; esac done CMD="$CC -MM $args `echo $files | sed -e 's,\.s$,\.S,g' -e 's,\.s ,\.S ,g'` | sed -e 's,\.S$,\.s,g' -e 's,\.S ,\.s ,g'" if [ X"$makefile" != X- ]; then CMD="$CMD >> $TMP" fi eval $CMD if [ X"$makefile" != X- ]; then $RM ${makefile}.bak $MV $makefile ${makefile}.bak $MV $TMP $makefile fi if [ x"$asmfiles" != x ]; then $RM $asmfiles fi $RM ${TMP}* exit 0 unace1.2b/unix/readme.txt000644 000000010310753154120000111130ustar To compile under unix: 1) Copy the contents of this directory to the source files 2) Check the makefile and select a suitable set of CFLAGS 3) 'make dep' 4) 'make' If the resulting 'unace' can't process any archives it might be because the machine you are using isn't using the same byte-order as Intel CPUs. In that case you need to replace #if defined(UNIX) #define DIRSEP '/' #define LO_HI_BYTE_ORDER #endif in os.h with #if defined(UNIX) #define DIRSEP '/' #define HI_LO_BYTE_ORDER #endif Good luck. /Mikael Nordqvist unace1.2b/COPYING000644 000000430761000630011000071640ustar GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. unace1.2b/file_id.diz000644 000000007301000630046400102360ustar -- UNACE-SOURCE v1.2b (extract-util) -- licence changed to GPL in 01/2004 --------------------------------------- WWW: http://www.winace.com EMAIL: mlemke@winace.com --------------------------------------- Files: unace.c, uac_sys.c, uac_dcpr.c, uac_crc.c,uac_crt.c, uac_comm.c, globals.c, globals.h,portable.h, acestruc.h, declare.h,defines.h, prototyp.h, unace.h, read.me, file_id.diz several os.h & several makefiles unace1.2b/readme000644 000000051011000630124000073010ustar Copyright by Marcel Lemke Description of public UNACE v1.2b January 2004 ------------------------------------------------- 1. Features 2. Platform compability 3. Compiling 4. Warranty 5. Latest public UNACE 6. Thanks ------------------------------------------------------------------------------ 1. Features ------------- The public version of UNACE is limited in its functionallity: * no v2.0 decompression * no EMS/XMS support * decompression dictionary limited by the target system; this means that the 16bit version has a maximum of 32k only * no decryption * no wildcard-handling 2. Platform compatibility --------------------------- There are different makefiles and OS.H files in the directories of public UNACE. Just copy the files of the directory for the system you want to compile for. It might be necessary to modify different things a bit to get it working with new compilers. If you had to do so, please tell me about these changes! This source has been tested as 16bit and 32bit MS-DOS, 16bit and 32bit Windows (character mode), Amiga, PPC-Amiga and LINUX executable. If you have any suggestions to make it more compatible for other platforms tell me please: email: mlemke@winace.com 3. Compiling -------------- To get UNACE.EXE choose the correct makefile and copy it to the source directory to run your MAKE-utility on it. Choose a 32bit target if possible. Otherwhise there might be not enough memory to decompress archives with dictionaries larger than 32kb. 4. Warranty ------------- Marcel Lemke, the author of ACE and the original source of this extraction utility, disclaims any liability for any damage caused by: * using or misusing this software * any bugs introduced by modifying source or due to the compile/link environment You use/distribute the compiled UNACE program at your own risk. The original author (Marcel Lemke) cannot be held responsible for data loss or other damages and any consequences from this loss or damages. 5. Thanks ----------- A lot of thanks to Wilfred van Velzen for porting UNACE to the Amiga and setting up the basic elements for general portability this way. Happy programming ... Marcel Lemke unace1.2b/globals.c000644 000000041131000630246000077170ustar /* ------------------------------------------------------------------------ */ /* */ /* Global variable declarations */ /* */ /* ------------------------------------------------------------------------ */ /* ML - 01/2004: changed licence to GPL */ /* ------------------------------------------------------------------------ */ #include "os.h" #include "acestruc.h" #include "unace.h" //-------- Ace sign const char *acesign = "**ACE**"; //-------- Version string for program const char *version="UNACE v1.2 public version\n"; #ifdef AMIGA //-------- Version string for VERSION program const char *_version="$VER: Unace Amiga 1.2 "__AMIGADATE__"\n\n"; #endif //-------- header buffer and pointers thead head; tmhead *t_mhead = (tmhead *) & head; tfhead *t_fhead = (tfhead *) & head; //-------- buffers ULONG *buf_rd =0; CHAR *buf =0; CHAR *buf_wr =0; UCHAR *readbuf =0; //-------- decompressor variables SHORT rpos =0, dcpr_do =0, dcpr_do_max =0, blocksize =0, dcpr_dic =0, dcpr_oldnum =0, bits_rd =0, dcpr_frst_file =0; USHORT dcpr_code_mn[1 << maxwd_mn], dcpr_code_lg[1 << maxwd_lg]; UCHAR dcpr_wd_mn[maxcode + 2], dcpr_wd_lg[maxcode + 2], wd_svwd[svwd_cnt]; ULONG dcpr_dpos =0, cpr_dpos2 =0, dcpr_dicsiz =0, dcpr_dican =0, dcpr_size =0, dcpr_olddist[4]={0,0,0,0}, code_rd =0; CHAR *dcpr_text =0; //-------- quicksort USHORT sort_org[maxcode + 2]; UCHAR sort_freq[(maxcode + 2) * 2]; //-------- file handling CHAR aname[PATH_MAX]; INT archan, wrhan; LONG skipsize=0; //-------- structures for archive handling struct tadat adat; //-------- flags INT f_err =0, f_err_crc =0, f_ovrall =0, f_allvol_pr=0, f_curpas =0, f_criterr =0; unace1.2b/uac_comm.c000644 000000031271000630247400100700ustar /* ------------------------------------------------------------------------ */ /* */ /* Decompresses and outputs comment if present. */ /* */ /* ------------------------------------------------------------------------ */ /* ML - 01/2004: changed licence to GPL */ /* ------------------------------------------------------------------------ */ #include // printf() #include "globals.h" #include "uac_dcpr.h" #include "uac_comm.h" INT comm_cpr_size=0; CHAR *comm; void comment_out(CHAR *top) // outputs comment if present { INT i; if (head.HEAD_FLAGS & ACE_COMM) { // comment present? if (head.HEAD_TYPE == MAIN_BLK) { // get begin and size of comment data comm = MCOMM; comm_cpr_size = MCOMM_SIZE; } else { comm = FCOMM; comm_cpr_size = FCOMM_SIZE; } // limit comment size if too big i = sizeof(head) - (INT)(comm - (CHAR*) &head); if (comm_cpr_size > i) comm_cpr_size = i; dcpr_comm(i); // decompress comment #ifdef AMIGA { char *p=comm; while (*p) { if (*p==0x0D) *p=0x0A; // Replace ms-dos line termination p++; } } #endif printf("%s\n\n%s\n\n", top, comm); // output comment } } unace1.2b/uac_crc.c000644 000000020401000630252000076650ustar /* ------------------------------------------------------------------------ */ /* */ /* CRC-calculation routines. */ /* */ /* ------------------------------------------------------------------------ */ /* ML - 01/2004: changed licence to GPL */ /* ------------------------------------------------------------------------ */ #include "uac_crc.h" ULONG crctable[256]; ULONG rd_crc=0; void make_crctable(void) // initializes CRC table { ULONG r, i, j; for (i = 0; i <= 255; i++) { for (r = i, j = 8; j; j--) r = (r & 1) ? (r >> 1) ^ CRCPOLY : (r >> 1); crctable[i] = r; } } // Updates crc from addr till addr+len-1 // ULONG getcrc(ULONG crc, UCHAR * addr, INT len) { while (len--) crc = crctable[(unsigned char) crc ^ (*addr++)] ^ (crc >> 8); return (crc); } unace1.2b/uac_crt.c000644 000000072321000630253200077210ustar /* ------------------------------------------------------------------------ */ /* */ /* Creates/Replaces files or directories. */ /* */ /* ------------------------------------------------------------------------ */ /* ML - 01/2004: changed licence to GPL */ /* ------------------------------------------------------------------------ */ #include "os.h" #include // AMIGA: open() #include // printf() remove() #include // strncpy() #include // struct stat #ifdef UNIX #include #else #if !defined(VA_CPP) #include // AMIGA: mkdir() rmdir() DOS: _dos_*() #endif #endif #if defined(DOS) || defined(WINNT) || defined(WIN16) || defined(VA_CPP) #include // access() #if defined(WATCOM_C) || defined(VA_CPP) #include // mkdir() #else #include // mkdir() #endif #endif #include "globals.h" #include "uac_crt.h" #include "uac_sys.h" /* gets file name from header */ CHAR *ace_fname(CHAR * s, thead * head, INT nopath) { INT i; char *cp; strncpy(s, (*(tfhead *) head).FNAME, i = (*(tfhead *) head).FNAME_SIZE); s[i] = 0; if (nopath) { cp=strrchr(s, '\\'); if (cp) memmove(s, cp+1, strlen(cp)); } #if (DIRSEP!='\\') // replace msdos directory seperator else { // by current OS seperator cp=s; while ((cp=strchr(cp, '\\'))!=NULL) *cp++=DIRSEP; } #endif return s; } void check_ext_dir(CHAR * f) // checks/creates path of file { CHAR *cp, d[PATH_MAX]; INT i; d[0] = 0; for (;;) { if ((cp = (CHAR *) strchr(&f[strlen(d) + 1], DIRSEP))!=NULL) { i = cp - f; strncpy(d, f, i); d[i] = 0; } else return; if (!fileexists(d)) if (mkdir(d)) { f_err = ERR_WRITE; printf("\n Error while creating directory.\n"); } } } INT ovr_delete(CHAR * n) // deletes directory or file { if (remove(n) && rmdir(n)) { printf("\n Could not delete file or directory. Access denied.\n"); return (1); } return (0); } INT create_dest_file(CHAR * file, INT a) // creates file or directory { INT han, i = 0, ex = fileexists(file); struct stat st; check_ext_dir(file); if (f_err) return (-1); if (a & _A_SUBDIR) { // create dir or file? if (ex) stat(file, &st); if (ex ? (st.st_mode & S_IFDIR) : mkdir(file)) { printf("\n Could not create directory.\n"); return (-1); } #ifdef DOS _dos_setfileattr(file, a); // set directory attributes #endif return (-1); } else { if (ex) { // does the file already exist if (!f_ovrall) { i = wrask("Overwrite existing file?"); // prompt for overwrite f_ovrall = (i == 1); if (i == 3) f_err = ERR_USER; } if ((i && !f_ovrall) || ovr_delete(file)) return (-1); // delete? } if ((han = open(file, O_WRONLY | O_TRUNC | O_CREAT | O_BINARY, S_IREAD | S_IWRITE | S_IEXEC | S_IDELETE | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH )) < 0) printf("\n Could not create destination file.\n"); return (han); } } unace1.2b/uac_dcpr.c000644 000000277771000630254000101000ustar /* ------------------------------------------------------------------------ */ /* */ /* These are the decompression algorithms. */ /* Don't change here anything (apart from memory allocation perhaps). */ /* Any changes will very likely cause bugs! */ /* */ /* ------------------------------------------------------------------------ */ /* ML - 01/2004: changed licence to GPL */ /* ------------------------------------------------------------------------ */ #include "os.h" #if defined(AMIGA) || defined(UNIX) #include // mem*() #endif #if defined(DOS) || defined(WIN16) || defined(WINNT) || defined(OS2) #if defined(VA_CPP) #include #else #include // mem*() #endif #endif #include // printf() #include // malloc() #include "globals.h" #include "portable.h" #include "uac_comm.h" #include "uac_crc.h" #include "uac_dcpr.h" #include "uac_sys.h" //------------------------------ QUICKSORT ---------------------------------// #define xchg_def(v1,v2) {INT dummy;\ dummy=v1; \ v1=v2; \ v2=dummy;} void sortrange(INT left, INT right) { INT zl = left, zr = right, hyphen; hyphen = sort_freq[right]; //divides by hyphen the given range into 2 parts do { while (sort_freq[zl] > hyphen) zl++; while (sort_freq[zr] < hyphen) zr--; //found a too small (left side) and //a too big (right side) element-->exchange them if (zl <= zr) { xchg_def(sort_freq[zl], sort_freq[zr]); xchg_def(sort_org[zl], sort_org[zr]); zl++; zr--; } } while (zl < zr); //sort partial ranges - when very small, sort directly if (left < zr) if (left < zr - 1) sortrange(left, zr); else if (sort_freq[left] < sort_freq[zr]) { xchg_def(sort_freq[left], sort_freq[zr]); xchg_def(sort_org[left], sort_org[zr]); } if (right > zl) if (zl < right - 1) sortrange(zl, right); else if (sort_freq[zl] < sort_freq[right]) { xchg_def(sort_freq[zl], sort_freq[right]); xchg_def(sort_org[zl], sort_org[right]); } } void quicksort(INT n) { INT i; for (i = n + 1; i--;) sort_org[i] = i; sortrange(0, n); } //------------------------------ read bits ---------------------------------// void readdat(void) { UINT i; i = (size_rdb - 2) << 2; rpos -= size_rdb - 2; buf_rd[0] = buf_rd[size_rdb - 2]; buf_rd[1] = buf_rd[size_rdb - 1]; read_adds_blk((CHAR *) & buf_rd[2], i); #ifdef HI_LO_BYTE_ORDER { ULONG *p; i>>=2; // count LONGs not BYTEs p=&buf_rd[2]; while (i--) { LONGswap(p); p++; } } #endif } #define addbits(bits) \ { \ rpos+=(bits_rd+=bits)>>5; \ bits_rd&=31; \ if (rpos==(size_rdb-2)) readdat(); \ code_rd=(buf_rd[rpos] << bits_rd) \ +((buf_rd[rpos+1] >> (32-bits_rd))&(!bits_rd-1)); \ } //---------------------- COMMENT DECOMPRESSION -----------------------------// #define comm_cpr_hf(a,b) (a+b) void dcpr_comm_init(void) { INT i; i = comm_cpr_size > size_rdb * sizeof(LONG) ? size_rdb * sizeof(LONG) : comm_cpr_size; if (!f_err) memcpy(buf_rd, comm, i); #ifdef HI_LO_BYTE_ORDER { ULONG *p; i>>=2; // count LONGs not BYTEs p=buf_rd; while (i--) { LONGswap(p); p++; } } #endif code_rd = buf_rd[0]; rpos = bits_rd = 0; } void dcpr_comm(INT comm_size) { SHORT hash[comm_cpr_hf(255, 255) + 1]; INT dpos = 0, c, pos, len, hs; memset(&hash, 0, sizeof(hash)); if (comm_cpr_size) { dcpr_comm_init(); len = code_rd >> (32 - 15); addbits(15); if (len >= comm_size) len = comm_size - 1; if (read_wd(maxwd_mn, dcpr_code_mn, dcpr_wd_mn, max_cd_mn)) do { if (dpos > 1) { pos = hash[hs = comm_cpr_hf(comm[dpos - 1], comm[dpos - 2])]; hash[hs] = dpos; } addbits(dcpr_wd_mn[(c = dcpr_code_mn[code_rd >> (32 - maxwd_mn)])]); if (rpos == size_rdb - 3) rpos = 0; if (c > 255) { c -= 256; c += 2; while (c--) comm[dpos++] = comm[pos++]; } else { comm[dpos++] = c; } } while (dpos < len); comm[len] = 0; } } //------------------------- LZW DECOMPRESSION ------------------------------// void wrchar(CHAR ch) { dcpr_do++; dcpr_text[dcpr_dpos] = ch; dcpr_dpos++; dcpr_dpos &= dcpr_dican; } void copystr(LONG d, INT l) { INT mpos; dcpr_do += l; mpos = dcpr_dpos - d; mpos &= dcpr_dican; if ((mpos >= dcpr_dicsiz - maxlength) || (dcpr_dpos >= dcpr_dicsiz - maxlength)) { while (l--) { dcpr_text[dcpr_dpos] = dcpr_text[mpos]; dcpr_dpos++; dcpr_dpos &= dcpr_dican; mpos++; mpos &= dcpr_dican; } } else { while (l--) dcpr_text[dcpr_dpos++] = dcpr_text[mpos++]; dcpr_dpos &= dcpr_dican; } } void decompress(void) { INT c, lg, i, k; ULONG dist; while (dcpr_do < dcpr_do_max) { if (!blocksize) if (!calc_dectabs()) return; addbits(dcpr_wd_mn[(c = dcpr_code_mn[code_rd >> (32 - maxwd_mn)])]); blocksize--; if (c > 255) { if (c > 259) { if ((c -= 260) > 1) { dist = (code_rd >> (33 - c)) + (1L << (c - 1)); addbits(c - 1); } else dist = c; dcpr_olddist[(dcpr_oldnum = (dcpr_oldnum + 1) & 3)] = dist; i = 2; if (dist > maxdis2) { i++; if (dist > maxdis3) i++; } } else { dist = dcpr_olddist[(dcpr_oldnum - (c &= 255)) & 3]; for (k = c + 1; k--;) dcpr_olddist[(dcpr_oldnum - k) & 3] = dcpr_olddist[(dcpr_oldnum - k + 1) & 3]; dcpr_olddist[dcpr_oldnum] = dist; i = 2; if (c > 1) i++; } addbits(dcpr_wd_lg[(lg = dcpr_code_lg[code_rd >> (32 - maxwd_lg)])]); dist++; lg += i; copystr(dist, lg); } else wrchar(c); } } //-------------------------- HUFFMAN ROUTINES ------------------------------// INT makecode(UINT maxwd, UINT size1_t, UCHAR * wd, USHORT * code) { UINT maxc, size2_t, l, c, i, max_make_code; memcpy(&sort_freq, wd, (size1_t + 1) * sizeof(CHAR)); if (size1_t) quicksort(size1_t); else sort_org[0] = 0; sort_freq[size1_t + 1] = size2_t = c = 0; while (sort_freq[size2_t]) size2_t++; if (size2_t < 2) { i = sort_org[0]; wd[i] = 1; size2_t += (size2_t == 0); } size2_t--; max_make_code = 1 << maxwd; for (i = size2_t + 1; i-- && c < max_make_code;) { maxc = 1 << (maxwd - sort_freq[i]); l = sort_org[i]; if (c + maxc > max_make_code) { dcpr_do = dcpr_do_max; return (0); } memset16(&code[c], l, maxc); c += maxc; } return (1); } INT read_wd(UINT maxwd, USHORT * code, UCHAR * wd, INT max_el) { UINT c, i, j, num_el, l, uplim, lolim; memset(wd, 0, max_el * sizeof(CHAR)); memset(code, 0, (1 << maxwd) * sizeof(SHORT)); num_el = code_rd >> (32 - 9); addbits(9); if (num_el > max_el) num_el = max_el; lolim = code_rd >> (32 - 4); addbits(4); uplim = code_rd >> (32 - 4); addbits(4); for (i = -1; ++i <= uplim;) { wd_svwd[i] = code_rd >> (32 - 3); addbits(3); } if (!makecode(maxwd_svwd, uplim, wd_svwd, code)) return (0); j = 0; while (j <= num_el) { c = code[code_rd >> (32 - maxwd_svwd)]; addbits(wd_svwd[c]); if (c < uplim) wd[j++] = c; else { l = (code_rd >> 28) + 4; addbits(4); while (l-- && j <= num_el) wd[j++] = 0; } } if (uplim) for (i = 0; ++i <= num_el;) wd[i] = (wd[i] + wd[i - 1]) % uplim; for (i = -1; ++i <= num_el;) if (wd[i]) wd[i] += lolim; return (makecode(maxwd, num_el, wd, code)); } INT calc_dectabs(void) { if (!read_wd(maxwd_mn, dcpr_code_mn, dcpr_wd_mn, max_cd_mn) || !read_wd(maxwd_lg, dcpr_code_lg, dcpr_wd_lg, max_cd_lg)) return (0); blocksize = code_rd >> (32 - 15); addbits(15); return (1); } //---------------------------- BLOCK ROUTINES ------------------------------// INT decompress_blk(CHAR * buf, UINT len) { LONG old_pos = dcpr_dpos; INT i; dcpr_do = 0; if ((dcpr_do_max = len - maxlength) > dcpr_size) dcpr_do_max = dcpr_size; if ((LONG) dcpr_size > 0 && dcpr_do_max) { decompress(); if (dcpr_do <= len) { if (old_pos + dcpr_do > dcpr_dicsiz) { i = dcpr_dicsiz - old_pos; memcpy(buf, &dcpr_text[old_pos], i); memcpy(&buf[i], dcpr_text, dcpr_do - i); } else memcpy(buf, &dcpr_text[old_pos], dcpr_do); } } dcpr_size -= dcpr_do; return (dcpr_do); } INT unstore(CHAR * buf, UINT len) { UINT rd = 0, i, pos = 0; while ((i = read_adds_blk((CHAR *) buf_rd, (INT) ((i = ((len > dcpr_size) ? dcpr_size : len)) > size_rdb ? size_rdb : i))) != 0) { rd += i; len -= i; dcpr_size -= i; memcpy(&buf[pos], buf_rd, i); pos += i; } for (i = 0; i < rd; i++) { dcpr_text[dcpr_dpos] = buf[i]; dcpr_dpos++; dcpr_dpos &= dcpr_dican; } return (INT)rd; } INT dcpr_adds_blk(CHAR * buf, UINT len) { INT r; switch (fhead.TECH.TYPE) { case TYPE_STORE: r = unstore(buf, len); break; case TYPE_LZ1: r = decompress_blk(buf, len); break; default: printf("\nFile compressed with unknown method. Decompression not possible.\n"); f_err = ERR_OTHER; r = 0; } rd_crc = getcrc(rd_crc, buf, r); return r; } //----------------------------- INIT ROUTINES ------------------------------// void dcpr_init(void) { dcpr_frst_file = 1; dcpr_dic = 20; while ((dcpr_text = malloc(dcpr_dicsiz = (LONG) 1 << dcpr_dic))==NULL) dcpr_dic--; dcpr_dican = dcpr_dicsiz - 1; } void dcpr_init_file(void) { UINT i; if (head.HEAD_FLAGS & ACE_PASSW) { printf("\nFound passworded file. Decryption not supported.\n"); f_err = ERR_OTHER; return; } rd_crc = CRC_MASK; dcpr_size = fhead.SIZE; if (fhead.TECH.TYPE == TYPE_LZ1) { if ((fhead.TECH.PARM & 15) + 10 > dcpr_dic) { printf("\nNot enough memory or dictionary of archive too large.\n"); f_err = ERR_MEM; return; } i = size_rdb * sizeof(LONG); read_adds_blk((CHAR *) buf_rd, i); #ifdef HI_LO_BYTE_ORDER { ULONG *p; i>>=2; // count LONGs not BYTEs p=buf_rd; while (i--) { LONGswap(p); p++; } } #endif code_rd = buf_rd[0]; bits_rd = rpos = 0; blocksize = 0; } if (!adat.sol || dcpr_frst_file) dcpr_dpos = 0; dcpr_oldnum = 0; memset(&dcpr_olddist, 0, sizeof(dcpr_olddist)); dcpr_frst_file = 0; } unace1.2b/uac_sys.c000644 000000060741000630254400077550ustar /* ------------------------------------------------------------------------ */ /* */ /* Some basic things. */ /* */ /* ------------------------------------------------------------------------ */ /* ML - 01/2004: changed licence to GPL */ /* ------------------------------------------------------------------------ */ #include "os.h" #include // signal() #include // fprintf() fflush() getch() putc() #if defined(DOS) || defined(WINNT) || defined(WIN16) || defined (VA_CPP) #include // getch() #endif #if defined(DOS) #include // delay() sound() #endif #ifdef NOSTRICMP #include // tolower() #endif #include "globals.h" #include "uac_sys.h" void memset16(USHORT * dest, SHORT val, INT len) // fills short-array with { // value while (len--) *(dest++) = val; } INT cancel(void) // checks whether to interrupt the program { #ifdef DOS while (kbhit()) { if (getch() == 27) f_err = ERR_USER; } #endif return (f_err); } INT wrask(CHAR * s) // prompt-routine { INT ch; fprintf(stderr, "\n %s (Yes,Always,No,Cancel) ", s); fflush(stderr); do { ch = getch(); ch = upcase(ch); } while (ch != 'Y' && ch != 'A' && ch != 'N' && ch != 'C' && ch != 27) ; fprintf(stderr, "%s", ch == 'Y' ? "Yes" : (ch == 'A' ? "Always" : (ch == 'N' ? "No" : "Cancel"))); fflush(stderr); return (ch == 'Y' ? 0 : (ch == 'A' ? 1 : (ch == 'N' ? 2 : 3))); } #ifdef NOSTRICMP INT stricmp( char *arg1, char *arg2 ) { INT chk; if ( (!arg2) || (!arg1) ) return 1; for ( ; *arg1 || *arg2; arg1++, arg2++ ) if ( (chk = tolower(*arg1) - tolower(*arg2)) ) if ( chk < 0 ) return -1; else return 1; return 0; } #endif /* NOSTRICMP */ void beep(void) // makes some noise { #ifdef DOS sound(800); delay(250); nosound(); #else putc(0x07, stdout); #endif } void my_signalhandler(INT sig_number) // sets f_err if ctrl+c or ctrl+brk { f_err = ERR_USER; printf("\nUser break\n"); } #ifdef DOS // handles hardware errors #ifdef __BORLANDC__ INT harderrhandler(UINT deverr, UINT errc, UINT * devhdr) #else INT __far harderrhandler(UINT deverr, UINT errc, UINT __far * devhdr) #endif { f_criterr = 'A' + deverr & 0xff; f_err = ERR_OTHER; return (0x3); } #endif void set_handler(void) // initializes handlers { #if defined(DOS) && !defined(__BORLANDC__) signal(SIGBREAK, my_signalhandler); // set ctrl-break/-c handlers #endif signal(SIGINT, my_signalhandler); #if defined(DOS) && !defined(__CONSOLE__) // set hardware error handler #ifdef __BORLANDC__ harderr(harderrhandler); #else _harderr(harderrhandler); #endif #endif } unace1.2b/unace.c000644 000000425461000630255400074070ustar /* ------------------------------------------------------------------------ */ /* */ /* Main file of public UNACE. */ /* */ /* ------------------------------------------------------------------------ */ /* ML - 01/2004: changed licence to GPL */ /* ------------------------------------------------------------------------ */ //--------------- include general files ------------------------------------// #include // tolower() #include // open() #include // printf() sprintf() remove() #include // malloc() #include // str*() #include // S_I* AMIGA: fstat() #if defined(AMIGA) #include // errno #include #endif #if defined(DOS) || defined(WINNT) || defined(WIN16) || defined(OS2) #include // lseek() open() read() write() eof() close() #endif #if defined(DOS) || defined(WINNT) || defined(WIN16) #include // lseek() open() read() write() eof() close() #endif #if defined(UNIX) #include #include #endif //--------------- include unace specific header files ----------------------// #include "os.h" #include "globals.h" #include "portable.h" #include "uac_comm.h" #include "uac_crc.h" #include "uac_crt.h" #include "uac_dcpr.h" #include "uac_sys.h" //--------------- BEGIN OF UNACE ROUTINES ----------------------------------// #ifdef CASEINSENSE #include /* fileexists() hack: * if first try of file existing doesn't work then swap Case of the c * in the .CXX extension */ INT fileexists_insense(char *name) { int len; char *s; if (fileexists(name)) return 1; len = strlen(name); if (len >= 3) { s = &name[len-3]; if (isalpha(*s)) { if (islower(*s)) *s = toupper(*s); else *s = tolower(*s); return fileexists(name); } } return 0; } #else #define fileexists_insense(name) fileexists(name) #endif void init_unace(void) // initializes unace { buf_rd =malloc(size_rdb * sizeof(ULONG)); // Allocate buffers: increase buf =malloc(size_buf); // sizes when possible to speed buf_wr =malloc(size_wrb); // up the program readbuf=malloc(size_headrdb); if (buf_rd ==NULL || buf ==NULL || buf_wr ==NULL || readbuf==NULL ) f_err = ERR_MEM; make_crctable(); // initialize CRC table dcpr_init(); // initialize decompression set_handler(); // ctrl+break etc. } void done_unace(void) { if (buf_rd ) free(buf_rd ); if (buf ) free(buf ); if (buf_wr ) free(buf_wr ); if (readbuf ) free(readbuf ); if (dcpr_text) free(dcpr_text); } INT read_header(INT print_err) // reads any header from archive { USHORT rd, head_size, crc_ok; LONG crc; UCHAR *tp=readbuf; lseek(archan, skipsize, SEEK_CUR); // skip ADDSIZE block if (read(archan, &head, 4)<4) return 0; // read CRC and header size #ifdef HI_LO_BYTE_ORDER WORDswap(&head.HEAD_CRC); WORDswap(&head.HEAD_SIZE); #endif // read size_headrdb bytes into head_size = head.HEAD_SIZE; // header structure rd = (head_size > size_headrdb) ? size_headrdb : head_size; if (read(archan, readbuf, rd) < rd) return 0; head_size -= rd; crc = getcrc(CRC_MASK, readbuf, rd); while (head_size) // skip rest of header { rd = (head_size > size_buf) ? size_buf : head_size; if (read(archan, buf, rd) < rd) return 0; head_size -= rd; crc = getcrc(crc, buf, rd); } head.HEAD_TYPE =*tp++; // generic buffer to head conversion head.HEAD_FLAGS=BUFP2WORD(tp); if (head.HEAD_FLAGS & ACE_ADDSIZE) skipsize = head.ADDSIZE = BUF2LONG(tp); // get ADDSIZE else skipsize = 0; // check header CRC if (!(crc_ok = head.HEAD_CRC == (crc & 0xffff)) && print_err) printf("\nError: archive is broken\n"); else switch (head.HEAD_TYPE) // specific buffer to head conversion { case MAIN_BLK: memcpy(mhead.ACESIGN, tp, acesign_len); tp+=acesign_len; mhead.VER_MOD=*tp++; mhead.VER_CR =*tp++; mhead.HOST_CR=*tp++; mhead.VOL_NUM=*tp++; mhead.TIME_CR=BUFP2LONG(tp); mhead.RES1 =BUFP2WORD(tp); mhead.RES2 =BUFP2WORD(tp); mhead.RES =BUFP2LONG(tp); mhead.AV_SIZE=*tp++; memcpy(mhead.AV, tp, rd-(USHORT)(tp-readbuf)); break; case FILE_BLK: fhead.PSIZE =BUFP2LONG(tp); fhead.SIZE =BUFP2LONG(tp); fhead.FTIME =BUFP2LONG(tp); fhead.ATTR =BUFP2LONG(tp); fhead.CRC32 =BUFP2LONG(tp); fhead.TECH.TYPE =*tp++; fhead.TECH.QUAL =*tp++; fhead.TECH.PARM =BUFP2WORD(tp); fhead.RESERVED =BUFP2WORD(tp); fhead.FNAME_SIZE=BUFP2WORD(tp); memcpy(fhead.FNAME, tp, rd-(USHORT)(tp-readbuf)); break; // default: (REC_BLK and future things): // do nothing 'cause isn't needed for extraction } return crc_ok; } // maximum SFX module size #define max_sfx_size 65536 // (needed by read_arc_head) INT read_arc_head(void) // searches for the archive header and reads it { INT i, flags, buf_pos = 0; LONG arc_head_pos, old_fpos, fpos = 0; struct stat st; fstat(archan, &st); memset(buf, 0, size_buf); while (lseek(archan, 0, SEEK_CUR) 0; adat.vol = (flags & ACE_MULT_VOL) > 0; adat.vol_num = mhead.VOL_NUM; adat.time_cr = mhead.TIME_CR; return 1; } } } // was no archive header, // continue search lseek(archan, fpos, SEEK_SET); memcpy(buf, &buf[size_buf - 512], 512); buf_pos = 512; // keep 512 old bytes } return 0; } INT open_archive(INT print_err) // opens archive (or volume) { CHAR av_str[80]; archan = open(aname, O_RDONLY | O_BINARY); // open file if (archan == -1) { printf("\nError opening file %s", aname); return 0; } if (!read_arc_head()) // read archive header { if (print_err) printf("\nInvalid archive file: %s\n", aname); close(archan); return 0; } printf("\nProcessing archive: %s\n\n", aname); if (head.HEAD_FLAGS & ACE_AV) { printf("Authenticity Verification:"); // print the AV sprintf(av_str, "\ncreated on %d.%d.%d by ", ts_day(adat.time_cr), ts_month(adat.time_cr), ts_year(adat.time_cr)); printf(av_str); strncpy(av_str, mhead.AV, mhead.AV_SIZE); av_str[mhead.AV_SIZE] = 0; printf("%s\n\n", av_str); } comment_out("Main comment:"); // print main comment return 1; } void get_next_volname(void) // get file name of next volume { CHAR *cp; INT num; if ((cp = (CHAR *) strrchr(aname, '.')) == NULL || !*(cp + 1)) num = -1; else { cp++; num = (*(cp + 1) - '0') * 10 + *(cp + 2) - '0'; if (!in(num, 0, 99)) num = -1; if (in(*cp, '0', '9')) num += (*cp - '0') * 100; } num++; if (num < 100) *cp = 'C'; else *cp = num / 100 + '0'; *(cp + 1) = (num / 10) % 10 + '0'; *(cp + 2) = num % 10 + '0'; } INT proc_vol(void) // opens volume { INT i; CHAR s[80]; // if f_allvol_pr is 2 we have -y and should never ask if ((!fileexists_insense(aname) && f_allvol_pr != 2) || !f_allvol_pr) { do { sprintf(s, "Ready to process %s?", aname); beep(); i = wrask(s); // ask whether ready or not f_allvol_pr = 0; if(i == 1) // "Always" --> process all volumes f_allvol_pr = 1; if (i >= 2) { f_err = ERR_FOUND; return 0; } } while (!fileexists_insense(aname)); } if (!open_archive(1)) // open volume { printf("\nError while opening archive. File not found or archive broken.\n"); f_err = ERR_OPEN; return 0; } return 1; } INT proc_next_vol(void) // opens next volume to process { close(archan); // close handle get_next_volname(); // get file name of next volume if (!proc_vol()) // try to open volume, read archive header return 0; if (!read_header(1)) // read 2nd header { f_err=ERR_READ; return 0; } return 1; } INT read_adds_blk(CHAR * buffer, INT len) // reads part of ADD_SIZE block { INT rd = 0, l = len; LONG i; while (!f_err && len && skipsize) { i = (skipsize > len) ? len : skipsize; skipsize -= i; errno = 0; rd += read(archan, buffer, i); if (errno) { printf("\nRead error\n"); f_err = ERR_READ; } buffer += i; len -= i; if (!skipsize) // if block is continued on next volume if (head.HEAD_FLAGS & ACE_SP_AFTER && !proc_next_vol()) break; } return (rd > l ? l : rd); } void crc_print(void) // checks CRC, prints message { INT crc_not_ok = rd_crc != fhead.CRC32; /* check CRC of file */ if(crc_not_ok) f_err_crc=1; if (!f_err) // print message { printf(crc_not_ok ? " CRC-check error" : " CRC OK"); flush; } } void analyze_file(void) // analyzes one file (for solid archives) { printf("\n Analyzing"); flush; while (!cancel() && (dcpr_adds_blk(buf_wr, size_wrb))) // decompress only ; crc_print(); } void extract_file(void) // extracts one file { INT rd; printf("\n Extracting"); flush; // decompress block while (!cancel() && (rd = dcpr_adds_blk(buf_wr, size_wrb))) { if (write(wrhan, buf_wr, rd) != rd) // write block { printf("\nWrite error\n"); f_err = ERR_WRITE; } } crc_print(); } /* extracts or tests all files of the archive */ void extract_files(int nopath, int test) { CHAR file[PATH_MAX]; while (!cancel() && read_header(1)) { if (head.HEAD_TYPE == FILE_BLK) { comment_out("File comment:"); // show file comment ace_fname(file, &head, nopath); // get file name printf("\n%s", file); flush; dcpr_init_file(); // initialize decompression of file if (!f_err) { if (test || (wrhan = create_dest_file(file, (INT) fhead.ATTR))<0) { if (test || adat.sol) analyze_file(); // analyze file } else { extract_file(); // extract it #ifdef DOS // set file time _dos_setftime(wrhan, (USHORT) (fhead.FTIME >> 16), (USHORT) fhead.FTIME); #endif close(wrhan); #ifdef DOS // set file attributes _dos_setfileattr(file, (UINT) fhead.ATTR); #endif #ifdef AMIGA { // set file date and time struct DateTime dt; char Date[9], Time[9]; ULONG tstamp=fhead.FTIME; sprintf(Date, "%02d-%02d-%02d", ts_year(tstamp)-1900, ts_month(tstamp), ts_day(tstamp)); sprintf(Time, "%02d:%02d:%02d", ts_hour(tstamp), ts_min(tstamp), ts_sec(tstamp)); dt.dat_Format = FORMAT_INT; dt.dat_Flags = 0; dt.dat_StrDate= Date; dt.dat_StrTime= Time; if (StrToDate(&dt)) SetFileDate(file, &dt.dat_Stamp); } #endif if (f_err) remove(file); } } } } } unsigned percentage(ULONG p, ULONG d) { return (unsigned)( d ? (d/2+p*100)/d : 100 ); } void list_files(int verbose) { unsigned files=0; ULONG size =0, psize=0, tpsize; CHAR file[PATH_MAX]; printf("Date |Time |Packed |Size |Ratio|File\n"); while (!cancel() && read_header(1)) { if (head.HEAD_TYPE == FILE_BLK) { ULONG ti=fhead.FTIME; ace_fname(file, &head, verbose ? 0 : 1); // get file name size += fhead.SIZE; psize += tpsize = fhead.PSIZE; files++; while (head.HEAD_FLAGS & ACE_SP_AFTER) { skipsize=0; if (!proc_next_vol()) break; psize += fhead.PSIZE; tpsize+= fhead.PSIZE; } if (!f_err) printf("%02u.%02u.%02u|%02u:%02u|%c%c%9lu|%9lu|%4u%%|%c%s\n", ts_day (ti), ts_month(ti), ts_year(ti)%100, ts_hour(ti), ts_min (ti), fhead.HEAD_FLAGS & ACE_SP_BEF ? '<' : ' ', fhead.HEAD_FLAGS & ACE_SP_AFTER ? '>' : ' ', tpsize, fhead.SIZE, percentage(tpsize, fhead.SIZE), fhead.HEAD_FLAGS & ACE_PASSW ? '*' : ' ', file ); } } if (!f_err) { printf("\n %9lu|%9lu|%4u%%| %u file%s", psize, size, percentage(psize, size), files, (char*)(files == 1 ? "" : "s") ); } } void showhelp(void) { printf("\n" "Usage: UNACE [] \n" "\n" "Where is one of:\n" "\n" " e Extract files\n" " l List archive\n" " t Test archive integrity\n" " v List archive (verbose)\n" " x Extract files with full path\n" "\n" "And is zero or more of:\n" "\n" " -y Assume 'yes' on all questions, never ask for input" ); f_err = ERR_CLINE; } int main(INT argc, CHAR * argv[]) // processes the archive { INT show_help, arg_cnt = 1; printf(version); show_help=0; if (argc < 3 || strlen(argv[1]) > 1 || argv[argc-1][0] == '-') show_help=1; while (!show_help && argv[++arg_cnt][0] == '-') { switch (tolower(argv[arg_cnt][1])) { case 'y': f_ovrall = 1; // Overwrite all f_allvol_pr = 2; // Process all volumes, and never ask break; default: show_help = 1; break; } } if (show_help) showhelp(); else { CHAR *s; init_unace(); // initialize unace strcpy(aname, argv[arg_cnt]); // get archive name if (!(s = (CHAR *) strrchr(aname, DIRSEP))) s = aname; if (!strrchr(s, '.')) strcat(aname, ".ACE"); if (open_archive(1)) // open archive to process { if (adat.vol_num) printf("\nFirst volume of archive required!\n"); else switch (tolower(*argv[1])) { case 'e': extract_files(1, 0); break; // extract files without path case 'x': extract_files(0, 0); break; // extract files with path case 'l': list_files (0 ); break; // list files case 'v': list_files (1 ); break; // list files verbose case 't': extract_files(0, 1); break; // test archive integrity. default : showhelp(); // Wrong command! } close(archan); if (f_err) { printf("\nError occurred\n"); if (f_criterr) printf("Critical error on drive %c\n", f_criterr); } } else f_err = ERR_CLINE; done_unace(); } putchar('\n'); putc ('\n', stderr); if (!f_err && f_err_crc) { printf("One or more CRC-errors were found.\n"); f_err = ERR_CRC; } return f_err; } unace1.2b/acestruc.h000644 000000071541000630257400101300ustar /* ------------------------------------------------------------------------ */ /* ML - 01/2004: changed licence to GPL */ /* ------------------------------------------------------------------------ */ #ifndef __acestruc_h #define __acestruc_h #include "declare.h" #include "portable.h" #define acesign_len 7 #define bytes_before_acesign 7 #define acever 10 struct tech { UCHAR TYPE; UCHAR QUAL; USHORT PARM; }; typedef struct tacehead { USHORT HEAD_CRC; USHORT HEAD_SIZE; UCHAR HEAD_TYPE; USHORT HEAD_FLAGS; ULONG ADDSIZE; UCHAR other[2048]; } thead; typedef struct tacemhead { USHORT HEAD_CRC; USHORT HEAD_SIZE; UCHAR HEAD_TYPE; USHORT HEAD_FLAGS; UCHAR ACESIGN[acesign_len]; UCHAR VER_MOD; UCHAR VER_CR; UCHAR HOST_CR; UCHAR VOL_NUM; ULONG TIME_CR; USHORT RES1; USHORT RES2; ULONG RES; UCHAR AV_SIZE; UCHAR AV[256]; USHORT COMM_SIZE; UCHAR COMM[2048]; } tmhead; #ifndef PATH_MAX #define PATH_MAX 512 #endif typedef struct tacefhead { USHORT HEAD_CRC; USHORT HEAD_SIZE; UCHAR HEAD_TYPE; USHORT HEAD_FLAGS; ULONG PSIZE; ULONG SIZE; ULONG FTIME; ULONG ATTR; ULONG CRC32; struct tech TECH; USHORT RESERVED; USHORT FNAME_SIZE; UCHAR FNAME[PATH_MAX]; USHORT COMM_SIZE; UCHAR COMM[2048]; } tfhead; #define mhead (*t_mhead) #define fhead (*t_fhead) #define rhead (*t_rhead) #define tmpmhead (*t_tmpmhead) #define tmpfhead (*t_tmpfhead) #define tmprhead (*t_tmprhead) #define mhead_size h_mhead_size(mhead) #define fhead_size h_fhead_size(fhead) #define rhead_size ((INT)&rhead.REC_CRC-(INT)&head.HEAD_TYPE+sizeof(rhead.REC_CRC)) #define h_mhead_size(phead) ((INT)mhead.AV-(INT)&head.HEAD_TYPE+ \ (phead).AV_SIZE+ \ ((phead).HEAD_FLAGS&ACE_COMM? \ sizeof((phead).COMM_SIZE)+H_MCOMM_SIZE(phead):0)) #define h_fhead_size(phead) ((INT)fhead.FNAME-(INT)&head.HEAD_TYPE+ \ (phead).FNAME_SIZE+ \ ((phead).HEAD_FLAGS&ACE_COMM? \ sizeof((phead).COMM_SIZE)+H_FCOMM_SIZE(phead):0)) //main-comment-definitions #define H_MCOMM_SIZE(head) (BUF2WORD((UCHAR*)&(head).AV+(head).AV_SIZE)) #define MCOMM_SIZE H_MCOMM_SIZE(mhead) #define H_MCOMM(head) ((UCHAR*)&(head).AV+(head).AV_SIZE+sizeof((head).COMM_SIZE)) #define MCOMM H_MCOMM(mhead) //file-comment-definitions #define H_FCOMM_SIZE(head) (BUF2WORD((UCHAR*)&(head).FNAME+(head).FNAME_SIZE)) #define FCOMM_SIZE H_FCOMM_SIZE(fhead) #define H_FCOMM(head) ((UCHAR*)&(head).FNAME+(head).FNAME_SIZE+sizeof((head).COMM_SIZE)) #define FCOMM H_FCOMM(fhead) // #define calc_head_crc getcrc16(CRC_MASK, (CHAR*)&head.HEAD_TYPE, head.HEAD_SIZE) #define GET_ADDSIZE ((head.HEAD_FLAGS & ACE_ADDSIZE) ? head.ADDSIZE : 0) //archive-header-flags #define ACE_LIM256 1024 #define ACE_MULT_VOL 2048 #define ACE_AV 4096 #define ACE_RECOV 8192 #define ACE_LOCK 16384 #define ACE_SOLID 32768 //file-header-flags #define ACE_ADDSIZE 1 #define ACE_PASSW 16384 #define ACE_SP_BEF 4096 #define ACE_SP_AFTER 8192 #define ACE_COMM 2 //block types #define MAIN_BLK 0 #define FILE_BLK 1 #define REC_BLK 2 //known compression types #define TYPE_STORE 0 #define TYPE_LZ1 1 //structure for archive handling struct tadat { INT sol, vol, vol_num; ULONG time_cr; }; #endif /* __acestruc_h */ unace1.2b/declare.h000644 000000015341000630263600077110ustar /******************************************************/ /* */ /* declare.h: declaration-symbols (UCHAR, ULONG, ...) */ /* */ /******************************************************/ /* ML - 01/2004: changed licence to GPL */ /*----------------------------------------------------*/ #ifndef __declare_h #define __declare_h #ifdef AMIGA #include #else /* AMIGA */ typedef unsigned short USHORT; typedef short SHORT ; typedef unsigned short UWORD ; typedef short WORD ; typedef unsigned long ULONG ; typedef long LONG ; #endif /* !AMIGA */ typedef unsigned char UCHAR ; typedef char CHAR ; typedef unsigned UINT ; typedef int INT ; #endif /* __declare_h */ unace1.2b/globals.h000644 000000037231000630266000077340ustar /* ------------------------------------------------------------------------ */ /* */ /* Global variable definitions */ /* */ /* ------------------------------------------------------------------------ */ /* ML - 01/2004: changed licence to GPL */ /* ------------------------------------------------------------------------ */ #ifndef __globals_h #define __globals_h #include "acestruc.h" #include "unace.h" //-------- Ace sign extern const char *acesign; //-------- Version string for program extern const char *version; //-------- header buffer and pointers extern thead head; extern tmhead *t_mhead; extern tfhead *t_fhead; //-------- buffers extern ULONG *buf_rd ; extern CHAR *buf ; extern CHAR *buf_wr ; extern UCHAR *readbuf; //-------- decompressor variables extern SHORT rpos , dcpr_do , dcpr_do_max , blocksize , dcpr_dic , dcpr_oldnum , bits_rd , dcpr_frst_file; extern USHORT dcpr_code_mn[1 << maxwd_mn], dcpr_code_lg[1 << maxwd_lg]; extern UCHAR dcpr_wd_mn[maxcode + 2], dcpr_wd_lg[maxcode + 2], wd_svwd[svwd_cnt]; extern ULONG dcpr_dpos , cpr_dpos2 , dcpr_dicsiz , dcpr_dican , dcpr_size , dcpr_olddist[4], code_rd ; extern CHAR *dcpr_text ; //-------- quicksort extern USHORT sort_org[maxcode + 2]; extern UCHAR sort_freq[(maxcode + 2) * 2]; //-------- file handling extern CHAR aname[PATH_MAX]; extern INT archan, wrhan; extern LONG skipsize; //-------- structures for archive handling extern struct tadat adat; //-------- flags extern INT f_err , f_err_crc , f_ovrall , f_allvol_pr, f_curpas , f_criterr ; #endif /* __globals_h */ unace1.2b/os.h000644 000000011241000630267600067320ustar /* ------------------------------------------------------------------------ */ /* ML - 01/2004: changed licence to GPL */ /* ------------------------------------------------------------------------ */ #ifndef __os_h #define __os_h #if defined(AMIGA) #define DIRSEP '/' #define HI_LO_BYTE_ORDER #endif #if defined(DOS) || defined(WINNT) || defined(WIN16) #define DIRSEP '\\' #define LO_HI_BYTE_ORDER #endif #if defined(OS2) #define DIRSEP '\\' #define LO_HI_BYTE_ORDER #endif #if defined(UNIX) #define DIRSEP '/' #endif #endif /* __os_h */ unace1.2b/uac_comm.h000644 000000006321000630275400100740ustar /* ------------------------------------------------------------------------ */ /* ML - 01/2004: changed licence to GPL */ /* ------------------------------------------------------------------------ */ #ifndef __uac_comm_h #define __uac_comm_h #include "declare.h" extern INT comm_cpr_size; extern CHAR *comm; void comment_out(CHAR *top); #endif /* __uac_comm_h */ unace1.2b/portable.h000644 000000067201000630276600101300ustar /****************************************************************/ /* */ /* A collection of routines used in making ACE portable for */ /* different computers */ /* */ /****************************************************************/ /* ML - 01/2004: changed licence to GPL */ /*--------------------------------------------------------------*/ #ifndef __portable_h #define __portable_h #include "os.h" #ifdef HI_LO_BYTE_ORDER /* All kinds of inplace swap routines, to reverse from LOHI to HILO byte order */ #ifdef AMIGA #if __SASC && __VERSION__>=6 && __REVISION__>=58 #define WORDswap(n) (*(n) = __builtin_rol(*(n), 8, 1)) #define LONGswap(n) ( WORDswap(&((WORD *)(n))[0]),\ WORDswap(&((WORD *)(n))[1]),\ *(n) = __builtin_rol(*(n), 16, 2) ) #else /* __SASC */ #define EORSWAP #endif /* !__SASC */ #endif /* AMIGA */ #ifdef EORSWAP /* With some compilers and processors these work faster then the * regular swap below, for example on a Amiga 68040 using SAS C 6.58. * But using builtin rotates works even faster, see above. */ #define WORDswap(n) (((BYTE*)(n))[0] ^= ((BYTE*)(n))[1],\ ((BYTE*)(n))[1] ^= ((BYTE*)(n))[0],\ ((BYTE*)(n))[0] ^= ((BYTE*)(n))[1]) #define LONGswap(n) (((BYTE*)(n))[0] ^= ((BYTE*)(n))[3],\ ((BYTE*)(n))[3] ^= ((BYTE*)(n))[0],\ ((BYTE*)(n))[0] ^= ((BYTE*)(n))[3],\ ((BYTE*)(n))[1] ^= ((BYTE*)(n))[2],\ ((BYTE*)(n))[2] ^= ((BYTE*)(n))[1],\ ((BYTE*)(n))[1] ^= ((BYTE*)(n))[2]) #endif /* EORSWAP */ #ifndef WORDswap /* If not yet defined use the standard swaps */ #define WORDswap(n) (*(n) = (*(n) << 8) | (*(n) >> 8)) #define LONGswap(n) ( WORDswap(&((WORD *)(n))[0]),\ WORDswap(&((WORD *)(n))[1]),\ *(n) = (*(n) >> 16) | (*(n) << 16) ) #endif /* WORDSWAP */ #endif /* HI_LO_BYTE_ORDER */ /* GENERIC: Convert to LONG or WORD from BYTE-Pointer-to-LOHI-byte-order data, * without worrying if the bytes are word alined in memory. * p is a pointer to char. */ #ifdef HI_LO_BYTE_ORDER #define BUFP2WORD(p) ((UWORD)*(p)++ | ((*(p)++)<<8)) #define BUFP2LONG(p) ((ULONG)*(p)++ | ((*(p)++)<<8) | ((*(p)++)<<16) | ((*(p)++)<<24)) #define BUF2WORD(p) ((UWORD)*(p) | (*((p)+1)<<8)) #define BUF2LONG(p) ((ULONG)*(p) | (*((p)+1)<<8) | (*((p)+2)<<16) | (*((p)+3)<<24)) #else /* HI_LO_BYTE_ORDER */ #define BUFP2WORD(p) *(UWORD*)((p+=2)-2) #define BUFP2LONG(p) *(ULONG*)((p+=4)-4) #define BUF2WORD(p) (*(UWORD*)p) #define BUF2LONG(p) (*(ULONG*)p) #endif /* !HI_LO_BYTE_ORDER */ /* Timestamp macros */ #define get_tx(m,d,h,n) (((ULONG)m<<21)+((ULONG)d<<16)+((ULONG)h<<11)+(n<<5)) #define get_tstamp(y,m,d,h,n,s) ((((ULONG)(y-1980))<<25)+get_tx(m,d,h,n)+(s/2)) #define ts_year(ts) ((UINT)((ts >> 25) & 0x7f) + 1980) #define ts_month(ts) ((UINT)(ts >> 21) & 0x0f) // 1..12 means Jan..Dec #define ts_day(ts) ((UINT)(ts >> 16) & 0x1f) // 1..31 means 1st..31st #define ts_hour(ts) ((UINT)(ts >> 11) & 0x1f) #define ts_min(ts) ((UINT)(ts >> 5) & 0x3f) #define ts_sec(ts) ((UINT)((ts & 0x1f) * 2)) #ifdef NOTELL #ifdef tell #undef tell #endif #define tell(_fd) lseek(_fd, 0, SEEK_CUR) #endif #endif /* __portable_h */ unace1.2b/uac_crc.h000644 000000010061000630300000076650ustar /* ------------------------------------------------------------------------ */ /* ML - 01/2004: changed licence to GPL */ /* ------------------------------------------------------------------------ */ #ifndef __uac_crc_h #define __uac_crc_h #include "declare.h" #define CRC_MASK 0xFFFFFFFFL #define CRCPOLY 0xEDB88320L extern ULONG crctable[256]; extern ULONG rd_crc; ULONG getcrc(ULONG crc, UCHAR * addr, INT len); void make_crctable(void); #endif /* __uac_crc_h */ unace1.2b/uac_crt.h000644 000000016511000630300400077200ustar /* ------------------------------------------------------------------------ */ /* ML - 01/2004: changed licence to GPL */ /* ------------------------------------------------------------------------ */ #ifndef __uac_crt_h #define __uac_crt_h #include "acestruc.h" CHAR *ace_fname(CHAR * s, thead * head, INT nopath); INT create_dest_file(CHAR * file, INT a); #ifdef UNIX #define mkdir(_a) mkdir(_a, S_IRWXU | S_IRWXG | S_IRWXO) #endif #ifndef _A_SUBDIR #define _A_SUBDIR 0x10 /* MS-DOS directory constant */ #endif #ifndef S_IEXEC #ifdef S_IEXECUTE #define S_IEXEC S_IEXECUTE #else #define S_IEXEC 0 #endif #endif #ifndef S_IDELETE #define S_IDELETE 0 #endif #ifndef S_IRGRP #define S_IRGRP 0 #define S_IWGRP 0 #endif #ifndef S_IROTH #define S_IROTH 0 #define S_IWOTH 0 #endif #ifndef O_BINARY #define O_BINARY 0 #endif #endif /* __uac_crt_h */ unace1.2b/uac_dcpr.h000644 000000010411000630301000100460ustar /* ------------------------------------------------------------------------ */ /* ML - 01/2004: changed licence to GPL */ /* ------------------------------------------------------------------------ */ #ifndef __uac_dcpr_h #define __uac_dcpr_h #include "declare.h" INT calc_dectabs(void); void dcpr_comm(INT comm_size); INT read_wd(UINT maxwd, USHORT * code, UCHAR * wd, INT max_el); void dcpr_init(void); INT dcpr_adds_blk(CHAR * buf, UINT len); void dcpr_init_file(void); #endif /* __uac_dcpr_h */ unace1.2b/uac_sys.h000644 000000010621000630301400077430ustar /* ------------------------------------------------------------------------ */ /* ML - 01/2004: changed licence to GPL */ /* ------------------------------------------------------------------------ */ #ifndef __uac_sys_h #define __uac_sys_h #include "declare.h" #define upcase(ch) ((in(ch,'a','z'))?(ch-32):(ch)) void memset16(USHORT * dest, SHORT val, INT len); INT cancel(void); INT wrask(CHAR * s); void beep(void); void set_handler(void); #if defined(UNIX) #define getch() getchar() #endif /* UNIX */ #endif unace1.2b/unace.h000644 000000026431000630302200073750ustar /* ------------------------------------------------------------------------ */ /* ML - 01/2004: changed licence to GPL */ /* ------------------------------------------------------------------------ */ #ifndef __unace_h #define __unace_h #include "declare.h" //--------- functions INT read_adds_blk(CHAR * buffer, INT len); //--------- buffers: increase sizes when possible to speed up the program #define size_rdb 1024 #define size_wrb 2048 #define size_buf 1024 #define size_headrdb (sizeof(head)-20) // (some bytes less esp. for Amiga) //--------- (de-)compressor constants #define maxdic 22 #define maxwd_mn 11 #define maxwd_lg 11 #define maxwd_svwd 7 #define maxlength 259 #define maxdis2 255 #define maxdis3 8191 #define maxcode (255+4+maxdic) #define svwd_cnt 15 #define max_cd_mn (256+4+(maxdic+1)-1) #define max_cd_lg (256-1) //--------- flags #define ERR_MEM 1 #define ERR_FILES 2 #define ERR_FOUND 3 #define ERR_FULL 4 #define ERR_OPEN 5 #define ERR_READ 6 #define ERR_WRITE 7 #define ERR_CLINE 8 #define ERR_CRC 9 #define ERR_OTHER 10 #define ERR_USER 255 //--------- system things #define flush fflush(stdout); #define in(v1,v2,v3) ((((long)v1)>=(v2)) && (((long)v1)<=(v3))) #define delay_len 500 //-------- file creation #define fileexists(name) (!access(name, 0)) //-------- eof #endif /* __unace_h */ unace1.2b/changes.log000644 000000016721000630320600102510ustar Modifications made to ACE --------------------------- Intention ----------- This file is to show inventions, bugfixes and other improvements made to public UNACE sources. This also helps to get to know about reasons of bugs. Meaning of the symbols ------------------------ $ modified + new - removed ! bugfixed * new release History of changes -------------------- DATE MODIFICATION (--2004--) 10.1. $ licence changed to GPL DATE MODIFICATION (--1998--) 10.1. ! unstore function in uac_dcpr.c 13.3. + UNIX port 15.5. ! UNIX port + '-y' switch *RELEASE UNACE- SRCS 1.2a 19.5. + port to Visual Age for C++ for OS/2 $ main() 21.5. + amiga/Readme.amiga ! UNIX: mkdir now creates directories with permissions 0777 & umask + unix/readme.txt to help people compile under UNIX