From 49807896eda1a7081cce1a7a134fb0071f5e7eeb Mon Sep 17 00:00:00 2001 From: HyungKyu Song Date: Sat, 16 Feb 2013 00:51:52 +0900 Subject: Tizen 2.0 Release --- BUGS | 6 + CHANGES | 1013 ++++++++++++++++ INSTALL | 188 +++ LICENSE | 55 + MANUAL | 804 +++++++++++++ README | 155 +++ README.CR | 115 ++ TODO | 72 ++ USexport.msg | 75 ++ WHATSNEW | 51 + WHERE | 258 ++++ acorn/GMakefile | 130 ++ acorn/ReadMe | 85 ++ acorn/ReadMe.GMakefile | 14 + acorn/RunMe1st | 23 + acorn/acornzip.c | 593 +++++++++ acorn/makefile | 111 ++ acorn/match.s | 217 ++++ acorn/osdep.h | 28 + acorn/riscos.c | 394 ++++++ acorn/riscos.h | 119 ++ acorn/sendbits.s | 105 ++ acorn/srcrename | Bin 0 -> 6175 bytes acorn/swiven.h | 59 + acorn/swiven.s | 276 +++++ acorn/zipup.h | 16 + amiga/LMKfile | 116 ++ amiga/README | 1 + amiga/amiga.c | 143 +++ amiga/amiga.h | 54 + amiga/amigazip.c | 510 ++++++++ amiga/crc_68.a | 144 +++ amiga/deflate.a | 1053 ++++++++++++++++ amiga/filedate.c | 636 ++++++++++ amiga/makefile.azt | 282 +++++ amiga/match.a | 182 +++ amiga/match_68.a | 273 +++++ amiga/osdep.h | 109 ++ amiga/smakefile | 671 +++++++++++ amiga/stat.c | 293 +++++ amiga/time_lib.c | 541 +++++++++ amiga/timezone.doc | 85 ++ amiga/z-stat.h | 95 ++ amiga/z-time.h | 76 ++ amiga/zipup.h | 25 + aosvs/aosvs.c | 662 ++++++++++ aosvs/make.cli | 5 + api.c | 494 ++++++++ api.h | 152 +++ atari/Makefile | 109 ++ atari/README | 5 + atari/atari.c | 682 +++++++++++ atari/make_all.mup | 7 + atari/make_zip.mup | 7 + atari/osdep.h | 20 + atari/zipup.h | 19 + atheos/Contents | 11 + atheos/Makefile | 144 +++ atheos/README | 23 + atheos/atheos.c | 885 ++++++++++++++ atheos/osdep.h | 63 + atheos/zipup.h | 24 + beos/Contents | 14 + beos/Makefile | 180 +++ beos/README | 31 + beos/beos.c | 946 +++++++++++++++ beos/osdep.h | 59 + beos/zipup.h | 19 + cmsmvs/README.CMS | 434 +++++++ cmsmvs/README.MVS | 92 ++ cmsmvs/README.MVS.LE | 286 +++++ cmsmvs/cczip.exec | 124 ++ cmsmvs/cms.c | 34 + cmsmvs/cmsmvs.c | 442 +++++++ cmsmvs/cmsmvs.h | 134 +++ cmsmvs/cstat.h | 53 + cmsmvs/mc.exec | 95 ++ cmsmvs/mvs.c | 221 ++++ cmsmvs/mvs.h | 40 + cmsmvs/mvs.mki | 128 ++ cmsmvs/pipzip.rexx | 27 + cmsmvs/zip.exec | 66 + cmsmvs/zip.makefile | 22 + cmsmvs/zipcloak.exec | 66 + cmsmvs/zipmvsc.job | 95 ++ cmsmvs/zipname.conven | 200 ++++ cmsmvs/zipnote.exec | 66 + cmsmvs/zipsplit.exec | 66 + cmsmvs/zipup.h | 18 + cmsmvs/zipvmc.exec | 50 + crc32.c | 64 + crc_i386.S | 240 ++++ crctab.c | 227 ++++ crypt.c | 584 +++++++++ crypt.h | 175 +++ deflate.c | 902 ++++++++++++++ ebcdic.h | 284 +++++ file_id.diz | 15 + fileio.c | 986 +++++++++++++++ globals.c | 96 ++ human68k/Makefile | 93 ++ human68k/Makefile.gcc | 76 ++ human68k/crc_68.s | 144 +++ human68k/deflate.s | 1076 +++++++++++++++++ human68k/human68k.c | 362 ++++++ human68k/match.s | 163 +++ human68k/osdep.h | 28 + human68k/zipup.h | 16 + macos/Contents | 63 + macos/HISTORY.TXT | 489 ++++++++ macos/README.TXT | 560 +++++++++ macos/ZipLib.h | 166 +++ macos/ZipSx.h | 167 +++ macos/ZpPrj.hqx | 455 +++++++ macos/osdep.h | 118 ++ macos/readme.1st | 12 + macos/source/VolWarn.h | 69 ++ macos/source/charmap.h | 380 ++++++ macos/source/extrafld.c | 920 ++++++++++++++ macos/source/getenv.c | 398 ++++++ macos/source/helpers.c | 477 ++++++++ macos/source/helpers.h | 57 + macos/source/macglob.h | 86 ++ macos/source/macopen.c | 363 ++++++ macos/source/macopen.h | 21 + macos/source/macos.c | 1079 +++++++++++++++++ macos/source/macstuff.c | 1724 ++++++++++++++++++++++++++ macos/source/macstuff.h | 1108 +++++++++++++++++ macos/source/mactime.c | 451 +++++++ macos/source/mactime.h | 61 + macos/source/pathname.c | 665 +++++++++++ macos/source/pathname.h | 59 + macos/source/recurse.c | 442 +++++++ macos/source/recurse.h | 129 ++ macos/source/unixlike.c | 313 +++++ macos/source/unixlike.h | 86 ++ macos/source/zip_rc.hqx | 43 + macos/zipup.h | 25 + man/zip.1 | 1318 ++++++++++++++++++++ match.S | 407 +++++++ mktime.c | 257 ++++ msdos/README.DOS | 155 +++ msdos/crc_i86.asm | 464 +++++++ msdos/makefile.bor | 196 +++ msdos/makefile.dj1 | 125 ++ msdos/makefile.dj2 | 135 +++ msdos/makefile.emx | 167 +++ msdos/makefile.msc | 205 ++++ msdos/makefile.tc | 177 +++ msdos/makefile.wat | 253 ++++ msdos/match.asm | 457 +++++++ msdos/msdos.c | 1059 ++++++++++++++++ msdos/osdep.h | 205 ++++ msdos/zipup.h | 16 + os2/makefile.os2 | 560 +++++++++ os2/match32.asm | 175 +++ os2/os2.c | 481 ++++++++ os2/os2acl.c | 385 ++++++ os2/os2acl.h | 34 + os2/os2zip.c | 1213 +++++++++++++++++++ os2/os2zip.h | 84 ++ os2/osdep.h | 173 +++ os2/zip.def | 3 + os2/zipup.h | 16 + packaging/exec-shield.patch | 19 + packaging/zcrypt29.tar.gz | Bin 0 -> 17484 bytes packaging/zip-2.3-currdir.patch | 11 + packaging/zip-2.31-configure.patch | 213 ++++ packaging/zip-2.31-install.patch | 11 + packaging/zip-2.31-near-4GB.patch | 293 +++++ packaging/zip.spec | 180 +++ packaging/zip23-umask.patch | 23 + packaging/zip23.patch | 93 ++ proginfo/3rdparty.bug | 114 ++ proginfo/ZipPorts | 285 +++++ proginfo/algorith.txt | 68 ++ proginfo/extra.fld | 1441 ++++++++++++++++++++++ proginfo/fileinfo.cms | 231 ++++ proginfo/infozip.who | 232 ++++ proginfo/nt.sd | 111 ++ proginfo/perform.dos | 183 +++ proginfo/txtvsbin.txt | 112 ++ proginfo/ziplimit.txt | 218 ++++ qdos/IZREADME.SMS | 600 ++++++++++ qdos/Makefile.qdos | 143 +++ qdos/Makefile.qlzip | 139 +++ qdos/config.s | 153 +++ qdos/crc68.s | 99 ++ qdos/match.s | 138 +++ qdos/osdep.h | 33 + qdos/qdos.c | 877 ++++++++++++++ qdos/qfileio.c | 235 ++++ qdos/zipup.h | 19 + revision.h | 123 ++ tailor.h | 480 ++++++++ tandem/DOIT | 21 + tandem/HISTORY | 97 ++ tandem/README | 94 ++ tandem/commacs | 85 ++ tandem/macros | 344 ++++++ tandem/make | 110 ++ tandem/tandem.c | 866 ++++++++++++++ tandem/tandem.h | 248 ++++ tandem/tannsk.h | 19 + tandem/tanzip.c | 637 ++++++++++ tandem/tanzip.h | 17 + tandem/zipup.h | 26 + theos/Makefile | 135 +++ theos/README | 34 + theos/_chmod.c | 21 + theos/_fprintf.c | 26 + theos/_isatty.c | 26 + theos/_rename.c | 83 ++ theos/_setargv.c | 140 +++ theos/_stat.c | 461 +++++++ theos/charconv.h | 93 ++ theos/osdep.h | 58 + theos/stat.h | 106 ++ theos/theos.c | 558 +++++++++ theos/zipup.h | 19 + tops20/make.mic | 36 + tops20/osdep.h | 31 + tops20/rename.mic | 6 + tops20/tops20.c | 576 +++++++++ tops20/zipup.h | 18 + trees.c | 1401 ++++++++++++++++++++++ ttyio.c | 637 ++++++++++ ttyio.h | 218 ++++ unix/Makefile | 268 +++++ unix/Packaging/README | 44 + unix/Packaging/pkginfo.in | 13 + unix/Packaging/postinstall | 22 + unix/Packaging/preinstall.in | 26 + unix/Packaging/prototype | 24 + unix/README.OS390 | 85 ++ unix/configure | 301 +++++ unix/osdep.h | 33 + unix/unix.c | 787 ++++++++++++ unix/zipup.h | 22 + util.c | 694 +++++++++++ vms/00binary.vms | 87 ++ vms/00readme.txt | 126 ++ vms/cmdline.c | 1010 ++++++++++++++++ vms/cvthelp.tpu | 176 +++ vms/descrip.mms | 315 +++++ vms/link_zip.com | 204 ++++ vms/make_zip.com | 287 +++++ vms/makefile.vms | 251 ++++ vms/osdep.h | 106 ++ vms/vms.c | 807 +++++++++++++ vms/vms.h | 271 +++++ vms/vms_im.c | 850 +++++++++++++ vms/vms_pk.c | 550 +++++++++ vms/vms_zip.rnh | 548 +++++++++ vms/vmsdefs.h | 320 +++++ vms/vmsmunch.c | 410 +++++++ vms/vmsmunch.h | 55 + vms/vmszip.c | 703 +++++++++++ vms/zip_cli.cld | 73 ++ vms/zip_cli.help | 617 ++++++++++ vms/zipup.h | 24 + win32/README.NT | 17 + win32/README.TZ | 7 + win32/crc_i386.asm | 241 ++++ win32/crc_i386.c | 228 ++++ win32/crc_lcc.asm | 119 ++ win32/gvmat64.asm | 513 ++++++++ win32/lm32_lcc.asm | 174 +++ win32/makefile.a64 | 134 +++ win32/makefile.bor | 179 +++ win32/makefile.dj | 110 ++ win32/makefile.emx | 291 +++++ win32/makefile.gcc | 142 +++ win32/makefile.ibm | 123 ++ win32/makefile.lcc | 123 ++ win32/makefile.w10 | 181 +++ win32/makefile.w32 | 147 +++ win32/makefile.wat | 181 +++ win32/match32.asm | 184 +++ win32/nt.c | 482 ++++++++ win32/nt.h | 73 ++ win32/osdep.h | 271 +++++ win32/readme.a64 | 42 + win32/rsxntwin.h | 166 +++ win32/vc6/zip.dsp | 328 +++++ win32/vc6/zip.dsw | 65 + win32/vc6/zipcloak.dsp | 164 +++ win32/vc6/zipnote.dsp | 144 +++ win32/vc6/zipsplit.dsp | 144 +++ win32/win32.c | 989 +++++++++++++++ win32/win32zip.c | 782 ++++++++++++ win32/win32zip.h | 33 + win32/zip.def | 4 + win32/zipup.h | 37 + windll/contents | 37 + windll/example.c | 375 ++++++ windll/example.h | 54 + windll/resource.h | 16 + windll/structs.h | 28 + windll/vb/VBZIP.vbw | 2 + windll/vb/VBZipBas.bas | 455 +++++++ windll/vb/Vbzip.vbp | 34 + windll/vb/Vbzipfrm.frm | 130 ++ windll/vb/readmeVB.txt | 35 + windll/visualc/dll/zip32.dsp | 168 +++ windll/visualc/dll/zip32.dsw | 29 + windll/visualc/dll/zip32.mak | 858 +++++++++++++ windll/visualc/lib/zip32.dsp | 162 +++ windll/visualc/lib/zip32.dsw | 29 + windll/visualc/lib/zip32.mak | 586 +++++++++ windll/windll.c | 174 +++ windll/windll.h | 61 + windll/windll.rc | 115 ++ windll/windll.txt | 132 ++ windll/windll16.def | 15 + windll/windll32.def | 15 + windll/ziplib.def | 15 + windll/zipver.h | 15 + zip.c | 2326 ++++++++++++++++++++++++++++++++++++ zip.h | 567 +++++++++ zipcloak.c | 409 +++++++ ziperr.h | 67 ++ zipfile.c | 1565 ++++++++++++++++++++++++ zipnote.c | 505 ++++++++ zipsplit.c | 804 +++++++++++++ zipup.c | 1186 ++++++++++++++++++ 326 files changed, 84828 insertions(+) create mode 100644 BUGS create mode 100644 CHANGES create mode 100644 INSTALL create mode 100644 LICENSE create mode 100644 MANUAL create mode 100644 README create mode 100644 README.CR create mode 100644 TODO create mode 100644 USexport.msg create mode 100644 WHATSNEW create mode 100644 WHERE create mode 100644 acorn/GMakefile create mode 100644 acorn/ReadMe create mode 100644 acorn/ReadMe.GMakefile create mode 100644 acorn/RunMe1st create mode 100644 acorn/acornzip.c create mode 100644 acorn/makefile create mode 100644 acorn/match.s create mode 100644 acorn/osdep.h create mode 100644 acorn/riscos.c create mode 100644 acorn/riscos.h create mode 100644 acorn/sendbits.s create mode 100644 acorn/srcrename create mode 100644 acorn/swiven.h create mode 100644 acorn/swiven.s create mode 100644 acorn/zipup.h create mode 100644 amiga/LMKfile create mode 100644 amiga/README create mode 100644 amiga/amiga.c create mode 100644 amiga/amiga.h create mode 100644 amiga/amigazip.c create mode 100644 amiga/crc_68.a create mode 100644 amiga/deflate.a create mode 100644 amiga/filedate.c create mode 100644 amiga/makefile.azt create mode 100644 amiga/match.a create mode 100644 amiga/match_68.a create mode 100644 amiga/osdep.h create mode 100644 amiga/smakefile create mode 100644 amiga/stat.c create mode 100644 amiga/time_lib.c create mode 100644 amiga/timezone.doc create mode 100644 amiga/z-stat.h create mode 100644 amiga/z-time.h create mode 100644 amiga/zipup.h create mode 100644 aosvs/aosvs.c create mode 100644 aosvs/make.cli create mode 100644 api.c create mode 100644 api.h create mode 100644 atari/Makefile create mode 100644 atari/README create mode 100644 atari/atari.c create mode 100644 atari/make_all.mup create mode 100644 atari/make_zip.mup create mode 100644 atari/osdep.h create mode 100644 atari/zipup.h create mode 100644 atheos/Contents create mode 100644 atheos/Makefile create mode 100644 atheos/README create mode 100644 atheos/atheos.c create mode 100644 atheos/osdep.h create mode 100644 atheos/zipup.h create mode 100644 beos/Contents create mode 100644 beos/Makefile create mode 100644 beos/README create mode 100644 beos/beos.c create mode 100644 beos/osdep.h create mode 100644 beos/zipup.h create mode 100644 cmsmvs/README.CMS create mode 100644 cmsmvs/README.MVS create mode 100644 cmsmvs/README.MVS.LE create mode 100644 cmsmvs/cczip.exec create mode 100644 cmsmvs/cms.c create mode 100644 cmsmvs/cmsmvs.c create mode 100644 cmsmvs/cmsmvs.h create mode 100644 cmsmvs/cstat.h create mode 100644 cmsmvs/mc.exec create mode 100644 cmsmvs/mvs.c create mode 100644 cmsmvs/mvs.h create mode 100644 cmsmvs/mvs.mki create mode 100644 cmsmvs/pipzip.rexx create mode 100644 cmsmvs/zip.exec create mode 100644 cmsmvs/zip.makefile create mode 100644 cmsmvs/zipcloak.exec create mode 100644 cmsmvs/zipmvsc.job create mode 100644 cmsmvs/zipname.conven create mode 100644 cmsmvs/zipnote.exec create mode 100644 cmsmvs/zipsplit.exec create mode 100644 cmsmvs/zipup.h create mode 100644 cmsmvs/zipvmc.exec create mode 100644 crc32.c create mode 100644 crc_i386.S create mode 100644 crctab.c create mode 100644 crypt.c create mode 100644 crypt.h create mode 100644 deflate.c create mode 100644 ebcdic.h create mode 100644 file_id.diz create mode 100644 fileio.c create mode 100644 globals.c create mode 100644 human68k/Makefile create mode 100644 human68k/Makefile.gcc create mode 100644 human68k/crc_68.s create mode 100644 human68k/deflate.s create mode 100644 human68k/human68k.c create mode 100644 human68k/match.s create mode 100644 human68k/osdep.h create mode 100644 human68k/zipup.h create mode 100644 macos/Contents create mode 100644 macos/HISTORY.TXT create mode 100644 macos/README.TXT create mode 100644 macos/ZipLib.h create mode 100644 macos/ZipSx.h create mode 100644 macos/ZpPrj.hqx create mode 100644 macos/osdep.h create mode 100644 macos/readme.1st create mode 100644 macos/source/VolWarn.h create mode 100644 macos/source/charmap.h create mode 100644 macos/source/extrafld.c create mode 100644 macos/source/getenv.c create mode 100644 macos/source/helpers.c create mode 100644 macos/source/helpers.h create mode 100644 macos/source/macglob.h create mode 100644 macos/source/macopen.c create mode 100644 macos/source/macopen.h create mode 100644 macos/source/macos.c create mode 100644 macos/source/macstuff.c create mode 100644 macos/source/macstuff.h create mode 100644 macos/source/mactime.c create mode 100644 macos/source/mactime.h create mode 100644 macos/source/pathname.c create mode 100644 macos/source/pathname.h create mode 100644 macos/source/recurse.c create mode 100644 macos/source/recurse.h create mode 100644 macos/source/unixlike.c create mode 100644 macos/source/unixlike.h create mode 100644 macos/source/zip_rc.hqx create mode 100644 macos/zipup.h create mode 100644 man/zip.1 create mode 100644 match.S create mode 100644 mktime.c create mode 100644 msdos/README.DOS create mode 100644 msdos/crc_i86.asm create mode 100644 msdos/makefile.bor create mode 100644 msdos/makefile.dj1 create mode 100644 msdos/makefile.dj2 create mode 100644 msdos/makefile.emx create mode 100644 msdos/makefile.msc create mode 100644 msdos/makefile.tc create mode 100644 msdos/makefile.wat create mode 100644 msdos/match.asm create mode 100644 msdos/msdos.c create mode 100644 msdos/osdep.h create mode 100644 msdos/zipup.h create mode 100644 os2/makefile.os2 create mode 100644 os2/match32.asm create mode 100644 os2/os2.c create mode 100644 os2/os2acl.c create mode 100644 os2/os2acl.h create mode 100644 os2/os2zip.c create mode 100644 os2/os2zip.h create mode 100644 os2/osdep.h create mode 100644 os2/zip.def create mode 100644 os2/zipup.h create mode 100644 packaging/exec-shield.patch create mode 100644 packaging/zcrypt29.tar.gz create mode 100644 packaging/zip-2.3-currdir.patch create mode 100644 packaging/zip-2.31-configure.patch create mode 100644 packaging/zip-2.31-install.patch create mode 100644 packaging/zip-2.31-near-4GB.patch create mode 100644 packaging/zip.spec create mode 100644 packaging/zip23-umask.patch create mode 100644 packaging/zip23.patch create mode 100644 proginfo/3rdparty.bug create mode 100644 proginfo/ZipPorts create mode 100644 proginfo/algorith.txt create mode 100644 proginfo/extra.fld create mode 100644 proginfo/fileinfo.cms create mode 100644 proginfo/infozip.who create mode 100644 proginfo/nt.sd create mode 100644 proginfo/perform.dos create mode 100644 proginfo/txtvsbin.txt create mode 100644 proginfo/ziplimit.txt create mode 100644 qdos/IZREADME.SMS create mode 100644 qdos/Makefile.qdos create mode 100644 qdos/Makefile.qlzip create mode 100644 qdos/config.s create mode 100644 qdos/crc68.s create mode 100644 qdos/match.s create mode 100644 qdos/osdep.h create mode 100644 qdos/qdos.c create mode 100644 qdos/qfileio.c create mode 100644 qdos/zipup.h create mode 100644 revision.h create mode 100644 tailor.h create mode 100644 tandem/DOIT create mode 100644 tandem/HISTORY create mode 100644 tandem/README create mode 100644 tandem/commacs create mode 100644 tandem/macros create mode 100644 tandem/make create mode 100644 tandem/tandem.c create mode 100644 tandem/tandem.h create mode 100644 tandem/tannsk.h create mode 100644 tandem/tanzip.c create mode 100644 tandem/tanzip.h create mode 100644 tandem/zipup.h create mode 100644 theos/Makefile create mode 100644 theos/README create mode 100644 theos/_chmod.c create mode 100644 theos/_fprintf.c create mode 100644 theos/_isatty.c create mode 100644 theos/_rename.c create mode 100644 theos/_setargv.c create mode 100644 theos/_stat.c create mode 100644 theos/charconv.h create mode 100644 theos/osdep.h create mode 100644 theos/stat.h create mode 100644 theos/theos.c create mode 100644 theos/zipup.h create mode 100644 tops20/make.mic create mode 100644 tops20/osdep.h create mode 100644 tops20/rename.mic create mode 100644 tops20/tops20.c create mode 100644 tops20/zipup.h create mode 100644 trees.c create mode 100644 ttyio.c create mode 100644 ttyio.h create mode 100644 unix/Makefile create mode 100644 unix/Packaging/README create mode 100644 unix/Packaging/pkginfo.in create mode 100755 unix/Packaging/postinstall create mode 100755 unix/Packaging/preinstall.in create mode 100644 unix/Packaging/prototype create mode 100644 unix/README.OS390 create mode 100755 unix/configure create mode 100644 unix/osdep.h create mode 100644 unix/unix.c create mode 100644 unix/zipup.h create mode 100644 util.c create mode 100644 vms/00binary.vms create mode 100644 vms/00readme.txt create mode 100644 vms/cmdline.c create mode 100644 vms/cvthelp.tpu create mode 100644 vms/descrip.mms create mode 100755 vms/link_zip.com create mode 100755 vms/make_zip.com create mode 100644 vms/makefile.vms create mode 100644 vms/osdep.h create mode 100644 vms/vms.c create mode 100644 vms/vms.h create mode 100644 vms/vms_im.c create mode 100644 vms/vms_pk.c create mode 100644 vms/vms_zip.rnh create mode 100644 vms/vmsdefs.h create mode 100644 vms/vmsmunch.c create mode 100644 vms/vmsmunch.h create mode 100644 vms/vmszip.c create mode 100644 vms/zip_cli.cld create mode 100644 vms/zip_cli.help create mode 100644 vms/zipup.h create mode 100644 win32/README.NT create mode 100644 win32/README.TZ create mode 100644 win32/crc_i386.asm create mode 100644 win32/crc_i386.c create mode 100644 win32/crc_lcc.asm create mode 100644 win32/gvmat64.asm create mode 100644 win32/lm32_lcc.asm create mode 100644 win32/makefile.a64 create mode 100644 win32/makefile.bor create mode 100644 win32/makefile.dj create mode 100644 win32/makefile.emx create mode 100644 win32/makefile.gcc create mode 100644 win32/makefile.ibm create mode 100644 win32/makefile.lcc create mode 100644 win32/makefile.w10 create mode 100644 win32/makefile.w32 create mode 100644 win32/makefile.wat create mode 100644 win32/match32.asm create mode 100644 win32/nt.c create mode 100644 win32/nt.h create mode 100644 win32/osdep.h create mode 100644 win32/readme.a64 create mode 100644 win32/rsxntwin.h create mode 100644 win32/vc6/zip.dsp create mode 100644 win32/vc6/zip.dsw create mode 100644 win32/vc6/zipcloak.dsp create mode 100644 win32/vc6/zipnote.dsp create mode 100644 win32/vc6/zipsplit.dsp create mode 100644 win32/win32.c create mode 100644 win32/win32zip.c create mode 100644 win32/win32zip.h create mode 100644 win32/zip.def create mode 100644 win32/zipup.h create mode 100644 windll/contents create mode 100644 windll/example.c create mode 100644 windll/example.h create mode 100644 windll/resource.h create mode 100644 windll/structs.h create mode 100644 windll/vb/VBZIP.vbw create mode 100644 windll/vb/VBZipBas.bas create mode 100644 windll/vb/Vbzip.vbp create mode 100644 windll/vb/Vbzipfrm.frm create mode 100644 windll/vb/readmeVB.txt create mode 100644 windll/visualc/dll/zip32.dsp create mode 100644 windll/visualc/dll/zip32.dsw create mode 100644 windll/visualc/dll/zip32.mak create mode 100644 windll/visualc/lib/zip32.dsp create mode 100644 windll/visualc/lib/zip32.dsw create mode 100644 windll/visualc/lib/zip32.mak create mode 100644 windll/windll.c create mode 100644 windll/windll.h create mode 100644 windll/windll.rc create mode 100644 windll/windll.txt create mode 100644 windll/windll16.def create mode 100644 windll/windll32.def create mode 100644 windll/ziplib.def create mode 100644 windll/zipver.h create mode 100644 zip.c create mode 100644 zip.h create mode 100644 zipcloak.c create mode 100644 ziperr.h create mode 100644 zipfile.c create mode 100644 zipnote.c create mode 100644 zipsplit.c create mode 100644 zipup.c diff --git a/BUGS b/BUGS new file mode 100644 index 0000000..21a9013 --- /dev/null +++ b/BUGS @@ -0,0 +1,6 @@ +- zip sometimes crashes on some versions of NetBSD (0.8, 0.9 and early + 0.9-current), FreeBSD (<= 1.1) and BSDI (< 1.1) . This is due to a + bug in stdio. + Upgrading the stdio package in /usr/src/lib/libc/stdio should + fix the problem. See *BSD mirrors in src/lib/libc/stdio + You must at least replace setvbuf.o in all the libc's with a newer version. diff --git a/CHANGES b/CHANGES new file mode 100644 index 0000000..b033871 --- /dev/null +++ b/CHANGES @@ -0,0 +1,1013 @@ +------------------------- August 7th 1996 version 2.2a ------------------ + 1. QDOS port (Jonathan Hudson) + 2. win32 volumelabel handling (Paul) + 3. VM/CMS clean up (Greg Hartwig) + 4. leading "../" in internal filenames are allowed (Paul) + 5. System V packages support (John Bush) + 6. Fix handling of atx in zipup() (Onno, Greg) + 7. Fixed typo that caused zip -R to dump core (Onno) + 8. msdos/makefile.dj2: fix for command line too long when linking zip.exe + 9. win95 long filename support with djgpp v2 (Onno, Kimio Itoh) +------------------------- August 9th 1996 version 2.2b ------------------ + 1. windll: use wiz instead of wizip (Mike) + 2. use z->name NOT z->zname to open files (Onno, Mike) +------------------------ September 1st 1996 version 2.2c ------------------ + 1. windll: use fprintf instead of putc to send data to std{out,err} (Mike) + 2. os2: make borlandc version detection equal to unzip 5.30d (Kai Uwe) + 3. use #elif constructions for msdos,os2 and win32 compiler detection (Onno) + 4. fix for incorrect free in zip.c (Onno, Mike, Steve) + 5. BeBox port from Chris + 6. unix/{configure,Makefile} fixes for SCO Xenix 286 (Tom Schmidt) + 7. remove zilog entry from unix/Makefile (Onno) + 8. man page fixes (Tom Schmidt) + 9. SCO ODT {3,5} fixes (Bill Davidsen) +------------------------ October 8th 1996 version 2.2d ------------------ + 1. Fix bug in QDOS patch that broke zipsplit.c (Onno, Paul) + 2. Fix a couple of warnings from BorlandC (Mike) + 3. msdos/makefile.wat: Delete some more files when cleaning up (Paul) + 4. store msdos volumelabels without a dot in them (Paul) + 5. clean up of unix/{Makefile,configure,packaging} (Tom Schmidt) + 6. make QDOS port case independent (Jonathan Hudson) + 7. new amiga SASC makefile (Walter Haidinger) + 8. don't truncate filenames in win32's in2ex() (Paul) + 9. os2/makefile.os2 update for emx 0.9c (Kai Uwe) +10. password() function for QDOS (Jonathan) +11. fix the last(?) free() related bug (Mike) +12. win32: security descriptors operations (Scott Field) +13. win32: FILE_SHARE_DELETE is not defined in some win32 compilers (Onno) +14. win32: fix makefile.wat to include nt.c (Onno) +------------------------ January 17th 1997 version 2.2e ------------------ + 1. define USE_CASE_MAP in osdep.h for those ports that need it (Onno) + 2. define PROCNAME in osdep.h for those ports that need it (Onno) + 3. wild() prototype decl only if PROCNAME defined => delete MSVMS define (Onno) + 4. add DOS EMX makefile (E-Yen Tan) + 5. include a little earlier in qdos/qdos.c (Jonathan) + 6. add ttyio.o to OBJZ in qdos/Makefile.qdos (Jonathan) + 7. remove unused fprintebc define from zip.c (Onno) + 8. use the right password routine in ttyio.c for unzip (Mike) + 9. BeOS update from Chris +10. Fix for 'zip -r foo x:' (Paul) +11. Fix library bug on beos (Chris) +12. Fix calculating version number (kitoh_@mix.or.jp, Walter Haidinger) +13. IsWinNT always returned TRUE (Mike) +14. Windll update from Mike +15. Improved crc routines for x86 from Scott Field +16. Detect in unix/configure if we can use crc_i386.S (Onno) +17. Fix spurious internal logic error (Paul) +18. Fix to include directory names on the Acorn when needed (Sergio) +19. include zip.h in mvs.h (Onno, George Carr) +20. add workaround for AZTEC C compiler bug to revision.h (Paul, Walter) +21. MVS doesn't have rmdir (George Carr) +22. define and use USE_ZIPMAIN for WINDLL en VM_CMS (Onno) +23. Fixes from Greg Hartwig to make CMS standalone versions possible. +24. Move OS specific encryption stuff to the os specific directories (Christian) +25. Change password fetching interface in ttyio and crypt (Christian) +26. Update emx support for 0.9c (Christian) +27. Define WINDLL instead of MSWIN (Christian) +28. Extended time stamp extra field format support (Christian) +29. Support for rsxnt-emx 0.9c win32 compiler (Christian) +30. Use izshr017b (Christian) +------------------------ March 11th 1997 version 2.2f ------------------ + 1. Move makefile.emx, rsxwinnt.h and zip.def to win32 subdir (Kai Uwe) + 2. Add win32 target to makefile.os2 to allow cross compilation (Kai Uwe) + 3. Fix NTSD_EAS link time failures with win32 (Paul) + 4. Fix buffer freed too early in password verification code (Mike) + 5. Remove unix/zipgrep and man/zipgrep.1 (sanvila@ctv.es) + 6. Only use crc_i386.o when we're using an x86 (Onno, Mark) + 7. Remove carriage returns from amiga/crc_68.a (Paul) + 8. New windll from Mike + 9. Fix typo in os2/os2zip.c (Kai Uwe) +10. Don't use ctime (last file status change) for unix and qdos cross compile + (Greg) +11. added gccwin32 crosscompilation target (RSXNT) to os2/makefile.os2 (Kai Uwe) +12. fixed the OS/2 file attribute and time stamp generation for zipping + stdin ("-") (Kai Uwe) +13. fixed the atime and ctime stat fields for the OS/2 Watcom C library + (Kai Uwe) +14. added atime and ctime support for the UT extra field when generated under + OS/2, the atime and ctime values are only stored when zipping (Kai Uwe) +15. qdos patches from Jonathan Hudson mainly for extended time flag handling +16. amiga aztec compiler bug workaround (Paul) +17. fix -v output of zipcloak, zipnote and zipsplit (Paul) +18. new amiga/makefile.azt with targets for debug versions (Paul) +------------------------ March 31st 1997 version 2.2g ------------------ + 1. remove -I/usr/local/include from unix/Makefile (Chris) + 2. Update versinfolines in revision.h (Greg) + 3. change 1U to 0x1 to accomodate non ANSI compilers (Onno, Rodney Brown) + 4. win32zip.c: cast buffer parameter in memcompress() to char * (Mike) + 5. remove beos/zipgrep (Chris) + 6. correct the -e password verification check in zip.c (Christian) + 7. use ZCONST instead of const in the generic code. (Christian) + 8. fix mktime timezone correction when time is near to daylight/nodaylight + switch points. (Christian) + 9. correct dependencies in makefile.os2 (Christian) +10. use a more sensible default for iztime.ctime than "0" when system does not + not support creation time stamps. (Christian) +11. fix VMS_PK_EXTRA function interface declarations. (Christian) +12. implement atime/ctime support in win32. (Christian) +13. win32/win32.c: replacement getch() for Watcom. (Paul) +14. win32/makefile.wat: debug object files kept separate. (Paul) +15. msdos/makefile.wat: debug object files kept separate. (Paul) +16. Fix extended time defines for the acorn. (Sergio) +17. Define PROCNAME() in acorn/osdep.h (Sergio) +18. Ignore exit status of ${INSTALL_D} in unix/Makefile (Chris) +19. Add Metroworks and BEOS info to version() in several files (Chris) +20. Move defines for the password fetch to zip.h (Christian) +21. Support the obsolete version rsxnt 1.1 / emx 0.9b (Christian) +22. Remove obsolete "#define PROCNAME ..." from cmsmvs/cmsmvs.h (Christian) +23. Fix extended time defines for qdos (Jonathan Hudson) +24. Use watcom getch() from unz530q in win32/win32.c (Onno) +25. Don't install zipgrep via the unix package tools (John Bush) +26. use izshr021 (Onno) +27. Fix zipnote: use iname not zname in zipnote.c (Onno) +28. Create proginfo directory (Christian) +------------------------ May 5th 1997 version 2.2h -------------------- + 1. Fix vms/zipup.h: iztime --> iztimes (Onno, Mike Freeman) + 2. Remove windll/wizdll.def (Mike) + 3. Add a couple of external variable declaration to windll.h (Mike) + 4. Remove zipgrep from install in unix/Makefile (Onno) + 5. Make updating .zip files with extended time fields possible (Kai Uwe) + 6. Delete beos/Makefile.gcc, beos/Makefiles handles both compilers (Chris) + 7. Fixes for unused variables (Chris) + 8. Added very simplistic example how to load and call the windll (Mike) + 9. Updated windll documentation to note this example (Mike) +10. Removed an unused memeber of a structure in windll (Mike) +11. Add BUGS instead of infozip.who and algorith.doc with the packaging + tools (John Bush) +12. tailor.h: increment NUM_HOSTS to keep in sync with UnZip (Christian) +13. win32/osdep.h: remove NO_SECURE_TESTS define (Christian) +14. zip.h: add declaration for free_crc_table() (Christian) +15. windll: move everything that's not windows specific into api.* (Mike) +16. use iname when checking for directory names in zipfile.c (Sergio) +17. improved mktime.c with better error checking (Christian) +18. improved crc routines (Christian, Rodney Brown) +19. get the -z option working again (Onno, Brad Clarke) +20. define BROKEN_FSEEK and seekable() for those systems where fseek() + always returns 0 (== OK) (Onno, Jeffrey Altman) +------------------------ May 10th 1997 version 2.2i -------------------- + 1. win32's seekable should only check for FILE_TYPE_DISK (Onno, Jeffrey Altman) + 2. add (ulg) cast to zipbeg = ~0 in zipfile.c (Steve) + 3. seekable() *really* belongs in flush_block, keep it there (Onno) + 4. seekable() calls fseekable(FILE *) (Onno) + 5. define HAVE_FSEEKABLE if a port has their own fseekable (Onno) + 6. WatCom doesn't have _get_osfhandle, use _os_handle instead (Paul) + 7. upgrade to Mike's latest windll sources (Mike) + 8. add -P option so you can specify a password on the commandline (Onno) + 9. Get -@ working again (Onno) +10. emx+RSXNT doesn't know about _get_osfhandle() (Kai Uwe) +11. fix a couple of typos in the OS/2 makefiles (Kai Uwe) +12. fix initialization bug in windll code (Mike) +13. tweak deletedir for RISC OS (Sergio) +14. RISCOS doesn't know about fstat() (Sergio) +15. Remove acorn/acorn (Sergio) +16. Delete debugging statements from version_local() in msdos.c (Greg) +17. Fix huge bug in readzipfile() (Onno) +------------------------ May 18th 1997 version 2.2j -------------------- + 1. Add missing ';' after return ZE_PARMS in zip.c (Mike) + 2. Remove obsolete 'struct stat st' in zipfile.c (Onno) + 3. Get Amiga SFX handling working again (Paul) + 4. Get zip -A working again (Onno) + 5. Change an && to & in zipfile.c (Johnny) + 6. Fix handling of empty sfx archives (Onno, Mike) + 7. Remove experimental entries from the makefiles (Jean-loup) + 8. Add exit codes to the manual page (Onno) + 9. Remove lines from the help screen that contain lesser used options (Onno) +------------------------ June 8th 1997 version 2.2k -------------------- + 1. use zip -t ddmmyyyy for year 2000 stuff (Greg) + 2. zip -@ only handles ONE filename per line (Jean-loup) + 3. beos support for DR9 filesystem and symlinks (Chris) + 4. VB support for windll (Mike) +------------------------ June 10th 1997 version 2.2l ------------------- + 1. beos filetype support (Chris) + 2. fill the buffer in getnam() to get it working again (Onno) + 3. implement -x@filename and -i@filename (Onno) +------------------------ June 22nd 1997 version 2.2m ------------------- + 1. Add a ; after de nextarg label in main() (Onno, Erik Baatz) + 2. Initialize p to NULL in get_filters() (Onno, Frank Donahoe) + 3. Fix typo in first if statement in filetypes() (Johnny Lee) + 4. zip -A works again (Onno, Greg) + 5. don't free zipbuf for VMS and CMS_MVS in main() (Onno, Mike Freeman) + 6. fix make_zip.com, link_zip.com and vmsdefs.h for gcc 2.6.3 on VMS (Onno) + 7. clarify -g option in the man page (Jean-loup) +------------------------ July 6th 1997 version 2.2n ------------------- + 1. use local in readzipfile2() declaration (Onno, Mike Freeman) + 2. return values with windll in get_filters() (Mike) + 3. a couple of minor patches for BEOS (Chris) + 4. zip -g works again (Onno, Chris) + 5. Some more Visual Basic dll support (Mike) + 6. Fix stack overflow in readzipfile() for DOS (Onno, Michael Mauch) +------------------------ August 19th 1997 version 2.2o ------------------- + 1. beos README and Makefile tweaks from Chris. + 2. Syntax corrections for README and man/zip.1 (Frank Donahoe) + 3. Use name not iname when deleting directories in trash() (Christian) + 4. change several wkuvx1 to lists in e-mail addresses (Christian) + 5. default to PK style extra fields for VMS (Christian) + 6. use izshr023 (Christian) + 7. replace buggy time library functions (Walter Haidinger, Paul, Christian) + 8. in2ex() and stat() are needed also when UTIL isn't defined (Greg Hartwig) + 9. don't use type=record in fopen() for MVS and CMS (Greg Hartwig) +10. Change P and K literals to hex for EBCDIC systems (Greg Hartwig) +11. Add output path support for CMS and MVS (Greg Hartwig) +12. Add memtoasc and memtoebc for EBCDIC systems (Greg Hartwig) +13. Handle comments correctly to fix zipnote for CMS and MVS (Greg Hartwig) +14. Add -tt option (do not operate on files after date mmddyy) (Christian) +15. move alloc routines for DOS into the !UTIL block (Christian) +16. move UTIL blocks and version_local() functions to a more logical place + (Christian) +17. Handle -P, -R, -x@, -i@ and -tt for the VMS CLI (Christian) +18. Update VMS help file with the new options (Christian) +19. Use iname in MATCH, not zname (Jonathan Hudson) +20. windll: more Visual Basic support (Mike) +21. windll: more project makefiles (Mike) +22. windll: insert Zip in front of global variable names (Mike) +------------------------ August 25th 1997 version 2.2p ------------------- + 1. Remove unused flags from LFLAGS2 in unix/Makefile (Onno) + 2. SunOS make bug: change unix_.o rule in unix/Makefile (Onno, Mike Freeman) + 3. ZipIsWinNT() instead of IsWinNT() in zip.h (Mike) + 4. Fix -t and -tt behaviour for windll (Mike) + 5. Remove windll makefiles that are now elsewhere (Mike) + 6. BEOS: preserve file attributes associated with symbolic links (Chris) + 7. No need to use in2ex() for ziputils (Christian) + 8. Fix comment handling for EBCDIC systems (Christian) + 9. EBCDIC conversion for entry names read from zipfile in UTIL mode (Christian) +10. Fix "fatal" error messages on EBCDIC systems (Christian) +11. zipnote.c: Fix handling of entry name changes for EBCDIC systems (Christian) +12. removed a large part of "dead" code from ziputils version (Christian) +13. use z->iname in comparison functions for sorting (Christian) +14. new installation utils for the acorn (Sergio) +15. use LSSTAT in set_extra_field for unix and beos (Onno) +16. perror(z->zname) instead of perror("zip warning") (Onno, Geoff Pennington) +17. Amiga SFX should work again (Paul) +18. refer to zip22 in install.doc (Frank Donahoe) +------------------------ September 10th 1997 version 2.2q ------------------- + 1. Change .doc to .txt, these aren't MS-Word documents (John D. Mitchell) + 2. Change msdos$_(OBJ) to msdos_$(OBJ) (Kai Uwe) + 3. Fix a couple of amiga related glitches (Paul) + 4. Support for DOS packed .exe files in makefile.dj2 (Frank Donahoe) + 5. Change warning message for zip -A (Greg) +------------------------ September 29th 1997 version 2.2r ------------------- + 1. Fix make svr4package (Eric Baatz) + 2. Fix VMS warning (Mike Freeman, Christian) + 3. Clean up beos gcc port and beos README (Chris) +-------------------------- October 6th 1997 version 2.2s -------------------- + 1. Change lpPrint to lpZipPrint for windll (Mike) + 2. Change lpPassword to lpZipPassword for windll (Mike) + 3. Amiga timezone fixes (Paul) + 4. WatCom C 11.0 makefile fixes (Paul) + 5. Tandem port from Dave Smith + 6. Corrections and updates for install.txt (Christian) + 7. Minor VMS README update (Christian) +-------------------------- October 12th 1997 version 2.2t -------------------- + 1. qdos compiler bug workaround (Jonathan) + 2. prevent storing qdos specific filenames that exceed filesystem limits + (Jonathan) + 3. fix undelimited comment in fileio.c (Frank Donahoe) + 4. disable storing of symlinks in BEOS until OS support is available (Chris) + 5. Init hash_head to 0 in amiga/deflate.a (Paul) + 6. Upgrade to izshr025 (Christian) + 7. don't add ".zip" to ZIP name for TANDEM (Dave Smith) + 8. use zipup.h not tandem.h in zipup.c (Dave Smith) + 9. rename history to CHANGES (Onno) +10. rename install.txt to INSTALL (Onno) +11. rename zip.txt to ZIPMAN (Onno) +12. create WHATSNEW (Onno) +-------------------------- October 15th 1997 version 2.2u -------------------- + 1. Use Info-ZIP instead of Info-Zip (Christian) + 2. Note recent filename changes in several files (Christian) + 3. Remove a couple of items from the TODO list (Christian, Onno) + 4. Add windll port, zip -t yyyymmdd and zip -R to WHATSNEW (Christian) + 5. VMS documentation cleanups and clarifications (Christian) + 6. dist entry in unix/Makefile (Onno) + 7. remove duplicate amiga/timezone.txt (Christian) + 8. rename ZIPMAN to MANUAL and update a couple of files regarding this (Onno) +-------------------------- October 24th 1997 version 2.2v -------------------- + 1. izshr026: in WHERE wiz40 instead of wiz30 (Christian) + 2. izshr026: another couple of Info-ZIP spelling fixes (Christian) + 3. Remove zipgrep from the makefiles that still had it (Christian) + 4. Update makefiles to handle the MANUAL renaming change (Christian) + 5. Fix the last daylight savings bug on the Amiga (Paul) + 6. Fix the SCO Unix specialty detection in unix/configure (Onno, + bug reported by Bo Kullmar for Solaris 2.6 and with uname -X output + for SCO Unix from ken@apisys.com and dgsmith@vnet.ibm.com) + 7. Update WHERE and amiga/time_lib.c from unzip 5.32g (Greg) +-------------------------- October 26th 1997 version 2.2w -------------------- + 1. Additional +Onolimit check in unix/configure (Onno, Peter Jones) + 2. Use ZIPERR macro instead of ziperr (Christian) + 3. initialize z->lflg for zip entries without extra field (Christian) + 4. "local (+ locextend)" vs. "central" header consistency check (Christian) + 5. Override local header values with central header values with -A + and differences between these headers (Christain) + 6. made "deltaoff" signed long; offset adjustment may be negative (Christian) + 7. fix a number of "wild" deallocation bugs (Christian) + 8. When zipping from a FAT drive (only 8.3 DOS names) under OS/2 or + WIN32, set z->vem to "OS_DOS | ". + Mark as "made by DOS PKZIP 2.0" only when dosify was requested. (Christian) + 9. DOS port should not store fake unix style external attributes. (Christian) +10. amiga/time_lib.c from izshr028 (Christian) +-------------------------- October 31st 1997 version 2.2y -------------------- + 1. amiga/time_lib.c from izshr029 (Christian) + 2. Turbo C++ version code clarification (E-Yen Tan) + 3. Fix spelling in cmsvms/zipname.conven (Rodney Brown) + 4. Fix memset check in unix/configure for Unixware 2.1.1 (Rodney Brown) + 5. Forward declaration fixes for HP-UX bundled compiler (Rodney Brown) +-------------------------- November 3rd 1997 version 2.2 -------------------- + 1. Update WHERE (Greg). +-------------------------- January 4th 1998 version 2.21a ------------------- + 1. BSD friendly version of version_local() in unix/unix.c (Onno) + 2. No NT versions in DOS version_local() (Steve Salisbury) + 3. -t mmddyyyy instead of -t ddmmyyyy in WHATSNEW (Walter Haidinger) + 4. use generic fseekable() for rsxnt (Christian) + 5. Fix MSC 8.x warnings (Christian, Steve Salisbury) + 6. win32 Borland C++ makefile (E-Yen Tan) + 7. Tandem doesn't know about extensions like .zip,.arj, ... (Dave Smith) + 8. Use dosmatch for EMX and DJGPP too (Christian) + 9. dummy djgpp startup functions to remove command line globbing and + recognition of environment variables from djgpp.env (Christian) +10. include DJGPP_MINOR in DOS version_local() (Christian) +11. TC 2.0 doesn't have mktime() (Christian, mmp@earthling.net) +12. VMS: rename opendir() to zopendir() so avoiding name clash with + VMS 7.x POSIX libraries (Christian, Martin Zinser) +13. Add support for VMS DEC C V 5.6 features (Christian) +14. Use iname for comparison in check_dup (Christian Spieler, Christian Michel) +15. Fix access to uninitialized ioctx records in vms_get_attributes() + Christian, Robert Nielsen) +16. Parenthesis around MAX_MATCH>>1 in match.S (Greg) +17. Use strchr() not strrchr() for -i and -x to get -i@ and -x@ really + working (Onno, Kai Uwe) +18. add chmod statements to unix/Makefile (Quentin Barnes) +19. Windll: handle both -r and -R (Mike) +20. Windll: general error handler in main() via setjmp/longjmp (Mike) +21. Don't allow zip -i@x.lst foo.zip (Onno) +22. vms/link_zip.com: use .eqs. not .nes. when checking with f$search + for the zip AXP object library (David Dachtera) +23. rsxnt 1.3.1 fixes (E-Yen Tan) +-------------------------- January 20th 1998 version 2.21b ------------------- + 1. Bigger PATH_MAX for win32's windll (Mike) + 2. Update windll.txt w.r.t. PATH_MAX (Mike) + 3. Amiga SAS/C fixes (Walter, Paul) + 4. zip -i@ and -x@ should *really* work now ...... (Onno) +-------------------------- February 20th 1998 version 2.21c ------------------- + 1. make -f unix/Makefile qnx needs LN=ln in its options (Chris) + 2. Support Metroworks Codewarrior/x86 on BEOS (Chris) + 3. Add Norbert Pueschel to proginfo/infozip.who (Walter) + 4. Use big endian for Be types (Chris) + 5. zip -i and -x were broken by the -i@ fix last time around (Christian) + 6. win32 stat bandaid (Paul) + 7. acorn filetype and timestamp fixes (Sergio, D. Krumbholz) + 8. update to izshr30 (Christian) + 9. Support for NTSD in the RSXNT environment (Christian) +10. restructure readzipfile() (Christian) +11. Where needed define MATCH in osdep.h (Christian) +12. version_local() fixes for RSXNT (Christian) +13. New vmsmunch.c (Christian) +-------------------------- March 15th 1998 version 2.3a ------------------- + 1. Fixes for the windll API (Mike) + 2. Use CPUTYPE in BorlandC Makefile for DOS (E-Yen Tan) + 3. BEOS: -rostr not available for the x86 compiler (Chris) + 4. preserve file attributes of a symlink on BEOS (Chris) + 5. New VM/CMS README.CMS and version_local() (Ian Gorman) + 6. INSTALL fixes from Takahiro Watanabe + 7. OS/390 port from Paul von Behren + 8. new api.h from Mike +-------------------------- April 19th 1998 version 2.3b ------------------- + 1. Improve Tandem file I/O performance (Dave Smith) + 2. New VM/CMS README.CMS and version_local() (Ian Gorman) + 3. cygwin32 port from Cosmin Truta + 4. Workaround for tasm32 5.0 bug in win32/crc_i386.asm (Cosmin Truta) + 5. win32/match32.asm fixes for tasm 5.0 (Cosmin Truta) + 6. simplify OS/390 port (Christian) + 7. win32 timezone handling fixes (Christian) + 8. fix 40-bit time conversion on the acorn (Sergio and Christian) + 9. strip network part from UNC type filenames (Christian) +10. Makefile for OpenMVS (Ian Gorman) +11. Use the Watcom getch() for cygwin32 (Christian) +12. Borland C++ 5.x added to win32's version_local() (Cosmin Truta) +13. Borland C++ needs tzset() in win32 (Christian, Cosmin Truta) +-------------------------- May 21st 1998 version 2.3c ------------------- + 1. Better error messages for -i and -x (Christian) + 2. Win32 stat() wrapper needs dos2unixtime (Christian,Paul,Mike) + 3. DJGPP: use _chmod to handle LFN attributes correctly (Michael Mauch) + 4. Fix Borlandc warnings (Mike) + 5. win32/makefile.bor fixes from Michael Mauch + 6. win32/makefile.{dj,emx} fixes from E-Yen Tan + 7. Use izshr031 (Christian) + 8. CMS: use RECFM=V LRECL=32760 by adding "byteseek" (Greg Hartwig) + 9. Check external name for trailing "/" (Greg Hartwig) +10. More specific info in CMS version_local() (Greg Hartwig) +11. Changed usage info to refer to "fm" rather than "path" on CMS (Greg Hartwig) +12. No more "extra data" messages when using the same OS (Greg Hartwig) +13. Rewritten README.CMS, one version for ZIP and UNZIP (Greg Hartwig) +14. DOS/OS2/WIN32/UNIX: ex2in() strips off "//host/share/" from UNC names (SPC) +-------------------------- June 23rd 1998 version 2.3d ------------------- + 1. Fixed Win32's stat() bandaid handling of time stamps (SPC) + 2. General fix of file selections for DELETE and FRESHEN action (SPC) + 3. CMS_MVS: Use ASCII coding for TIME extra field ID (SPC) + 4. EBCDIC: Repaired bogus CMS_MVS fix in zipup.c; check the internal + name for trailing (ASCII) '/' to detect directory entries (SPC) + 5. Use explicit ASCII coding when comparing or setting chars in iname (SPC) + 6. Fixed win32/makefile.bor, win32/makefile.dj (support NTSD), + win32/makefile.emx (SPC) + 7. Replaced win32/makefile.cyg by win32/makefile.gcc, containing new + support for mingw32 GCC environment (SPC) + 8. Use izshr032 (SPC) + 9. Modified zipup.c to hold (un)compressed lengths in "ulg" variables, in + an attempt to support handling of huge (>2GByte) files. (SPC) +10. Removed some duplicate #defines from api.h, they are now in crypt.h (SPC) +11. Reenabled "extra data size" info messages in noisy mode for all systems + except RISCOS and CMS_MVS (SPC) +12. For EMX 0.9c, the runtime lib contains a working mktime(), use it (SPC) +13. Miscellanous cosmetic changes (SPC) +14. Move win32/makefile.emx to msdos (E-Yen Tan) +15. make api.h work with zcrypt2.8 (Mike) +16. define ydays differently in api.h to avoid linking problems (Mike) +17. New windll.txt (Mike) +18. win32 lcc patches (E-Yen Tan) +19. win32 lcc makefile (E-Yen Tan) +20. Multiple inclusion bug: no malloc.h when using lcc-win32 (E-Yen Tan) +21. New VB support files for windll (Mike Le Voi, Raymond King) +22. MacOS port by Dirk Haase +-------------------------- August 1st 1998 version 2.3e ------------------- + 1. Generalized check for validy of TZ timezone setup info, similar to + UnZip; use it on AMIGA and MSDOS, as before. (SPC) + 2. Apply TZ validy check on OS/2 and enable creation of UT e.f. (SPC) + 3. BEOS: New Makefile, updates for README and Contents (Chris Herborth) + 4. beos/beos.c: declare some private functions as "local" (SPC) + 5. Include memcompress() code only for ports that make use of it, controlled + by preprocessor symbol ZP_NEED_MEMCOMPR (SPC) + 6. cmsmvs/README.CMS fix: Zip archive entries to be extracted into var-length + records CMS files should >>NOT<< contain binary data ... (SPC) + 7. crc32.c, crctab.c: the crc polynom table is ZCONST (SPC) + 8. trees.c: fixed a bug in the deflate algorithm that limited the compressed + size of an archive member to 512 MByte (SPC) + 9. deflate.c: Integrated the changes found in zlib that are neccessary to make + the deflate algorithm deterministic; modified msdos/match.asm to take + care of the "nice_match" global no longer being constant. (SPC) +10. deflate.c, trees.c, zipup.c: Reorganized and simplified deflate's + compressed output buffer handling. I/O and compression code are now + separated more cleanly. (SPC) +11. Killed bits.c by moving its contents into trees.c resp. zipup.c; + synchronized all Makefiles and Make procedures with this change. (SPC) +12. Integrated support for optionally replacement of deflate and crc32 by + public domain zlib code. (SPC) +13. Synchronize the different variants (UNIX/GNU C, OS/2, WIN32) of i386 + assembler replacement for deflate's longest_match() (SPC) +14. Moved the EMX+rsxnt Makefile.emx from msdos/ back into win32/ (SPC) +15. Restored a separate Makefile.emx for DOS; on DOS, some make programs may + have difficulties with recursive invokation (SPC) +16. Fixed the "include header mess" of the new MACOS port and removed the + "work-around hacks" caused by these bad MACOS .h-file includes (SPC) +17. Integrated Dirk Haase's beta4 (27-Jun-98) release of MacZIP (Dirk Haase) +18. Added support for MS Quick C in the MSDOS version_local() report (SPC) +19. Added WIN32 rsxnt targets linking against the emx crtl DLL to Makefile.emx + in os2/ and win32/ (SPC) +20. Fixed typo in os2/os2.c wild() function. (Kai Uwe Rommel) +21. Removed ChangeNameForFAT() from os2/os2.c in2ex() to fix problem with + long filename support. (Kai Uwe Rommel) +22. os2/os2zip.[ch]: correct type of DOS-style timestamp data is "ulg" (SPC) +23. vms/cmdline.c: Removed wrong ';' behind if condition (Johnny Lee) +24. VMS: Preliminary preparations in C code for supporting GNU C on OpenVMS + Alpha (Onno van der Linden, Christian Spieler) +25. VMS: Fixed check against adding zipfile to itself in fileio.c (SPC) +26. WIN32: Added lcc-Win32 variants of i386 assembler code for crc32() and + longest_match(). (SPC) +27. WIN32: Removed bogus type-cast in assignment to statb st_mode member (SPC) +28. zip.c: Fixed MACOS-related typo that broke "-@" command option (SPC) +29. zipup.c: Fixed messed-up expression for assignment to z->ver (SPC) +30. MACOS extra fields: check realloc return values (Onno, Johnny Lee) +31. Fix the PUTBYTE macro in trees.c: >= instead of < (Onno) +-------------------------- September 6th 1998 version 2.3f ------------------- + 1. Add zp_tz_is_valid to globals.c (Onno, Frank Donahoe) + 2. Updated tandem files from Dave Smith + 3. Windll: allow comments to zip archive with VB (Mike) + 4. Windll: add support for -b and update the documentation (Mike) + 5. win32: use wbS for FOPW to handle large zip files better (Steve Miller) + 6. MVS fix: use fseek();clearerr() instead of rewind() (Onno, Lee Burton) + 7. Updated VB examples for windll (Mike) + 8. Tandem: use UTC timestamps and GID/UID in extra field (Dave Smith) + 9. Tandem: handle -o option (Dave Smith) +10. default for ZCONST is const in tailor.h, override in osdep.h (Onno) +11. additional Macintosh options in zip.c (Dirk Haase) +12. additional Macintosh options in zip.1 and MANUAL (Onno, Dirk Haase) +13. Integrate Beta 5 of the Macintosh Port (Dirk Haase) +-------------------------- October 27th 1998 version 2.3g ------------------- + 1. zip_tz_is_valid should be zp_tz_is_valid (Kai Uwe) + 2. MVS native (not OE) beta fixes (Keith Owens) + 3. LynxOS support from Giuseppe Guerrini + 4. MVS already has stat() and fstat() so use 'em (Keith Owens) + 5. MVS fix in readzipfile() for new, unopened dataset without EOF marker + (Keith Owens) + 6. Remove 16-bit stuff from windll/windll.rc (Mike) + 7. Windll: Use hCurrentInst not hInst (Mike) + 8. In util.c compare strchr() return value with NULL (Onno, Frank Donahoe) + 9. unix/unix.c: initialize variable t in ex2in() (Onno, Frank Danahoe) +10. Remove windll/borland subdirectory (Mike) +11. Really fix extra field realloc() for BeOS and MacOS (Christian) +12. Fix the dj2 LFN related access violation bug (Christian, Joe Forster) +13. proginfo/3rdparty.bug: Added more info about other Zip clone's bugs. +14. The global copyright definitions in revision.h now depend on DEFCPYRT + (Christian). +15. tandem/macros: removed obsolete object file references (Christian) +16. fix memory leak with the "filter" patterns (Christian, Leah Kramer) +17. zip.c: completed the support for MacOS specific -N (Christian) +18. reorganized the Mac specific help screen code (Christian) +19. zipup.c: corrected the USE_ZLIB code to emit "stored" entries under + the same conditions as the "native deflate" code (Christian) +20. A couple of vars that will never be negative should be unsigned (Christian) +-------------------------- November 18th 1998 version 2.3h ------------------- + 1. DJGPP: When compressing from stdin don't set binary mode if stdin is + a terminal (E-Yen Tan) + 2. Fix signed/unsigned comparisons in fileio.c, util.c and zipcloak.c + (Frank Donahoe) + 3. Move macgetch() prototype from macos/source/macos.c to macos/osdep.h + (Christian) + 4. _doserrno should have type int, not unsigned int (Christian) + 5. In zipfile.c init a file pointer with NULL to fix gcc warning (Christian) + 6. Upgrade to MacOS beta 7 (Dirk Haase) + 7. Move the #pragma statements from generic sources to cmsmvs.h (Christian) + 8. Support for QNX/Neutrino 2.0 (Chris) + 9. Default to -r in help screen add -R at the bottom (Chris) +10. Clean up Makefile for BeOS R4 on x86 (Chris) +11. Beos: If not storing symlinks store attributes of symlink target (Chris) +12. Use izshr037 (Christian) +13. Remove ZIPERR() macro from in {msdos,win32}/osdep.h (Christian) +14. win32/win32.c: Fix 1-day offset in non-64bit FileTime2utime() (Christian) +15. win32: enable 64-bit FileTime2utime() for MS VC++ >= 5.0 (Christian) +16. cygwin32 only has _P_WAIT (Thomas Klausner) +17. msname() should *really* ignore illegal characters (Thomas Klausner) +18. Fix a missing ')' in Opendir() from win32zip.c (Thomas Klausner) +-------------------------- December 5th 1998 version 2.3i ------------------- + 1. Remove the #pragma statements that were forgotten the first time (Ian) + 2. Remove obsolete macos/source/CharMap.h (Steve Salisbury) + 3. isatty(fileno(zstdin)) in zipup.c should be isatty(zstdin) + (Onno, E-Yen Tan) + 4. several "shut up warnings from compiler" fixes (Christian) + 5. several cosmetic source changes (Christian) + 6. win32: make NTSD handling to be robust against alignment and structure + padding problems (Christian) + 7. Apply don't set binary mode when stdin is a terminal in zipup.c for + MSDOS and human68k (Christian) + 8. Upgrade to MacOS beta 8 (Dirk Haase) + 9. Add callback for WINDLL to handle user termination (Mike) +10. Fix typo in acornzip.c (Darren Salt) +11. acorn/sendbits.s: pass correct parameters to flush_outbuf() (Darren Salt) +12. Fixes for IBM C/C++ 3.6 where time_t is a double (Kai Uwe) +13. Fixes for IBM Visual Age C++ for win32 (Douglas Hendrix) +14. man/zip.1: some version numbers in the text were still "2.2" (Christian) +15. win32/makefile.emx: added a compilation variant that generates + standalone executables (Christian) +16. change __CYGWIN32__ into __CYGWIN__ and add compatiblity definition for + B19 and older (Cosmin Truta) +17. create uniform win32 getch() replacement (Christian) +18. put back in define of USE_EF_UT_TIME in tandem.h (Dave Smith) +19. put back in define of USE_CASE_MAP in tandem.h (Dave Smith) +20. updates to make/macros to allow the object to be licensed (Dave Smith) +21. updates to macros/doit to remove mktime.c (Dave Smith) +22. updates to tandem.c for in2ex/mapname/chmod amendments to match Unzip + (Dave Smith) +23. Use izshr039.zip (Christian) +24. Init filenotes to 0 for the amiga too (Onno) +25. get_filters(): remove one flag=0 statement to make -R work again (Onno) +-------------------------- December 17th 1998 version 2.3j ------------------ + 1. FOPWT defines opening a temp file for writing (Ian) + 2. Remove handling of bits.c from a couple of tandem files (Christian) + 3. A couple of "shut up warnings from compiler" fixes (Christian) + 4. win32/osdep.h: removed duplicate "IZ_PACKED" definition (Christian) + 5. win32/zipup.h: remove invalid "elseif" preprocessor token (Christian) + 6. sync MacOS help screen with other ports (Christian) + 7. get_filters(): set flag to 0 when -R isn't used (Christian) + 8. "local extra != central extra" now has "info" status (Christian) + 9. use windll directory as "home" directory for builds (Mike) +10. CMS/MVS: define FOPWT (Ian) +11. Upgrade to MacOS beta 9 (Dirk Haase) +-------------------------- January 17th 1999 version 2.3k ------------------ + 1. Change FOPW into FOPW_TMP (Christian) + 2. win32: #include uses paths relative to the parent directory (Christian) + 3. Use forward slashes as path separator in #include statements (Christian) + 4. windll: fix descriptions of f{In,Ex}cludeDate (Christian) + 5. win32/makefile.lcc: add some -I options to find files in the + right places (Christian) + 6. Supply default empty IZ_PACKED define (Christian) + 7. windll: Fix some typos, descriptions (Christian) + 8. windll project files: use relative paths, no specific root directory + (Christian) + 9. windll project files: remove link references to import libraries that + are not used by the zip library (Christian) +10. windll: fix potential infinite loop in a VB sample (Mike) +11. windll/windll.txt: remove "may not work with VB" statement (Mike) +12. Multibyte character set support from Yoshioka Tsuneo +13. Theos port from Jean-Michel Dubois +14. Tandem: added simple handling of Enscribe files by converting them into + text type files (Dave Smith) +15. Tandem Extra Field ("TA") containing Tandem File Attributes (Dave Smith) +16. Tandem history file showing background info to (UN)ZIP ports (Dave Smith) +17. create ZIP file on tandem with special file code (1001) (Dave Smith) +18. made tandem.c & tandem.h code completely the same as UNZIP (Dave Smith) +19. unix/configure: move +Onolimit and -Olimit into the machine specific + section (Onno, John Wiersba) +-------------------------- February 21st 1999 version 2.3l ------------------ + 1. Fix qdos Makefile (Jonathan Hudson) + 2. fgets instead of gets in zipnote to fix linker warnings (Jonathan Hudson) + 3. Theos: remove _setargv.c and a reference in zip.c (Jean-Michel Dubois) + 4. Theos README (Jean-Michel Dubois) + 5. interchanged the fRecurse flag values for "-R" and "-r" (Christian) + 6. add "z" pr prefix to MBCS functions to avoid name clashes (Christian) + 7. Whenever the position of the increment operator does not matter, the + INCSTR variant is used, which has been mapped to the {PRE|POS}INCSTR + variant that is more efficient. (Christian) + 8. fixed the "-R" handling in fileio.c, filter() function (Christian) + 9. simplified some THEOS specific code additions (Christian) +10. changed the line break of the compiler version message in version_local() + for MSDOS and Win32 to take into account some verbose compilers (Christian) +11. removed the THEOS changes from ttyio.c. Instead, a THEOS specific + setup was added to ttyio.h (Christian) +12. sync vms/link_zip.com with the corresponding make_zip.com (Christian) +13. added compatibility settings for support of MBCS on Win32 with all tested + compilers to win32/osdep.h +14. added type-casts to isalpha() macro calls (Christian) +15. fixed win32's wild_match which was clobbered by the MBCS addition + (Christian) +16. finished up the "potential infinite loop" problems in the VB sample + that Mike started to repair (Christian) +17. in ziperr.h, AZTEK C might require the false comma that was removed + to satisfy THEOS C (Christian) +18. removed the bogus THEOS specific isdir check in zipup.c (Christian) +19. modified the code for line ending translation to be independent + of the local system's convention for '\n' and '\r'; this allowed + the removal of the THEOS specialities (Christian) +20. Tandem: -B option to zip Enscribe files with no record delimiters + (Dave Smith) +21. Tandem: attempt to catch Large Transfer mode failure (Dave Smith) +22. Theos: Fixed keyboard entry functions. (Jean-Michel Dubois) +23. Theos: workaround for the argument wild card expansion that is bugged + in the standard library. Managed by MAINWA_BUG flag. (Jean-Michel Dubois) +24. Theos: support for filenames and notes with accented characters. + (Jean-Michel Dubois) +25. Upgrade to MacOS final (Dirk Haase) +-------------------------- March 31st 1999 version 2.3m ------------------- + 1. Theos: for relative paths to root directory cause open, fopen and stat + failure, workaround this. (Jean-Michel Dubois) + 2. Theos: when no path is indicated in a file or directory name and the + file or directory doesn't exist in the current directory it looks for + the file or directory in the root directory, workaround this. + (Jean-Michel Dubois) + 3. Corrected some typos and spelling error in macos/HISTORY.TXT; skipped + off invisible trailing whitespace (Christian) + 4. proginfo/extra.fld: added documentation for Tandem and Theos extra + field layout (Christian with Dave D Smith resp. Jean-Michel Dubois) + 5. qdos/Makefile.qdos: The build of ZipCloak requires inclusion of + the crctab object module; qfileio_.o compilation requires the -DUTIL + flag (Christian) + 6. win32: fix incorrect MB_CUR_MAX macro for mingw32 and lcc (Christian) + 7. theos/_fprintf.c, theos/_rename.c, theos/osdep.h: Some function + parameters require the "const" attribute to achieve compatibility + with ANSI C requirements (Christian) + 8. theos/theos.c: map Theos' (No)Hidden file attribute to MSDOS Hidden + bit in the MSDOS part of zipentry header's external attribute field; + 9. theos/stat.h: prevent multiple inclusions +10. Theos: Fixed wild card management for options other than adding + (Jean-Michel Dubois) +11. Theos: Removed modifications of const strings (Jean-Michel Dubois) +12. Split tandem.c up into separate zip/unzip parts (Dave Smith, Christian) +13. Move inclusion of OS specific zipup.h files to tailor.h (Onno) +-------------------------- August 14th 1999 version 2.3n ------------------- + 1. Move inclusion of OS specific zipup.h files back to zipup.c (Onno) + 2. Remove getline() from zipnote.c and use gets() again (Onno) + 3. BeOS PowerPC R4.1 support (Chris) + 4. New DOIT and MACROS files for the tandem port (Dave Smith) + 5. Don't switch the console to binary mode (Michel de Ruiter) + 6. In some circumstances undosm could be freed twice (Mike) + 7. Also define const in tailor.h for ultrix (Onno, Foppa Uberti Massimo) + 8. Tandem: Change zopen in TANZIPC to allow opening of files with missing + alt keys (err 4) (Dave Smith) + 9. Tandem: Assume not DST if can't resolve time (no DST table available) + (Dave Smith) +10. WIN32: skip trailing dots and spaces in getnam (Onno, Dan Kegel) +11. Use ZE_NONE when nothing to freshen or update (Onno, Yuri Sidorenko) +12. Remove tabs from files that don't need them (Onno) +13. Remove tabs and spaces from the end of a text line (Onno) +14. Upgrade macos to 1.04b2 (Dirk) +15. Add -Q documentation to manual page (Jonathan Hudson) +16. Copy hiperspace files instead of renaming them (Keith Owens) +17. Disallow some more characters to appear in DOS filenames when using -k + (Onno, Thomas Klausner) +18. Document missing options and environment variables in the manual (Onno) +19. New acorn/GMakefile to compile with gcc on RISCOS (Darren Salt) +20. ISO 8601 date format support for -t and -tt (Rodney Brown) +-------------------------- September 21st 1999 version 2.3o ------------------- + 1. Sync zip.h license with LICENSE (Onno) + 2. Add copyright notice to README, os2zip.c and os2.zip.h (Onno, Greg) + 3. Fix the ASM variable in acorn/GMakefile (Darren Salt) + 4. Add another requirement to acorn/ReadMe.GMakefile (Darren Salt) + 5. Fix unbalanced parenthesis in vms_get_attributes declaration in zip.h + and move it to vms/zipup.h (Onno, Mike Freeman) + 6. Make a couple of os2 files public domain (Kai Uwe) + 7. Change and rename disclaimer array in revision.h (Onno) + 8. Change copyright array in revision.h (Onno) + 9. macstuff.c copyright is the same as macstuff.h (Christian) +10. WHATSNEW: add ISO 8601 dates supported (Christian) +11. fileio.c - msname(): strip off leading dots, these are illegal for + MSDOS compatible names (Christian) +13. fileio.c - replace(): deactivate "dead" code for CMS_MVS (Christian) +14. man/zip.1: "-$" option is also used for WIN32 ports +15. msdos/msdos.c - version_local(): break the version line for + GNU compilers too (Christian) +16. tailor.h: added typecasts to MBCS macros, to suppress "type mismatch" + warnings (Christian) +17. util.c, zip.h, zipfile.c: ZCONSTify several pointers (Christian) +18. util.c - recmatch(), zip.c - version_info(): add compile time option + WILD_STOP_AT_DIR (Christian, Darren Salt) +19. util.c - envargs(): MBCS related fixes (Christian) +20. win32/lm32_lcc.asm: add TAB characters that are required by the lcc + assembler source parser (Christian) +21. zip.c: fix the "is a console" check (Christian) +22. zipnote.c: use getline() (Christian) +23. zipup.c: use zclose() in case of I/O errors (Christian) +24. zipup.c: use ZE_WRITE when a write error occurs (Christian) +25. win32/win32.c: HAVE_INT64 is used by mingw32 (Cosmin Truta) +26. update shared sources to match izshr041 (Christian) +-------------------------- November 29th 1999 version 2.3 ------------------ + 1. Missing parenthesis in win32/win32.c (Steve Salisbury) + 2. Add Cosmin Truta to proginfo/infozip.who (Onno) + 3. Remove one parenthesis pair too many from vms_get_attributes() declaration + in vms/zipup.h (Mike Freeman) + 4. qdos .s are expected to start with a #, work around it (Jonathan Hudson) + 5. tandem: -B0 should be deflating not storing (Dave Smith) + 6. human68k updates from Shimazaki Ryo + 7. beos Makefile cleanup (Chris) + 8. workaround for fseek to negativate offset behaviour of the RISC OS + SharedCLibrary (Darren Salt) + 9. set file type for RISC OS in zipcloak.c (Darren Salt) +10. change tandem zgetch() to allow crypt version to work (Dave Smith) +11. fix a comment typo in acorn/riscos.c (Christian) +12. fileio.c: two type-cast to shut up noisy compilers (Christian) +13. human68k: fix missing case_flag argmument (Christian) +14. win32/win32.c: remove HAVE_INT64 completely (Christian) +15. zip.c: raise "cannot zip to console" error when stdout IS a tty (Christian) +16. zip.h: don't use dummy argument names in declarations (Christian) +17. Add missing semicolon in fileio.c (Shimazaki Ryo) +18. win32.c: IBMC compiler >= 3.50 have int64 (Kai Uwe) +19. Handle initialization error return value from MVS stat() in procname() + (Keith Owens) +20. Use RISC OS instead of RiscOS in the manual (Darren Salt) +21. Use # instead of ? as single character wildcard on RISC OS (Darren Salt) +22. New windll example.c (Mike) +23. Correct storage of 8-bit char filenames with RSXNT (Burkhard Hirzinger) +24. fix install in unix/Makefile (Santiago Vila, Onno) +25. Fix zip -L output (Santiago Vila, Onno) +26. Ignore unix special files (Jonathan O'Brien) +27. Upgrade to izshr042 (Onno) +28. Make copyright notice the same as in izshr042 (Onno) +29. Make copyright notice in zip.h the same as LICENSE (Christian) +30. Set tempzf to NULL _after_ it has been closed (Chris Kacher) +31. Change email address for Jonathan Hudson (Jonathan Hudson) +32. Remove win32/winzip.c.orig (Steve Salisbury) +33. Use 'Steve Salisbury' throughout the documentation (Steve Salisbury) +34. Change email address for Steve Salisbury (Steve Salisbury) +35. Change email address for Chris Herborth (Chris Herborth) +36. Use zip23 in INSTALL (Roger Cornelius) +37. Use zcrypt28 in INSTALL (Onno) +38. New acorn/srcrename (Darren Salt) +39. amiga/makefile.azt: make clean should remove some more items (Paul) +40. Change email address for Cosmin Truta (Cosmin Truta) +------------------------ December 10th 2004 version 2.31a ------------------ +This is a patch to Zip 2.3 including various bug fixes. +See Zip 3.0 for the latest additional features. + 1. Crypt added to source by default now that export restrictions have been + relaxed (Ed Gordon) + 2. Debian patch 001 for bug 99659 - Converted quoted strings in version compile + information to defines (Debian patch 001, Ed) + 3. Debian patch 002 - Sets the "normal" unix permissions in the Makefile, so + don't have to change them in debian/rules (Debian patch 002, Ed) + 4. Debian patch 003 - to support DEB_BUILD_OPTIONS as required by latest + policy. The LFLAGS1 thing could be considered debian-specific, but + INSTALL_PROGRAM thing should be in the upstream version (Debian patch 003, Ed) + 5. Debian patch 004 - Make gcc happy (probably gcc 3.x) - apply 2.4i configure + changes to remove need for -fno-builtin in unix/configure (Onno, Ed) + 6. Debian patch 005 for bug 279867 - Fix for FNMAX path bug that could crash + on large paths and create security problem (Greg) +------------------------ December 17th 2004 version 2.31b ------------------ + 1. File cleanup (Ed) +------------------------ December 30th 2004 version 2.31c ------------------ + 1. Add VMS tempname (Steven Schweda (SMS)) + 2. Add VMS option -VV for archiving most all file types on VMS and fix -V to create + more portable archives (SMS) + 3. Update VMS command line interface + 4. Update README (Ed) +------------------------ January 1st 2005 version 2.31d ------------------ + 1. Delete duplicate free(name) in filetime in unix/unix.c (Johnny Lee) +------------------------ January 8th 2005 version 2.31e ------------------ + 1. Change zfstat to fstat in unix/unix.c (Ed) +------------------------ January 22nd 2005 version 2.31f ------------------ + 1. Update file_id.diz (Cosmin Truta) + 2. Initialize use_longname_ea under both OS2 and WIN32. zip.c (Cosmin) + 3. Enclose option -! and use_privileges under NTSD_EAS guard. api.c, + zip.c (Cosmin) + 4. Implement partial support for Cygwin inside the Unix port (Cosmin) + 5. Add i586, i686 and Cygwin to version_local(). unix/unix.c (Cosmin) + 6. Ensure stat'ing always works on file names with trailing '/' in + set_extra_field(). unix/unix.c (Cosmin) + 7. Define ASM_CRC by default. win32/osdep.h (Cosmin) + 8. Update from zip24h. win32/makefile.bor, win32/makefile.w32 (Cosmin) + 9. Enable the i686-optimized code by default. crc_i386.S, + win32/crc_i386.asm, win32/crc_i386.c (Cosmin) +10. Replaced win32/VC6.dsp with a complete Visual C++ 6.0 project to build + zip, zipnote, zipsplit and zipcloak, with both ASM and non-ASM settings. + (Note that win32/VC6.dsp was a new addition since Zip 2.3 and at this + point won't be released since this new workspace is better. Ed) + win32/vc6/zip.dsw (new) (Cosmin) +11. Add AtheOS port (Ruslan Nickolaev, Ed) +12. Formatting and consistency fixes (Johnny Lee, Ed) +13. Add kluge to api.c so zip32.dll supports string parameters in Visual + Basic. See VB project files (Ed) +------------------------ January 28th 2005 version 2.31g ------------------ + 1. Adjust binary detection in trees.c by changing 20% binary (4 out of 5 + ascii) to 2% (64 out of 65) (Ed) + 2. Update license and license headers (Ed) + 3. Update Install and Readme.cr (Ed) + 4. Update windll.rc (Ed) + 5. Update Readme (Ed) + 6. Update Manual (Ed) +------------------------ February 5th 2005 version 2.31h ------------------ + 1. Add error return for filetime() FXMAX bug fix where missed in acornzip.c, + atari.c, beos.c, human68k.c, msdos.c, os2.c, theos.c, tops20.c, and + win32zip.c (Ed) + 2. Move -r and -R code in api.c lower down to avoid -R bug (Ed) + 3. Update VB project ReadmeVB files and notes in new VB project (Ed) + 4. Update license. revision.h (Ed) + 5. Update Readme.cr with updated encryption information and update zip.c + to include encryption notice in version information (Ed) + 6. Remove win32/VC6-old.dsp (Cosmin) + 7. Check for symlink support in procname(). unix/unix.c (Cosmin) + 8. Define (again) ASM_CRC by default. win32/osdep.h (Cosmin) + 9. Use the right type (DWORD) for volSerNo, maxCompLen and fileSysFlags + in FSusesLocalTime(). win32/win32.c (Cosmin) +10. Update win32/makefile.bor, win32/makefile.gcc, win32/makefile.w32 (Cosmin) +11. Update Readme (Ed) +------------------------ February 15th 2005 version 2.31i ------------------ + 1. WHERE updated (Cosmin, Christian) + 2. Allow for reverting to Win32 time handling using NO_W32TIMES_IZFIX. + win32/win32.c, win32/win32zip.h, zip.c (Christian) + 3. Update crypt comments and default behavior. crypt.h + 4. Kludge to work around non-standard S_IFREG flag used in DJGPP V2.x, + compiler version strings changes. msdos/msdos.c (Christian) + 5. Changes to MS rtl function declarations. win32/osdep.h (Christian) + 6. Time changes including GetPlatformLocalTimezone; force use of registry + to get timezone info with MS C rtl. win32/win32.c (Christian) + 7. Compiler version string changes. win32/win32.c (Christian, Brad Clarke) + 8. Changes to extra field bytes to compress. win32/win32zip.c (Christian) + 9. Changes to get_filters(), changes to help and version option detection + (allow redirection of version screen to file), add set dosflag for DOS to + force the use of msdos style when updating zip entries originally created + under non-DOS OS. zip.c (Christian) +10. License update. zip.h (Christian) +11. Rename errors array to ziperrors to avoid MacOSX library clash. + ziperr.h (Mark) +12. Updates to zipcloak.c for crypt and other changes. (Christian) +13. Updates to zipsplit.c (use ZCONST in prototypes where appropiate). + (Christian) +14. Update version. windll/zipver.h (Mike) +15. Makefile updates (use UPX compressor and ...). msdos/makefile.bor, + msdos/makefile.dj2, msdos/makefile.msc, msdos/makefile.tc (Christian) +16. Detect Turbo C 2.01 in msdos/osdep.h NO_MKTIME definition. (Brian Lindholm) +17. Readme update. msdos/README.DOS (Christian, Ed) +18. Change Zip limits description. msdos/README.DOS (Christian) +19. Fixed ASFLAGS for watcom16dos. os2/makefile.os2 (Christian) +20. Changes to GetLongPathEA(); fix OS/2's ACL compression code. + os2/os2zip.c, os2/os2zip.h (Christian, Kai Uwe) +21. Changes to acorn. acorn/acornzip.c, acorn/GMakefile, acorn/makefile, + acorn/osdep.h, acorn/ReadMe.GMakefile, acorn/riscos.c, acorn/riscos.h, + acorn/RunMe1st (Darren Salt, Andy Wingate, Christian) +22. Update proginfo/extra.fld (and appnote.iz). (Christian) +23. Correct translation of EBCDIC passwords to ASCII. (Christian) +------------------------ February 19th 2005 version 2.31j ------------------ + 1. Data corruption, buffer size, type cast and other fixes for VMS. + vms/vms_pk.c, vms/vmsmunch.c (SMS) + 2. Update version in file_id.diz. (Cosmin) + 3. Update file version. readme.cr (Cosmin) + 4. Put mktemp() declaration inside the NO_PROTO guard. tailor.h (Cosmin) + 5. Remove getenv() declaration. util.c (Cosmin) + 6. Document and implement a new text detection scheme in set_file_type(). + proginfo/txtvsbin.txt, trees.c (Cosmin) + 7. Set the "zip Debug" configuration as default. win32/vc6/zip.dsp (Cosmin) + 8. Move new encryption notice from zip.c into revision.h where the other + notice texts reside. (Cosmin) + 9. Change USE_ZLIB compiler message from -v to show version. zip.c (Cosmin) +10. Removed change of Zip 2.31i to MS rtl function declarations. + win32/osdep.h (Cosmin, Christian) +11. Don't use mmap for stored entries. zipup.c (Christian) +12. msdos/msdos.c, corrected missing change in version_local. (Christian) +13. BIG_MEM and MMAP cannot be defined at the same time. tailor.h (Christian) +14. Update LICENSE to include the new Zip maintainer Ed Gordon and + Cosmin Truta. LICENSE, revision.h (Christian) +15. Format changes. LICENSE, revision.h (Cosmin, Christian, Ed) +16. WHERE: URLs updated, removed last zcrXXX references. (Christian) +17. Note that ZIP64 enhancements will (probably) never be applicable for + MSDOS. msdos/README.DOS (Christian, Ed) +18. msdos/makefile.wat, win32/makefile.wat: bug-fixes (added creation of + intermediate object directories). (Christian) +19. win32/win32.c, minor indentation and code format changes. (Christian) +20. Modified zipnote.c to handle line widths of at least 2047 characters in + write mode. (Christian) +------------------------ February 20th 2005 version 2.31k ------------------ + 1. Update to msdos/README.DOS noting splits can support some Zip64 features + but we may not get to most Zip64 features for MSDOS. (Christian, Ed) + 2. Move encryption notice in revision.h and delete blank line. (Christian) + 3. Change old binary detection to new black list version. Provided by + Cosmin. trees.c (Cosmin, Johnny, Christian) + 4. Update documentation for new binary detection. trees.c (Christian, Ed) + 5. Set debug directory to od32w. win32/makefile.wat (Christian, Ed) + 6. Allow -@ and - (stdout) at same time. The check for -@ and - was + intended to prevent having both file contents and file names from stdin + at the same time but prevented this case instead. The case where both + -@ and - (stdin) is used at the same time was not trapped before and + is still not trapped in Zip 2.31. It apparently results in an empty + file called "-" in the archive. (This may be fixed in a later Zip 2.x + release. It is fixed in the Zip 3.0 beta. Ed) (Christian) + 7. Update zip.h with new license (Christian) + 8. Update version. revision.h (Ed) + 9. Add check for file size beyond 4 GB limit to file_read but should only + get used for OS that support large files but Zip was not compiled with + large file support. zipup.c (Christian) +10. Allow store method in memcompress. zipup.c (Christian) +11. Add note to ToDo (Ed) +12. Update ZE_BIG to include reading and writing. ziperr.h (Ed) +13. Update Whatsnew (Ed) +------------------------ February 26th 2005 version 2.31l ------------------ + 1. License date change, ftp site change from ftp.uu.net to ftp.info-zip.org, + and other minor changes in Readme (Ed) + 2. Update windll/VB-orig/readmeVB.txt, windll/VB/readmeVB.txt (Ed) + 3. Update man page including updating the date, notes about wildcard + escaping on various ports, add a note to -ll about binary detection, + note on -v now allowing stdin to print version, and update error code 6 + (ZE_BIG) to include read and written files. man/zip.1 (Ed) + 4. Remove zip32-old.dsp from windll/visualc/dll and windll/visualc/lib (Ed) + 5. Update notes on crypt, TZ, WIN32, and WINDLL. INSTALL (Christian) + 6. Update indentation and add Steven Schweda to LICENSE (Christian) + 7. Add Steven Schweda to license. zip.h (Ed) + 8. Update copyright and version in atheos/Makefile (Christian) + 9. Format changes. atheos/README, athoes/atheos.c, atheos/osdep.h (Christian) +10. Update header and error 6 in ziperr.h (Christian) +11. Change 64k entries note, add Zip64 note, and add Zip 3 and UnZip 6 note. + proginfo/ziplimit.txt (Christian) +11. Update report problems address. proginfo/ziplimit.txt (Ed) +12. Add Steven Schweda to license. revision.h (Ed) +13. Add directory for files. makefile.w10 (Christian) +14. Change ob32w to od32w for debugging. makefile.wat (Christian) +15. Remove Borland and Win16 support. windll/contents (Christian) +16. Update formatting of license. zip.h (Christian) +------------------------ February 28th 2005 version 2.31m ------------------ + 1. Update txtvsbin.txt. proginfo/txtvsbin.txt (Cosmin) + 2. Changes to comments for binary detection. trees.c (Cosmin) + 3. Add USE_ZLIB note. zip.c (Cosmin) + 4. Update zipcloak.c to use new crypto notice (Cosmin) + 5. Remove duplicate license copyright note. zipnote.c (Cosmin) + 6. Remove duplicate license copyright note. zipsplit.c (Cosmin) + 7. Format change in LICENSE (Christian) + 8. Update copyright. atheos/zipup.h (Christian) + 9. Update license to match final official version. revision.h (Christian) +10. Update license to match final official version. zip.h (Christian) +11. Update version to Zip 2.31 for release. revision.h (Ed) +12. Update notes in VB files. windll/vb/vbzipfrm.frm, + windll/vb/readmeVB.txt (Ed) +13. Formatting fixes for Manual to get dashes to be consistent and other + changes. man/zip.1 (Cosmin) +14. Change Makefile to filter out tabs using col -bx to create MANUAL to + avoid problems with spacing on WIN32. unix/Makefile (Ed) +15. Additional formatting and other changes to manual (Ed) +16. Recompile MANUAL from man/zip.1 (Ed) +17. Fix ZipCloak to remove old crypt comment and get encryption notice off + front page and move to the version page. zipcloak.c (Ed) +18. Update file times on unchanged files that somehow became off 6 hours + to match times in Zip 2.3 release. Bugs, USexport.msg, and many files + in acorn, amiga, aosvs, atari, beos, cmsmvs, human68k, macos, msdos, + os2, proginfo, qdos, tandem, theos, tops20, unix, vms, win32, and + windll (Cosmin) +19. Add new longest_match in WIN64 assembler. Must use the new makefile + to compile it. Also change win32/osdep.h to allow use of assembler + for longest_match without using assembler for CRC. THIS IS UNTESTED. + win32/gvmat64.asm, win32/readme.x64, win32/makefile.asm64, + win32/osdep.h (Gilles Vollant) +20. Add note WIN64 assembler not completely tested. win32/readme.x64 (Ed) +21. Minor change of wording on regulations involving crypt. readme.cr (Ed) +22. Update release date to 28 Feb 2005 (Ed) +23. Update USexport.msg (Greg) +24. Rename makefile.asm64 to makefile.a64 to stay in 8.3 name restriction + if someone unpacks all this on MSDOS and rename readme.x64 to + readme.a64 to match. win32/readme.a64, win32/makefile.a64 (Ed) +------------------------ March 4th 2005 version 2.31n ------------------ + 1. Fix byte counts on exit in zipcloak() and zipbare() to fix zipcloak bug. + crypt.c (Paul, Christian) + 2. Fix swlicense size from 40 to 50. revision.h (Cosmin) + 3. For ZLIB use www.zlib.net instead of www.zlib.org. WHERE (Cosmin) + 4. Remove windll/windll.aps as it is not needed (Cosmin) + 5. Update version date. revision.h (Ed) + 6. Remove windll/vb-orig project (Ed) + 7. Changes to VB project comments. readmeVB.txt, VBZipBas.bas (Ed) + 8. Change to ZCONST. amiga/amiga.c (Paul) + 9. Update Atheos port to most recent changes. zipup.c, zipnote.c, zip.h, + ttyio.c, tailor.h, atheos/atheos.c, atheos/contents, atheos/Makefile, + atheos/osdep.h, atheos/Readme, atheos/zipup.h (Ruslan Nickolaev, Ed) +------------------------ March 8th 2005 version 2.31 ------------------ + 1. Update gvmat64.asm (Gilles) + 2. Update version. revision.h (Ed) + 3. Update WhatsNew (Ed) diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..7549e8d --- /dev/null +++ b/INSTALL @@ -0,0 +1,188 @@ +HOW TO INSTALL ZIP + + Zip is distributed as C source code that can be compiled on a + wide range of systems: Unix, VMS, MSDOS, OS/2, NT, Amiga, Atari, + BeOS, VM/CMS, ... You will need Unzip 5.0p1 (under any system) or + PKUNZIP 2.04g or later (under MSDOS) to unpack the distribution + file, zip231.zip. But since you read this, you have unpacked it + already, or you cheated and got a tar.Z file... + +Installation on Unix + + Let's assume that you start from scratch and have not yet + unpacked the sources. First, unpack the source as follows, + assuming that you have zip231.zip in the current directory. + + mkdir zipsrc + cd zipsrc + unzip ../zip231 + + This extracts all source files and documentation in the + directory called "zipsrc". This release now includes the standard + encryption code previously in the separate package zcrypt29.zip, + but you still can decide wether to activate the crypt code or not. + Crypt is enabled by default, but you may disable it by specifying + the option -DNO_CRYPT in the LOCAL_ZIP environment variable (or by + adding this option to the compilation options in the appropiate + makefile). + See Readme.cr for more on crypt. + + You then do: + + make -f unix/Makefile system + + where "system" is one of: generic, generic_gcc, + att6300, coherent, cray_v3, minix, sco_x286, xenix, zilog. + + Try "make -f unix/Makefile generic" first, this works on many systems. + If this fails, then use one of the special targets given above. + + Among other special systems are Cray Unicos, Zilog Zeus and MINIX. + + If you get error messages "constant expected" in deflate.c, add + -DDYN_ALLOC to CFLAGS in your makefile entry. + + If you have lots of memory, try compiling with -DBIG_MEM. If your + system supports mmap(), try compiling with -DMMAP. This generally + gives faster compression but uses more memory. See the unix/Makefile + entry mmap_gcc for an example. + + If none of these compiles, links, and functions properly on + your Unix system, see the file README for how to get help. + + If the appropriate system was selected, then the executables + zip, zipnote and zipsplit will be created. You can copy them + to an appropriate directory in the search path using: + + make -f unix/Makefile install + + The defaults are /usr/local/bin for the executables and + /usr/local/man/man1 for the manual page. Change the macros + BINDIR and MANDIR in makefile if appropriate. + + You can use the command "set" to see the current search + path. If you are using the C-Shell (csh), enter the com- + mand: + + rehash + + so csh can find the new command in the path. You are now + ready to use Zip. + + You can get rid of the now unnecessary source and object + files with: + + cd .. + rm -r zipsrc + + This will remove the directory zip and its contents created + by unzip. You should keep the zip231.zip file around though, + in case you need to build it again or want to give it to a + colleague. + + You can add the following lines to the file /etc/magic for + usage by the 'file' command: + +0 string PK Zip archive +>4 byte 011 (at least v0.9 to extract) +>4 byte 012 (at least v1.0 to extract) +>4 byte 013 (at least v1.1 to extract) +>4 byte 024 (at least v2.0 to extract) +>4 byte 025 (at least v2.1 to extract) + + +Installation on other systems + + The steps for installation under VMS, MSDOS, OS/2, NT, Amiga and + Atari are similar to the above: first unzip the distribution + files into their own directory. The system dependant files are + stored in special subdirectories. + + For all the non-unix ports which support the creation of "UT" extra + fields (these ports contain USE_EF_UT_TIME in the list of optional + features displayed with "zip -v"), the timezone environment variable TZ + should be set according to the local timezone in order for the -f, + -u and -o options to work correctly. This is not needed for the WIN32 + and WinDLL ports, since they get the timezone information from the OS by + other means. + + MSDOS: + + Do one of: + + make msdos\makefile.msc (Microsoft C 5.1) + nmake -f msdos\makefile.msc (Microsoft C 6.0 and newer) + make -fmsdos\makefile.bor -DCC_REV=1 (Borland Turbo C++ 1.0) + make -fmsdos\makefile.bor (Borland C++ 2.0 and newer) + make -fmsdos\makefile.tc (Borland Turbo C 2.0x) + make -f msdos/makefile.dj1 (DJGPP v1.12m4) + make -f msdos/makefile.dj2 (DJGPP v2.01 and newer) + make -f msdos/makefile.emx (gcc/emx 0.9b and newer) + make -f os2/makefile.os2 gccdos (gcc/emx 0.9b and newer) + wmake -f msdos\makefile.wat (Watcom C 11.x 16-bit) + wmake -f msdos\makefile.wat PM=1 (Watcom C 11.x 32-bit, PMODE/W) + + + for Microsoft, Borland C++ and Turbo C, Watcom C/C++ and the various + free GNU C implementations, respectively. More detailed instructions + can be found in the respective makefiles. + + + WIN32 (Windows NT/2K/XP/2K3 and Windows 95/98/ME): + + Supported compilers are Microsoft Visual C++, Borland C++, Watcom C/C++, + and miscellaneous free GNU C implementations (gcc/mingw, CygWin, ...). + The makefiles supplied in the win32/ subdirectory contain further + information. + + + Windows DLL (WIN32): + + Supported environments are Visual C++ (32-bit only, 5.x and newer). + For instructions how to build the DLLs and where find the makefiles, + look into windll/contents. + + + OS/2: + + Type + + {make} -f os2/makefile.os2 + + to get a list of supported targets/compiling environments. + (replace "{make}" with the name of your OS/2 make utility.) + + To initiate the actual compiling process, you have to specify + a system target: + + {make} -f os2/makefile.os2 {system} + + An example: type + + nmake -f os2/makefile.os2 msc + + for Microsoft C 6.00. + + + VMS (OpenVMS): + + Apply + + @[.vms]make_zip + + or use DEC's MMS make utility (or the MMK clone) if available: + + mms /descr=[.vms]descrip.mms /macro=(__ALPHA__=1) for Alpha AXP + mms /descr=[.vms]descrip.mms /macro=(__DECC__=1) for DEC C on VAX + mms /descr=[.vms]descrip.mms /macro=(__VAXC__=1) for VAX C + mms /descr=[.vms]descrip.mms /macro=(__GNUC__=1) for GNU C on VAX + + (If you have installed both DEC C and VAX C on your VAX and want to use + the latter compiler, you should define the macro "__FORCE_VAXC__" + instead of "__VAXC__".) + + For further information please consult 00readme.txt in the vms/ + subdirectory. + +For command help on any of the zip* utilities, simply enter +the name with no arguments. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..9cc83dc --- /dev/null +++ b/LICENSE @@ -0,0 +1,55 @@ +This is version 2005-Feb-10 of the Info-ZIP copyright and license. +The definitive version of this document should be available at +ftp://ftp.info-zip.org/pub/infozip/license.html indefinitely. + + +Copyright (c) 1990-2005 Info-ZIP. All rights reserved. + +For the purposes of this copyright and license, "Info-ZIP" is defined as +the following set of individuals: + + Mark Adler, John Bush, Karl Davis, Harald Denker, Jean-Michel Dubois, + Jean-loup Gailly, Hunter Goatley, Ed Gordon, Ian Gorman, Chris Herborth, + Dirk Haase, Greg Hartwig, Robert Heath, Jonathan Hudson, Paul Kienitz, + David Kirschbaum, Johnny Lee, Onno van der Linden, Igor Mandrichenko, + Steve P. Miller, Sergio Monesi, Keith Owens, George Petrov, Greg Roelofs, + Kai Uwe Rommel, Steve Salisbury, Dave Smith, Steven M. Schweda, + Christian Spieler, Cosmin Truta, Antoine Verheijen, Paul von Behren, + Rich Wales, Mike White + +This software is provided "as is," without warranty of any kind, express +or implied. In no event shall Info-ZIP or its contributors be held liable +for any direct, indirect, incidental, special or consequential damages +arising out of the use of or inability to use this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + + 1. Redistributions of source code must retain the above copyright notice, + definition, disclaimer, and this list of conditions. + + 2. Redistributions in binary form (compiled executables) must reproduce + the above copyright notice, definition, disclaimer, and this list of + conditions in documentation and/or other materials provided with the + distribution. The sole exception to this condition is redistribution + of a standard UnZipSFX binary (including SFXWiz) as part of a + self-extracting archive; that is permitted without inclusion of this + license, as long as the normal SFX banner has not been removed from + the binary or disabled. + + 3. Altered versions--including, but not limited to, ports to new operating + systems, existing ports with new graphical interfaces, and dynamic, + shared, or static library versions--must be plainly marked as such + and must not be misrepresented as being the original source. Such + altered versions also must not be misrepresented as being Info-ZIP + releases--including, but not limited to, labeling of the altered + versions with the names "Info-ZIP" (or any variation thereof, including, + but not limited to, different capitalizations), "Pocket UnZip," "WiZ" + or "MacZip" without the explicit permission of Info-ZIP. Such altered + versions are further prohibited from misrepresentative use of the + Zip-Bugs or Info-ZIP e-mail addresses or of the Info-ZIP URL(s). + + 4. Info-ZIP retains the right to use the names "Info-ZIP," "Zip," "UnZip," + "UnZipSFX," "WiZ," "Pocket UnZip," "Pocket Zip," and "MacZip" for its + own source and binary releases. diff --git a/MANUAL b/MANUAL new file mode 100644 index 0000000..6b6f88b --- /dev/null +++ b/MANUAL @@ -0,0 +1,804 @@ +ZIP(1L) ZIP(1L) + +NAME + zip, zipcloak, zipnote, zipsplit - package and compress (archive) files + +SYNOPSIS + zip [-aABcdDeEfFghjklLmoqrRSTuvVwXyz!@$] [-b path] [-n suffixes] + [-t mmddyyyy] [-tt mmddyyyy] [ zipfile [ file1 file2 ...]] [-xi list] + + zipcloak [-dhL] [-b path] zipfile + + zipnote [-hwL] [-b path] zipfile + + zipsplit [-hiLpst] [-n size] [-b path] zipfile + +DESCRIPTION + zip is a compression and file packaging utility for Unix, VMS, MSDOS, + OS/2, Windows NT, Minix, Atari and Macintosh, Amiga and Acorn RISC OS. + + It is analogous to a combination of the UNIX commands tar(1) and com- + press(1) and is compatible with PKZIP (Phil Katz's ZIP for MSDOS sys- + tems). + + A companion program (unzip(1L)), unpacks zip archives. The zip and + unzip(1L) programs can work with archives produced by PKZIP, and PKZIP + and PKUNZIP can work with archives produced by zip. zip version 2.31 + is compatible with PKZIP 2.04. Note that PKUNZIP 1.10 cannot extract + files produced by PKZIP 2.04 or zip 2.31. You must use PKUNZIP 2.04g or + unzip 5.0p1 (or later versions) to extract them. + + For a brief help on zip and unzip, run each without specifying any + parameters on the command line. + + The program is useful for packaging a set of files for distribution; + for archiving files; and for saving disk space by temporarily compress- + ing unused files or directories. + + The zip program puts one or more compressed files into a single zip + archive, along with information about the files (name, path, date, time + of last modification, protection, and check information to verify file + integrity). An entire directory structure can be packed into a zip + archive with a single command. Compression ratios of 2:1 to 3:1 are + common for text files. zip has one compression method (deflation) and + can also store files without compression. zip automatically chooses + the better of the two for each file to be compressed. + + When given the name of an existing zip archive, zip will replace iden- + tically named entries in the zip archive or add entries for new names. + For example, if foo.zip exists and contains foo/file1 and foo/file2, + and the directory foo contains the files foo/file1 and foo/file3, then: + + zip -r foo foo + + will replace foo/file1 in foo.zip and add foo/file3 to foo.zip. After + this, foo.zip contains foo/file1, foo/file2, and foo/file3, with + foo/file2 unchanged from before. + + If the file list is specified as -@, [Not on MacOS] zip takes the list + of input files from standard input. Under UNIX, this option can be + used to powerful effect in conjunction with the find(1) command. For + example, to archive all the C source files in the current directory and + its subdirectories: + + find . -name "*.[ch]" -print | zip source -@ + + (note that the pattern must be quoted to keep the shell from expanding + it). zip will also accept a single dash ("-") as the zip file name, in + which case it will write the zip file to standard output, allowing the + output to be piped to another program. For example: + + zip -r - . | dd of=/dev/nrst0 obs=16k + + would write the zip output directly to a tape with the specified block + size for the purpose of backing up the current directory. + + zip also accepts a single dash ("-") as the name of a file to be com- + pressed, in which case it will read the file from standard input, + allowing zip to take input from another program. For example: + + tar cf - . | zip backup - + + would compress the output of the tar command for the purpose of backing + up the current directory. This generally produces better compression + than the previous example using the -r option, because zip can take + advantage of redundancy between files. The backup can be restored using + the command + + unzip -p backup | tar xf - + + When no zip file name is given and stdout is not a terminal, zip acts + as a filter, compressing standard input to standard output. For exam- + ple, + + tar cf - . | zip | dd of=/dev/nrst0 obs=16k + + is equivalent to + + tar cf - . | zip - - | dd of=/dev/nrst0 obs=16k + + zip archives created in this manner can be extracted with the program + funzip which is provided in the unzip package, or by gunzip which is + provided in the gzip package. For example: + + dd if=/dev/nrst0 ibs=16k | funzip | tar xvf - + + When changing an existing zip archive, zip will write a temporary file + with the new contents, and only replace the old one when the process of + creating the new version has been completed without error. + + If the name of the zip archive does not contain an extension, the + extension .zip is added. If the name already contains an extension + other than .zip the existing extension is kept unchanged. + +OPTIONS + -a [Systems using EBCDIC] Translate file to ASCII format. + + -A Adjust self-extracting executable archive. A self-extracting + executable archive is created by prepending the SFX stub to an + existing archive. The -A option tells zip to adjust the entry + offsets stored in the archive to take into account this "pream- + ble" data. + + Note: self-extracting archives for the Amiga are a special case. At + present, only the Amiga port of Zip is capable of adjusting or updating + these without corrupting them. -J can be used to remove the SFX stub + if other updates need to be made. + + -B [VM/CMS and MVS] force file to be read binary (default is text). + + -Bn [TANDEM] set Edit/Enscribe formatting options with n defined as + bit 0: Don't add delimiter (Edit/Enscribe) + bit 1: Use LF rather than CR/LF as delimiter (Edit/Enscribe) + bit 2: Space fill record to maximum record length (Enscribe) + bit 3: Trim trailing space (Enscribe) + bit 8: Force 30K (Expand) large read for unstructured files + + -b path + Use the specified path for the temporary zip archive. For exam- + ple: + + zip -b /tmp stuff * + + will put the temporary zip archive in the directory /tmp, copy- + ing over stuff.zip to the current directory when done. This + option is only useful when updating an existing archive, and the + file system containing this old archive does not have enough + space to hold both old and new archives at the same time. + + -c Add one-line comments for each file. File operations (adding, + updating) are done first, and the user is then prompted for a + one-line comment for each file. Enter the comment followed by + return, or just return for no comment. + + -d Remove (delete) entries from a zip archive. For example: + + zip -d foo foo/tom/junk foo/harry/\* \*.o + + will remove the entry foo/tom/junk, all of the files that start + with foo/harry/, and all of the files that end with .o (in any + path). Note that shell pathname expansion has been inhibited + with backslashes, so that zip can see the asterisks, enabling + zip to match on the contents of the zip archive instead of the + contents of the current directory. + + Under systems where the shell does not expand wildcards, such as + MSDOS, the backslashes are not needed. The above would then be + + zip -d foo foo/tom/junk foo/harry/* *.o + + Under MSDOS, -d is case sensitive when it matches names in the + zip archive. This requires that file names be entered in upper + case if they were zipped by PKZIP on an MSDOS system. + + -df [MacOS] Include only data-fork of files zipped into the archive. + Good for exporting files to foreign operating-systems. + Resource-forks will be ignored at all. + + -D Do not create entries in the zip archive for directories. + Directory entries are created by default so that their + attributes can be saved in the zip archive. The environment + variable ZIPOPT can be used to change the default options. For + example under Unix with sh: + + ZIPOPT="-D"; export ZIPOPT + + (The variable ZIPOPT can be used for any option except -i and -x + and can include several options.) The option -D is a shorthand + for -x "*/" but the latter cannot be set as default in the + ZIPOPT environment variable. + + -e Encrypt the contents of the zip archive using a password which + is entered on the terminal in response to a prompt (this will + not be echoed; if standard error is not a tty, zip will exit + with an error). The password prompt is repeated to save the + user from typing errors. + + -E [OS/2] Use the .LONGNAME Extended Attribute (if found) as file- + name. + + -f Replace (freshen) an existing entry in the zip archive only if + it has been modified more recently than the version already in + the zip archive; unlike the update option (-u) this will not add + files that are not already in the zip archive. For example: + + zip -f foo + + This command should be run from the same directory from which + the original zip command was run, since paths stored in zip + archives are always relative. + + Note that the timezone environment variable TZ should be set + according to the local timezone in order for the -f , -u and -o + options to work correctly. + + The reasons behind this are somewhat subtle but have to do with + the differences between the Unix-format file times (always in + GMT) and most of the other operating systems (always local time) + and the necessity to compare the two. A typical TZ value is + ``MET-1MEST'' (Middle European time with automatic adjustment + for ``summertime'' or Daylight Savings Time). + + -F Fix the zip archive. This option can be used if some portions of + the archive are missing. It is not guaranteed to work, so you + MUST make a backup of the original archive first. + + When doubled as in -FF the compressed sizes given inside the + damaged archive are not trusted and zip scans for special signa- + tures to identify the limits between the archive members. The + single -F is more reliable if the archive is not too much dam- + aged, for example if it has only been truncated, so try this + option first. + + Neither option will recover archives that have been incorrectly + transferred in ascii mode instead of binary. After the repair, + the -t option of unzip may show that some files have a bad CRC. + Such files cannot be recovered; you can remove them from the + archive using the -d option of zip. + + -g Grow (append to) the specified zip archive, instead of creating + a new one. If this operation fails, zip attempts to restore the + archive to its original state. If the restoration fails, the + archive might become corrupted. This option is ignored when + there's no existing archive or when at least one archive member + must be updated or deleted. + + -h Display the zip help information (this also appears if zip is + run with no arguments). + + -i files + Include only the specified files, as in: + + zip -r foo . -i \*.c + + which will include only the files that end in .c in the current + directory and its subdirectories. (Note for PKZIP users: the + equivalent command is + + pkzip -rP foo *.c + + PKZIP does not allow recursion in directories other than the + current one.) The backslash avoids the shell filename substitu- + tion, so that the name matching is performed by zip at all + directory levels. Not escaping wildcards on shells that do + wildcard substitution before zip gets the command line may seem + to work but files in subdirectories matching the pattern will + never be checked and so not matched. For shells, such as Win32 + command prompts, that do not replace file patterns containing + wildcards with the respective file names, zip will do the recur- + sion and escaping the wildcards is not needed. + + Also possible: + + zip -r foo . -i@include.lst + + which will only include the files in the current directory and + its subdirectories that match the patterns in the file + include.lst. + + -I [Acorn RISC OS] Don't scan through Image files. When used, zip + will not consider Image files (eg. DOS partitions or Spark + archives when SparkFS is loaded) as directories but will store + them as single files. + + For example, if you have SparkFS loaded, zipping a Spark archive + will result in a zipfile containing a directory (and its con- + tent) while using the 'I' option will result in a zipfile con- + taining a Spark archive. Obviously this second case will also be + obtained (without the 'I' option) if SparkFS isn't loaded. + + -j Store just the name of a saved file (junk the path), and do not + store directory names. By default, zip will store the full path + (relative to the current path). + + -jj [MacOS] record Fullpath (+ Volname). The complete path including + volume will be stored. By default the relative path will be + stored. + + -J Strip any prepended data (e.g. a SFX stub) from the archive. + + -k Attempt to convert the names and paths to conform to MSDOS, + store only the MSDOS attribute (just the user write attribute + from UNIX), and mark the entry as made under MSDOS (even though + it was not); for compatibility with PKUNZIP under MSDOS which + cannot handle certain names such as those with two dots. + + -l Translate the Unix end-of-line character LF into the MSDOS con- + vention CR LF. This option should not be used on binary files. + This option can be used on Unix if the zip file is intended for + PKUNZIP under MSDOS. If the input files already contain CR LF, + this option adds an extra CR. This ensures that unzip -a on Unix + will get back an exact copy of the original file, to undo the + effect of zip -l. See the note on binary detection for -ll + below. + + -ll Translate the MSDOS end-of-line CR LF into Unix LF. This option + should not be used on binary files and a warning will be issued + when a file is converted that later is detected to be binary. + This option can be used on MSDOS if the zip file is intended for + unzip under Unix. + + In Zip 2.31 binary detection has been changed from a simple per- + centage of binary characters being considered binary to a more + selective method that should consider files in many character + sets, including UTF-8, that only include text characters in that + character set to be text. This allows unzip -a to convert these + files. + + -L Display the zip license. + + -m Move the specified files into the zip archive; actually, this + deletes the target directories/files after making the specified + zip archive. If a directory becomes empty after removal of the + files, the directory is also removed. No deletions are done + until zip has created the archive without error. This is useful + for conserving disk space, but is potentially dangerous so it is + recommended to use it in combination with -T to test the archive + before removing all input files. + + -n suffixes + Do not attempt to compress files named with the given suffixes. + Such files are simply stored (0% compression) in the output zip + file, so that zip doesn't waste its time trying to compress + them. The suffixes are separated by either colons or semi- + colons. For example: + + zip -rn .Z:.zip:.tiff:.gif:.snd foo foo + + will copy everything from foo into foo.zip, but will store any + files that end in .Z, .zip, .tiff, .gif, or .snd without trying + to compress them (image and sound files often have their own + specialized compression methods). By default, zip does not com- + press files with extensions in the list + .Z:.zip:.zoo:.arc:.lzh:.arj. Such files are stored directly in + the output archive. The environment variable ZIPOPT can be used + to change the default options. For example under Unix with csh: + + setenv ZIPOPT "-n .gif:.zip" + + To attempt compression on all files, use: + + zip -n : foo + + The maximum compression option -9 also attempts compression on + all files regardless of extension. + + On Acorn RISC OS systems the suffixes are actually filetypes (3 + hex digit format). By default, zip does not compress files with + filetypes in the list DDC:D96:68E (i.e. Archives, CFS files and + PackDir files). + + -N [Amiga, MacOS] Save Amiga or MacOS filenotes as zipfile com- + ments. They can be restored by using the -N option of unzip. If + -c is used also, you are prompted for comments only for those + files that do not have filenotes. + + -o Set the "last modified" time of the zip archive to the latest + (oldest) "last modified" time found among the entries in the zip + archive. This can be used without any other operations, if + desired. For example: + + zip -o foo + + will change the last modified time of foo.zip to the latest time + of the entries in foo.zip. + + -P password + use password to encrypt zipfile entries (if any). THIS IS INSE- + CURE! Many multi-user operating systems provide ways for any + user to see the current command line of any other user; even on + stand-alone systems there is always the threat of over-the- + shoulder peeking. Storing the plaintext password as part of a + command line in an automated script is even worse. Whenever + possible, use the non-echoing, interactive prompt to enter pass- + words. (And where security is truly important, use strong + encryption such as Pretty Good Privacy instead of the relatively + weak encryption provided by standard zipfile utilities.) + + -q Quiet mode; eliminate informational messages and comment + prompts. (Useful, for example, in shell scripts and background + tasks). + + -Qn [QDOS] store information about the file in the file header with + n defined as + bit 0: Don't add headers for any file + bit 1: Add headers for all files + bit 2: Don't wait for interactive key press on exit + + -r Travel the directory structure recursively; for example: + + zip -r foo foo + + In this case, all the files and directories in foo are saved in + a zip archive named foo.zip, including files with names starting + with ".", since the recursion does not use the shell's file-name + substitution mechanism. If you wish to include only a specific + subset of the files in directory foo and its subdirectories, use + the -i option to specify the pattern of files to be included. + You should not use -r with the name ".*", since that matches + ".." which will attempt to zip up the parent directory (proba- + bly not what was intended). + + -R Travel the directory structure recursively starting at the cur- + rent directory; for example: + + zip -R foo '*.c' + + In this case, all the files matching *.c in the tree starting at + the current directory are stored into a zip archive named + foo.zip. Note for PKZIP users: the equivalent command is + + pkzip -rP foo *.c + + -S [MSDOS, OS/2, WIN32 and ATARI] Include system and hidden files. + [MacOS] Includes finder invisible files, which are ignored oth- + erwise. + + -t mmddyyyy + Do not operate on files modified prior to the specified date, + where mm is the month (0-12), dd is the day of the month (1-31), + and yyyy is the year. The ISO 8601 date format yyyy-mm-dd is + also accepted. For example: + + zip -rt 12071991 infamy foo + + zip -rt 1991-12-07 infamy foo + + will add all the files in foo and its subdirectories that were + last modified on or after 7 December 1991, to the zip archive + infamy.zip. + + -tt mmddyyyy + Do not operate on files modified after or at the specified date, + where mm is the month (0-12), dd is the day of the month (1-31), + and yyyy is the year. The ISO 8601 date format yyyy-mm-dd is + also accepted. For example: + + zip -rtt 11301995 infamy foo + + zip -rtt 1995-11-30 infamy foo + + will add all the files in foo and its subdirectories that were + last modified before the 30 November 1995, to the zip archive + infamy.zip. + + -T Test the integrity of the new zip file. If the check fails, the + old zip file is unchanged and (with the -m option) no input + files are removed. + + -u Replace (update) an existing entry in the zip archive only if it + has been modified more recently than the version already in the + zip archive. For example: + + zip -u stuff * + + will add any new files in the current directory, and update any + files which have been modified since the zip archive stuff.zip + was last created/modified (note that zip will not try to pack + stuff.zip into itself when you do this). + + Note that the -u option with no arguments acts like the -f + (freshen) option. + + -v Verbose mode or print diagnostic version info. + + Normally, when applied to real operations, this option enables + the display of a progress indicator during compression and + requests verbose diagnostic info about zipfile structure oddi- + ties. + + When -v is the only command line argument, and either stdin or + stdout is not redirected to a file, a diagnostic screen is + printed. In addition to the help screen header with program + name, version, and release date, some pointers to the Info-ZIP + home and distribution sites are given. Then, it shows informa- + tion about the target environment (compiler type and version, OS + version, compilation date and the enabled optional features used + to create the zip executable. + + -V [VMS] Save VMS file attributes and use portable form. zip + archives created with this option are truncated at EOF but still + may not be usable on other systems depending on the file types + being zipped. + + -VV [VMS] Save VMS file attributes. zip archives created with this + option include the entire file and should be able to recreate + most VMS files on VMS systems but these archives will generally + not be usable on other systems. + + -w [VMS] Append the version number of the files to the name, + including multiple versions of files. (default: use only the + most recent version of a specified file). + + -x files + Explicitly exclude the specified files, as in: + + zip -r foo foo -x \*.o + + which will include the contents of foo in foo.zip while exclud- + ing all the files that end in .o. The backslash avoids the + shell filename substitution, so that the name matching is per- + formed by zip at all directory levels. If you do not escape + wildcards in patterns it may seem to work but files in subdirec- + tories will not be checked for matches. + + Also possible: + + zip -r foo foo -x@exclude.lst + + which will include the contents of foo in foo.zip while exclud- + ing all the files that match the patterns in the file + exclude.lst (each file pattern on a separate line). + + -X Do not save extra file attributes (Extended Attributes on OS/2, + uid/gid and file times on Unix). + + -y Store symbolic links as such in the zip archive, instead of com- + pressing and storing the file referred to by the link (UNIX + only). + + -z Prompt for a multi-line comment for the entire zip archive. The + comment is ended by a line containing just a period, or an end + of file condition (^D on UNIX, ^Z on MSDOS, OS/2, and VAX/VMS). + The comment can be taken from a file: + + zip -z foo < foowhat + + -# Regulate the speed of compression using the specified digit #, + where -0 indicates no compression (store all files), -1 indi- + cates the fastest compression method (less compression) and -9 + indicates the slowest compression method (optimal compression, + ignores the suffix list). The default compression level is -6. + + -! [WIN32] Use priviliges (if granted) to obtain all aspects of + WinNT security. + + -@ Take the list of input files from standard input. Only one file- + name per line. + + -$ [MSDOS, OS/2, WIN32] Include the volume label for the drive + holding the first file to be compressed. If you want to include + only the volume label or to force a specific drive, use the + drive name as first file name, as in: + + zip -$ foo a: c:bar + +EXAMPLES + The simplest example: + + zip stuff * + + creates the archive stuff.zip (assuming it does not exist) and puts all + the files in the current directory in it, in compressed form (the .zip + suffix is added automatically, unless that archive name given contains + a dot already; this allows the explicit specification of other suf- + fixes). + + Because of the way the shell does filename substitution, files starting + with "." are not included; to include these as well: + + zip stuff .* * + + Even this will not include any subdirectories from the current direc- + tory. + + To zip up an entire directory, the command: + + zip -r foo foo + + creates the archive foo.zip, containing all the files and directories + in the directory foo that is contained within the current directory. + + You may want to make a zip archive that contains the files in foo, + without recording the directory name, foo. You can use the -j option + to leave off the paths, as in: + + zip -j foo foo/* + + If you are short on disk space, you might not have enough room to hold + both the original directory and the corresponding compressed zip + archive. In this case, you can create the archive in steps using the + -m option. If foo contains the subdirectories tom, dick, and harry, + you can: + + zip -rm foo foo/tom + zip -rm foo foo/dick + zip -rm foo foo/harry + + where the first command creates foo.zip, and the next two add to it. + At the completion of each zip command, the last created archive is + deleted, making room for the next zip command to function. + +PATTERN MATCHING + This section applies only to UNIX, though the ?, *, and [] special + characters are implemented on other systems including MSDOS and Win32. + Watch this space for details on MSDOS and VMS operation. + + The UNIX shells (sh(1) and csh(1)) do filename substitution on command + arguments. The special characters are: + + ? match any single character + + * match any number of characters (including none) + + [] match any character in the range indicated within the brackets + (example: [a-f], [0-9]). + + When these characters are encountered (without being escaped with a + backslash or quotes), the shell will look for files relative to the + current path that match the pattern, and replace the argument with a + list of the names that matched. + + The zip program can do the same matching on names that are in the zip + archive being modified or, in the case of the -x (exclude) or -i + (include) options, on the list of files to be operated on, by using + backslashes or quotes to tell the shell not to do the name expansion. + In general, when zip encounters a name in the list of files to do, it + first looks for the name in the file system. If it finds it, it then + adds it to the list of files to do. If it does not find it, it looks + for the name in the zip archive being modified (if it exists), using + the pattern matching characters described above, if present. For each + match, it will add that name to the list of files to be processed, + unless this name matches one given with the -x option, or does not + match any name given with the -i option. + + The pattern matching includes the path, and so patterns like \*.o match + names that end in ".o", no matter what the path prefix is. Note that + the backslash must precede every special character (i.e. ?*[]), or the + entire argument must be enclosed in double quotes (""). + + In general, use backslash to make zip do the pattern matching with the + -f (freshen) and -d (delete) options, and sometimes after the -x + (exclude) option when used with an appropriate operation (add, -u, -f, + or -d). + +ENVIRONMENT + ZIPOPT contains default options that will be used when running zip + + ZIP [Not on RISC OS and VMS] see ZIPOPT + + Zip$Options + [RISC OS] see ZIPOPT + + Zip$Exts + [RISC OS] contains extensions separated by a : that will cause + native filenames with one of the specified extensions to be + added to the zip file with basename and extension swapped. zip + + ZIP_OPTS + [VMS] see ZIPOPT + +SEE ALSO + compress(1), shar(1L), tar(1), unzip(1L), gzip(1L) + +DIAGNOSTICS + The exit status (or error level) approximates the exit codes defined by + PKWARE and takes on the following values, except under VMS: + + 0 normal; no errors or warnings detected. + + 2 unexpected end of zip file. + + 3 a generic error in the zipfile format was detected. Pro- + cessing may have completed successfully anyway; some bro- + ken zipfiles created by other archivers have simple work- + arounds. + + 4 zip was unable to allocate memory for one or more buffers + during program initialization. + + 5 a severe error in the zipfile format was detected. Pro- + cessing probably failed immediately. + + 6 entry too large to split (with zipsplit), read, or write + + 7 invalid comment format + + 8 zip -T failed or out of memory + + 9 the user aborted zip prematurely with control-C (or simi- + lar) + + 10 zip encountered an error while using a temp file + + 11 read or seek error + + 12 zip has nothing to do + + 13 missing or empty zip file + + 14 error writing to a file + + 15 zip was unable to create a file to write to + + 16 bad command line parameters + + 18 zip could not open a specified file to read + + VMS interprets standard Unix (or PC) return values as other, scarier- + looking things, so zip instead maps them into VMS-style status codes. + The current mapping is as follows: 1 (success) for normal exit, + and (0x7fff000? + 16*normal_zip_exit_status) for all errors, where the + `?' is 0 (warning) for zip value 12, 2 (error) for the zip values 3, 6, + 7, 9, 13, 16, 18, and 4 (fatal error) for the remaining ones. + +BUGS + zip 2.31 is not compatible with PKUNZIP 1.10. Use zip 1.1 to produce + zip files which can be extracted by PKUNZIP 1.10. + + zip files produced by zip 2.31 must not be updated by zip 1.1 or PKZIP + 1.10, if they contain encrypted members or if they have been produced + in a pipe or on a non-seekable device. The old versions of zip or PKZIP + would create an archive with an incorrect format. The old versions can + list the contents of the zip file but cannot extract it anyway (because + of the new compression algorithm). If you do not use encryption and + use regular disk files, you do not have to care about this problem. + + Under VMS, not all of the odd file formats are treated properly. Only + stream-LF format zip files are expected to work with zip. Others can + be converted using Rahul Dhesi's BILF program. This version of zip + handles some of the conversion internally. When using Kermit to trans- + fer zip files from Vax to MSDOS, type "set file type block" on the Vax. + When transfering from MSDOS to Vax, type "set file type fixed" on the + Vax. In both cases, type "set file type binary" on MSDOS. + + Under VMS, zip hangs for file specification that uses DECnet syntax + foo::*.*. + + On OS/2, zip cannot match some names, such as those including an excla- + mation mark or a hash sign. This is a bug in OS/2 itself: the 32-bit + DosFindFirst/Next don't find such names. Other programs such as GNU + tar are also affected by this bug. + + Under OS/2, the amount of Extended Attributes displayed by DIR is (for + compatibility) the amount returned by the 16-bit version of DosQuery- + PathInfo(). Otherwise OS/2 1.3 and 2.0 would report different EA sizes + when DIRing a file. However, the structure layout returned by the + 32-bit DosQueryPathInfo() is a bit different, it uses extra padding + bytes and link pointers (it's a linked list) to have all fields on + 4-byte boundaries for portability to future RISC OS/2 versions. There- + fore the value reported by zip (which uses this 32-bit-mode size) dif- + fers from that reported by DIR. zip stores the 32-bit format for + portability, even the 16-bit MS-C-compiled version running on OS/2 1.3, + so even this one shows the 32-bit-mode size. + + Development of Zip 3.0 is underway. See that source distribution for + many new features and the latest bug fixes. + +AUTHORS + Copyright (C) 1997-2005 Info-ZIP. + + Copyright (C) 1990-1997 Mark Adler, Richard B. Wales, Jean-loup Gailly, + Onno van der Linden, Kai Uwe Rommel, Igor Mandrichenko, John Bush and + Paul Kienitz. Permission is granted to any individual or institution + to use, copy, or redistribute this software so long as all of the orig- + inal files are included, that it is not sold for profit, and that this + copyright notice is retained. + + LIKE ANYTHING ELSE THAT'S FREE, ZIP AND ITS ASSOCIATED UTILITIES ARE + PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED + OR IMPLIED. IN NO EVENT WILL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + DAMAGES RESULTING FROM THE USE OF THIS SOFTWARE. + + Please send bug reports and comments to: zip-bugs at www.info-zip.org. + For bug reports, please include the version of zip (see zip -h), the + make options used to compile it (see zip -v), the machine and operating + system in use, and as much additional information as possible. + +ACKNOWLEDGEMENTS + Thanks to R. P. Byrne for his Shrink.Pas program, which inspired this + project, and from which the shrink algorithm was stolen; to Phil Katz + for placing in the public domain the zip file format, compression for- + mat, and .ZIP filename extension, and for accepting minor changes to + the file format; to Steve Burg for clarifications on the deflate for- + mat; to Haruhiko Okumura and Leonid Broukhis for providing some useful + ideas for the compression algorithm; to Keith Petersen, Rich Wales, + Hunter Goatley and Mark Adler for providing a mailing list and ftp site + for the Info-ZIP group to use; and most importantly, to the Info-ZIP + group itself (listed in the file infozip.who) without whose tireless + testing and bug-fixing efforts a portable zip would not have been pos- + sible. Finally we should thank (blame) the first Info-ZIP moderator, + David Kirschbaum, for getting us into this mess in the first place. + The manual page was rewritten for UNIX by R. P. C. Rodgers. + +Info-ZIP 27 February 2005 (v2.31) ZIP(1L) diff --git a/README b/README new file mode 100644 index 0000000..3cd10c3 --- /dev/null +++ b/README @@ -0,0 +1,155 @@ +Copyright (c) 1990-2005 Info-ZIP. All rights reserved. + +See the accompanying file LICENSE, version 2005-Feb-10 or later +(the contents of which are also included in zip.h) for terms of use. +If, for some reason, both of these files are missing, the Info-ZIP license +also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html + +This is Zip 2.31, a maintenance update for Zip 2.3. Changes include a +few bug fixes for Debian and SourceForge bugs, inclusion of the standard +zip encryption code in the main code, some VMS updates, some changes to +the Win32 projects, and some other bug fixes. We are also working on +the new Zip 3.0 and companion UnZip 6.00 that finally support files and +archives larger than 4 GB on systems that support large files and include +other new features. See the latest betas for details and the new releases +when available. + +Zip 2.31 is a compression and file packaging utility. It is compatible with +PKZIP 2.04g (Phil Katz ZIP) for MSDOS systems. There is a companion to zip +called unzip (of course) which you should be able to find the same place +you got zip. See the file 'WHERE' for details on ftp sites and mail +servers. + +This version of zip has been ported to a wide array of Unix and other +mainframes, minis, and micros including VMS, OS/2, Minix, MSDOS, Windows NT, +Atari, Amiga, BeOS and VM/CMS. Although highly compatible with PKware's +PKZIP and PKUNZIP utilities of MSDOS fame, our primary objective has been +one of portability and other-than-MSDOS functionality. Features not found +in the PKWare version include creation of zip files in a pipe or on a +device, VMS, BeOS and OS/2 extended file attributes, conversion from Unix to +MSDOS text file format; and, of course, the ability to run on most of your +favorite operating systems. And it's free. + +See the file WhatsNew for a summary of new features and the file 'CHANGES' for +a detailed list of all changes. + +This version does not support multi-volume archives as in pkzip 2.04g. +This is currently being looked at and may be provided in the release of +Zip 3.0 if time permits. + +Please read the file INSTALL for information on how to compile and install +zip, zipsplit, zipcloak, and zipnote. Please read the file MANUAL for +information on how to use them. The file "contents" is a complete list +of the files you should have in this distribution. Also, if you are +using MSDOS, you should read the note on file formats at the end of the +contents file. (The contents file somehow got misplaced apparently in +the Zip 2.3 distribution. If time permits we will create a new one.) + +This version supports standard zip encryption. The encryption code was +distributed separately before this version because of US export regulations but +recent relaxing of export restrictions now allow the code to be included. Note +that standard zip encryption is considered weak by today's standards. We are +looking at adding strong encryption to a later release. Decryption can be made +with unzip 5.0p1 or later, or with zipcloak. + +All bug reports should go to zip-bugs using the web form at www.info-zip.org, +and suggestions for new features can be sent using the same form (although +we don't promise to use all suggestions). Contact us to send patches as we +currently don't have a standard way to do that. Patches should be sent as +context diffs only (diff -c). + +If you're considering a port, please check in with zip-bugs FIRST, +since the code is constantly being updated behind the scenes. We'll +arrange to give you access to the latest source. + +If you'd like to keep up to date with our Zip (and companion UnZip utility) +development, join the ranks of BETA testers, add your own thoughts and con- +tributions, etc., send a two-line mail message containing the commands HELP +and LIST (on separate lines in the body of the message, not on the subject +line) to mxserver@lists.wku.edu. You'll receive two messages listing the +various Info-ZIP mailing-list formats which are available (and also various +unrelated lists) and instructions on how to subscribe to one or more of them +(courtesy of Hunter Goatley). (Currently these are all discontinued but +we are considering implementing new versions. However, a discussion +group for Info-ZIP issues is at http://www.quicktopic.com/27/H/V6ZQZ54uKNL +and can be used to discuss issues, request features, and is one place new +betas and releases are announced.) + +Frequently asked questions on zip and unzip: + +Q. When unzipping I get an error message about "compression method 8". + +A. Please get the latest version of unzip. See the file 'WHERE' for details. + + +Q. I can't extract this zip file that I just downloaded. I get + "zipfile is part of multi-disk archive" or some other message. + +A. Please make sure that you made the transfer in binary mode. Check + in particular that your copy has exactly the same size as the original. + + +Q. When running unzip, I get a message about "End-of-central-directory + signature not found". + +A. This usually means that your zip archive is damaged, or that you + have an uncompressed file with the same name in the same directory. + In the first case, it makes more sense to contact the person you + obtained the zip file from rather than the Info-ZIP software + developers, and to make sure that your copy is strictly identical to + the original. In the second case, use "unzip zipfile.zip" instead + of "unzip zipfile", to let unzip know which file is the zip archive + you want to extract. + + +Q. Why doesn't zip do just like PKZIP does? + +A. Zip is not a PKZIP clone and is not intended to be one. In some + cases we feel PKZIP does not do the right thing (e.g., not + including pathnames by default); in some cases the operating system + itself is responsible (e.g., under Unix it is the shell which + expands wildcards, not zip). Info-ZIP's and PKWARE's zipfiles + are interchangeable, not the programs. + + For example, if you are used to the following PKZIP command: + pkzip -rP foo *.c + you must use instead on Unix: + zip -R foo '*.c' + (the singled quotes are needed to let the shell know that it should + not expand the *.c argument but instead pass it on to the program) + + +Q. Can I distribute zip and unzip sources and/or executables? + +A. You may redistribute the latest official distributions without any + modification, without even asking us for permission. You can charge + for the cost of the media (CDROM, diskettes, etc...) and a small copying + fee. If you want to distribute modified versions please contact us at + zip-bugs at www.info-zip.org first. You must not distribute beta versions. + The latest official distributions are on ftp.info-zip.org in directory + /pub/archiving/zip and subdirectories as well as on mirror sites. + + +Q. Can I use the executables of zip and unzip to distribute my software? + +A. Yes, so long as it is made clear in the product documentation that + zip or unzip are not being sold, that the source code is freely + available, and that there are no extra or hidden charges resulting + from its use by or inclusion with the commercial product. Here is + an example of a suitable notice: + + NOTE: is packaged on this CD using Info-ZIP's compression + utility. The installation program uses UnZip to read zip files from + the CD. Info-ZIP's software (Zip, UnZip and related utilities) is + free and can be obtained as source code or executables from various + anonymous-ftp sites, including ftp.info-zip.org:/pub/archiving/zip/*. + + +Q. Can I use the source code of zip and unzip in my commercial application? + +A. Yes, so long as you include in your product an acknowledgment and an + offer of the original compression sources for free or for a small + copying fee, and make clear that there are no extra or hidden charges + resulting from the use of the compression code by your product. In other + words, you are allowed to sell only your own work, not ours. If you have + special requirements contact us at zip-bugs at www.info-zip.org. diff --git a/README.CR b/README.CR new file mode 100644 index 0000000..79d4ca7 --- /dev/null +++ b/README.CR @@ -0,0 +1,115 @@ +_____________________________________________________________________________ + + This is Info-ZIP's README.CR for zcrypt29.zip, last updated 28 February 2005. +_____________________________________________________________________________ + + +The files described below contain the encryption/decryption code for Zip 2.31, +UnZip 5.52, and WiZ 5.02 (and later). These files are included in the main +source for all of these. This file both describes the history of this package +and notes the current conditions for use. Check the comments at the top +of crypt.c and crypt.h for additional information. + +As of version 2.9, this encryption source code is copyrighted by Info-ZIP; +see the enclosed LICENSE file for details. Older versions remain in the pub- +lic domain. Zcrypt was originally written in Europe and, as of April 2000, +can be freely distributed from the US as well as other countries. + +(The ability to export from the US is new and is due to a change in the Bureau +of Export Administration's regulations, as published in Volume 65, Number +10, of the Federal Register [14 January 2000]. Info-ZIP filed the required +notification via e-mail on 9 April 2000; see the USexport.msg file in this +archive. However, as of June 2002, it can now be freely distributed in both +source and object forms from any country, including the USA under License +Exception TSU of the U.S. Export Administration Regulations (section 740.13(e)) +of 6 June 2002.) + + LIKE ANYTHING ELSE THAT IS FREE, ZIP, UNZIP AND THEIR ASSOCIATED + UTILITIES ARE PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY KIND, + EITHER EXPRESSED OR IMPLIED. IN NO EVENT WILL THE AUTHORS BE LIABLE + FOR ANY DAMAGES RESULTING FROM THE USE OF THIS SOFTWARE. + +The encryption code is a direct transcription of the algorithm from +Roger Schlafly, described by Phil Katz in the file appnote.txt. This +file is distributed with the PKZIP program (even in the version without +encryption capabilities). Note that the encryption will probably resist +attacks by amateurs if the password is well chosen and long enough (at +least 8 characters) but it will probably not resist attacks by experts. +Paul Kocher has made available information concerning a known-plaintext +attack for the PKWARE encryption scheme; see http://www.cryptography.com/ +for details.) Short passwords consisting of lowercase letters only can be +recovered in a few hours on any workstation. But for casual cryptography +designed to keep your mother from reading your mail, it's OK. + +For more serious encryption, check into PGP (Pretty Good Privacy), a +public-key-based encryption system available from various Internet sites. +PGP has Zip and UnZip built into it. The most recent version at the time +this was written was 6.5, although older versions are still widespread. + +We are looking at adding AES strong encryption to future versions of Zip and +UnZip. + +Zip 2.3x and UnZip 5.5x are compatible with PKZIP 2.04g. (Thanks to Phil +Katz for accepting our suggested minor changes to the zipfile format.) + +IMPORTANT NOTE: + + Zip archives produced by Zip 2.0 or later must not be *updated* by + Zip 1.1 or PKZIP 1.10 or PKZIP 1.93a, if they contain encrypted members + or if they have been produced in a pipe or on a non-seekable device. + The old versions of Zip or PKZIP would destroy the zip structure. The + old versions can list the contents of the zipfile but cannot extract + it anyway (because of the new compression algorithm). If you do not + use encryption and compress regular disk files, you need not worry about + this problem. + + +Contents that were distributed and now are part of the main source files: + + file what it is + ---- ---------- + README.CR this file + LICENSE Info-ZIP license (terms of reuse and redistribution) + USexport.msg export notice sent to US Bureau of Export Administration + WHERE where Zip/UnZip/WiZ and related utilities can be found + crypt.c code for encryption and decryption + crypt.h code for encryption and decryption + file_id.diz description file for some BBSes + +Most all of the files are in Unix (LF only) format. On MSDOS systems, you +can use the -a option of UnZip to convert the source files to CRLF +format. This is only necessary if you wish to edit the files -- they +will compile as is with Microsoft C and Turbo/Borland C++ 1.0 or +later. However, you will have to convert the files (using "unzip -a") +to the CRLF format to compile with the older Turbo C 1.0 or 2.0. You +should be able to find Zip and UnZip in the same place you found this +(see ftp://ftp.info-zip.org/pub/infozip/Info-ZIP.html or the file +"WHERE" for details). + +To update previous versions using the zcrypt sources: + + (1) Get the main sources (e.g., Zip 2.3) and unpack into a working + directory, as usual. + + (2) Overwrite the dummy crypt.c and crypt.h from the main sources with + the versions from this package. If you want to overwrite directly + out of the zcrypt29 archive, do not use UnZip's freshen/updating + option; the dummy files may be newer than the real sources in + zcrypt29. ("unzip -o zcrypt29 -d /your/working/dir" will do the + Right Thing in most cases, although it may overwrite a newer WHERE + file under some circumstances.) + + (3) Read the main INSTALL document and compile normally! No makefile + changes are necessary on account of the zcrypt sources. You can + check that the version you just compiled has encryption or decryption + support enabled by typing "zip -v" or "unzip -v" and verifying that + the last "special compilation option" says encryption or decryption + is included. + +Encryption enables new "-e" and "-P password" options in Zip, and a new +"-P password" option in UnZip--see the normal Zip and UnZip documentation +for details. (Note that passing a plaintext password on the command line +is potentially much more insecure than being prompted for it interactively, +which is the default for UnZip and for Zip with "-e". Also note that the +interactive method allows UnZip to deal with archives that use different +passwords for different files.) diff --git a/TODO b/TODO new file mode 100644 index 0000000..a3510a7 --- /dev/null +++ b/TODO @@ -0,0 +1,72 @@ +This is old. See Changes and WhatsNew for what has been implemented. + +(See the latest Zip 3.0 beta for an update to this list.) + +Main features still missing for next official version: + +- use install in unix/Makefile instead of mkdir -p, look at install sh script. +- #elif for those ports that can handle it. +- what about zopen vs. fopen ? +- Add zcreate or zfcreate for win32. +- Assembler stuff in match.S (subexpressions) +- zipping huge files (> 2G, unsigned 32bit) +- Testsuite for zip and unzip (John D. Mitchell) +- make a version.c or version.h that includes all the compiler names +- run utils with dmalloc(). +- what to do with zip -F and zip -FF (readzipfile2()) ? +- profiling of the code +- multi disk zip files +- zipfile modification tool (Greg) +- Implement -- option (Thomas Klauser, wiz@danbala.tuwien.ac.at) +- don't add files with "Archive bit " + or add files with "Archive bit " (uwe.becher@metronet.de) +- 32 bit file attributes +- generate output without having to seek at all +- remove contractions from zip error messages, make them clearer (Steve) +- display "[text]" for ascii files when not quiet (no -q) (Timo Salmi) +- does zipnote accept names with version number? +- for a WORM, zip should create temp file only when updating; new archives + should be created directly. +- APPNOTE.TXT specifies "4) The entries in the central directory may + not necessarily be in the same order that files appear in the zipfile" + but readzipfile() relies on same order. +- on Mac, MPW C 3.3.1 requires #if (a || b) ["#if a || b" taken as "#if a"] +- on Unix, let -S be "include non-regular files without reading from them" + (as pkzip on Unix). This requires unzip support. +- zip -l should do ebcdic->ascii translation on CMS and MVS +- zip as subroutine (zdig/241) +- accept k and M in zipsplit +- store / (part of file name) as ! in OS/2 (problem only with -E ?) + +Known bugs: + +- On VMS, zip fails reading some files with "byte record too large for + user's buffer". You must use the "-V" option for such files. + +- on MSDOS, zip386.exe does not like "zip -bc: foo ..." + +- on MSDOS, zip386.exe is sometimes much slower than zip.exe. This is + probably a problem with DJGPP (to be investigated). + +- on NT with C shell, zip should not do file name expansion again. + +- zip zipfile ... ignores existing zipfile if name does not have an extension + (except for the -A option, generally used on self-extracting files). + +- For an sfx file without extension, "zip -A sfx" works but "zip sfx -A" + doesn't. + +- When storing files in a zipfile (-0), zip marks all of them as binary. + +- On VMS, some indexed files are not restored correctly after zip -V and unzip. + (This is now known to be a problem of UnZip. The workaround for Zip 2.2 + and newer is to use PK-style VMS extra fields; this is now the default. + NOTE that UnZip 5.32 has been fixed [971019]!) + +- zip and unzip should use the same pattern matching rules, particularly + on MSDOS and OS/2. On OS/2, "zip foo *.*" should also match files + without extension. + Partially DONE (OS/2 "*.*" matches "*".) + +- there should be a way to avoid updating archive members (only addition + of new files allowed) diff --git a/USexport.msg b/USexport.msg new file mode 100644 index 0000000..068aa9f --- /dev/null +++ b/USexport.msg @@ -0,0 +1,75 @@ +From roelofs (at) sonic.net Tue Jun 17 08:26:55 2003 +Date: Tue, 17 Jun 2003 08:26:50 -0700 +Message-Id: <200306171526.h5HFQoaw014091 (at) bolt.sonic.net> +From: Greg Roelofs +Reply-To: Greg Roelofs +To: crypt (at) bis.doc.gov, enc (at) ncsc.mil, web_site (at) bis.doc.gov +Subject: TSU NOTIFICATION - Encryption (Info-ZIP zcrypt.zip) +Cc: newt (at) pobox.com, zip-bugs (at) lists.wku.edu + + + SUBMISSION TYPE: TSU + SUBMITTED BY: Greg Roelofs + SUBMITTED FOR: the Info-ZIP group (an informal, Internet-based + collection of software developers with the contact + address given in next item) + POINT OF CONTACT: Zip-Bugs (at) lists.wku.edu + PHONE and/or FAX: n/a + MANUFACTURER: n/a + PRODUCT NAME/MODEL #: zcrypt + ECCN: 5D002 + + NOTIFICATION: + + ftp://ftp.info-zip.org/pub/infozip/src/zcrypt.zip + + +FURTHER COMMENTS: + +(1) This notice is being sent in order to ensure that we may legally + take advantage of the 6 June 2002 amendment to 740.13 regarding + "corresponding object code." The encryption code in question is + unchanged since our original notification of 9 April 2000, appended + below and also reproduced within the above zcrypt.zip archive. + (Indeed, there has been no change to the core encryption/decryption + code in well over five years.) + +(2) The (larger) source archives for Zip, UnZip, MacZip, WiZ, and + potentially other packages, currently available in the same ftp + directory given above, also contain (or may contain) copies of + the same zcrypt source code. + +(3) ftp.info-zip.org currently points to a site in Germany, so techni- + cally it is not involved in "US export" in any direct way. However, + we encourage other sites to "mirror" our software, and some of these + mirror sites may be US-based (and therefore involved in reexport of + the code in question). In addition, some Info-ZIP members reside in + the US, and www.info-zip.org currently points to a site in Kentucky. + + +ORIGINAL NOTIFICATION: + +From roelofs (at) sonic.net Sun Apr 9 15:11:45 2000 +Date: Sun, 9 Apr 2000 15:11:27 -0700 +Message-Id: <200004092211.PAA20023 (at) sonic.net> +From: Greg Roelofs +To: crypt (at) bxa.doc.gov +Subject: notice of export of unrestricted encryption source code +Cc: newt (at) pobox.com, zip-bugs (at) lists.wku.edu + +The Info-ZIP group, an informal, Internet-based collection of software +developers with contact address Zip-Bugs (at) lists.wku.edu, hereby notifies +the US Bureau of Export Administration (BXA) of the posting of freely +available encryption source code on the Internet under License Exception +TSU, to commence later today at this location: + + ftp://ftp.info-zip.org/pub/infozip/src/zcrypt.zip + +This notification is in accordance with section 740.13(e) of the amended +Export Administration Regulations, as published in the 14 January 2000 +issue of the Federal Register. + +-- +Greg Roelofs newt (at) pobox.com http://pobox.com/~newt/ +Newtware, PNG Group, Info-ZIP, Philips Research, ... + diff --git a/WHATSNEW b/WHATSNEW new file mode 100644 index 0000000..a0c1a2d --- /dev/null +++ b/WHATSNEW @@ -0,0 +1,51 @@ +WhatsNew file for Zip 2.31 + +(See Changes for details) + +New things in Zip 2.31 + +- Crypt now part of source distribution (see Readme.cr) +- Bug fixes: + - Debian patch 001 - Converted quoted strings + - Debian patch 002 - Makefile changes + - Debian patch 003 - Build changes + - Debian patch 004 - Changes to unix/configure + - Debian patch 005 - Fix for FNMAX path bug +- Split VMS -V into -V and -VV (see Manual) +- New VC6 project files thanks to Cosmin +- AtheOS port (thanks to Ruslan Nickolaev) +- Add api.c kluge for zip32.dll to support Visual Basic +- Binary detection changed from 20% binary to new algorithm + that should better detect word processing files as binary + and should accept UTF-8 files as text. This flags the file + in the archive as TEXT or BINARY for use by UnZip for line + end conversion (see proginfo/txtvsbin.txt) +- License update +- DJGPP fixes +- Many Makefile updates +- Fixes to ZipSplit, ZipNotes, and ZipCloak + +New things in Zip 2.3 + +- IBM OS/390 port (Unix like, but EBCDIC) by Paul von Behren +- Apple Macintosh (MACOS) port by Dirk Haase +- Theos port by Jean-Michel Dubois +- Multibyte characterset support by Yoshioka Tsuneo +- Support for ISO 8601 date format with -t and -tt options +- Info-ZIP license + +New things in Zip 2.2 + +- BEOS port by Chris Herborth +- QDOS port by Jonathan Hudson +- TANDEM port by Dave Smith +- WINDLL port (16-bit Win 3.x and 32-bit WinNT/Win95) by Mike White +- SYSV packages support by John Bush +- zip -P SeCrEt encrypts entries in the zip file with password SeCrEt + (WARNING: THIS IS INSECURE, use at your own risk) +- zip -R recurses into subdirectories of current dir like "PKZIP -rP" +- zip -x@exclude.lst excludes files specified in the file exclude.lst +- zip -i@include.lst includes files specified in the file include.lst +- zip -@ only handles one filename per line, but supports whitespace in names +- zip -t mmddyyyy, 4 digit year number for uniqueness of years beyond 2000 +- zip -tt mmddyyyy only includes files before a specified date diff --git a/WHERE b/WHERE new file mode 100644 index 0000000..c5f6c0b --- /dev/null +++ b/WHERE @@ -0,0 +1,258 @@ +__________________________________________________________________________ + + This is the Info-ZIP file ``WHERE,'' last updated on 1 March 2005. +__________________________________________________________________________ + + The latest version of this file can be found online at: + + ftp://ftp.info-zip.org/pub/infozip/doc/WHERE + + Note that some ftp sites may not yet have the latest versions of Zip + and UnZip when you read this. The latest versions always appear in + ftp://ftp.info-zip.org/pub/infozip/ (and subdirectories thereof) first, + except for encryption binaries, which always appear in + ftp://ftp.icce.rug.nl/infozip/ (and subdirectories) first. + + IF YOU FIND AN ERROR: please let us know! We don't have time to + check each and every site personally (or even collectively), so any + number of the sites listed below may have moved or disappeared en- + tirely. E-mail to Zip-Bugs@lists.wku.edu and we'll update this file. +__________________________________________________________________________ + + +Info-ZIP's home WWW site is listed on Yahoo and is at: + + ftp://ftp.info-zip.org/pub/infozip/Info-ZIP.html (master version) + http://ftp.info-zip.org/pub/infozip/ (master version) + http://www.info-zip.org/ + +Note that the old sites at http://www.cdrom.com/pub/infozip/ and +http://www.freesoftware.com/pub/infozip are PERMANENTLY BROKEN. They +cannot be updated or removed, apparently. + +The Zip and UnZip pages have links to most known mirror sites carrying our +source and/or binary distributions, and they generally are more up-to-date +and have better information than what you are reading: + + ftp://ftp.info-zip.org/pub/infozip/Zip.html + ftp://ftp.info-zip.org/pub/infozip/UnZip.html + +The related zlib package by Info-ZIP's Jean-loup Gailly and Mark Adler is at: + + http://www.zlib.net/ + +Source-code archives for Info-ZIP's portable Zip, UnZip, and related +utilities: + + zip231.zip Zip 2.31 (deflation; includes zipnote/zipsplit/zipcloak) + zip231.tar.Z ditto, compress'd tar format + + zip11.zip Zip 1.1 (shrinking, implosion; compatible w. PKUNZIP 1.1) + zip11.tar.Z ditto, compress'd tar format + + unzip552.zip UnZip 5.52 (all methods[*]; unzip/funzip/unzipsfx/zipgrep) + unzip552.tar.gz ditto, gzip'd tar format + unzip552.tar.Z ditto, compress'd tar format + + unred552.zip UnZip 5.52 add-on, contains copyrighted unreduce support + + zcrypt29.zip encryption support for Zip 2.3[**] + zcrypt10.zip encryption support for Zip 1.1 + + MacZip106src.zip contains all the GUI stuff and the project files to build + the MacZip main-app. To build MacZip successfully, both + the Zip 2.31 and UnZip 5.52 sources are required, too. + + wiz502.zip WiZ 5.02, Windows 9x/NT GUI front-end for Info-ZIP DLLs + wiz502+dlls.zip WiZ 5.02, Windows 9x/NT GUI front-end plus DLL sources + +[*] Unreducing is disabled by default, but is available as add-on. + As of July 2004, Unisys's LZW patent was expired worldwide, and + unshrinking is turned on by default since the release of UnZip 5.52. + See UnZip's INSTALL file for details. + +[**] As of January 2000, US export regulations were amended to allow export + of free encryption source code from the US. As of June 2002, these + regulations were further relaxed to allow export of encryption binaries + associated with free encryption source code. The Zip 2.31, UnZip 5.52 + and Wiz 5.02 archives now include full crypto source code. As of the + Zip 2.31 release, all official binaries include encryption support; the + former "zcr" archives ceased to exist. + (Note that restrictions may still exist in other countries, of course.) + +Executables archives (and related files) for Info-ZIP's software; not all +of these will be immediately available due to lack of access to appropriate +systems on the part of Info-ZIP members. + + zip231x.zip MSDOS executables and docs + zip231x1.zip OS/2 1.x (16-bit) executables and docs + zip231x2.zip OS/2 2/3/4.x (32-bit) executables and docs + zip231xA.zip Amiga executables and docs + zip231xB.zip BeOS executables and docs + zip231xC.zip VM/CMS executable and docs + zip231xK.zip Tandem NSK executables and docs + zip231xM.xmit MVS classic executable + zip231xM-docs.zip MVS classic port, docs only + zip231dN.zip WinNT/Win9x (Intel) DLL, header files, docs + zip231xN.zip WinNT/Win9x (Intel) executables and docs + zip231xN-axp.zip WinNT (Alpha AXP) executables and docs + zip231xN-mip.zip WinNT (MIPS R4000) executables and docs + zip231xN-ppc.zip WinNT (PowerPC) executables and docs + zip231xO.zip IBM OS/390 Open Edition binaries and docs + zip231xQ.zip SMS/QDOS executables and docs + zip231xR.zip Acorn RISC OS executables and docs + zip231xT.zip Atari TOS executables and docs + zip231-vms-axp-obj.zip + VMS (Alpha AXP) object libs, link procedure and docs + zip231-vms-axp-exe.zip + VMS (Alpha AXP) executables for VMS 6.1 or later and docs + zip231-vms-vax-decc-obj.zip + VMS (VAX) object libs (new DEC C), link procedure and docs + zip231-vms-vax-decc-exe.zip + VMS (VAX) executables (DEC C) for VMS 6.1 or later; docs + zip231-vms-vax-vaxc-obj.zip + VMS (VAX) object libs (old VAX C), link procedure and docs + zip231x.hqx Macintosh BinHex'd executables and docs + + unz552x.exe MSDOS self-extracting executable (16-bit unzip, ..., docs) + unz552x3.exe MSDOS self-extracting executable (16-, 32-bit unzip, docs) + unz552x1.exe OS/2 1.x (16-bit) self-extracting executables and docs + unz552x2.exe OS/2 2/3/4.x (32-bit) self-extracting executables and docs + unz552d2.zip OS/2 2/3/4.x (32-bit) DLL, header file, demo exe and docs + unz552xA.ami Amiga self-extracting executables and docs + unz552xA.lha Amiga executables and docs, LHa archive + unz552xB.sfx BeOS self-extracting executables and docs + unz552xB.tar.gz BeOS executables and docs, gzip'd tar archive + unz552xC.mod VM/CMS executable module in "packed" format + unz552xC-docs.zip VM/CMS docs, only + unz552xF.zip FlexOS executable and docs + unz552xK.zip Tandem NSK executable and docs + unz552xM.xmit MVS classic executable + unz552xM-docs.zip MVS classic port, docs only + unz552dN.zip NT4/W2K/XP/2K3/W9x (32-bit Intel) DLL, header files, docs + unz552xN.exe NT/2K/XP/2K3/W9x self-extracting i386 executables and docs + unz552xN-axp.exe WinNT (Alpha AXP) self-extracting executables and docs + unz552xN-mip.exe WinNT (MIPS R4000) self-extracting executables and docs + unz552xN-ppc.exe WinNT (PowerPC) self-extracting executables and docs + unz552xQ.sfx SMS/QDOS self-extracting executables and docs + unz552xO.tar.Z IBM OS/390 Open edition (Unix-like), exes and docs + unz552xR.exe Acorn RISC OS self-extracting executables and docs + unz552xR.spk Acorn RISC OS Spark'd executables and docs + unz552xT.tos Atari TOS self-extracting executables and docs + unz552x-vms-axp-obj.bck VMS backup saveset, + contains UnZip (Alpha) obj libs, link procedure, docs + unz552x-vms-axp-obj.exe VMS (Alpha AXP) SFX archive (statically linked), + contains UnZip (Alpha) obj libs, link procedure, docs + unz552x-vms-axp-exe.exe VMS (Alpha AXP) SFX archive (dynamically linked), + contains UnZip (Alpha AXP, DEC C) executables and docs, + smaller than object archive, but requires VMS 6.1 + unz552x-vms-vax-decc-obj.bck VMS backup saveset, + contains UnZip (new DEC C) obj libs, link procedure, docs + unz552x-vms-vax-decc-obj.exe VMS (VAX) SFX archive (statically linked), + contains UnZip (new DEC C) obj libs, link procedure, docs + unz552x-vms-vax-decc-exe.exe VMS (VAX) SFX archive (dynamically linked), + contains UnZip (new DEC C) executables and docs, + smaller than object archive, but requires VMS 6.1 + unz552x-vms-vax-vaxc-obj.bck VMS backup saveset, + contains UnZip (old VAX C) obj libs, link procedure, docs + unz552x-vms-vax-vaxc-obj.exe VMS (VAX) SFX archive (statically linked), + contains UnZip (old VAX C) obj libs, link procedure, docs + unz552x.hqx Macintosh BinHex'd executables and docs for unzip + (unz552x.tar.{Z,gz} Unix exes/docs for Solaris 2.x, SCO Unix, Linux, etc., + depending on directory/location; generally only provided + in cases where the OS does *not* ship with a bundled C + compiler) + + MacZip106nc.hqx Macintosh combined Zip&UnZip application with GUI, + executables and docs (no encryption) + MacZip106c.hqx Macintosh combined Zip&UnZip application with GUI, + executables and docs (with encryption) + + wiz502xN.exe WiZ 5.02 32-bit (Win9x/NT/2K/XP/2K3) app+docs (self-extr.) + + UnzpHist.zip complete changes-history of UnZip and its precursors + ZipHist.zip complete changes-history of Zip + +ftp/web sites for the US-exportable sources and executables: + + NOTE: Look for the Info-ZIP file names given above (not PKWARE or third- + party stuff) in the following locations. Some sites like to use slightly + different names, such as zip-2.31.tar.gz instead of zip231.tar.Z. + + ftp://ftp.info-zip.org/pub/infozip/ [THE INFO-ZIP HOME SITE] + ftp://sunsite.doc.ic.ac.uk/packages/zip/ [MIRRORS THE INFO-ZIP HOME SITE] + ftp://unix.hensa.ac.uk/mirrors/uunet/pub/archiving/zip/ + + ftp://ftp.cmdl.noaa.gov/aerosol/doc/archiver/{all,dos,os2,mac,vax_alpha}/ + ftp://garbo.uwasa.fi/pc/arcers/ [AND OTHER GARBO MIRRORS] + ftp://garbo.uwasa.fi/unix/arcers/ [AND OTHER GARBO MIRRORS] + ftp://ftp.elf.stuba.sk/pub/pc/pack/ [AND OTHER STUBA MIRRORS] + ftp://ftp-os2.cdrom.com/pub/os2/archiver/ + ftp://ftp-os2.nmsu.edu/os2/archiver/ + ftp://ftp.informatik.tu-muenchen.de/pub/comp/os/os2/archiver/ + ftp://sumex-aim.stanford.edu/info-mac/cmp/ + ftp://ftp.wustl.edu/pub/aminet/util/arc/ [AND OTHER AMINET MIRRORS] + ftp://atari.archive.umich.edu/pub/Archivers/ [AND OTHER UMICH MIRRORS] + http://www.umich.edu/~archive/atari/Archivers/ + ftp://jake.educom.com.au/pub/infozip/acorn/ [Acorn RISC OS] + http://www.sitec.net/maczip/ [MacZip port] + +ftp/web sites for the encryption and decryption sources and/or executables: + + Outside the US: + ftp://ftp.info-zip.org/pub/infozip/ [THE INFO-ZIP HOME SITE] + ftp://ftp.icce.rug.nl/infozip/ [THE INFO-ZIP ENCRYPTION HOME SITE] + ftp://ftp.elf.stuba.sk/pub/pc/pack/ + ftp://garbo.uwasa.fi/pc/arcers/ + ftp://ftp.inria.fr/system/arch-compr/ + ftp://ftp.leo.org/pub/comp/os/os2/leo/archiver/ + (mail server at ftp-mailer@ftp.leo.org) + + ftp://ftp.win.tue.nl/pub/compression/zip/ + ftp://ftp.uni-erlangen.de/pub/pc/msdos/arc-utils/zip/ + + +The primary distribution site for the MacZip port can be found at: + + http://www.sitec.net/maczip/ + +ftp sites for VMS-format Zip and UnZip packages (sources, object files and +executables, no encryption/decryption--see also "Mail servers" section below): + + ftp.spc.edu [192.107.46.27] and ftp.wku.edu: + + [.MACRO32]AAAREADME.TXT + [.MACRO32.SAVESETS]UNZIP.BCK or UNZIP.ZIP (if already have older version) + [.MACRO32.SAVESETS]ZIP.ZIP + +To find other ftp/web sites: + + The "archie" ftp database utility can be used to find an ftp site near + you (although the command-line versions always seem to find old ver- + sions...the `FTPsearch' server at http://ftpsearch.ntnu.no/ftpsearch + --formerly `Archie 95'--is quite up-to-date, however). Or check a stan- + dard WWW search engine like AltaVista (http://www.altavista.digital.com/) + or Yahoo (http://www.yahoo.com/). If you don't know how to use these, + DON'T ASK US--read the web sites' help pages or check the Usenet groups + news.announce.newusers or news.answers or some such, or ask your system + administrator. + +Mail servers: + + To get the encryption sources by e-mail, send the following commands + to ftp-mailer@informatik.tu-muenchen.de: + + get /pub/comp/os/os2/archiver/zcrypt29.zip + quit + + To get the VMS Zip/UnZip package by e-mail, send the following + commands in the body of a mail message to fileserv@wku.edu (the + "HELP" command is also accepted): + + SEND FILESERV_TOOLS + SEND UNZIP + SEND ZIP + + To get Atari executables by e-mail, send a message to + atari@atari.archive.umich.edu for information about the mail server. +__________________________________________________________________________ diff --git a/acorn/GMakefile b/acorn/GMakefile new file mode 100644 index 0000000..e9f02bc --- /dev/null +++ b/acorn/GMakefile @@ -0,0 +1,130 @@ +# Makefile for Zip, ZipNote, ZipCloak and ZipSplit + +# add -g to CC to debug +# add -d to BIND to debug +CC = gcc -mlibscl +BIND = $(CC) +AS = $(CC) -c +ASM = AS +SQUEEZE = squeeze -v +E = + +# flags +# CFLAGS flags for C compile +# LFLAGS1 flags after output file spec, before obj file list +# LFLAGS2 flags after obj file list (libraries, etc) +# +LIB = +CFLAGS = -O2 -mthrowback -DASMV +ASMFLAGS = -throwback -objasm -upper +LFLAGS1 = +LFLAGS2 = $(LIB) + +# Uncomment the following line to enable support for Unix +# Extra Field (Timezone) +#CFLAGS = $(CFLAGS) -DUSE_EF_UT_TIME + +# object file lists +OBJZ = o.zip o.zipfile o.zipup o.fileio o.util o.globals o.crc32 o.crctab \ + o.crypt o.ttyio o.riscos o.acornzip o.swiven + +OBJI = o.deflate o.trees +OBJA = o.match o.sendbits +OBJU = o.zipfile_ o.fileio_ o.util_ o.globals o.riscos o.acornzip_ o.swiven +OBJN = o.zipnote $(OBJU) +OBJC = o.zipcloak $(OBJU) o.crctab o.crypt_ o.ttyio +OBJS = o.zipsplit $(OBJU) + +ZIP_H = h.zip h.ziperr h.tailor acorn.h.osdep acorn.h.riscos acorn.h.swiven + +all: zip zipnote zipsplit zipcloak + +install: %.zip %.zipnote %.zipsplit %.zipcloak %.acorn.zipsfx \ + zip zipnote zipsplit zipcloak acorn.zipsfx + $(SQUEEZE) zip %.zip + $(SQUEEZE) zipnote %.zipnote + $(SQUEEZE) zipsplit %.zipsplit + $(SQUEEZE) zipcloak %.zipcloak + copy acorn.zipsfx %.zipsfx ~CVF + +# rules for zip, zipnote, zipcloak and zipsplit + +o.api: c.api + $(CC) $(CFLAGS) -c c.api -o o.api +o.crc32: c.crc32 $(ZIP_H) + $(CC) $(CFLAGS) -c c.crc32 -o o.crc32 +o.crctab: c.crctab $(ZIP_H) + $(CC) $(CFLAGS) -c c.crctab -o o.crctab +o.crypt: c.crypt $(ZIP_H) h.crypt h.ttyio + $(CC) $(CFLAGS) -c c.crypt -o o.crypt +o.deflate: c.deflate $(ZIP_H) + $(CC) $(CFLAGS) -c c.deflate -o o.deflate +o.fileio: c.fileio $(ZIP_H) + $(CC) $(CFLAGS) -c c.fileio -o o.fileio +o.globals: c.globals $(ZIP_H) + $(CC) $(CFLAGS) -c c.globals -o o.globals +o.mktime: c.mktime + $(CC) $(CFLAGS) -c c.mktime -o o.mktime +o.trees: c.trees $(ZIP_H) + $(CC) $(CFLAGS) -c c.trees -o o.trees +o.ttyio: c.ttyio $(ZIP_H) h.crypt + $(CC) $(CFLAGS) -c c.ttyio -o o.ttyio +o.util: c.util $(ZIP_H) + $(CC) $(CFLAGS) -c c.util -o o.util +o.zip: c.zip $(ZIP_H) h.crypt h.revision h.ttyio + $(CC) $(CFLAGS) -c c.zip -o o.zip +o.zipcloak: c.zipcloak $(ZIP_H) h.crypt h.revision h.ttyio + $(CC) $(CFLAGS) -c c.zipcloak -o o.zipcloak +o.zipfile: c.zipfile $(ZIP_H) + $(CC) $(CFLAGS) -c c.zipfile -o o.zipfile +o.zipnote: c.zipnote $(ZIP_H) h.revision + $(CC) $(CFLAGS) -c c.zipnote -o o.zipnote +o.zipsplit: c.zipsplit $(ZIP_H) h.revision + $(CC) $(CFLAGS) -c c.zipsplit -o o.zipsplit +o.zipup: c.zipup $(ZIP_H) h.crypt h.revision + $(CC) $(CFLAGS) -c c.zipup -o o.zipup + +o.crypt_: c.crypt $(ZIP_H) h.crypt h.ttyio + $(CC) $(CFLAGS) -DUTIL -c c.crypt -o o.crypt_ +o.util_: c.util $(ZIP_H) + $(CC) $(CFLAGS) -DUTIL -c c.util -o o.util_ +o.fileio_: c.fileio $(ZIP_H) + $(CC) $(CFLAGS) -DUTIL -c c.fileio -o o.fileio_ +o.zipfile_: c.zipfile $(ZIP_H) + $(CC) $(CFLAGS) -DUTIL -c c.zipfile -o o.zipfile_ +o.acornzip_: acorn.c.acornzip $(ZIP_H) + $(CC) $(CFLAGS) -I@ -DUTIL -c acorn.c.acornzip -o o.acornzip_ + +o.riscos: acorn.c.riscos acorn.h.riscos $(ZIP_H) + $(CC) $(CFLAGS) -I@ -c acorn.c.riscos -o o.riscos + +o.acornzip: acorn.c.acornzip $(ZIP_H) + $(CC) $(CFLAGS) -I@ -c acorn.c.acornzip -o o.acornzip + +o.match: acorn.s.match + $(ASM) $(ASMFLAGS) -I@ acorn.s.match -o o.match + +o.sendbits: acorn.s.sendbits + $(ASM) $(ASMFLAGS) -I@ acorn.s.sendbits -o o.sendbits + +o.swiven: acorn.s.swiven + $(ASM) $(ASMFLAGS) -I@ acorn.s.swiven -o o.swiven + +zip: $(OBJZ) $(OBJI) $(OBJA) + $(BIND) -o zip$(E) $(LFLAGS1) $(OBJZ) $(OBJI) $(OBJA) $(LFLAGS2) +zipnote: $(OBJN) + $(BIND) -o zipnote$(E) $(LFLAGS1) $(OBJN) $(LFLAGS2) +zipcloak: $(OBJC) + $(BIND) -o zipcloak$(E) $(LFLAGS1) $(OBJC) $(LFLAGS2) +zipsplit: $(OBJS) + $(BIND) -o zipsplit$(E) $(LFLAGS1) $(OBJS) $(LFLAGS2) + +clean: + remove zip + remove zipcloak + remove zipsplit + remove zipnote + create o.!fake! 0 + wipe o.* ~cf + +# end of Makefile diff --git a/acorn/ReadMe b/acorn/ReadMe new file mode 100644 index 0000000..41c37a5 --- /dev/null +++ b/acorn/ReadMe @@ -0,0 +1,85 @@ +Acorn-specific compile instructions +----------------------------------- + +Use the "RunMe1st" file (it is an Obey file) to convert all the files from +"filename/[chs]" to "[chs].filename" (so that zip could be easily compiled +under RISC OS). It will also set the correct makefile. + +To compile just set the CSD to the main zip directory and run 'amu'. + +Currently only the Acorn C V5 compiler has been tested but probably also +Acorn C V4 and the Acorn Assembler V2 will be able to compile zip. + +The default makefile is configured without the support for the +Extended Timestamp Extra Field. If you wan to enable it you have to +add "-DUSE_EF_UT_TIME" to CFLAGS (see makefile). Without the Extended +Timestamp Field support, zipfiles created by zip are identical to the +zipfiles created by SparkFS. However, the Extended Timestamp Field can +be useful if you are going to unzip your zipfiles on a non-RISC OS machine +since the correct time stamp will be preserved across different timezones. +Note that in this case, both the SparkFS Extra Field and the Extended +Timestamp Extra Field will be used, so the zipfiles will still be fully +compatible with SparkFS and with the RISC OS version of unzip. + +The executables-only distributions will be compiled without the support for +the Extended Timestamp Extra Field. If you need it but you can't compile zip +yourself, you can contact the authors at the Info-ZIP address who will do it +for you. + + +Acorn-specific usage instructions +--------------------------------- + +An extra option ('I') has been added to the Acorn port: if it is specified +zip will not consider Image files (eg. DOS partitions or Spark archives when +SparkFS is loaded) as directories but will store them as single files. This +means that if you have, say, SparkFS loaded, zipping a Spark archive will +result in a zipfile containing a directory (and its content) while using the +'I' option will result in a zipfile containing a Spark archive. Obviously +this second case will also be obtained (without the 'I' option) if SparkFS +isn't loaded. + +When adding files to a zipfile; to maintain FileCore compliance, all +files named "file/ext" will be added to the archive as "file.ext". +This presents no problem if you wish to use unzip to extract them on any +other machine, as the files are correctly named. This also presents no +problem if you use unzip for RISC OS, as the files are converted back to +"file/ext" format. The only problem appears when you use SparkFS to +decompress the files, as a file called "file.ext" will be extracted as +"file_ext", not what it was added as. You must be careful about this. + +Case Specific. Depending on how you type the command, files will be added +exactly as named; in this example: +*zip new/zip newfile +*zip new/zip NewFile +*zip new/zip NEWFILE +will create an archive containing 3 copies of the same Risc OS file 'newfile' +called 'newfile', 'NewFile' and 'NEWFILE'. Please be careful. + +The Acorn port conserves file attributes, including filetype, so if you +zip on an Acorn, and unzip on another Acorn, filetypes will be maintained +precisely as if you used uncompressed files. If you de-archive on another +machine (PC, Mac, Unix etc..), filetypes will be ignored, but the files +will be identical despite this. This feature is fully compatible with +SparkFS, so zipfiles created by zip will be correctly uncompressed (including +filetype, etc.) by SparkFS. + +An additional feature went into this port to cope better with C-code +and extensions. This allows the acorn files "c.foo" to be added to the +archive as "foo/c", eventually appearing in the archive as "foo.c", allowing +for better handling of C or C++ code. Example: +*Set Zip$Exts "dir1:dir2:dir3" +*zip new/zip dir1.file +*zip new/zip dir2.help +*zip new/zip dir3.textfile +Creates a zipfile new/zip, with entries file.dir1, help.dir2, textfile.dir3. +The usual settings for Zip$Exts are "h:o:s:c", allowing C code to be added +to the archive in standard form. + +A final note about the Acorn port regards the use of the 'n' option: this is +used to specify a list of suffixes that will not be compressed (eg. .ZIP, +since it is already a compressed file). Since RISC OS uses filetypes instead +of suffixes, this list of suffixes is actually considered as a list of +filetypes (3 hex digit format). By default, zip doesn't compress filetypes +DDC (Archive, Spark or Zip), D96 (CFS files) and 68E (PackDir). + diff --git a/acorn/ReadMe.GMakefile b/acorn/ReadMe.GMakefile new file mode 100644 index 0000000..714fe2d --- /dev/null +++ b/acorn/ReadMe.GMakefile @@ -0,0 +1,14 @@ +GMakefile is for use with Acorn RISC OS and the forthcoming +post-Acorn RISC OS for the compilation of both the current release and +development versions of zip. + +It is recommended that you use gcc 2.95.4 or higher and you will need a +suitable 'make' utility. Both are available from +. + +You will need the files gcc.zip and cc1.zip for the C compiler with the +documentation available in the gccdoc.zip archive. GNU make can be +found in the utils.zip archive, although most versions of 'make' should be +fine. + +When using gcc, check RunMe1st for two lines which need uncommenting. diff --git a/acorn/RunMe1st b/acorn/RunMe1st new file mode 100644 index 0000000..a330adb --- /dev/null +++ b/acorn/RunMe1st @@ -0,0 +1,23 @@ +| This Obey file prepares the zip port for a Desktop C re-compile. +| Run it and it will copy all the needed files into the correct +| place. + +| Set the correct type of 'srcrename' so that the only requirement +| for the user is to set 'RunMe1st' to Obey +SetType .srcrename FF8 + +| Run 'srcrename' on the main zip directory with recursion enabled +/.srcrename -r -e c:h:s:o .^ + +| Create the 'o' directory +CDir .^.o + +| Put the Makefile in its correct place and set the correct filetype +Copy .makefile .^.makefile ~C ~V F + +| Uncomment the following lines if you're using gcc +|| Put the Makefile in its correct place and set the correct filetype +|Copy .GMakefile .^.makefile ~C~VF + +SetType .^.makefile FE1 +SetType .zipsfx Obey diff --git a/acorn/acornzip.c b/acorn/acornzip.c new file mode 100644 index 0000000..8de308c --- /dev/null +++ b/acorn/acornzip.c @@ -0,0 +1,593 @@ +/* + Copyright (c) 1990-2005 Info-ZIP. All rights reserved. + + See the accompanying file LICENSE, version 2004-May-22 or later + (the contents of which are also included in zip.h) for terms of use. + If, for some reason, all these files are missing, the Info-ZIP license + also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html +*/ +#include +#include +#include "zip.h" + +#ifndef UTIL + +#define PAD 0 +#define PATH_END '/' + + +local int wild_recurse(char *whole, char *wildtail); +local int uxtime2acornftime(unsigned *pexadr, unsigned *pldadr, time_t ut); + +extern char *label; +local ulg label_time = 0; +local ulg label_mode = 0; +local time_t label_utim = 0; + +char *readd(DIR *d) +/* Return a pointer to the next name in the directory stream d, or NULL if + no more entries or an error occurs. */ +{ + struct dirent *e; + + e = readdir(d); + return (e == NULL ? (char *) NULL : e->d_name); +} + +/* What we have here is a mostly-generic routine using opend()/readd() and */ +/* isshexp()/MATCH() to find all the files matching a multi-part filespec */ +/* using the portable pattern syntax. It shouldn't take too much fiddling */ +/* to make it usable for any other platform that has directory hierarchies */ +/* but no shell-level pattern matching. It works for patterns throughout */ +/* the pathname, such as "foo:*.?/source/x*.[ch]". */ + +/* whole is a pathname with wildcards, wildtail points somewhere in the */ +/* middle of it. All wildcards to be expanded must come AFTER wildtail. */ + +local int wild_recurse(whole, wildtail) char *whole; char *wildtail; +{ + DIR *dir; + char *subwild, *name, *newwhole = NULL, *glue = NULL, plug = 0, plug2; + ush newlen, amatch = 0; + struct stat statb; + int disk_not_mounted=0; + int e = ZE_MISS; + + if (!isshexp(wildtail)) { + if (stat(whole,&statb)==0 && (statb.st_mode & S_IREAD)!=0) { + return procname(whole, 0); + } else + return ZE_MISS; /* woops, no wildcards! */ + } + + /* back up thru path components till existing dir found */ + do { + name = wildtail + strlen(wildtail) - 1; + for (;;) + if (name-- <= wildtail || *name == '.') { + subwild = name + 1; + plug2 = *subwild; + *subwild = 0; + break; + } + if (glue) + *glue = plug; + glue = subwild; + plug = plug2; + dir = opendir(whole); + } while (!dir && !disk_not_mounted && subwild > wildtail); + wildtail = subwild; /* skip past non-wild components */ + + if ((subwild = strchr(wildtail + 1, '.')) != NULL) { + /* this "+ 1" dodges the ^^^ hole left by *glue == 0 */ + *(subwild++) = 0; /* wildtail = one component pattern */ + newlen = strlen(whole) + strlen(subwild) + 32; + } else + newlen = strlen(whole) + 31; + if (!dir || !(newwhole = malloc(newlen))) { + if (glue) + *glue = plug; + e = dir ? ZE_MEM : ZE_MISS; + goto ohforgetit; + } + strcpy(newwhole, whole); + newlen = strlen(newwhole); + if (glue) + *glue = plug; /* repair damage to whole */ + if (!isshexp(wildtail)) { + e = ZE_MISS; /* non-wild name not found */ + goto ohforgetit; + } + + while (name = readd(dir)) { + if (MATCH(wildtail, name, 0)) { + strcpy(newwhole + newlen, name); + if (subwild) { + name = newwhole + strlen(newwhole); + *(name++) = '.'; + strcpy(name, subwild); + e = wild_recurse(newwhole, name); + } else + e = procname(newwhole, 0); + newwhole[newlen] = 0; + if (e == ZE_OK) + amatch = 1; + else if (e != ZE_MISS) + break; + } + } + + ohforgetit: + if (dir) closedir(dir); + if (subwild) *--subwild = '.'; + if (newwhole) free(newwhole); + if (e == ZE_MISS && amatch) + e = ZE_OK; + return e; +} + +int wild(p) +char *p; +{ + char *path; + int toret; + + /* special handling of stdin request */ + if (strcmp(p, "-") == 0) /* if compressing stdin */ + return newname(p, 0, 0); + + path=p; + if (strchr(p, ':')==NULL && *p!='@') { + if (!(path=malloc(strlen(p)+3))) { + return ZE_MEM; + } + strcpy(path,"@."); + strcat(path,p); + } + + toret=wild_recurse(path, path); + + if (path!=p) { + free(path); + } + return toret; +} + +int procname(n, caseflag) +char *n; /* name to process */ +int caseflag; /* true to force case-sensitive match */ +/* Process a name or sh expression to operate on (or exclude). Return + an error code in the ZE_ class. */ +{ + char *a; /* path and name for recursion */ + DIR *d; /* directory stream from opendir() */ + char *e; /* pointer to name from readd() */ + int m; /* matched flag */ + char *p; /* path for recursion */ + struct stat s; /* result of stat() */ + struct zlist far *z; /* steps through zfiles list */ + + if (strcmp(n, "-") == 0) /* if compressing stdin */ + return newname(n, 0, caseflag); + else if (LSSTAT(n, &s)) + { + /* Not a file or directory--search for shell expression in zip file */ + p = ex2in(n, 0, (int *)NULL); /* shouldn't affect matching chars */ + m = 1; + for (z = zfiles; z != NULL; z = z->nxt) { + if (MATCH(p, z->iname, caseflag)) + { + z->mark = pcount ? filter(z->zname, caseflag) : 1; + if (verbose) + fprintf(mesg, "zip diagnostic: %scluding %s\n", + z->mark ? "in" : "ex", z->name); + m = 0; + } + } + free((zvoid *)p); + return m ? ZE_MISS : ZE_OK; + } + + /* Live name--use if file, recurse if directory */ + if ((s.st_mode & S_IFDIR) == 0) + { + /* add or remove name of file */ + if ((m = newname(n, 0, caseflag)) != ZE_OK) + return m; + } else { + /* Add trailing / to the directory name */ + if ((p = malloc(strlen(n)+2)) == NULL) + return ZE_MEM; + if (strcmp(n, ".") == 0) { + *p = '\0'; /* avoid "./" prefix and do not create zip entry */ + } else { + strcpy(p, n); + a = p + strlen(p); + if (a[-1] != '.') + strcpy(a, "."); + if (dirnames && (m = newname(p, 1, caseflag)) != ZE_OK) { + free((zvoid *)p); + return m; + } + } + /* recurse into directory */ + if (recurse && (d = opendir(n)) != NULL) + { + while ((e = readd(d)) != NULL) { + if (strcmp(e, ".") && strcmp(e, "..")) + { + if ((a = malloc(strlen(p) + strlen(e) + 1)) == NULL) + { + closedir(d); + free((zvoid *)p); + return ZE_MEM; + } + strcat(strcpy(a, p), e); + if ((m = procname(a, caseflag)) != ZE_OK) /* recurse on name */ + { + if (m == ZE_MISS) + zipwarn("name not matched: ", a); + else + ziperr(m, a); + } + free((zvoid *)a); + } + } + closedir(d); + } + free((zvoid *)p); + } /* (s.st_mode & S_IFDIR) == 0) */ + return ZE_OK; +} + +char *ex2in(x, isdir, pdosflag) +char *x; /* external file name */ +int isdir; /* input: x is a directory */ +int *pdosflag; /* output: force MSDOS file attributes? */ +/* Convert the external file name to a zip file name, returning the malloc'ed + string or NULL if not enough memory. */ +{ + char *n; /* internal file name (malloc'ed) */ + char *t; /* shortened name */ + char *tmp; + int dosflag; + char *lastlastdir=NULL; /* pointer to 2 dirs before... */ + char *lastdir=NULL; /* pointer to last dir... */ + + /* Malloc space for internal name and copy it */ + if ((tmp = malloc(strlen(x) + 1)) == NULL) + return NULL; + strcpy(tmp, x); + + dosflag = dosify; /* default for non-DOS and non-OS/2 */ + + /* Find starting point in name before doing malloc */ + for(t=tmp;*t;t++) { + if (*t=='/') { + *t='.'; + } + else if (*t=='.') { + *t='/'; + lastlastdir=lastdir; + lastdir=t+1; + } + } + + t=strchr(tmp,'$'); /* skip FS name */ + if (t!=NULL) + t+=2; /* skip '.' after '$' */ + else + t=tmp; + if (*t=='@') /* skip @. at the beginning of filenames */ + t+=2; + + /* Make changes, if any, to the copied name (leave original intact) */ + + /* return a pointer to '\0' if the file is a directory with the same + same name as an extension to swap (eg. 'c', 'h', etc.) */ + if (isdir && exts2swap!=NULL) { + if (lastlastdir==NULL) + lastlastdir=t; + if (checkext(lastlastdir)) { + free((void *)tmp); + n=malloc(1); + if (n!=NULL) + *n='\0'; + return n; + } + } + + if (exts2swap!=NULL && lastdir!=NULL) { + if (lastlastdir==NULL) + lastlastdir=t; + if (checkext(lastlastdir)) { + if (swapext(lastlastdir,lastdir-1)) { + free((void *)tmp); + return NULL; + } + } + } + + if (!pathput) + t = last(t, PATH_END); + + /* Malloc space for internal name and copy it */ + if ((n = malloc(strlen(t) + 1)) == NULL) { + free((void *)tmp); + return NULL; + } + strcpy(n, t); + + free((void *)tmp); + + if (dosify) + msname(n); + + /* Returned malloc'ed name */ + if (pdosflag) + *pdosflag = dosflag; + return n; +} + +char *in2ex(n) +char *n; /* internal file name */ +/* Convert the zip file name to an external file name, returning the malloc'ed + string or NULL if not enough memory. */ +{ + char *x; /* external file name */ + char *t; /* scans name */ + char *lastext=NULL; /* pointer to last extension */ + char *lastdir=NULL; /* pointer to last dir */ + + if ((x = malloc(strlen(n) + 1 + PAD)) == NULL) + return NULL; + strcpy(x, n); + + for(t=x;*t;t++) { + if (*t=='.') { + *t='/'; + lastext=t+1; + } + else if (*t=='/') { + *t='.'; + lastdir=t+1; + } + } + + if (exts2swap!=NULL && (int)lastext>(int)lastdir) { + if (lastdir==NULL) + lastdir=x; + if (checkext(lastext)) { + if (swapext(lastdir,lastext-1)) { + free((void *)x); + return NULL; + } + } + } + + return x; +} + +local int uxtime2acornftime(unsigned *pexadr, unsigned *pldadr, time_t ut) +{ + unsigned timlo; /* 3 lower bytes of acorn file-time plus carry byte */ + unsigned timhi; /* 2 high bytes of acorn file-time */ + + timlo = ((unsigned)ut & 0x00ffffffU) * 100 + 0x00996a00U; + timhi = ((unsigned)ut >> 24); + timhi = timhi * 100 + 0x0000336eU + (timlo >> 24); + if (timhi & 0xffff0000U) + return 1; /* calculation overflow, do not change time */ + + /* insert the five time bytes into loadaddr and execaddr variables */ + *pexadr = (timlo & 0x00ffffffU) | ((timhi & 0x000000ffU) << 24); + *pldadr = (*pldadr & 0xffffff00U) | ((timhi >> 8) & 0x000000ffU); + + return 0; /* subject to future extension to signal overflow */ +} + +void stamp(f, d) +char *f; /* name of file to change */ +ulg d; /* dos-style time to change it to */ +/* Set last updated and accessed time of file f to the DOS time d. */ +{ + time_t m_time; + unsigned int loadaddr, execaddr; + int attr; + + /* Convert DOS time to time_t format in m_time */ + m_time = dos2unixtime(d); + + /* set the file's modification time */ + SWI_OS_File_5(f,NULL,&loadaddr,NULL,NULL,&attr); + + if (uxtime2acornftime(&execaddr, &loadaddr, m_time) != 0) + return; + + SWI_OS_File_1(f,loadaddr,execaddr,attr); +} + +ulg filetime(f, a, n, t) +char *f; /* name of file to get info on */ +ulg *a; /* return value: file attributes */ +long *n; /* return value: file size */ +iztimes *t; /* return value: access, modific. and creation times */ +/* If file *f does not exist, return 0. Else, return the file's last + modified date and time as an MSDOS date and time. The date and + time is returned in a long with the date most significant to allow + unsigned integer comparison of absolute times. Also, if a is not + a NULL pointer, store the file attributes there, with the high two + bytes being the Unix attributes, and the low byte being a mapping + of that to DOS attributes. If n is not NULL, store the file size + there. If t is not NULL, the file's access, modification and creation + times are stored there as UNIX time_t values. + If f is "-", use standard input as the file. If f is a device, return + a file size of -1 */ +{ + struct stat s; /* results of stat() */ + char *name; + unsigned int len = strlen(f); + + if (f == label) { + if (a != NULL) + *a = label_mode; + if (n != NULL) + *n = -2L; /* convention for a label name */ + if (t != NULL) + t->atime = t->mtime = t->ctime = label_utim; + return label_time; + } + + if ((name = malloc(len + 1)) == NULL) { + ZIPERR(ZE_MEM, "filetime"); + } + strcpy(name, f); + if (name[len - 1] == '.') + name[len - 1] = '\0'; + /* not all systems allow stat'ing a file with / appended */ + + if (strcmp(f, "-") == 0) { + /* forge stat values for stdin since Amiga and RISCOS have no fstat() */ + s.st_mode = (S_IREAD|S_IWRITE|S_IFREG); + s.st_size = -1; + s.st_mtime = time(&s.st_mtime); + } else if (LSSTAT(name, &s) != 0) { + /* Accept about any file kind including directories + * (stored with trailing / with -r option) + */ + free(name); + return 0; + } + + if (a != NULL) { + *a = ((ulg)s.st_mode << 16) | !(s.st_mode & S_IWRITE); + if ((s.st_mode & S_IFDIR) != 0) { + *a |= MSDOS_DIR_ATTR; + } + } + if (n != NULL) + *n = (s.st_mode & S_IFMT) == S_IFREG ? s.st_size : -1L; + if (t != NULL) { + t->atime = s.st_atime; + t->mtime = s.st_mtime; + t->ctime = s.st_ctime; + } + + free(name); + + return unix2dostime((time_t *) &s.st_mtime); +} + +int set_extra_field(z, z_utim) + struct zlist far *z; + iztimes *z_utim; +{ +#ifdef USE_EF_UT_TIME + char *eb_ptr; +#endif /* USE_EF_UT_TIME */ + char *name; + extra_block *block; + +#define EB_SPARK_LEN 20 +#define EB_SPARK_SIZE (EB_HEADSIZE+EB_SPARK_LEN) +#ifdef USE_EF_UT_TIME +# ifdef IZ_CHECK_TZ +# define EB_UTTIME_SIZE (zp_tz_is_valid ? EB_HEADSIZE+EB_UT_LEN(1) : 0) +# else +# define EB_UTTIME_SIZE (EB_HEADSIZE+EB_UT_LEN(1)) +# endif +#else +# define EB_UTTIME_SIZE 0 +#endif +#define EF_SPARK_TOTALSIZE (EB_SPARK_SIZE + EB_UTTIME_SIZE) + + if ((name=(char *)malloc(strlen(z->name)+1))==NULL) { + fprintf(stderr," set_extra_field: not enough memory for directory name\n"); + return ZE_MEM; + } + + strcpy(name,z->name); + + if (name[strlen(name)-1]=='.') { /* remove the last '.' in directory names */ + name[strlen(name)-1]=0; + } + + z->extra=(char *)malloc(EF_SPARK_TOTALSIZE); + if (z->extra==NULL) { + fprintf(stderr," set_extra_field: not enough memory\n"); + free(name); + return ZE_MEM; + } + z->cextra = z->extra; + z->cext = z->ext = EF_SPARK_TOTALSIZE; + + block=(extra_block *)z->extra; + block->ID=SPARKID; + block->size=EB_SPARK_LEN; + block->ID_2=SPARKID_2; + block->zero=0; + + if (SWI_OS_File_5(name,NULL,&block->loadaddr,&block->execaddr, + NULL,&block->attr) != NULL) { + fprintf(stderr," OS error while set_extra_field of %s\n",name); + } + + free(name); + +#ifdef USE_EF_UT_TIME +# ifdef IZ_CHECK_TZ + if (zp_tz_is_valid) { +# endif + eb_ptr = z->extra + EB_SPARK_SIZE; + + eb_ptr[0] = 'U'; + eb_ptr[1] = 'T'; + eb_ptr[2] = EB_UT_LEN(1); /* length of data part of e.f. */ + eb_ptr[3] = 0; + eb_ptr[4] = EB_UT_FL_MTIME; + eb_ptr[5] = (char)(z_utim->mtime); + eb_ptr[6] = (char)(z_utim->mtime >> 8); + eb_ptr[7] = (char)(z_utim->mtime >> 16); + eb_ptr[8] = (char)(z_utim->mtime >> 24); +# ifdef IZ_CHECK_TZ + } +# endif +#endif /* USE_EF_UT_TIME */ + + return ZE_OK; +} + +#endif /* !UTIL */ + + +/******************************/ +/* Function version_local() */ +/******************************/ + +void version_local() +{ + static ZCONST char CompiledWith[] = "Compiled with %s%s for %s%s%s%s.\n\n"; + + printf(CompiledWith, +#ifdef __GNUC__ + "gcc ", __VERSION__, +#else +# ifdef __CC_NORCROFT + "Norcroft ", "cc", +# else + "cc", "", +# endif +#endif + + "RISC OS", + + " (Acorn Computers Ltd)", + +#ifdef __DATE__ + " on ", __DATE__ +#else + "", "" +#endif + ); + +} /* end function version_local() */ diff --git a/acorn/makefile b/acorn/makefile new file mode 100644 index 0000000..5aa1c5c --- /dev/null +++ b/acorn/makefile @@ -0,0 +1,111 @@ +# Makefile for Zip, ZipNote, ZipCloak and ZipSplit + +# add -g to CC to debug +# add -d to BIND to debug +CC = cc +BIND = link +AS = $(CC) -c +ASM = objasm +SQUEEZE = squeeze -v +E = + +# flags +# CFLAGS flags for C compile +# LFLAGS1 flags after output file spec, before obj file list +# LFLAGS2 flags after obj file list (libraries, etc) +# +LIB = +CBASE = -throwback -wn -DASMV -apcs 3/26 +CFLAGS = $(CBASE) -IC:,@. +ASMFLAGS = -Throwback -Stamp -NoCache -CloseExec -quit -apcs 3/26 +LFLAGS1 = +LFLAGS2 = $(LIB) C:o.Stubs + +# Uncomment the following line to enable support for Unix +# Extra Field (Timezone) +#CFLAGS = $(CFLAGS) -DUSE_EF_UT_TIME + +# object file lists +OBJZ = zip.o zipfile.o zipup.o fileio.o util.o globals.o crc32.o crctab.o \ + crypt.o ttyio.o riscos.o acornzip.o swiven.o + +OBJI = deflate.o trees.o +OBJA = match.o sendbits.o +OBJU = zipfile_.o fileio_.o util_.o globals.o riscos.o acornzip_.o swiven.o +OBJN = zipnote.o $(OBJU) +OBJC = zipcloak.o $(OBJU) crctab.o crypt_.o ttyio.o +OBJS = zipsplit.o $(OBJU) + +ZIP_H = zip.h ziperr.h tailor.h acorn/osdep.h acorn/riscos.h acorn/swiven.h + +all: zip zipnote zipsplit zipcloak + + +install: %.zip %.zipnote %.zipsplit %.zipcloak %.zipsfx \ + zip zipnote zipsplit zipcloak zipsfx + $(SQUEEZE) zip %.zip + $(SQUEEZE) zipnote %.zipnote + $(SQUEEZE) zipsplit %.zipsplit + $(SQUEEZE) zipcloak %.zipcloak + copy acorn.zipsfx %.zipsfx ~CVF + +# suffix rules +.SUFFIXES: _.o .o .c +.c_.o: + $(CC) $(CFLAGS) -DUTIL -c $*.c -o $*_.o +.c.o: + $(CC) $(CFLAGS) -c $< +.s.o: + $(ASM) $(ASMFLAGS) -from @*.s -to @*.o + +# rules for zip, zipnote, zipcloak and zipsplit +$(OBJZ): $(ZIP_H) +$(OBJI): $(ZIP_H) +$(OBJN): $(ZIP_H) +$(OBJS): $(ZIP_H) +$(OBJC): $(ZIP_H) +zip.o zipup.o crypt.o ttyio.o zipcloak.o crypt_.o: crypt.h +zip.o zipup.o zipnote.o zipcloak.o zipsplit.o: revision.h +zip.o crypt.o ttyio.o zipcloak.o crypt_.o: ttyio.h + +crypt_.o: crypt.c + $(CC) $(CFLAGS) -DUTIL -c c.crypt -o o.crypt_ +util_.o: util.c + $(CC) $(CFLAGS) -DUTIL -c c.util -o o.util_ +fileio_.o: fileio.c + $(CC) $(CFLAGS) -DUTIL -c c.fileio -o o.fileio_ +zipfile_.o: zipfile.c + $(CC) $(CFLAGS) -DUTIL -c c.zipfile -o o.zipfile_ +acornzip_.o: acorn/acornzip.c $(ZIP_H) + $(CC) $(CFLAGS) -DUTIL -c acorn/acornzip.c -o o.acornzip_ + +riscos.o: acorn/riscos.c acorn/riscos.h + $(CC) $(CFLAGS) -c acorn/riscos.c + +acornzip.o: acorn/acornzip.c $(ZIP_H) + $(CC) $(CFLAGS) -c acorn/acornzip.c + +match.o: acorn/match.s + $(ASM) $(ASMFLAGS) -from acorn.s.match -to o.match + +sendbits.o: acorn/sendbits.s + $(ASM) $(ASMFLAGS) -from acorn.s.sendbits -to o.sendbits + +swiven.o: acorn/swiven.s + $(ASM) $(ASMFLAGS) -from acorn.s.swiven -to o.swiven + +zip: $(OBJZ) $(OBJI) $(OBJA) + $(BIND) -o zip$(E) $(LFLAGS1) $(OBJZ) $(OBJI) $(OBJA) $(LFLAGS2) +zipnote: $(OBJN) + $(BIND) -o zipnote$(E) $(LFLAGS1) $(OBJN) $(LFLAGS2) +zipcloak: $(OBJC) + $(BIND) -o zipcloak$(E) $(LFLAGS1) $(OBJC) $(LFLAGS2) +zipsplit: $(OBJS) + $(BIND) -o zipsplit$(E) $(LFLAGS1) $(OBJS) $(LFLAGS2) + +clean: ;remove zip; remove zipcloak; + remove zipsplit; remove zipnote; + create o.!fake! 0 + wipe o.* ~cf + +# end of Makefile diff --git a/acorn/match.s b/acorn/match.s new file mode 100644 index 0000000..ee68ce6 --- /dev/null +++ b/acorn/match.s @@ -0,0 +1,217 @@ +;=========================================================================== +; Copyright (c) 1990-1999 Info-ZIP. All rights reserved. +; +; See the accompanying file LICENSE, version 1999-Oct-05 or later +; (the contents of which are also included in zip.h) for terms of use. +; If, for some reason, both of these files are missing, the Info-ZIP license +; also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html +;=========================================================================== +; match.s for ARM by Sergio Monesi. + +r0 RN 0 +r1 RN 1 +r2 RN 2 +r3 RN 3 +r4 RN 4 +r5 RN 5 +r6 RN 6 +r7 RN 7 +r8 RN 8 +r9 RN 9 +sl RN 10 +fp RN 11 +ip RN 12 +sp RN 13 +lr RN 14 +pc RN 15 + +MAX_DIST EQU 32506 +WMASK EQU 32767 +MAX_MATCH EQU 258 + + AREA |C$$code|, CODE, READONLY + + +; r1 = chain_lenght +; r2 = scan +; r3 = match +; r4 = len (tmp) +; r5 = best_len +; r6 = limit +; r7 = strend +; r8 = scan_end1 +; r9 = scan_end +; lr = window +; fp = prev + +|__max_chain_length| + IMPORT max_chain_length + DCD max_chain_length +|__window| + IMPORT window + DCD window +|__prev| + IMPORT prev + DCD prev +|__prev_length| + IMPORT prev_length + DCD prev_length +|__strstart| + IMPORT strstart + DCD strstart +|__good_match| + IMPORT good_match + DCD good_match +|__nice_match| + IMPORT nice_match + DCD nice_match +|__match_start| + IMPORT match_start + DCD match_start + + DCB "longest_match" + DCB &00,&00,&00 + DCD &ff000010 + + EXPORT longest_match +longest_match + STMFD sp!, {r4-r9,fp,lr} + + LDR fp, [pc, #|__prev|-.-8] + + LDR r1, [pc, #|__max_chain_length|-.-8] + LDR r1, [r1] + LDR lr, [pc, #|__window|-.-8] + + LDR ip, [pc, #|__strstart|-.-8] + LDR ip, [ip] + ADD r2, lr, ip + LDR r5, [pc, #|__prev_length|-.-8] + LDR r5, [r5] + SUBS ip, ip, #MAX_DIST-250 ; if r6 > MAX_DIST + SUBCSS r6, ip, #250 ; r6 = r6 - MAXDIST + MOVLS r6, #0 ; else r6 = 0 + + ADD r7, r2, #MAX_MATCH-256 + ADD r7, r7, #256 ; r7 = r2 + MAX_MATCH (=258); + + SUB ip, r5, #1 + LDRB r8, [r2, ip] + LDRB r9, [r2, r5] + + LDR ip, [pc, #|__good_match|-.-8] + LDR ip, [ip] + CMP r5, ip + MOVCS r1, r1, LSR #2 + +cycle + ADD r3, lr, r0 + + LDRB ip, [r3, r5] + CMP ip, r9 + BNE cycle_end + + SUB ip, r5, #1 + LDRB ip, [r3, ip] + CMP ip, r8 + BNE cycle_end + + LDRB ip, [r2] + LDRB r4, [r3] + CMP ip, r4 + BNE cycle_end + + LDRB ip, [r3, #1] + LDRB r4, [r2, #1] + CMP ip, r4 + BNE cycle_end + + ADD r2, r2, #2 + ADD r3, r3, #2 + +inn_cycle + LDRB ip, [r2, #1]! + LDRB r4, [r3, #1]! + CMP ip, r4 + BNE exit_inn_cycle + + LDRB ip, [r2, #1]! + LDRB r4, [r3, #1]! + CMP ip, r4 + BNE exit_inn_cycle + + LDRB ip, [r2, #1]! + LDRB r4, [r3, #1]! + CMP ip, r4 + BNE exit_inn_cycle + + LDRB ip, [r2, #1]! + LDRB r4, [r3, #1]! + CMP ip, r4 + BNE exit_inn_cycle + + LDRB ip, [r2, #1]! + LDRB r4, [r3, #1]! + CMP ip, r4 + BNE exit_inn_cycle + + LDRB ip, [r2, #1]! + LDRB r4, [r3, #1]! + CMP ip, r4 + BNE exit_inn_cycle + + LDRB ip, [r2, #1]! + LDRB r4, [r3, #1]! + CMP ip, r4 + BNE exit_inn_cycle + + LDRB ip, [r2, #1]! + LDRB r4, [r3, #1]! + CMP ip, r4 + BNE exit_inn_cycle + + CMP r2, r7 + BCC inn_cycle + +exit_inn_cycle + SUB r4, r2, r7 ; len = MAX_MATCH - (int)(strend - scan); + ADD r4, r4, #MAX_MATCH-256 + ADD r4, r4, #256 + + SUB r2, r2, r4 ; scan = strend - MAX_MATCH + + CMP r4, r5 ; if (len > best_len) { + BLE cycle_end + + LDR ip, [pc, #|__match_start|-.-8] ; match_start = cur_match; + STR r0, [ip] + MOV r5, r4 ; best_len = len; + + LDR ip, [pc, #|__nice_match|-.-8] ; if (len >= nice_match) + LDR ip, [ip] + CMP r4, ip + BGE exit_match ; break; + + SUB ip, r5, #1 ; scan_end1 = scan[best_len-1]; + LDRB r8, [r2, ip] + LDRB r9, [r2, r5] ; scan_end = scan[best_len]; + +cycle_end + MOV ip, r0, LSL #17 ; cur_match & WMASK + MOV ip, ip, LSR #17 + + LDR r0, [fp, ip, ASL #1] ; cur_match = prev[cur_match & WMASK] + MOV r0, r0, ASL #16 + MOV r0, r0, LSR #16 + + CMP r0, r6 ; cur_match > limit + BLS exit_match + SUBS r1, r1, #1 ; --chain_length + BNE cycle ; chain_length != 0 + +exit_match + MOV r0, r5 + + LDMFD sp!, {r4-r9,fp,pc}^ + + END diff --git a/acorn/osdep.h b/acorn/osdep.h new file mode 100644 index 0000000..ea002ef --- /dev/null +++ b/acorn/osdep.h @@ -0,0 +1,28 @@ +/* + Copyright (c) 1990-2005 Info-ZIP. All rights reserved. + + See the accompanying file LICENSE, version 2004-May-22 or later + (the contents of which are also included in zip.h) for terms of use. + If, for some reason, all these files are missing, the Info-ZIP license + also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html +*/ +#include "riscos.h" + +#define RISCOS +#define NO_SYMLINK +#define NO_FCNTL_H +#define NO_UNISTD_H +#define NO_MKTEMP + +#define PROCNAME(n) (action == ADD || action == UPDATE ? wild(n) : \ + procname(n, 1)) + +#define isatty(a) 1 +#define fseek(f,o,t) riscos_fseek((f),(o),(t)) + +#define localtime riscos_localtime +#define gmtime riscos_gmtime + +#ifdef ZCRYPT_INTERNAL +# define ZCR_SEED2 (unsigned)3141592654L /* use PI as seed pattern */ +#endif diff --git a/acorn/riscos.c b/acorn/riscos.c new file mode 100644 index 0000000..eb1b897 --- /dev/null +++ b/acorn/riscos.c @@ -0,0 +1,394 @@ +/* + Copyright (c) 1990-2005 Info-ZIP. All rights reserved. + + See the accompanying file LICENSE, version 2004-May-22 or later + (the contents of which are also included in zip.h) for terms of use. + If, for some reason, all these files are missing, the Info-ZIP license + also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html +*/ +/* riscos.c */ + +#include +#include +#include +#include "zip.h" +#include "riscos.h" + +#define MAXEXT 256 + +/* External globals */ +extern int scanimage; + +/* Local globals (!?!?) */ +char *exts2swap = NULL; /* Extensions to swap (actually, directory names) */ + +int stat(char *filename,struct stat *res) +{ + int attr; /* object attributes */ + unsigned int load; /* load address */ + unsigned int exec; /* exec address */ + int type; /* type: 0 not found, 1 file, 2 dir, 3 image */ + + if (!res) + return -1; + + if (SWI_OS_File_5(filename,&type,&load,&exec,(int *)&res->st_size,&attr)!=NULL) + return -1; + + if (type==0) + return -1; + + res->st_dev=0; + res->st_ino=0; + res->st_nlink=0; + res->st_uid=1; + res->st_gid=1; + res->st_rdev=0; + res->st_blksize=1024; + + res->st_mode = ((attr & 0001) << 8) | ((attr & 0002) << 6) | + ((attr & 0020) >> 2) | ((attr & 0040) >> 4); + + switch (type) { + case 1: /* File */ + res->st_mode |= S_IFREG; + break; + case 2: /* Directory */ + res->st_mode |= S_IFDIR | 0700; + break; + case 3: /* Image file */ + if (scanimage) + res->st_mode |= S_IFDIR | 0700; + else + res->st_mode |= S_IFREG; + break; + } + + if ((((unsigned int) load) >> 20) == 0xfff) { /* date stamped file */ + unsigned int t1, t2, tc; + + t1 = (unsigned int) (exec); + t2 = (unsigned int) (load & 0xff); + + tc = 0x6e996a00U; + if (t1 < tc) + t2--; + t1 -= tc; + t2 -= 0x33; /* 00:00:00 Jan. 1 1970 = 0x336e996a00 */ + + t1 = (t1 / 100) + (t2 * 42949673U); /* 0x100000000 / 100 = 42949672.96 */ + t1 -= (t2 / 25); /* compensate for .04 error */ + + res->st_atime = res->st_mtime = res->st_ctime = t1; + } + else + res->st_atime = res->st_mtime = res->st_ctime = 0; + + return 0; +} + +#ifndef SFX + +DIR *opendir(char *dirname) +{ + DIR *thisdir; + int type; + int attr; + os_error *er; + + thisdir=(DIR *)malloc(sizeof(DIR)); + if (thisdir==NULL) + return NULL; + + thisdir->dirname=(char *)malloc(strlen(dirname)+1); + if (thisdir->dirname==NULL) { + free(thisdir); + return NULL; + } + + strcpy(thisdir->dirname,dirname); + if (thisdir->dirname[strlen(thisdir->dirname)-1]=='.') + thisdir->dirname[strlen(thisdir->dirname)-1]=0; + + if (er=SWI_OS_File_5(thisdir->dirname,&type,NULL,NULL,NULL,&attr),er!=NULL || + type<=1 || (type==3 && !scanimage)) + { + free(thisdir->dirname); + free(thisdir); + return NULL; + } + + thisdir->buf=malloc(DIR_BUFSIZE); + if (thisdir->buf==NULL) { + free(thisdir->dirname); + free(thisdir); + return NULL; + } + + thisdir->size=DIR_BUFSIZE; + thisdir->offset=0; + thisdir->read=0; + + return thisdir; +} + +struct dirent *readdir(DIR *d) +{ + static struct dirent dent; + + if (d->read==0) { /* no more objects read in the buffer */ + if (d->offset==-1) { /* no more objects to read */ + return NULL; + } + + d->read=255; + if (SWI_OS_GBPB_9(d->dirname,d->buf,&d->read,&d->offset,DIR_BUFSIZE,NULL)!=NULL) + return NULL; + + if (d->read==0) { + d->offset=-1; + return NULL; + } + d->read--; + d->act=(char *)d->buf; + } + else { /* some object is ready in buffer */ + d->read--; + d->act=(char *)(d->act+strlen(d->act)+1); + } + + strcpy(dent.d_name,d->act); + dent.d_namlen=strlen(dent.d_name); + + return &dent; +} + +void closedir(DIR *d) +{ + if (d->buf!=NULL) + free(d->buf); + if (d->dirname!=NULL) + free(d->dirname); + free(d); +} + +int unlink(f) +char *f; /* file to delete */ +/* Delete the file *f, returning non-zero on failure. */ +{ + os_error *er; + char canon[256]; + int size=255; + + er=SWI_OS_FSControl_37(f,canon,&size); + if (er==NULL) { + er=SWI_OS_FSControl_27(canon,0x100); + } + else { + er=SWI_OS_FSControl_27(f,0x100); + } + return (int)er; +} + +int deletedir(char *d) +{ + int objtype; + char *s; + int len; + os_error *er; + + len = strlen(d); + if ((s = malloc(len + 1)) == NULL) + return -1; + + strcpy(s,d); + if (s[len-1]=='.') + s[len-1]=0; + + if (er=SWI_OS_File_5(s,&objtype,NULL,NULL,NULL,NULL),er!=NULL) { + free(s); + return -1; + } + if (objtype<2 || (!scanimage && objtype==3)) { + /* this is a file or it doesn't exist */ + free(s); + return -1; + } + + if (er=SWI_OS_File_6(s),er!=NULL) { + /* maybe this is a problem with the DDEUtils module, try to canonicalise the path */ + char canon[256]; + int size=255; + + if (er=SWI_OS_FSControl_37(s,canon,&size),er!=NULL) { + free(s); + return -1; + } + if (er=SWI_OS_File_6(canon),er!=NULL) { + free(s); + return -1; + } + } + free(s); + return 0; +} + +#endif /* !SFX */ + +int chmod(char *file, int mode) +{ +/*************** NOT YET IMPLEMENTED!!!!!! ******************/ +/* I don't know if this will be needed or not... */ + file=file; + mode=mode; + return 0; +} + +void setfiletype(char *fname,int ftype) +{ + char str[256]; + sprintf(str,"SetType %s &%3.3X",fname,ftype); + SWI_OS_CLI(str); +} + +void getRISCOSexts(char *envstr) +{ + char *envptr; /* value returned by getenv */ + + envptr = getenv(envstr); + if (envptr == NULL || *envptr == 0) return; + + exts2swap=malloc(1+strlen(envptr)); + if (exts2swap == NULL) + return; + + strcpy(exts2swap, envptr); +} + +int checkext(char *suff) +{ + register char *extptr=exts2swap; + register char *suffptr; + register int e,s; + + if (extptr != NULL) while(*extptr) { + suffptr=suff; + e=*extptr; s=*suffptr; + while (e && e!=':' && s && s!='.' && s!='/' && e==s) { + e=*++extptr; s=*++suffptr; + } + if (e==':') e=0; + if (s=='.' || s=='/') s=0; + if (!e && !s) { + return 1; + } + while(*extptr!=':' && *extptr!='\0') /* skip to next extension */ + extptr++; + if (*extptr!='\0') + extptr++; + } + return 0; +} + +int swapext(char *name, char *exptr) +{ + char *ext; + char *p1=exptr; + char *p2; + int extchar=*exptr; + unsigned int i=0; + + while(*++p1 && *p1!='.' && *p1!='/') + ; + ext=malloc(i=p1-exptr); + if (!ext) + return 1; + memcpy(ext, exptr+1, i); + p2=exptr-1; + p1=exptr+i-1; + while(p2 >= name) + *p1--=*p2--; + strcpy(name,ext); + *p1=(extchar=='/'?'.':'/'); + free(ext); + return 0; +} + +void remove_prefix(void) +{ + SWI_DDEUtils_Prefix(NULL); +} + +void set_prefix(void) +{ + char *pref; + int size=0; + + if (SWI_OS_FSControl_37("@",pref,&size)!=NULL) + return; + + size=1-size; + + if (pref=malloc(size),pref!=NULL) { + if (SWI_OS_FSControl_37("@",pref,&size)!=NULL) { + free(pref); + return; + } + + if (SWI_DDEUtils_Prefix(pref)==NULL) { + atexit(remove_prefix); + } + + free(pref); + } +} + +#ifdef localtime +# undef localtime +#endif + +#ifdef gmtime +# undef gmtime +#endif + +/* Acorn's implementation of localtime() and gmtime() + * doesn't consider the timezone offset, so we have to + * add it before calling the library functions + */ + +struct tm *riscos_localtime(const time_t *timer) +{ + time_t localt=*timer; + + localt+=SWI_Read_Timezone()/100; + + return localtime(&localt); +} + +struct tm *riscos_gmtime(const time_t *timer) +{ + time_t localt=*timer; + + localt+=SWI_Read_Timezone()/100; + + return gmtime(&localt); +} + + +int riscos_fseek(FILE *fd, long offset, int whence) +{ + int ret; + switch (whence) + { + case SEEK_END: + ret = (fseek) (fd, 0, SEEK_END); + if (ret) + return ret; + /* fall through */ + case SEEK_CUR: + offset += ftell (fd); + /* fall through */ + default: /* SEEK_SET */ + return (fseek) (fd, offset < 0 ? 0 : offset, SEEK_SET); + } +} diff --git a/acorn/riscos.h b/acorn/riscos.h new file mode 100644 index 0000000..2bbd72e --- /dev/null +++ b/acorn/riscos.h @@ -0,0 +1,119 @@ +/* + Copyright (c) 1990-2005 Info-ZIP. All rights reserved. + + See the accompanying file LICENSE, version 2004-May-22 or later + (the contents of which are also included in zip.h) for terms of use. + If, for some reason, both of these files are missing, the Info-ZIP license + also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.htmlse.html +*/ +/* riscos.h */ + +#ifndef __riscos_h +#define __riscos_h + +#include +#include + +typedef struct { + int errnum; + char errmess[252]; +} os_error; + +#ifndef __swiven_h +# include "swiven.h" +#endif + +#define MAXPATHLEN 256 +#define MAXFILENAMELEN 64 /* should be 11 for ADFS, 13 for DOS, 64 seems a sensible value... */ +#define DIR_BUFSIZE 1024 /* this should be enough to read a whole E-Format directory */ + +struct stat { + unsigned int st_dev; + int st_ino; + unsigned int st_mode; + int st_nlink; + unsigned short st_uid; + unsigned short st_gid; + unsigned int st_rdev; + unsigned int st_size; + unsigned int st_blksize; + time_t st_atime; + time_t st_mtime; + time_t st_ctime; +}; + +typedef struct { + char *dirname; + void *buf; + int size; + char *act; + int offset; + int read; +} DIR; + +#define dstrm DIR + +struct dirent { + unsigned int d_off; /* offset of next disk directory entry */ + int d_fileno; /* file number of entry */ + size_t d_reclen; /* length of this record */ + size_t d_namlen; /* length of d_name */ + char d_name[MAXFILENAMELEN]; /* name */ +}; + +typedef struct { + unsigned int load_addr; + unsigned int exec_addr; + int lenght; + int attrib; + int objtype; + char name[13]; +} riscos_direntry; + +#define SPARKID 0x4341 /* = "AC" */ +#define SPARKID_2 0x30435241 /* = "ARC0" */ + +typedef struct { + short ID; + short size; + int ID_2; + unsigned int loadaddr; + unsigned int execaddr; + int attr; + int zero; +} extra_block; + + +#define S_IFMT 0770000 + +#define S_IFDIR 0040000 +#define S_IFREG 0100000 /* 0200000 in UnixLib !?!?!?!? */ + +#ifndef S_IEXEC +# define S_IEXEC 0000100 +# define S_IWRITE 0000200 +# define S_IREAD 0000400 +#endif + +extern char *exts2swap; /* Extensions to swap */ + +int stat(char *filename,struct stat *res); +DIR *opendir(char *dirname); +struct dirent *readdir(DIR *d); +char *readd(DIR *d); +void closedir(DIR *d); +int unlink(char *f); +int chmod(char *file, int mode); +void setfiletype(char *fname,int ftype); +void getRISCOSexts(char *envstr); +int checkext(char *suff); +int swapext(char *name, char *exptr); +void remove_prefix(void); +void set_prefix(void); +struct tm *riscos_localtime(const time_t *timer); +struct tm *riscos_gmtime(const time_t *timer); + +int riscos_fseek(FILE *fd, long offset, int whence); +/* work around broken assumption that fseek() is OK with -ve file offsets */ + +#endif /* !__riscos_h */ diff --git a/acorn/sendbits.s b/acorn/sendbits.s new file mode 100644 index 0000000..f12921a --- /dev/null +++ b/acorn/sendbits.s @@ -0,0 +1,105 @@ +;=========================================================================== +; Copyright (c) 1990-1999 Info-ZIP. All rights reserved. +; +; See the accompanying file LICENSE, version 1999-Oct-05 or later +; (the contents of which are also included in zip.h) for terms of use. +; If, for some reason, both of these files are missing, the Info-ZIP license +; also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html +;=========================================================================== +; sendbits.s for ARM by Sergio Monesi and Darren Salt. + +r0 RN 0 +r1 RN 1 +r2 RN 2 +r3 RN 3 +r4 RN 4 +r5 RN 5 +r6 RN 6 +r7 RN 7 +r8 RN 8 +r9 RN 9 +sl RN 10 +fp RN 11 +ip RN 12 +sp RN 13 +lr RN 14 +pc RN 15 + + AREA |Asm$$Code|, CODE, READONLY + + = "send_bits",0 + ALIGN + & &FF00000C + + IMPORT __rt_stkovf_split_small + IMPORT flush_outbuf + + IMPORT bi_valid + IMPORT bi_buf + IMPORT out_size + IMPORT out_offset + IMPORT out_buf + + EXPORT send_bits +send_bits + MOV ip,sp + STMDB sp!,{r4,r5,fp,ip,lr,pc} + SUB fp,ip,#4 + LDR r5,=bi_buf + LDR r3,=bi_valid + LDR r4,[r5] + LDR r2,[r3] + ORR r4,r4,r0,LSL r2 ; |= value<= out_size-1 + LDRHS r0,=out_buf + LDRHS r0,[r0] + BLHS flush_outbuf ; then flush the buffer + LDR r0,=out_buf + LDR r1,=out_offset + LDR r0,[r0] + LDR r2,[r1] + MOV r5,r4,LSR #8 + STRB r4,[r0,r2]! ; store 'old' bi_buf + STRB r5,[r0,#1] + ADD r2,r2,#2 + STR r2,[r1] + + LDMDB fp,{r4,r5,fp,sp,pc}^ + + +ptr_bi & bi_valid + & bi_buf + + + = "bi_reverse",0 + ALIGN + & &FF00000C + + EXPORT bi_reverse +bi_reverse + MOV r2,#0 +loop MOVS r0,r0,LSR #1 + ADCS r2,r2,r2 + SUBS r1,r1,#1 + BNE loop + MOV r0,r2 + MOVS pc,lr + + + END diff --git a/acorn/srcrename b/acorn/srcrename new file mode 100644 index 0000000..7bd6119 Binary files /dev/null and b/acorn/srcrename differ diff --git a/acorn/swiven.h b/acorn/swiven.h new file mode 100644 index 0000000..c860d7d --- /dev/null +++ b/acorn/swiven.h @@ -0,0 +1,59 @@ +/* + Copyright (c) 1990-1999 Info-ZIP. All rights reserved. + + See the accompanying file LICENSE, version 1999-Oct-05 or later + (the contents of which are also included in zip.h) for terms of use. + If, for some reason, both of these files are missing, the Info-ZIP license + also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html +*/ +/* swiven.h */ + +#ifndef __swiven_h +#define __swiven_h + +os_error *SWI_OS_FSControl_26(char *source, char *dest, int actionmask); +/* copy */ + +os_error *SWI_OS_FSControl_27(char *filename, int actionmask); +/* wipe */ + +os_error *SWI_OS_GBPB_9(char *dirname, void *buf, int *number, + int *offset, int size, char *match); +/* read dir */ + +os_error *SWI_OS_File_1(char *filename, unsigned int loadaddr, + unsigned int execaddr, int attrib); +/* write file attributes */ + +os_error *SWI_OS_File_5(char *filename, int *objtype, unsigned int *loadaddr, + unsigned int *execaddr, int *length, int *attrib); +/* read file info */ + +os_error *SWI_OS_File_6(char *filename); +/* delete */ + +os_error *SWI_OS_File_7(char *filename, int loadaddr, int execaddr, int size); +/* create an empty file */ + +os_error *SWI_OS_CLI(char *cmd); +/* execute a command */ + +int SWI_OS_ReadC(void); +/* get a key from the keyboard buffer */ + +os_error *SWI_OS_ReadVarVal(char *var, char *buf, int len, int *bytesused); +/* reads an OS varibale */ + +os_error *SWI_OS_FSControl_54(char *buffer, int dir, char *fsname, int *size); +/* reads the path of a specified directory */ + +os_error *SWI_OS_FSControl_37(char *pathname, char *buffer, int *size); +/* canonicalise path */ + +os_error *SWI_DDEUtils_Prefix(char *dir); +/* sets the 'prefix' directory */ + +int SWI_Read_Timezone(void); +/* returns the timezone offset (centiseconds) */ + +#endif /* !__swiven_h */ diff --git a/acorn/swiven.s b/acorn/swiven.s new file mode 100644 index 0000000..1630124 --- /dev/null +++ b/acorn/swiven.s @@ -0,0 +1,276 @@ +;=========================================================================== +; Copyright (c) 1990-1999 Info-ZIP. All rights reserved. +; +; See the accompanying file LICENSE, version 1999-Oct-05 or later +; (the contents of which are also included in zip.h) for terms of use. +; If, for some reason, both of these files are missing, the Info-ZIP license +; also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html +;=========================================================================== +; SWI veneers used by Zip/Unzip +; + +r0 RN 0 +r1 RN 1 +r2 RN 2 +r3 RN 3 +r4 RN 4 +r5 RN 5 +r6 RN 6 +r7 RN 7 +r8 RN 8 +r9 RN 9 +r10 RN 10 +r11 RN 11 +r12 RN 12 +sp RN 13 +lr RN 14 +pc RN 15 + +sl RN 10 +fp RN 11 +ip RN 12 + + +XOS_Bit EQU &020000 + +OS_GBPB EQU &00000C +OS_File EQU &000008 +OS_FSControl EQU &000029 +OS_CLI EQU &000005 +OS_ReadC EQU &000004 +OS_ReadVarVal EQU &000023 +DDEUtils_Prefix EQU &042580 +Territory_ReadCurrentTimeZone EQU &043048 + + MACRO + STARTCODE $name + EXPORT $name +$name + MEND + + + AREA |C$$code|, CODE, READONLY + +; os_error *SWI_OS_FSControl_26(char *source, char *dest, int actionmask); + + STARTCODE SWI_OS_FSControl_26 + + MOV ip, lr + + MOV r3, r2 + MOV r2, r1 + MOV r1, r0 + MOV r0, #26 + + SWI OS_FSControl + XOS_Bit + + MOVVC r0, #0 + + MOVS pc, ip + + +; os_error *SWI_OS_FSControl_27(char *filename, int actionmask); + + STARTCODE SWI_OS_FSControl_27 + + MOV ip, lr + + MOV r3, r1 + MOV r1, r0 + MOV r0, #27 + + SWI OS_FSControl + XOS_Bit + + MOVVC r0, #0 + + MOVS pc, ip + + +; os_error *SWI_OS_GBPB_9(char *dirname, void *buf, int *number, +; int *offset, int size, char *match); + + STARTCODE SWI_OS_GBPB_9 + + MOV ip, sp + STMFD sp!, {r2-r6,lr} + LDMIA ip, {r5,r6} + LDR r4, [r3] + LDR r3, [r2] + MOV r2, r1 + MOV r1, r0 + MOV r0, #9 + SWI OS_GBPB + XOS_Bit + LDMVSFD sp!, {r2-r6,pc}^ + MOV r0, #0 + LDMFD sp, {r5,r6} + STR r3, [r5] + STR r4, [r6] + LDMFD sp!, {r2-r6,pc}^ + + +; os_error *SWI_OS_File_1(char *filename, int loadaddr, int execaddr, int attrib); + + STARTCODE SWI_OS_File_1 + + STMFD sp!, {r5,lr} + MOV r5, r3 + MOV r3, r2 + MOV r2, r1 + MOV r1, r0 + MOV r0, #1 + SWI OS_File + XOS_Bit + MOVVC r0, #0 + LDMFD sp!, {r5,pc}^ + + + +; os_error *SWI_OS_File_5(char *filename, int *objtype, int *loadaddr, +; int *execaddr, int *length, int *attrib); + + STARTCODE SWI_OS_File_5 + + STMFD sp!, {r1-r5,lr} + MOV r1, r0 + MOV r0, #5 + SWI OS_File + XOS_Bit + LDMVSFD sp!, {r1-r5,pc}^ + LDR lr, [sp] + TEQ lr, #0 + STRNE r0, [lr] + LDR lr, [sp, #4] + TEQ lr ,#0 + STRNE r2, [lr] + LDR lr, [sp, #8] + TEQ lr, #0 + STRNE r3, [lr] + LDR lr, [sp ,#24] + TEQ lr, #0 + STRNE r4, [lr] + LDR lr, [sp ,#28] + TEQ lr, #0 + STRNE r5, [lr] + MOV r0, #0 + LDMFD sp!, {r1-r5,pc}^ + + +; os_error *SWI_OS_File_6(char *filename); + + STARTCODE SWI_OS_File_6 + + STMFD sp!, {r4-r5,lr} + MOV r1, r0 + MOV r0, #6 + SWI OS_File + XOS_Bit + MOVVC r0, #0 + LDMFD sp!, {r4-r5,pc}^ + + +; os_error *SWI_OS_File_7(char *filename, int loadaddr, int execaddr, int size); + + STARTCODE SWI_OS_File_7 + + STMFD sp!, {r4-r5,lr} + MOV r5, r3 + MOV r4, #0 + MOV r3, r2 + MOV r2, r1 + MOV r1, r0 + MOV r0, #7 + SWI OS_File + XOS_Bit + MOVVC r0, #0 + LDMFD sp!, {r4-r5,pc}^ + + +; os_error *SWI_OS_CLI(char *cmd); + + STARTCODE SWI_OS_CLI + + MOV ip, lr + SWI OS_CLI + XOS_Bit + MOVVC r0, #0 + MOVS pc, ip + + +; int SWI_OS_ReadC(void); + + STARTCODE SWI_OS_ReadC + + MOV ip, lr + SWI OS_ReadC + XOS_Bit + MOVS pc, ip + + +; os_error *SWI_OS_ReadVarVal(char *var, char *buf, int len, int *bytesused); + + STARTCODE SWI_OS_ReadVarVal + + STMFD sp!, {r4,lr} + MOV ip, r3 + MOV r3, #0 + MOV r4, #0 + SWI OS_ReadVarVal + XOS_Bit + LDMVSFD sp!, {r4,pc}^ + TEQ ip, #0 + STRNE r2, [ip] + MOV r0, #0 + LDMFD sp!, {r4,pc}^ + + +; os_error *SWI_OS_FSControl_54(char *buffer, int dir, char *fsname, int *size); + + STARTCODE SWI_OS_FSControl_54 + + STMFD sp!, {r3-r6,lr} + LDR r5, [r3] + MOV r3, r2 + MOV r2, r1 + MOV r1, r0 + MOV r0, #54 + SWI OS_FSControl + XOS_Bit + LDMVSFD sp!, {r3-r6,pc}^ + MOV r0, #0 + LDMFD sp!, {r3} + STR r5, [r3] + LDMFD sp!, {r4-r6,pc}^ + + +; os_error *SWI_OS_FSControl_37(char *pathname, char *buffer, int *size); + + STARTCODE SWI_OS_FSControl_37 + + STMFD sp!, {r2,r3-r5,lr} + LDR r5, [r2] + MOV r3, #0 + MOV r4, #0 + MOV r2, r1 + MOV r1, r0 + MOV r0, #37 + SWI OS_FSControl + XOS_Bit + LDMVSFD sp!, {r2,r3-r5,pc}^ + MOV r0, #0 + LDMFD sp!, {r2} + STR r5, [r2] + LDMFD sp!, {r3-r5,pc}^ + + +; os_error *SWI_DDEUtils_Prefix(char *dir); + + STARTCODE SWI_DDEUtils_Prefix + + MOV ip, lr + SWI DDEUtils_Prefix + XOS_Bit + MOVVC r0, #0 + MOVS pc, ip + +; int SWI_Read_Timezone(void); + + STARTCODE SWI_Read_Timezone + + MOV ip, lr + SWI Territory_ReadCurrentTimeZone + XOS_Bit + MOVVC r0, r1 + MOVVS r0, #0 + MOVS pc, ip + + + END diff --git a/acorn/zipup.h b/acorn/zipup.h new file mode 100644 index 0000000..47c3536 --- /dev/null +++ b/acorn/zipup.h @@ -0,0 +1,16 @@ +/* + Copyright (c) 1990-1999 Info-ZIP. All rights reserved. + + See the accompanying file LICENSE, version 1999-Oct-05 or later + (the contents of which are also included in zip.h) for terms of use. + If, for some reason, both of these files are missing, the Info-ZIP license + also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html +*/ +#define fhow "r" +#define fbad (NULL) +typedef FILE *ftype; +#define zopen(n,p) fopen(n,p) +#define zread(f,b,n) fread((b),1,(n),(FILE*)(f)) +#define zclose(f) fclose(f) +#define zerr(f) (k==(extent)(-1L)) +#define zstdin 0 diff --git a/amiga/LMKfile b/amiga/LMKfile new file mode 100644 index 0000000..6b6aa40 --- /dev/null +++ b/amiga/LMKfile @@ -0,0 +1,116 @@ +# Makefile for Zip, ZipNote, ZipCloak and ZipSplit, Amiga SAS/C 5.10b +# See the master Makefile under the top level Zip/Unzip source directory +# for more information on compiler macros and flags for this version. +# Last update: Jun 25, 1998 +# -John Bush, , + + +####################### +# MACROBE DEFINITIONS # +####################### + +# Compiler and loader debug flags. Omit comments as req'd. +# Do not set when building production version. +# CDBG = -d3 +# LDBG = ADDSYM + +DEFINES = -DNO_MKTEMP +CC = lc +OPT = -O +CFLAGS = $(OPT) $(DEFINES) $(CDBG) -v -mat -cuisf -b0 -j85i86i87i100i + +LD = blink +LDSTART = LIB:c.o +LDFLAGS = LIB LIB:lc.lib+LIB:amiga.lib + +TMPFILE = ram:MakeZip.tmp + +############################################### +# BASIC COMPILE INSTRUCTIONS AND DEPENDENCIES # +############################################### + +# default C rules +.c.o: + $(CC) $(CFLAGS) -o$@ $*.c + +# Alternate rules for routines containing entries needed by utilities +.c.oo: + $(CC) $(CFLAGS) -DUTIL -o$*.oo $*.c + +# object file macrough lists + +HFILES = zip.h ziperr.h tailor.h revision.h crypt.h ttyio.h amiga/amiga.h \ + amiga/zipup.h amiga/osdep.h + +OBJA = zipfile.o zipup.o fileio.o util.o globals.o crc32.o crctab.o crypt.o \ + ttyio.o amiga.o amigazip.o time_lib.o +OBJI = deflate.o trees.o +OBJU = zipfile.oo fileio.oo util.oo globals.o amiga.o amigazip.oo time_lib.o + +OBJZ = zip.o $(OBJA) $(OBJI) + +OBJN = zipnote.o $(OBJU) +OBJC = zipcloak.o $(OBJU) crctab.o crypt.oo ttyio.o +OBJS = zipsplit.o $(OBJU) + +ZIPS = zip zipnote zipcloak zipsplit + +all: Message $(ZIPS) + +Message: + -echo " " + -echo "WARNING: Lattice 5.x HAS NOT BEEN TESTED WITH THIS ZIP VERSION" + -echo "Report problems to " + -echo " " + +zip: $(OBJZ) $(HFILES) + -echo "$(OBJZ)" > $(TMPFILE) + $(LD) TO Zip FROM $(LDSTART) WITH $(TMPFILE) $(LDFLAGS) $(LDBG) + -delete $(TMPFILE) Zip.info + +zipnote: $(OBJN) $(HFILES) + -echo "$(OBJN)" > $(TMPFILE) + $(LD) TO ZipNote FROM $(LDSTART) WITH $(TMPFILE) $(LDFLAGS) $(LDBG) + -delete $(TMPFILE) ZipNote.info + +zipcloak: $(OBJC) $(HFILES) + -echo "$(OBJC)" > $(TMPFILE) + $(LD) TO ZipCloak FROM $(LDSTART) WITH $(TMPFILE) $(LDFLAGS) $(LDBG) + -delete $(TMPFILE) ZipCloak.info + +zipsplit: $(OBJS) $(HFILES) + -echo "$(OBJS)" > $(TMPFILE) + $(LD) TO ZipSplit FROM $(LDSTART) WITH $(TMPFILE) $(LDFLAGS) $(LDBG) + -delete $(TMPFILE) ZipSplit.info + +clean: + -delete $(OBJZ) all quiet force >nil: + -delete $(OBJU) all quiet force >nil: + -delete $(OBJA) all quiet force >nil: + -delete $(OBJI) all quiet force >nil: + -delete $(OBJN) all quiet force >nil: + -delete $(OBJC) all quiet force >nil: + -delete $(OBJS) all quiet force >nil: + +zip.o: zip.c $(HFILES) +zipnote.o: zipnote.c $(HFILES) +zipcloak.o: zipcloak.c $(HFILES) +crypt.o: crypt.c $(HFILES) +ttyio.o: ttyio.c $(HFILES) +zipsplit.o: zipsplit.c $(HFILES) +deflate.o: deflate.c $(HFILES) +trees.o: trees.c $(HFILES) +zipfile.o: zipfile.c $(HFILES) +zipup.o: zipup.c $(HFILES) +fileio.o: fileio.c $(HFILES) +util.o: util.c $(HFILES) +crc32.o: crc32.c $(HFILES) +crctab.o: crctab.c $(HFILES) +globals.o: globals.c $(HFILES) + +# Amiga specific objects +amiga.o: amiga/amiga.c $(HFILES) +amigazip.o: amiga/amigazip.c $(HFILES) +time_lib.o: amiga/time_lib.c + +# end of Makefile diff --git a/amiga/README b/amiga/README new file mode 100644 index 0000000..861ff85 --- /dev/null +++ b/amiga/README @@ -0,0 +1 @@ +the -A option currently does not work for the amiga. diff --git a/amiga/amiga.c b/amiga/amiga.c new file mode 100644 index 0000000..93bd495 --- /dev/null +++ b/amiga/amiga.c @@ -0,0 +1,143 @@ +/* + Copyright (c) 1990-2005 Info-ZIP. All rights reserved. + + See the accompanying file LICENSE, version 2004-May-22 or later + (the contents of which are also included in zip.h) for terms of use. + If, for some reason, both of these files are missing, the Info-ZIP license + also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html +*/ +/* OS specific routines for AMIGA platform. + * + * John Bush BIX: jbush + * Paul Kienitz + * + * History: + * + * Date DoBee Comments + * ------- -------- ----------------------------------------------- + * 21Jan93 JBush Original coding. + * Incorporated filedate.c (existing routine). + * + * 31Jan93 JBush Made filedate.c include unconditional. + * + * 18Jul93 PaulK Moved Aztec _abort() here from stat.c because we + * can't share the same one between Zip and UnZip. + * Added close_leftover_open_dirs() call to it. + * + * 17Apr95 PaulK Added Amiga internal version string so that + * installer programs can compare the version being + * installed to see if the copy the user already has + * is older or newer. Added Prestart_Hook to support + * debug tracing in deflate.a. + * + * 6May95 PaulK Added GetComment() for filenote support. + * + * 12Nov95 PaulK Added #define ZIP in front of filedate.c, for + * new options in there; removed declare of set_con() + * since echon() no longer expands to it (or anything). + * + * 12Feb96 PaulK Removed call of echon() entirely. + * + * 12Jul97 PaulK Made both Aztec and SAS define USE_TIME_LIB for filedate.c + * + * 26Aug97 PaulK Added ClearIOErr_exit() + * + * 2Jan98 HWalt Adapted for SAS/C using stat.c replacement functions + */ + +#include +#ifdef AZTEC_C +# include +# include +# include +# include +# include +# include +#else +# include +# include +#endif +#include + +#ifndef ZCONST +# define ZCONST const +#endif +#include "ziperr.h" +void ziperr(int c, ZCONST char *h); + +#if defined(AZTEC_C) || defined(__SASC) +# define USE_TIME_LIB +#endif + +#define ZIP +#if !defined(UTIL) && !defined(USE_TIME_LIB) +# define NO_MKTIME +#endif + +#ifdef AZTEC_C + +/* ============================================================= */ +/* filedate.c is an external file, since it's shared with UnZip. */ +/* Aztec includes it here, but SAS/C now compiles it separately. */ +# include "amiga/filedate.c" + +/* the same applies to stat.c */ +# include "amiga/stat.c" + +# define setenv BOGUS_INCOMPATIBLE_setenv +# include +# undef setenv +# ifdef DEBUG +# define PRESTART_HOOK +# endif +#endif + +extern void close_leftover_open_dirs(void); + + +/* the following handles cleanup when a ^C interrupt happens: */ + +void _abort(void) /* called when ^C is pressed */ +{ + close_leftover_open_dirs(); + ziperr(ZE_ABORT, "^C"); +} + +void ClearIOErr_exit(int e) /* EXIT is defined as this */ +{ + if (!e) + ((struct Process *) FindTask(NULL))->pr_Result2 = 0; + /* we clear IoErr() since we are successful, in a 1.x-compatible way */ + exit(e); +} + + +/* Make sure the version number here matches the number in revision.h */ +/* as closely as possible in strict decimal "#.#" form: */ +const char version_id[] = "\0$VER: Zip 2.3 (" +# include "env:VersionDate" +")\r\n"; + +/* call this with an arg of NULL to free storage: */ + +char *GetComment(char *filename) +{ + BPTR lk; + static struct FileInfoBlock *fib = NULL; + + if (!filename) { + if (fib) FreeMem(fib, sizeof(*fib)); + fib = NULL; + return NULL; + } + if (!fib) { + if (!(fib = AllocMem(sizeof(*fib), MEMF_PUBLIC))) + ziperr(ZE_MEM, "was checking filenotes"); + } + if (!(lk = Lock(filename, ACCESS_READ))) + return NULL; + if (!Examine(lk, fib)) + fib->fib_Comment[0] = '\0'; + UnLock(lk); + return fib->fib_Comment[0] ? &fib->fib_Comment[0] : NULL; +} diff --git a/amiga/amiga.h b/amiga/amiga.h new file mode 100644 index 0000000..a1461d8 --- /dev/null +++ b/amiga/amiga.h @@ -0,0 +1,54 @@ +/* + Copyright (c) 1990-1999 Info-ZIP. All rights reserved. + + See the accompanying file LICENSE, version 1999-Oct-05 or later + (the contents of which are also included in zip.h) for terms of use. + If, for some reason, both of these files are missing, the Info-ZIP license + also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html +*/ +#ifndef __amiga_amiga_h +#define __amiga_amiga_h + +/* amiga.h + * + * Globular definitions that affect all of AmigaDom. + * + * Originally included in unzip.h, extracted for simplicity and eeze of + * maintenance by John Bush. + * + * This version is for use with Zip. It is not globally included, but used + * only by functions in amiga/amigazip.c. Much material that was needed for + * UnZip is absent here. + * + */ + +#include /* O_BINARY for open() w/o CR/LF translation */ +#include "amiga/z-stat.h" /* substitute for and */ +#define direct dirent + +#ifndef MODERN +# define MODERN +#endif + +#ifdef AZTEC_C /* Manx Aztec C, 5.0 or newer only */ +# include +# include /* do inline dos.library calls */ +# define O_BINARY 0 +#endif /* AZTEC_C */ + + +#ifdef __SASC +# include +# include +# define disk_not_mounted 0 +# if ( (!defined(O_BINARY)) && defined(O_RAW)) +# define O_BINARY O_RAW +# endif +#endif /* SASC */ + + +/* Funkshine Prough Toe Taipes */ + +LONG FileDate (char *, time_t[]); + +#endif /* __amiga_amiga_h */ diff --git a/amiga/amigazip.c b/amiga/amigazip.c new file mode 100644 index 0000000..f72f27d --- /dev/null +++ b/amiga/amigazip.c @@ -0,0 +1,510 @@ +/* + Copyright (c) 1990-2005 Info-ZIP. All rights reserved. + + See the accompanying file LICENSE, version 2004-May-22 or later + (the contents of which are also included in zip.h) for terms of use. + If, for some reason, both of these files are missing, the Info-ZIP license + also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html +*/ +#include "zip.h" +#include "amiga/amiga.h" + +#ifndef UTIL /* the companion #endif is a bit of ways down ... */ + +#define utime FileDate + +#define PAD 0 +#define PATH_END '/' + +/* Local globals (kinda like "military intelligence" or "broadcast quality") */ + +extern char *label; /* still declared in fileio.c */ +local ulg label_time = 0; +local ulg label_mode = 0; +local time_t label_utim = 0; + +/* Local functions */ +local char *readd OF((DIR *)); +local int wild_recurse OF((char *, char *)); + + +local char *readd(d) +DIR *d; /* directory stream to read from */ +/* Return a pointer to the next name in the directory stream d, or NULL if + no more entries or an error occurs. */ +{ + struct dirent *e = readdir(d); + return e == NULL ? (char *) NULL : e->d_name; +} + + +/* What we have here is a mostly-generic routine using opendir()/readd() and */ +/* isshexp()/MATCH() to find all the files matching a multi-part filespec */ +/* using the portable pattern syntax. It shouldn't take too much fiddling */ +/* to make it usable for any other platform that has directory hierarchies */ +/* but no shell-level pattern matching. It works for patterns throughout */ +/* the pathname, such as "foo:*.?/source/x*.[ch]". */ + +#define ONENAMELEN 30 +/* the length of one filename component on the Amiga */ + +/* whole is a pathname with wildcards, wildtail points somewhere in the */ +/* middle of it. All wildcards to be expanded must come AFTER wildtail. */ + +local int wild_recurse(whole, wildtail) char *whole; char *wildtail; +{ + DIR *dir; + char *subwild, *name, *newwhole = NULL, *glue = NULL, plug = 0, plug2; + ush newlen, amatch = 0; + BPTR lok; + int e = ZE_MISS; + + if (!isshexp(wildtail)) + if (lok = Lock(whole, ACCESS_READ)) { /* p exists? */ + UnLock(lok); + return procname(whole, 0); + } else + return ZE_MISS; /* woops, no wildcards! */ + + /* back up thru path components till existing dir found */ + do { + name = wildtail + strlen(wildtail) - 1; + for (;;) + if (name-- <= wildtail || *name == PATH_END) { + subwild = name + 1; + plug2 = *subwild; + *subwild = 0; + break; + } + if (glue) + *glue = plug; + glue = subwild; + plug = plug2; + dir = opendir(whole); + } while (!dir && !disk_not_mounted && subwild > wildtail); + wildtail = subwild; /* skip past non-wild components */ + + if ((subwild = strchr(wildtail + 1, PATH_END)) != NULL) { + /* this "+ 1" dodges the ^^^ hole left by *glue == 0 */ + *(subwild++) = 0; /* wildtail = one component pattern */ + newlen = strlen(whole) + strlen(subwild) + (ONENAMELEN + 2); + } else + newlen = strlen(whole) + (ONENAMELEN + 1); + if (!dir || !(newwhole = malloc(newlen))) { + if (glue) + *glue = plug; + + e = dir ? ZE_MEM : ZE_MISS; + goto ohforgetit; + } + strcpy(newwhole, whole); + newlen = strlen(newwhole); + if (glue) + *glue = plug; /* repair damage to whole */ + if (!isshexp(wildtail)) { + e = ZE_MISS; /* non-wild name not found */ + goto ohforgetit; + } + + while (name = readd(dir)) { + if (MATCH(wildtail, name, 0)) { + strcpy(newwhole + newlen, name); + if (subwild) { + name = newwhole + strlen(newwhole); + *(name++) = PATH_END; + strcpy(name, subwild); + e = wild_recurse(newwhole, name); + } else + e = procname(newwhole, 0); + newwhole[newlen] = 0; + if (e == ZE_OK) + amatch = 1; + else if (e != ZE_MISS) + break; + } + } + + ohforgetit: + if (dir) closedir(dir); + if (subwild) *--subwild = PATH_END; + if (newwhole) free(newwhole); + if (e == ZE_MISS && amatch) + e = ZE_OK; + return e; +} + +int wild(p) char *p; +{ + char *use; + + /* special handling of stdin request */ + if (strcmp(p, "-") == 0) /* if compressing stdin */ + return newname(p, 0, 0); + + /* wild_recurse() can't handle colons in wildcard part: */ + if (use = strchr(p, ':')) { + if (strchr(++use, ':')) + return ZE_PARMS; + } else + use = p; + + return wild_recurse(p, use); +} + + +int procname(n, caseflag) +char *n; /* name to process */ +int caseflag; /* true to force case-sensitive match */ +/* Process a name or sh expression to operate on (or exclude). Return + an error code in the ZE_ class. */ +{ + char *a; /* path and name for recursion */ + DIR *d; /* directory stream from opendir() */ + char *e; /* pointer to name from readd() */ + int m; /* matched flag */ + char *p; /* path for recursion */ + struct stat s; /* result of stat() */ + struct zlist far *z; /* steps through zfiles list */ + + if (strcmp(n, "-") == 0) /* if compressing stdin */ + return newname(n, 0, caseflag); + else if (LSSTAT(n, &s)) + { + /* Not a file or directory--search for shell expression in zip file */ + p = ex2in(n, 0, (int *)NULL); /* shouldn't affect matching chars */ + m = 1; + for (z = zfiles; z != NULL; z = z->nxt) { + if (MATCH(p, z->iname, caseflag)) + { + z->mark = pcount ? filter(z->zname, caseflag) : 1; + if (verbose) + fprintf(mesg, "zip diagnostic: %scluding %s\n", + z->mark ? "in" : "ex", z->name); + m = 0; + } + } + free((zvoid *)p); + return m ? ZE_MISS : ZE_OK; + } + + /* Live name--use if file, recurse if directory */ + if ((s.st_mode & S_IFDIR) == 0) + { + /* add or remove name of file */ + if ((m = newname(n, 0, caseflag)) != ZE_OK) + return m; + } else { + /* Add trailing / to the directory name */ + if ((p = malloc(strlen(n)+2)) == NULL) + return ZE_MEM; + strcpy(p, n); + a = p + strlen(p); + if (*p && a[-1] != '/' && a[-1] != ':') + strcpy(a, "/"); + if (dirnames && (m = newname(p, 1, caseflag)) != ZE_OK) { + free((zvoid *)p); + return m; + } + /* recurse into directory */ + if (recurse && (d = opendir(n)) != NULL) + { + while ((e = readd(d)) != NULL) { + if ((a = malloc(strlen(p) + strlen(e) + 1)) == NULL) + { + closedir(d); + free((zvoid *)p); + return ZE_MEM; + } + strcat(strcpy(a, p), e); + if ((m = procname(a, caseflag)) != ZE_OK) /* recurse on name */ + { + if (m == ZE_MISS) + zipwarn("name not matched: ", a); + else + ziperr(m, a); + } + free((zvoid *)a); + } + closedir(d); + } + free((zvoid *)p); + } /* (s.st_mode & S_IFDIR) == 0) */ + return ZE_OK; +} + +char *ex2in(x, isdir, pdosflag) +char *x; /* external file name */ +int isdir; /* input: x is a directory */ +int *pdosflag; /* output: force MSDOS file attributes? */ +/* Convert the external file name to a zip file name, returning the malloc'ed + string or NULL if not enough memory. */ +{ + char *n; /* internal file name (malloc'ed) */ + char *t; /* shortened name */ + int dosflag; + + dosflag = dosify; /* default for non-DOS and non-OS/2 */ + + /* Find starting point in name before doing malloc */ + if ((t = strrchr(x, ':')) != NULL) /* reject ":" */ + t++; + else + t = x; + { /* reject "//" */ + char *tt = t; + while (tt = strchr(tt, '/')) + while (*++tt == '/') + t = tt; + } + while (*t == '/') /* reject leading "/" on what's left */ + t++; + + if (!pathput) + t = last(t, PATH_END); + + /* Malloc space for internal name and copy it */ + if ((n = malloc(strlen(t) + 1)) == NULL) + return NULL; + strcpy(n, t); + + if (dosify) + msname(n); + /* Returned malloc'ed name */ + if (pdosflag) + *pdosflag = dosflag; + return n; +} + +char *in2ex(n) +char *n; /* internal file name */ +/* Convert the zip file name to an external file name, returning the malloc'ed + string or NULL if not enough memory. */ +{ + char *x; /* external file name */ + + if ((x = malloc(strlen(n) + 1 + PAD)) == NULL) + return NULL; + strcpy(x, n); + return x; +} + +void stamp(f, d) +char *f; /* name of file to change */ +ulg d; /* dos-style time to change it to */ +/* Set last updated and accessed time of file f to the DOS time d. */ +{ + time_t u[2]; /* argument for utime() */ + + /* Convert DOS time to time_t format in u */ + u[0] = u[1] = dos2unixtime(d); + + /* Set updated and accessed times of f */ + utime(f, u); +} + +ulg filetime(f, a, n, t) +char *f; /* name of file to get info on */ +ulg *a; /* return value: file attributes */ +long *n; /* return value: file size */ +iztimes *t; /* return value: access, modific. and creation times */ +/* If file *f does not exist, return 0. Else, return the file's last + modified date and time as an MSDOS date and time. The date and + time is returned in a long with the date most significant to allow + unsigned integer comparison of absolute times. Also, if a is not + a NULL pointer, store the file attributes there, with the high two + bytes being the Unix attributes, and the low byte being a mapping + of that to DOS attributes. If n is not NULL, store the file size + there. If t is not NULL, the file's access, modification and creation + times are stored there as UNIX time_t values. + If f is "-", use standard input as the file. If f is a device, return + a file size of -1 */ +{ + struct stat s; /* results of stat() */ + char *name; + unsigned int len = strlen(f); + + if (f == label) { + if (a != NULL) + *a = label_mode; + if (n != NULL) + *n = -2L; /* convention for a label name */ + if (t != NULL) + t->atime = t->mtime = t->ctime = label_utim; + return label_time; + } + + if ((name = malloc(len + 1)) == NULL) { + ZIPERR(ZE_MEM, "filetime"); + } + strcpy(name, f); + if (name[len - 1] == '/') + name[len - 1] = '\0'; + /* not all systems allow stat'ing a file with / appended */ + + if (strcmp(f, "-") == 0) { + if (fstat(fileno(stdin), &s) != 0) { + free(name); + error("fstat(stdin)"); + } + } else if (SSTAT(name, &s) != 0) { + /* Accept about any file kind including directories + * (stored with trailing / with -r option) + */ + free(name); + return 0; + } + + if (a != NULL) { + *a = ((ulg)s.st_mode << 16) | !(s.st_mode & S_IWRITE); + if ((s.st_mode & S_IFDIR) != 0) { + *a |= MSDOS_DIR_ATTR; + } + } + if (n != NULL) + *n = (s.st_mode & S_IFMT) == S_IFREG ? s.st_size : -1L; + if (t != NULL) { + t->atime = s.st_atime; + t->mtime = s.st_mtime; + t->ctime = s.st_ctime; + } + + free(name); + + return unix2dostime(&s.st_mtime); +} + +int set_extra_field(z, z_utim) + struct zlist far *z; + iztimes *z_utim; + /* create extra field and change z->att if desired */ +{ +#ifdef USE_EF_UT_TIME +#ifdef IZ_CHECK_TZ + if (!zp_tz_is_valid) return ZE_OK; /* skip silently if no valid TZ info */ +#endif + + if ((z->extra = (char *)malloc(EB_HEADSIZE+EB_UT_LEN(1))) == NULL) + return ZE_MEM; + + z->extra[0] = 'U'; + z->extra[1] = 'T'; + z->extra[2] = EB_UT_LEN(1); /* length of data part of e.f. */ + z->extra[3] = 0; + z->extra[4] = EB_UT_FL_MTIME; + z->extra[5] = (char)(z_utim->mtime); + z->extra[6] = (char)(z_utim->mtime >> 8); + z->extra[7] = (char)(z_utim->mtime >> 16); + z->extra[8] = (char)(z_utim->mtime >> 24); + + z->cextra = z->extra; + z->cext = z->ext = (EB_HEADSIZE+EB_UT_LEN(1)); + + return ZE_OK; +#else /* !USE_EF_UT_TIME */ + return (int)(z-z); +#endif /* ?USE_EF_UT_TIME */ +} + +int deletedir(d) +char *d; /* directory to delete */ +/* Delete the directory *d if it is empty, do nothing otherwise. + Return the result of rmdir(), delete(), or system(). + For VMS, d must be in format [x.y]z.dir;1 (not [x.y.z]). + */ +{ + return rmdir(d); +} + +#endif /* !UTIL */ + + +/******************************/ +/* Function version_local() */ +/******************************/ + + +/* NOTE: the following include depends upon the environment + * variable $Workbench to be set correctly. (Set by + * default, by Version command in Startup-sequence.) + */ +int WBversion = (int) +#include "ENV:Workbench" +; + +void version_local() +{ + static ZCONST char CompiledWith[] = "Compiled with %s%s under %s%s%s%s.\n\n"; + +/* Define buffers. */ + + char buf1[16]; /* compiler name */ + char buf2[16]; /* revstamp */ + char buf3[16]; /* OS */ + char buf4[16]; /* Date */ +/* char buf5[16]; /* Time */ + +/* format "with" name strings */ + +#ifdef AMIGA +# ifdef __SASC + strcpy(buf1,"SAS/C "); +# else +# ifdef LATTICE + strcpy(buf1,"Lattice C "); +# else +# ifdef AZTEC_C + strcpy(buf1,"Manx Aztec C "); +# else + strcpy(buf1,"UNKNOWN "); +# endif +# endif +# endif +/* "under" */ + sprintf(buf3,"AmigaDOS v%d",WBversion); +#else + strcpy(buf1,"Unknown compiler "); + strcpy(buf3,"Unknown OS"); +#endif + +/* Define revision, date, and time strings. + * NOTE: Do not calculate run time, be sure to use time compiled. + * Pass these strings via your makefile if undefined. + */ + +#if defined(__VERSION__) && defined(__REVISION__) + sprintf(buf2,"version %d.%d",__VERSION__,__REVISION__); +#else +# ifdef __VERSION__ + sprintf(buf2,"version %d",__VERSION__); +# else + sprintf(buf2,"unknown version"); +# endif +#endif + +#ifdef __DATE__ + sprintf(buf4," on %s",__DATE__); +#else + strcpy(buf4," unknown date"); +#endif + +/****** +#ifdef __TIME__ + sprintf(buf5," at %s",__TIME__); +#else + strcpy(buf5," unknown time"); +#endif +******/ + +/* Print strings using "CompiledWith" mask defined above. + * ("Compiled with %s%s under %s%s%s%s.") + */ + + printf(CompiledWith, + buf1, + buf2, + buf3, + buf4, + /* buf5, */ "", + "" ); /* buf6 not used */ + +} /* end function version_local() */ diff --git a/amiga/crc_68.a b/amiga/crc_68.a new file mode 100644 index 0000000..809a0ba --- /dev/null +++ b/amiga/crc_68.a @@ -0,0 +1,144 @@ +;=========================================================================== +; Copyright (c) 1990-1999 Info-ZIP. All rights reserved. +; +; See the accompanying file LICENSE, version 1999-Oct-05 or later +; (the contents of which are also included in zip.h) for terms of use. +; If, for some reason, both of these files are missing, the Info-ZIP license +; also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html +;=========================================================================== +; crc_68 created by Paul Kienitz, last modified 04 Jan 96. +; +; Return an updated 32 bit CRC value, given the old value and a block of data. +; The CRC table used to compute the value is gotten by calling get_crc_table(). +; This replaces the older updcrc() function used in Zip and fUnZip. The +; prototype of the function is: +; +; ulg crc32(ulg crcval, uch *text, extent textlen); +; +; On the Amiga, type extent is always unsigned long, not unsigned int, because +; int can be short or long at whim, but size_t is long. +; +; If using this source on a non-Amiga 680x0 system, note that we treat +; a0/a1/d0/d1 as scratch registers not preserved across function calls. +; We do not bother to support registerized arguments for crc32() -- the +; textlen parm is usually large enough so that savings outside the loop +; are pointless. +; +; Define NO_UNROLLED_LOOPS to use a simple short loop which might be more +; efficient on certain machines with dinky instruction caches ('020?), or for +; processing short strings. If loops are unrolled, the textlen parm must be +; less than 512K; if not unrolled, it must be less than 64K. + + xdef _crc32 ; (ulg val, uch *buf, extent bufsize) + +DO_CRC0 MACRO + moveq #0,ltemp + move.b (textbuf)+,ltemp + eor.b crcval,ltemp + lsl.w #2,ltemp + move.l (crc_table,ltemp.w),ltemp + lsr.l #8,crcval + eor.l ltemp,crcval + ENDM + + machine mc68020 + +DO_CRC2 MACRO + move.b (textbuf)+,btemp + eor.b crcval,btemp + lsr.l #8,crcval + move.l (crc_table,btemp.w*4),ltemp + eor.l ltemp,crcval + ENDM + +crc_table equr a0 array of unsigned long +crcval equr d0 unsigned long initial value +textbuf equr a1 array of unsigned char +textbufsize equr d1 unsigned long (count of bytes in textbuf) +btemp equr d2 +ltemp equr d3 + + + xref _get_crc_table ; ulg *get_crc_table(void) + + NOLIST + INCLUDE 'exec/execbase.i' + LIST + xref _SysBase ; struct ExecBase * + + +_crc32: + move.l 8(sp),d0 + bne.s valid + moveq #0,d0 + rts +valid: movem.l btemp/ltemp,-(sp) + jsr _get_crc_table + move.l d0,ltemp + move.l 12(sp),crcval + move.l 16(sp),textbuf + move.l 20(sp),textbufsize + not.l crcval + move.l _SysBase,crc_table + move.w AttnFlags(crc_table),btemp + move.l ltemp,crc_table + btst #AFB_68020,btemp + bne twenty + + IFD NO_UNROLLED_LOOPS + + bra.s decr +loop: DO_CRC0 +decr: dbra textbufsize,loop + bra.s done + +twenty: moveq #0,btemp + bra.s decr2 +loop2: DO_CRC2 +decr2: dbra textbufsize,loop2 + + ELSE ; !NO_UNROLLED_LOOPS + + move.l textbufsize,btemp + lsr.l #3,textbufsize + bra decr8 +loop8: DO_CRC0 + DO_CRC0 + DO_CRC0 + DO_CRC0 + DO_CRC0 + DO_CRC0 + DO_CRC0 + DO_CRC0 +decr8: dbra textbufsize,loop8 + and.w #7,btemp + bra.s decr1 +loop1: DO_CRC0 +decr1: dbra btemp,loop1 + bra done + +twenty: moveq #0,btemp + move.l textbufsize,-(sp) + lsr.l #3,textbufsize + bra decr82 +loop82: DO_CRC2 + DO_CRC2 + DO_CRC2 + DO_CRC2 + DO_CRC2 + DO_CRC2 + DO_CRC2 + DO_CRC2 +decr82: dbra textbufsize,loop82 + move.l (sp)+,textbufsize + and.w #7,textbufsize + bra.s decr12 +loop12: DO_CRC2 +decr12: dbra textbufsize,loop12 + + ENDC ; ?NO_UNROLLED_LOOPS + +done: movem.l (sp)+,btemp/ltemp + not.l crcval +;;;;; move.l crcval,d0 ; crcval already is d0 + rts diff --git a/amiga/deflate.a b/amiga/deflate.a new file mode 100644 index 0000000..b21adae --- /dev/null +++ b/amiga/deflate.a @@ -0,0 +1,1053 @@ +;=========================================================================== +; Copyright (c) 1990-1999 Info-ZIP. All rights reserved. +; +; See the accompanying file LICENSE, version 1999-Oct-05 or later +; (the contents of which are also included in zip.h) for terms of use. +; If, for some reason, both of these files are missing, the Info-ZIP license +; also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html +;=========================================================================== +; This is a 680x0 assembly language translation of the Info-ZIP source file +; deflate.c, by Paul Kienitz. The function longest_match is based in part +; on match.a by Carsten Steger, which in turn is partly based on match.s +; for 386 by Jean-loup Gailly and Kai Uwe Rommel. Mostly, however, this +; material is based on deflate.c, by Gailly, Rommel, and Igor Mandrichenko. +; This code is not commented very much; see deflate.c for comments that explain +; what the functions are doing. +; +; The symbols that can be used to select different versions are as follows: +; +; CPU020 if defined, use 68020 instructions always. +; +; CPUTEST if defined, check at runtime for CPU type. Another symbol +; specifying the platform-specific test must be used with this. +; If neither of these is defined, use 68000 instructions only. +; Runtime test is nonportable; it is different for each OS. +; +; AMIGA use Amiga-specific test for 68020, if CPUTEST defined. Also +; tells it that registers d0/a0/d1/a1 are not preserved by +; function calls. At present, if AMIGA is not defined, it +; causes functions to preserve all registers. ALL OF THIS CODE +; CURRENTLY ASSUMES THAT REGISTERS D2-D7/A2-A6 WILL BE PRESERVED +; BY ANY FUNCTIONS THAT IT CALLS. +; +; DYN_ALLOC should be defined here if it is defined for C source; tells us +; that big arrays are allocated instead of static. +; +; WSIZE must be defined as the same number used for WSIZE in the C +; source, and must be a power of two <= 32768. As elsewhere, +; the default value is 32768. +; +; INT16 define this if ints are 16 bits; otherwise 32 bit ints assumed. +; +; SMALL_MEM define this if it is defined in the C source; otherwise it uses +; the MEDIUM_MEM model. BIG_MEM and MMAP are *not* supported. +; The FULL_SEARCH option in deflate.c is also not supported. +; +; DEBUG activates some tracing output, as in the C source. +; +; QUADLONG this selects a different version of the innermost longest_match +; loop code for 68020 operations, comparing bytes four at a time +; instead of two at a time. It seems to be a tiny bit faster on +; average, but it's slower often enough that one can't generalize. +; +; This code currently assumes that function results are returned in D0 for +; all platforms. It assumes that args to functions are pushed onto the stack, +; last arg first. It also currently assumes that all C symbols have an +; underscore prepended when referenced from assembly. + + IFND CPU020 + IFND CPUTEST +CPU000 equ 1 + ENDC + ENDC + +; Use these macros for accessing variables of type int: + IFD INT16 +MOVINT MACRO + move.w \1,\2 + ENDM +CLRINT MACRO + clr.w \1 + ENDM +INTSIZE equ 2 + ELSE ; !INT16 +MOVINT MACRO + move.l \1,\2 + ENDM +CLRINT MACRO + clr.l \1 + ENDM +INTSIZE equ 4 + ENDC + + IFD DYN_ALLOC +BASEPTR MACRO + move.l \1,\2 + ENDM + ELSE +BASEPTR MACRO + lea \1,\2 + ENDM + ENDC + +; constants we use, many of them adjustable: + +MAX_MATCH equ 258 +MIN_MATCH equ 3 +TOO_FAR equ 4096 + IFND WSIZE +WSIZE equ 32768 + ENDC +WMASK equ WSIZE-1 +MAX_DIST equ WSIZE-MAX_MATCH-MIN_MATCH-1 +MIN_LOOKAHEAD equ MAX_MATCH+MIN_MATCH+1 +; IFD BIG_MEM ; NOT supported -- type Pos needs to be 32 bits +;HASH_BITS equ 15 +; ELSE + IFD SMALL_MEM +HASH_BITS equ 13 + ELSE +HASH_BITS equ 14 ; default -- MEDIUM_MEM + ENDC +; ENDC ; BIG_MEM +HASH_SIZE equ 1< + MOVINT Strst,_strstart ; ct_tally reads this variable + moveq #0,d0 + move.b -1(Window,Strst.l),d0 + MOVINT d0,-(sp) + CLRINT -(sp) + jsr _ct_tally + addq #2*INTSIZE,sp + tst.w d0 + beq.s skipliteral + FLUSH_B #0 + move.l Strst,_block_start +skipliteral: + addq.w #1,Strst + subq.w #1,Look + +refill: + cmp.w #MIN_LOOKAHEAD,Look + bhs look_loop + bsr fill_window + bra look_loop + +last_tally: + tst.w Avail + beq last_flush + MOVINT Strst,_strstart ; ct_tally reads this variable + moveq #0,d0 + move.b -1(Window,Strst.l),d0 + MOVINT d0,-(sp) + CLRINT -(sp) + jsr _ct_tally + addq #2*INTSIZE,sp +last_flush: + FLUSH_B #1 + bra deflate_exit + +; ================== This is another version used for low compression levels: + +deflate_fast: + moveq #0,MatchL + moveq #MIN_MATCH-1,PrevL +flook_loop: + tst.w Look + beq flast_flush + + IN_STR a0,d0 + tst.w Head + beq.s fno_new_match + move.w Strst,d0 + sub.w Head,d0 + cmp.w #MAX_DIST,d0 + bhi.s fno_new_match + move.w PrevL,prev_length ; longest_match reads these variables + MOVINT Strst,_strstart + MOVINT Head,d0 ; parm for longest_match + bsr longest_match ; sets match_start + cmp.w Look,d0 ; does length exceed valid data? + bls.s fstml + move.w Look,d0 +fstml: move.w d0,MatchL ; valid length of match + +fno_new_match: + cmp.w #MIN_MATCH,MatchL + blo fliteral + ; CHECK_MATCH Strst,match_start,MatchL + MOVINT Strst,_strstart ; ct_tally reads this variable + move.l MatchL,d0 + subq.w #MIN_MATCH,d0 + MOVINT d0,-(sp) + move.l Strst,d0 + sub.w match_start,d0 + MOVINT d0,-(sp) + jsr _ct_tally ; sets d0 true if we have to flush + addq #2*INTSIZE,sp + sub.w MatchL,Look + cmp.w max_lazy_match,MatchL + bhi ftoolong + subq.w #2,MatchL +finsertmatch: + addq.w #1,Strst + IN_STR a0,d1 ; preserve d0 + dbra MatchL,finsertmatch + moveq #0,MatchL ; not needed? + addq.w #1,Strst + bra.s flushfill + +ftoolong: + add.w MatchL,Strst + moveq #0,MatchL + moveq #0,d1 ; preserve d0 + move.b (Window,Strst.l),d1 + move.w d1,ins_h +; My assembler objects to passing <1(Window,Strst.l)> directly to UP_HASH... + move.b 1(Window,Strst.l),Avail ; Avail is not used in deflate_fast + UP_HASH d1,Avail ; preserve d0 + IFNE MIN_MATCH-3 + FAIL needs to UP_HASH another MIN_MATCH-3 times, but with what arg? + ENDC + bra.s flushfill + +fliteral: + TRACE_C <(Window,Strst.l)> + MOVINT Strst,_strstart ; ct_tally reads this variable + moveq #0,d0 + move.b (Window,Strst.l),d0 + MOVINT d0,-(sp) + CLRINT -(sp) + jsr _ct_tally ; d0 set if we need to flush + addq #2*INTSIZE,sp + addq.w #1,Strst + subq.w #1,Look + +flushfill: + tst.w d0 + beq.s frefill + FLUSH_B #0 + move.l Strst,_block_start +frefill: + cmp.w #MIN_LOOKAHEAD,Look + bhs flook_loop + bsr fill_window + bra flook_loop + +flast_flush: + FLUSH_B #1 ; sets our return value + +deflate_exit: + MOVINT Strst,_strstart ; save back cached values + move.w PrevL,prev_length + move.w Look,lookahead + movem.l (sp)+,DEFREGS + rts + + +; ========================================================================= +; void fill_window(void) calls the input function to refill the sliding +; window that we use to find substring matches in. + +More equr Head ; local variable in fill_window +WindTop equr Prev ; local variable used for sliding +SlidIx equr PrevL ; local variable used for sliding + + IFD AMIGA +FWREGS reg d2-d5/a2-a6 ; does NOT include Look and Strst + ELSE +FWREGS reg d1-d5/a0-a6 ; likewise + ENDC +; all registers available to be clobbered by the sliding operation: +; we exclude More, WindTop, SlidIx, Look, Strst, Window, a4 and a7. +SPAREGS reg d0-d3/a0-a1/a5-a6 +SPCOUNT equ 8 ; number of registers in SPAREGS + + +_fill_window: ; C-callable entry point + movem.l Strst/Look,-(sp) + IFD INT16 + moveq #0,Strst ; Strst must be valid as a long + ENDC + MOVINT _strstart,Strst + move.w lookahead,Look + BASEPTR _window,Window + bsr.s fill_window + MOVINT Strst,_strstart + move.w Look,lookahead + movem.l (sp)+,Strst/Look + rts + +; strstart, lookahead, and window must be cached in Strst, Look, and Window: +fill_window: ; asm-callable entry point + movem.l FWREGS,-(sp) + tst.w eofile ; we put this up here for speed + bne fwdone + and.l #$FFFF,Look ; make sure Look is valid as long +fw_refill: + move.l _window_size,More ; <= 64K + sub.l Look,More + sub.l Strst,More ; Strst is already valid as long + cmp.w #EOF,More + bne.s notboundary + subq.w #1,More + bra checkend + +notboundary: + tst.w sliding + beq checkend + cmp.w #WSIZE+MAX_DIST,Strst + blo checkend + IFGT 32768-WSIZE + lea WSIZE(Window),WindTop ; WindTop is aligned when Window is + ELSE + move.l Window,WindTop + add.l #WSIZE,WindTop + ENDC + move.l Window,d0 + and.w #3,d0 + beq.s isaligned + subq.w #1,d0 +align: move.b (WindTop)+,(Window)+ ; copy up to a longword boundary + dbra d0,align +isaligned: +; This is faster than a simple move.l (WindTop)+,(Window)+ / dbra loop: + move.w #(WSIZE-1)/(4*SPCOUNT),SlidIx +slide: movem.l (WindTop)+,SPAREGS ; copy, 32 bytes at a time! + movem.l SPAREGS,(Window) ; a slight overshoot doesn't matter. + lea 4*SPCOUNT(Window),Window ; can't use (aN)+ as movem.l dest + dbra SlidIx,slide + BASEPTR _window,Window ; restore cached value + sub.w #WSIZE,match_start + sub.w #WSIZE,Strst + sub.l #WSIZE,_block_start + add.w #WSIZE,More + BASEPTR _head,a0 + move.w #HASH_SIZE-1,d0 +fixhead: + move.w (a0),d1 + sub.w #WSIZE,d1 + bpl.s headok + moveq #0,d1 +headok: move.w d1,(a0)+ + dbra d0,fixhead + BASEPTR _prev,a0 + move.w #WSIZE-1,d0 +fixprev: + move.w (a0),d1 + sub.w #WSIZE,d1 + bpl.s prevok + moveq #0,d1 +prevok: move.w d1,(a0)+ + dbra d0,fixprev + TRACE_C #'.' + +checkend: ; assert eofile is false + MOVINT More,-(sp) ; assert More's upper word is zero + move.l Strst,d0 + add.w Look,d0 + add.l Window,d0 + move.l d0,-(sp) + move.l _read_buf,a0 + jsr (a0) ; refill the upper part of the window + addq #4+INTSIZE,sp + tst.w d0 + beq.s iseof + cmp.w #EOF,d0 + beq.s iseof + add.w d0,Look + cmp.w #MIN_LOOKAHEAD,Look + blo fw_refill ; eofile is still false + + bra.s fwdone +iseof: move.w #1,eofile +fwdone: movem.l (sp)+,FWREGS + rts + + +; ========================================================================= +; void lm_free(void) frees dynamic arrays in the DYN_ALLOC version. + + xdef _lm_free ; the entry point + +_lm_free: + IFD DYN_ALLOC + move.l _window,d0 + beq.s lf_no_window + move.l d0,-(sp) + jsr _free + addq #4,sp + clr.l _window +lf_no_window: + move.l _prev,d0 + beq.s lf_no_prev + move.l d0,-(sp) + jsr _free + move.l _head,(sp) ; reuse the same stack arg slot + jsr _free + addq #4,sp + clr.l _prev + clr.l _head +lf_no_prev: + ENDC + rts + +; ============================================================================ +; void lm_init(int pack_level, unsigned short *flags) allocates dynamic arrays +; if any, and initializes all variables so that deflate() is ready to go. + + xdef _lm_init ; the entry point + +Level equr d2 +;Window equr a2 ; as in deflate() + IFD AMIGA +INIREGS reg d2/a2 + ELSE +INIREGS reg d0-d2/a0-a1 + ENDC + +_lm_init: + MOVINT 4(sp),d0 + move.l 4+INTSIZE(sp),a0 + movem.l INIREGS,-(sp) + move.w d0,Level + cmp.w #1,Level + blt.s levelerr + bgt.s try9 + bset.b #B_FAST,1(a0) +try9: cmp.w #9,Level + bgt.s levelerr + blt.s levelok + bset.b #B_SLOW,1(a0) + bra.s levelok +levelerr: + pea level_message + jsr _error ; never returns +levelok: + clr.w sliding + tst.l _window_size + bne.s gotawindowsize + move.w #1,sliding + move.l #2*WSIZE,_window_size +gotawindowsize: + + BASEPTR _window,Window + IFD DYN_ALLOC + move.l Window,d0 ; fake tst.l + bne.s gotsomewind + CAL_SH WSIZE + move.l d0,Window + move.l d0,_window + bne.s gotsomewind + pea window_message + MOVINT #ZE_MEM,-(sp) + jsr _ziperr ; never returns +gotsomewind: + tst.l _prev + bne.s gotsomehead + CAL_SH WSIZE + move.l d0,_prev + beq.s nohead + CAL_SH HASH_SIZE + move.l d0,_head + bne.s gotfreshhead ; newly calloc'd memory is zeroed +nohead: pea hash_message + MOVINT #ZE_MEM,-(sp) + jsr _ziperr ; never returns +gotsomehead: + ENDC ; DYN_ALLOC + + move.w #(HASH_SIZE/2)-1,d0 ; two shortwords per loop + BASEPTR _head,a0 +wipeh: clr.l (a0)+ + dbra d0,wipeh +gotfreshhead: + move.l Level,d0 + IFEQ Sizeof_config-8 + asl.l #3,d0 + ELSE + mulu #Sizeof_config,d0 + ENDC + lea config_table,a0 + add.l d0,a0 + move.w Max_lazy(a0),max_lazy_match + move.w Good_length(a0),good_match + move.w Nice_length(a0),nice_match + move.w Max_chain(a0),max_chain_len + CLRINT _strstart + clr.l _block_start + bsr match_init + + clr.w eofile + MOVINT #WSIZE,-(sp) ; We read only 32K because lookahead is short + move.l Window,-(sp) ; even when int size is long, as if deflate.c + move.l _read_buf,a0 ; were compiled with MAXSEG_64K defined. + jsr (a0) + addq #4+INTSIZE,sp + move.w d0,lookahead + beq.s noread + cmp.w #EOF,d0 + bne.s irefill +noread: move.w #1,eofile + clr.w lookahead + bra.s init_done + +irefill: + move.w lookahead,d0 + cmp.w #MIN_LOOKAHEAD,d0 + bhs.s hashify + bsr _fill_window ; use the C-callable version +hashify: + clr.w ins_h + moveq #MIN_MATCH-2,d0 +hash1: move.b (Window)+,d1 + UP_HASH Level,d1 + dbra d0,hash1 + +init_done: + movem.l (sp)+,INIREGS + rts + +; strings for error messages: +hash_message dc.b 'hash table allocation',0 +window_message dc.b 'window allocation',0 +level_message dc.b 'bad pack level',0 + + end diff --git a/amiga/filedate.c b/amiga/filedate.c new file mode 100644 index 0000000..84c7bed --- /dev/null +++ b/amiga/filedate.c @@ -0,0 +1,636 @@ +/* + Copyright (c) 1990-2005 Info-ZIP. All rights reserved. + + See the accompanying file LICENSE, version 2004-May-22 or later + (the contents of which are also included in zip.h) for terms of use. + If, for some reason, both of these files are missing, the Info-ZIP license + also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html +*/ +/* Low-level Amiga routines shared between Zip and UnZip. + * + * Contains: FileDate() + * locale_TZ() + * getenv() [Aztec C only; replaces bad C library versions] + * setenv() [ditto] + * tzset() [ditto] + * gmtime() [ditto] + * localtime() [ditto] + * time() [ditto] + * sendpkt() + * Agetch() + * + * The first nine are used by all Info-ZIP programs except fUnZip. + * The last two are used by all except the non-CRYPT version of fUnZip. + * Probably some of the stuff in here is unused by ZipNote and ZipSplit too... + * sendpkt() is used by Agetch() and FileDate(), and by windowheight() in + * amiga/amiga.c (UnZip). time() is used only by Zip. + */ + + +/* HISTORY/CHANGES + * 2 Sep 92, Greg Roelofs, Original coding. + * 6 Sep 92, John Bush, Incorporated into UnZip 5.1 + * 6 Sep 92, John Bush, Interlude "FileDate()" defined, which calls or + * redefines SetFileDate() depending upon AMIGADOS2 definition. + * 11 Oct 92, John Bush, Eliminated AMIGADOS2 switch by determining + * revision via OpenLibrary() call. Now only one version of + * the program runs on both platforms (1.3.x vs. 2.x) + * 11 Oct 92, John Bush, Merged with Zip version and changed arg passing + * to take time_t input instead of struct DateStamp. + * Arg passing made to conform with utime(). + * 22 Nov 92, Paul Kienitz, fixed includes for Aztec and cleaned up some + * lint-ish errors; simplified test for AmigaDOS version. + * 11 Nov 95, Paul Kienitz, added Agetch() for crypt password input and + * UnZip's "More" prompt -- simplifies crypt.h and avoids + * use of library code redundant with sendpkt(). Made it + * available to fUnZip, which does not use FileDate(). + * 22 Nov 95, Paul Kienitz, created a new tzset() that gets the current + * timezone from the Locale preferences. These exist only under + * AmigaDOS 2.1 and up, but it is probably correctly set on more + * Amigas than the TZ environment variable is. We check that + * only if TZ is not validly set. We do not parse daylight + * savings syntax except to check for presence vs. absence of a + * DST part; United States rules are assumed. This is better + * than the tzset()s in the Amiga compilers' libraries do. + * 15 Jan 96, Chr. Spieler, corrected the logic when to select low level + * sendpkt() (when FileDate(), Agetch() or windowheight() is used), + * and AMIGA's Agetch() (CRYPT, and UnZip(SFX)'s UzpMorePause()). + * 10 Feb 96, Paul Kienitz, re-fiddled that selection logic again, moved + * stuff around for clarity. + * 16 Mar 96, Paul Kienitz, created a replacement localtime() to go with the + * new tzset(), because Aztec's is hopelessly broken. Also + * gmtime(), which localtime() calls. + * 12 Apr 96, Paul Kienitz, daylight savings was being handled incorrectly. + * 21 Apr 96, Paul Kienitz, had to replace time() as well, Aztec's returns + * local time instead of GMT. That's why their localtime() was bad, + * because it assumed time_t was already local, and gmtime() was + * the one that checked TZ. + * 23 Apr 96, Chr. Spieler, deactivated time() replacement for UnZip stuff. + * Currently, the UnZip sources do not make use of time() (and do + * not supply the working mktime() replacement, either!). + * 29 Apr 96, Paul Kienitz, created a replacement getenv() out of code that + * was previously embedded in tzset(), for reliable global test + * of whether TZ is set or not. + * 19 Jun 96, Haidinger Walter, re-adapted for current SAS/C compiler. + * 7 Jul 96, Paul Kienitz, smoothed together compiler-related changes. + * 4 Feb 97, Haidinger Walter, added set_TZ() for SAS/C. + * 23 Apr 97, Paul Kienitz, corrected Unix->Amiga DST error by adding + * mkgmtime() so localtime() could be used. + * 28 Apr 97, Christian Spieler, deactivated mkgmtime() definition for ZIP; + * the Zip sources supply this function as part of util.c. + * 24 May 97, Haidinger Walter, added time_lib support for SAS/C and moved + * set_TZ() to time_lib.c. + * 12 Jul 97, Paul Kienitz, adapted time_lib stuff for Aztec. + * 26 Jul 97, Chr. Spieler, old mkgmtime() fixed (ydays[] def, sign vs unsign). + * 30 Dec 97, Haidinger Walter, adaptation for SAS/C using z-stat.h functions. + * 19 Feb 98, Haidinger Walter, removed alloc_remember, more SAS.C fixes. + * 23 Apr 98, Chr. Spieler, removed mkgmtime(), changed FileDate to convert to + * Amiga file-time directly. + * 24 Apr 98, Paul Kienitz, clip Unix dates earlier than 1978 in FileDate(). + * 02 Sep 98, Paul Kienitz, C. Spieler, always include zip.h to get a defined + * header inclusion sequence that resolves all header dependencies. + */ + +#ifndef __amiga_filedate_c +#define __amiga_filedate_c + + +#include "zip.h" +#include +#include + +#include +#include +#include + +#ifdef AZTEC_C +# include +# include +# include +# include +# include +# include +# include +# include +# define ESRCH ENOENT +# define EOSERR EIO +#endif + +#ifdef __SASC +# include +# if (defined(_M68020) && (!defined(__USE_SYSBASE))) + /* on 68020 or higher processors it is faster */ +# define __USE_SYSBASE /* to use the pragma libcall instead of syscall */ +# endif /* to access functions of the exec.library */ +# include /* see SAS/C manual:part 2,chapter 2,pages 6-7 */ +# include +# include +# ifdef DEBUG +# include +# endif +# ifdef MWDEBUG +# include /* include both before memwatch.h again just */ +# include /* to be safe */ +# include "memwatch.h" +# endif /* MWDEBUG */ +#endif /* __SASC */ + +#include "crypt.h" /* just so we can tell if CRYPT is supported */ + + + +#ifndef FUNZIP + +#ifndef SUCCESS +# define SUCCESS (-1L) +# define FAILURE 0L +#endif + +#define ReqVers 36L /* required library version for SetFileDate() */ +#define ENVSIZE 100 /* max space allowed for an environment var */ + +extern struct ExecBase *SysBase; + +#ifndef USE_TIME_LIB +#ifdef AZTEC_C /* should be pretty safe for reentrancy */ + long timezone = 0; /* already declared SAS/C external */ + int daylight = 0; /* likewise */ +#endif +int real_timezone_is_set = FALSE; /* set by tzset() */ +#endif /* !USE_TIME_LIB */ + +/* prototypes */ +char *getenv(const char *var); +#ifdef __SASC +int setenv(const char *var, const char *value, int overwrite); +/* !!!! We have really got to find a way to operate without this. */ +#endif + +LONG FileDate (char *filename, time_t u[]); +LONG sendpkt(struct MsgPort *pid, LONG action, LONG *args, LONG nargs); +int Agetch(void); + +/* prototypes for time replacement functions */ +#ifndef USE_TIME_LIB + void tzset(void); + int locale_TZ(void); + struct tm *gmtime(const time_t *when); + struct tm *localtime(const time_t *when); +# ifdef __SASC + extern void set_TZ(long time_zone, int day_light); /* in time_lib.c */ +# endif +# ifdef ZIP + time_t time(time_t *tp); +# endif +#endif /* !USE_TIME_LIB */ + +/* =============================================================== */ + +/***********************/ +/* Function filedate() */ +/***********************/ + +/* FileDate() (originally utime.c), by Paul Wells. Modified by John Bush + * and others (see also sendpkt() comments, below); NewtWare SetFileDate() + * clone cheaply ripped off from utime(). + */ + +/* DESCRIPTION + * This routine chooses between 2 methods to set the file date on AMIGA. + * Since AmigaDOS 2.x came out, SetFileDate() was available in ROM (v.36 + * and higher). Under AmigaDOS 1.3.x (less than v.36 ROM), SetFileDate() + * must be accomplished by constructing a message packet and sending it + * to the file system handler of the file to be stamped. + * + * The system's ROM version is extracted from the external system Library + * base. + * + * NOTE: although argument passing conforms with utime(), note the + * following differences: + * - Return value is boolean success/failure. + * - If a structure or array is passed, only the first value + * is used, which *may* correspond to date accessed and not + * date modified. + */ + +/* Nonzero if `y' is a leap year, else zero. */ +#define leap(y) (((y) % 4 == 0 && (y) % 100 != 0) || (y) % 400 == 0) + +/* Number of leap years from 1970 to `y' (not including `y' itself). */ +#define nleap(y) (((y) - 1969) / 4 - ((y) - 1901) / 100 + ((y) - 1601) / 400) + +/* Accumulated number of days from 01-Jan up to start of current month. */ +#ifdef ZIP +static const unsigned short ydays[] = +{ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 }; +#else +extern const unsigned short ydays[]; /* in unzip's fileio.c */ +#endif + +LONG FileDate(filename, u) + char *filename; + time_t u[]; +{ + LONG SetFileDate(UBYTE *filename, struct DateStamp *pDate); + LONG sendpkt(struct MsgPort *pid, LONG action, LONG *args, LONG nargs); + struct MsgPort *taskport; + BPTR dirlock, lock; + struct FileInfoBlock *fib; + LONG pktargs[4]; + UBYTE *ptr; + long ret; + + struct DateStamp pDate; + struct tm *ltm; + int years; + + /* tzset(); */ + /* Amiga file date is based on 01-Jan-1978 00:00:00 (local time): + * 8 years and 2 leapdays difference from Unix time. + */ + ltm = localtime(&u[0]); + years = ltm->tm_year + 1900; + if (years < 1978) + pDate.ds_Days = pDate.ds_Minute = pDate.ds_Tick = 0; + else { + pDate.ds_Days = (years - 1978) * 365L + (nleap(years) - 2) + + ((ltm->tm_mon > 1 && leap(years)) ? 1 : 0) + + ydays[ltm->tm_mon] + (ltm->tm_mday - 1); + pDate.ds_Minute = ltm->tm_hour * 60 + ltm->tm_min; + pDate.ds_Tick = ltm->tm_sec * TICKS_PER_SECOND; + } + + if (SysBase->LibNode.lib_Version >= ReqVers) + { + return (SetFileDate(filename,&pDate)); /* native routine at 2.0+ */ + } + else /* !(SysBase->lib_Version >=ReqVers) */ + { + if( !(taskport = (struct MsgPort *)DeviceProc(filename)) ) + { + errno = ESRCH; /* no such process */ + return FAILURE; + } + + if( !(lock = Lock(filename,SHARED_LOCK)) ) + { + errno = ENOENT; /* no such file */ + return FAILURE; + } + + if( !(fib = (struct FileInfoBlock *)AllocMem( + (long)sizeof(struct FileInfoBlock),MEMF_PUBLIC|MEMF_CLEAR)) ) + { + errno = ENOMEM; /* insufficient memory */ + UnLock(lock); + return FAILURE; + } + + if( Examine(lock,fib)==FAILURE ) + { + errno = EOSERR; /* operating system error */ + UnLock(lock); + FreeMem(fib,(long)sizeof(*fib)); + return FAILURE; + } + + dirlock = ParentDir(lock); + ptr = (UBYTE *)AllocMem(64L,MEMF_PUBLIC); + strcpy((ptr+1),fib->fib_FileName); + *ptr = strlen(fib->fib_FileName); + FreeMem(fib,(long)sizeof(*fib)); + UnLock(lock); + + /* now fill in argument array */ + + pktargs[0] = 0; + pktargs[1] = (LONG)dirlock; + pktargs[2] = (LONG)&ptr[0] >> 2; + pktargs[3] = (LONG)&pDate; + + errno = ret = sendpkt(taskport,ACTION_SET_DATE,pktargs,4L); + + FreeMem(ptr,64L); + UnLock(dirlock); + + return SUCCESS; + } /* ?(SysBase->lib_Version >= ReqVers) */ +} /* FileDate() */ + + +char *getenv(const char *var) /* not reentrant! */ +{ + static char space[ENVSIZE]; + struct Process *me = (void *) FindTask(NULL); + void *old_window = me->pr_WindowPtr; + char *ret = NULL; + + me->pr_WindowPtr = (void *) -1; /* suppress any "Please insert" popups */ + if (SysBase->LibNode.lib_Version >= ReqVers) { + if (GetVar((char *) var, space, ENVSIZE - 1, /* GVF_GLOBAL_ONLY */ 0) > 0) + ret = space; + } else { /* early AmigaDOS, get env var the crude way */ + BPTR hand, foot, spine; + int z = 0; + if (foot = Lock("ENV:", ACCESS_READ)) { + spine = CurrentDir(foot); + if (hand = Open((char *) var, MODE_OLDFILE)) { + z = Read(hand, space, ENVSIZE - 1); + Close(hand); + } + UnLock(CurrentDir(spine)); + } + if (z > 0) { + space[z] = '\0'; + ret = space; + } + } + me->pr_WindowPtr = old_window; + return ret; +} + +#ifdef __SASC +int setenv(const char *var, const char *value, int overwrite) +{ + struct Process *me = (void *) FindTask(NULL); + void *old_window = me->pr_WindowPtr; + int ret = -1; + + me->pr_WindowPtr = (void *) -1; /* suppress any "Please insert" popups */ + if (SysBase->LibNode.lib_Version >= ReqVers) + ret = !SetVar((char *) var, (char *) value, -1, GVF_GLOBAL_ONLY | LV_VAR); + else { + BPTR hand, foot, spine; + long len = value ? strlen(value) : 0; + if (foot = Lock("ENV:", ACCESS_READ)) { + spine = CurrentDir(foot); + if (len) { + if (hand = Open((char *) var, MODE_NEWFILE)) { + ret = Write(hand, (char *) value, len + 1) >= len; + Close(hand); + } + } else + ret = DeleteFile((char *) var); + UnLock(CurrentDir(spine)); + } + } + me->pr_WindowPtr = old_window; + return ret; +} +#endif /* __SASC */ + + +#ifndef USE_TIME_LIB + +/* set timezone and daylight to settings found in locale.library */ +int locale_TZ(void) +{ + struct Library *LocaleBase; + struct Locale *ll; + struct Process *me = (void *) FindTask(NULL); + void *old_window = me->pr_WindowPtr; + BPTR eh; + int z, valid = FALSE; + + /* read timezone from locale.library if TZ envvar missing */ + me->pr_WindowPtr = (void *) -1; /* suppress any "Please insert" popups */ + if (LocaleBase = OpenLibrary("locale.library", 0)) { + if (ll = OpenLocale(NULL)) { + z = ll->loc_GMTOffset; + if (z == -300) { + if (eh = Lock("ENV:sys/locale.prefs", ACCESS_READ)) + UnLock(eh); + else + z = 300; /* bug: locale not initialized, default is bogus! */ + } else + real_timezone_is_set = TRUE; + timezone = z * 60; + daylight = (z >= 4*60 && z <= 9*60); /* apply in the Americas */ + valid = TRUE; + CloseLocale(ll); + } + CloseLibrary(LocaleBase); + } + me->pr_WindowPtr = old_window; + return valid; +} + +void tzset(void) +{ + char *p,*TZstring; + int z,valid = FALSE; + + if (real_timezone_is_set) + return; + timezone = 0; /* default is GMT0 which means no offsets */ + daylight = 0; /* from local system time */ + TZstring = getenv("TZ"); /* read TZ envvar */ + if (TZstring && TZstring[0]) { /* TZ exists and has contents? */ + z = 3600; + for (p = TZstring; *p && !isdigit(*p) && *p != '-'; p++) ; + if (*p == '-') + z = -3600, p++; + if (*p) { + timezone = 0; + do { + while (isdigit(*p)) + timezone = timezone * 10 + z * (*p++ - '0'), valid = TRUE; + if (*p == ':') p++; + } while (isdigit(*p) && (z /= 60) > 0); + } + while (isspace(*p)) p++; /* probably not needed */ + if (valid) { + real_timezone_is_set = TRUE; + daylight = !!*p; /* a DST name part exists */ + } + } + if (!valid) + locale_TZ(); /* read locale.library */ +#ifdef __SASC + /* Some SAS/C library functions, e.g. stat(), call library */ + /* __tzset() themselves. So envvar TZ *must* exist in order to */ + /* to get the right offset from GMT. XXX WE SHOULD TRY HARD */ + /* find and replace any remaining functions that need this! */ + set_TZ(timezone, daylight); +#endif /* __SASC */ +} + + +struct tm *gmtime(const time_t *when) +{ + static struct tm tbuf; /* this function is intrinsically non-reentrant */ + static short smods[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; + long days = *when / 86400; + long secs = *when % 86400; + short yell, yday; + + tbuf.tm_wday = (days + 4) % 7; /* 1/1/70 is a Thursday */ + tbuf.tm_year = 70 + 4 * (days / 1461); + yday = days % 1461; + while (yday >= (yell = (tbuf.tm_year & 3 ? 365 : 366))) + yday -= yell, tbuf.tm_year++; + smods[1] = (tbuf.tm_year & 3 ? 28 : 29); + tbuf.tm_mon = 0; + tbuf.tm_yday = yday; + while (yday >= smods[tbuf.tm_mon]) + yday -= smods[tbuf.tm_mon++]; + tbuf.tm_mday = yday + 1; + tbuf.tm_isdst = 0; + tbuf.tm_sec = secs % 60; + tbuf.tm_min = (secs / 60) % 60; + tbuf.tm_hour = secs / 3600; +#ifdef AZTEC_C + tbuf.tm_hsec = 0; /* this field exists for Aztec only */ +#endif + return &tbuf; +} + +struct tm *localtime(const time_t *when) +{ + struct tm *t; + time_t localwhen; + int dst = FALSE, sundays, lastweekday; + + tzset(); + localwhen = *when - timezone; + t = gmtime(&localwhen); + /* So far we support daylight savings correction by the USA rule only: */ + if (daylight && t->tm_mon >= 3 && t->tm_mon <= 9) { + if (t->tm_mon > 3 && t->tm_mon < 9) /* May Jun Jul Aug Sep: yes */ + dst = TRUE; + else { + sundays = (t->tm_mday + 6 - t->tm_wday) / 7; + if (t->tm_wday == 0 && t->tm_hour < 2 && sundays) + sundays--; /* a Sunday does not count until 2:00am */ + if (t->tm_mon == 3 && sundays > 0) /* first sunday in April */ + dst = TRUE; + else if (t->tm_mon == 9) { + lastweekday = (t->tm_wday + 31 - t->tm_mday) % 7; + if (sundays < (37 - lastweekday) / 7) + dst = TRUE; /* last sunday in October */ + } + } + if (dst) { + localwhen += 3600; + t = gmtime(&localwhen); /* crude but effective */ + t->tm_isdst = 1; + } + } + return t; +} + + +# ifdef ZIP +time_t time(time_t *tp) +{ + time_t t; + struct DateStamp ds; + DateStamp(&ds); + t = ds.ds_Tick / TICKS_PER_SECOND + ds.ds_Minute * 60 + + (ds.ds_Days + 2922) * 86400; + t = mktime(gmtime(&t)); + /* gmtime leaves ds in the local timezone, mktime converts it to GMT */ + if (tp) *tp = t; + return t; +} +# endif /* ZIP */ +#endif /* !USE_TIME_LIB */ + +#endif /* !FUNZIP */ + + +#if CRYPT || !defined(FUNZIP) + +/* sendpkt.c + * by A. Finkel, P. Lindsay, C. Sheppner + * returns Res1 of the reply packet + */ +/* +#include +#include +#include +#include +#include +#include +*/ + +LONG sendpkt(struct MsgPort *pid, LONG action, LONG *args, LONG nargs); + +LONG sendpkt(pid,action,args,nargs) +struct MsgPort *pid; /* process identifier (handler message port) */ +LONG action, /* packet type (desired action) */ + *args, /* a pointer to argument list */ + nargs; /* number of arguments in list */ +{ + + struct MsgPort *replyport, *CreatePort(UBYTE *, long); + void DeletePort(struct MsgPort *); + struct StandardPacket *packet; + LONG count, *pargs, res1; + + replyport = CreatePort(NULL,0L); + if( !replyport ) return(0); + + packet = (struct StandardPacket *)AllocMem( + (long)sizeof(struct StandardPacket),MEMF_PUBLIC|MEMF_CLEAR); + if( !packet ) + { + DeletePort(replyport); + return(0); + } + + packet->sp_Msg.mn_Node.ln_Name = (char *)&(packet->sp_Pkt); + packet->sp_Pkt.dp_Link = &(packet->sp_Msg); + packet->sp_Pkt.dp_Port = replyport; + packet->sp_Pkt.dp_Type = action; + + /* copy the args into the packet */ + pargs = &(packet->sp_Pkt.dp_Arg1); /* address of 1st argument */ + for( count=0; countsp_Pkt.dp_Res1; + + FreeMem((char *)packet,(long)sizeof(*packet)); + DeletePort(replyport); + + return(res1); + +} /* sendpkt() */ + +#endif /* CRYPT || !FUNZIP */ + + +#if CRYPT || (defined(UNZIP) && !defined(FUNZIP)) + +/* Agetch() reads one raw keystroke -- uses sendpkt() */ + +int Agetch(void) +{ + LONG sendpkt(struct MsgPort *pid, LONG action, LONG *args, LONG nargs); + struct Task *me = FindTask(NULL); + struct CommandLineInterface *cli = BADDR(((struct Process *) me)->pr_CLI); + BPTR fh = cli->cli_StandardInput; /* this is immune to < redirection */ + void *conp = ((struct FileHandle *) BADDR(fh))->fh_Type; + char longspace[8]; + long *flag = (long *) ((ULONG) &longspace[4] & ~3); /* LONGWORD ALIGNED! */ + UBYTE c; + + *flag = 1; + sendpkt(conp, ACTION_SCREEN_MODE, flag, 1); /* assume success */ + Read(fh, &c, 1); + *flag = 0; + sendpkt(conp, ACTION_SCREEN_MODE, flag, 1); + if (c == 3) /* ^C in input */ + Signal(me, SIGBREAKF_CTRL_C); + return c; +} + +#endif /* CRYPT || (UNZIP && !FUNZIP) */ + +#endif /* __amiga_filedate_c*/ diff --git a/amiga/makefile.azt b/amiga/makefile.azt new file mode 100644 index 0000000..08f1cee --- /dev/null +++ b/amiga/makefile.azt @@ -0,0 +1,282 @@ +# Makefile for Zip, ZipNote, ZipCloak, ZipSplit for Aztec C 5.2 +# Also ZipLM, a version of Zip that needs much less free memory +# -- Paul Kienitz, last updated 25 Jun 98 + +# Make sure platform is defined correctly, and select memory usage options: +DEFINES = -d AMIGA -d DYN_ALLOC -d ASM_CRC +# ASM_CRC now serves only as a notation for "Zip -L". + +CC = cc +AS = as +CFLAGS = -psb0e -sabfmnpu -wcr0u $(DEFINES) +# -pbs means unsigned chars and short ints, -sabfmnpu is various small +# optimizations, -wcr0u adjusts type checking strictness + +CFLAGD = -bs -psb0e -s0f0n -wcr0u $(DEFINES) +# -bs is include source debugging info, -s0f0n is avoid hard-to-debug optimizations + +WSIZ = WSIZE=4096 +LOWFLAGS = $(CFLAGS) -d $(WSIZ) -d SMALL_MEM +# used for compiling a low-memory-use version of Zip + +LOWFLAGD = $(CFLAGD) -d $(WSIZ) -d SMALL_MEM +# for the debuggable low-memory-use version + +ASOPTS = -n -eAMIGA -eDYN_ALLOC -eCPUTEST -eINT16 +LOWASOPTS = $(ASOPTS) -e$(WSIZ) -eSMALL_MEM +# Options used for assembling amiga/deflate.a; must generally match the +# settings in DEFINES. LOWASOPTS are for the low-memory version. + +LD = ln +LDLIBS = -lc16 +LDFLAGS = -m +q + +LDFLAGD = -m +q -g -w + + +# default C rules +.c.o : + $(CC) $(CFLAGS) -o $@ $*.c + +# rules for routines containing entries needed by utilities +.c.oo : + $(CC) $(CFLAGS) -d UTIL -o $@ $*.c + +# rules for the low-memory version: + +.c.ol : + $(CC) $(LOWFLAGS) -o $@ $*.c + +# default C rules for debugging +.c.od : + $(CC) $(CFLAGD) -o $@ $*.c + +# debugging rules for routines containing entries needed by utilities +.c.dd : + $(CC) $(CFLAGD) -d UTIL -o $@ $*.c + +# rules for the low-memory version: + +.c.dl : + $(CC) $(LOWFLAGD) -o $@ $*.c + + +# object file lists + +ZIP_H = zip.h ziperr.h tailor.h amiga/osdep.h amiga/z-stat.h amiga/z-time.h + + +OBJZ = zip.o deflate.o trees.o zipfile.o zipup.o util.o \ + fileio.o globals.o amiga/amiga.o amiga/amigazip.o amiga/crc_68.o \ + amiga/time_lib.o crctab.o crypt.o ttyio.o + +OBJL = zip.ol deflate.ol trees.ol zipfile.ol \ + zipup.ol util.ol fileio.ol globals.ol crypt.ol ttyio.ol crctab.ol \ + amiga/amiga.ol amiga/amigazip.ol amiga/crc_68.o amiga/time_lib.o + +OBJU = zipfile.oo fileio.oo util.oo globals.o amiga/amiga.oo \ + amiga/amigazip.oo amiga/time_lib.o +OBJN = zipnote.o $(OBJU) +OBJC = zipcloak.o $(OBJU) crctab.o crypt.oo ttyio.o +OBJS = zipsplit.o $(OBJU) + +# These are the debuggable versions: + +DBJZ = zip.od deflate.od trees.od zipfile.od zipup.od \ + util.od fileio.od globals.od amiga/amiga.od amiga/amigazip.od \ + amiga/crc_68.o amiga/time_lib.od crctab.od crypt.od ttyio.od + +DBJL = zip.dl deflate.dl trees.dl zipfile.dl zipup.dl util.dl \ + fileio.dl globals.dl amiga/amiga.dl amiga/amigazip.dl amiga/crc_68.o \ + amiga/time_lib.od crctab.dl crypt.dl ttyio.dl + +DBJU = zipfile.dd fileio.dd util.dd globals.od amiga/amiga.dd \ + amiga/amigazip.dd amiga/time_lib.od +DBJN = zipnote.od $(DBJU) +DBJC = zipcloak.od $(DBJU) crctab.od crypt.dd ttyio.od +DBJS = zipsplit.od $(DBJU) + + +# HERE WE GO: + +all : Zip ZipNote ZipSplit ZipCloak + +z : Zip + +n : ZipNote + +s : ZipSplit + +c : ZipCloak + +l : ZipLM + +# Debug versions: + +dall : Zip.dbg ZipNote.dbg ZipSplit.dbg ZipCloak.dbg + +dz : Zip.dbg + +dn : ZipNote.dbg + +ds : ZipSplit.dbg + +dc : ZipCloak.dbg + +dl : ZipLM.dbg + + +Zip : $(OBJZ) $(ZIP_H) + $(LD) $(LDFLAGS) -o $@ $(OBJZ) $(LDLIBS) + -@delete Zip.dbg + +ZipNote : $(OBJN) $(ZIP_H) + $(LD) $(LDFLAGS) -o $@ $(OBJN) $(LDLIBS) + -@delete ZipNote.dbg + +ZipSplit : $(OBJS) $(ZIP_H) + $(LD) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS) + -@delete ZipSplit.dbg + +ZipCloak : $(OBJC) $(ZIP_H) + $(LD) $(LDFLAGS) -o $@ $(OBJC) $(LDLIBS) + -@delete ZipCloak.dbg + +ZipLM : $(OBJL) $(ZIP_H) + $(LD) $(LDFLAGS) -o $@ $(OBJL) $(LDLIBS) + -@delete ZipLM.dbg + + +Zip.dbg : $(DBJZ) $(ZIP_H) + $(LD) $(LDFLAGD) -o Zip $(DBJZ) $(LDLIBS) + +ZipNote.dbg : $(DBJN) $(ZIP_H) + $(LD) $(LDFLAGD) -o ZipNote $(DBJN) $(LDLIBS) + +ZipSplit.dbg : $(DBJS) $(ZIP_H) + $(LD) $(LDFLAGD) -o ZipSplit $(DBJS) $(LDLIBS) + +ZipCloak.dbg : $(DBJC) $(ZIP_H) + $(LD) $(LDFLAGD) -o ZipCloak $(DBJC) $(LDLIBS) + +ZipLM.dbg : $(DBJL) $(ZIP_H) + $(LD) $(LDFLAGD) -o ZipLM $(DBJL) $(LDLIBS) + + +clean : bugclean + -delete quiet $(OBJZ) + -delete quiet $(OBJL) + -delete quiet zipnote.o zipcloak.o zipsplit.o \ + crypt.oo $(OBJU) + +bugclean : + -delete quiet $(DBJZ) + -delete quiet $(DBJL) + -delete quiet zipnote.od zipcloak.od zipsplit.od \ + crypt.dd $(DBJU) + +cleaner : clean + -delete quiet Zip ZipNote ZipSplit ZipCloak ZipLM + -delete quiet Zip.dbg ZipNote.dbg ZipSplit.dbg ZipCloak.dbg ZipLM.dbg + + +# header dependencies: + +zip.o zipnote.o zipcloak.o zipsplit.o crypt.o ttyio.o deflate.o \ + trees.o zipfile.o zipup.o fileio.o util.o crctab.o \ + globals.o amiga/amiga.o : $(ZIP_H) + +zip.ol zipnote.ol zipcloak.ol zipsplit.ol crypt.ol ttyio.ol deflate.ol \ + trees.ol zipfile.ol zipup.ol fileio.ol util.ol crctab.ol \ + globals.ol amiga/amiga.ol : $(ZIP_H) + +crypt.oo zipfile.oo fileio.oo util.oo : $(ZIP_H) + +amiga/amigazip.o amiga/amigazip.ol amiga/amigazip.oo : amiga/amiga.h $(ZIP_H) + +zip.o zipnote.o zipcloak.o zipsplit.o zipup.o \ + zip.ol zipnote.ol zipcloak.ol zipsplit.ol zipup.ol : revision.h + +amiga/amiga.o amiga/amiga.ol : crypt.h + +crypt.o crypt.oo crypt.ol ttyio.o ttyio.ol zipcloak.o zipcloak.ol \ + zip.o zip.ol zipup.o zipup.ol : crypt.h ttyio.h + +zipup.o zipup.ol : amiga/zipup.h + + +# SPECIAL CASES: + +# -mr changes expression parsing; avoids a bogus "expression too complex" error: +trees.o : trees.c + $(CC) $(CFLAGS) -mr -o $@ trees.c + +trees.ol : trees.c + $(CC) $(LOWFLAGS) -mr -o $@ trees.c + +trees.od : trees.c + $(CC) $(CFLAGD) -mr -o $@ trees.c + +trees.ld : trees.c + $(CC) $(LOWFLAGD) -mr -o $@ trees.c + +# Substitute the assembly version of deflate.c: (but not in debug version) +deflate.o : amiga/deflate.a + $(AS) $(ASOPTS) -o $@ amiga/deflate.a + +deflate.ol : amiga/deflate.a + $(AS) $(LOWASOPTS) -o $@ amiga/deflate.a + +# The assembly CRC function: +amiga/crc_68.o : amiga/crc_68.a + $(AS) -n -o $@ amiga/crc_68.a + +# Put the Amiga internal version data with today's date into amiga.c: +amiga/amiga.o : amiga/amiga.c amiga/filedate.c amiga/stat.c + rx > env:VersionDate "say '""'translate(date('E'), '.', '/')'""'" + $(CC) $(CFLAGS) -o $@ amiga/amiga.c + delete env:VersionDate + +amiga/amiga.ol : amiga/amiga.c amiga/filedate.c amiga/stat.c + rx > env:VersionDate "say '""'translate(date('E'), '.', '/')'""'" + $(CC) $(LOWFLAGS) -o $@ amiga/amiga.c + delete env:VersionDate + +amiga/amiga.od : amiga/amiga.c amiga/filedate.c amiga/stat.c + rx > env:VersionDate "say '""'translate(date('E'), '.', '/')'""'" + $(CC) $(CFLAGD) -o $@ amiga/amiga.c + delete env:VersionDate + +amiga/amiga.ld : amiga/amiga.c amiga/filedate.c amiga/stat.c + rx > env:VersionDate "say '""'translate(date('E'), '.', '/')'""'" + $(CC) $(LOWFLAGD) -o $@ amiga/amiga.c + delete env:VersionDate + +amiga/amiga.oo : amiga/amiga.c amiga/filedate.c amiga/stat.c + rx > env:VersionDate "say '""'translate(date('E'), '.', '/')'""'" + $(CC) $(CFLAGS) -d UTIL -o $@ amiga/amiga.c + delete env:VersionDate + +amiga/amiga.dd : amiga/amiga.c amiga/filedate.c amiga/stat.c + rx > env:VersionDate "say '""'translate(date('E'), '.', '/')'""'" + $(CC) $(CFLAGD) -d UTIL -o $@ amiga/amiga.c + delete env:VersionDate + +# Put the compiler version number into amigazip.c: +amiga/amigazip.o : amiga/amigazip.c + $(CC) $(CFLAGS) -o $@ -d __VERSION__=5 -d __REVISION__=2 amiga/amigazip.c + +amiga/amigazip.ol : amiga/amigazip.c + $(CC) $(LOWFLAGS) -o $@ -d __VERSION__=5 -d __REVISION__=2 amiga/amigazip.c + +amiga/amigazip.od : amiga/amigazip.c + $(CC) $(CFLAGD) -o $@ -d __VERSION__=5 -d __REVISION__=2 amiga/amigazip.c + +amiga/amigazip.ld : amiga/amigazip.c + $(CC) $(LOWFLAGD) -o $@ -d __VERSION__=5 -d __REVISION__=2 amiga/amigazip.c + +amiga/amigazip.oo : amiga/amigazip.c + $(CC) $(CFLAGS) -d UTIL -o $@ -d __VERSION__=5 -d __REVISION__=2 amiga/amigazip.c + +amiga/amigazip.dd : amiga/amigazip.c + $(CC) $(CFLAGD) -d UTIL -o $@ -d __VERSION__=5 -d __REVISION__=2 amiga/amigazip.c diff --git a/amiga/match.a b/amiga/match.a new file mode 100644 index 0000000..ec5bcf0 --- /dev/null +++ b/amiga/match.a @@ -0,0 +1,182 @@ +;=========================================================================== +; Copyright (c) 1990-1999 Info-ZIP. All rights reserved. +; +; See the accompanying file LICENSE, version 1999-Oct-05 or later +; (the contents of which are also included in zip.h) for terms of use. +; If, for some reason, both of these files are missing, the Info-ZIP license +; also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html +;=========================================================================== +; match.a -- optional optimized asm version of longest match in deflate.c +; Written by Jean-loup Gailly +; Adapted for the Amiga by Carsten Steger +; using the code in match.S. +; The major change in this code consists of removing all unaligned +; word accesses, because they cause 68000-based Amigas to crash. +; For maximum speed, UNALIGNED_OK can be defined in Makefile.sasc. +; The program will then only run on 68020-based Amigas, though. +; If you have reduced WSIZE in zip.h, then make sure this is +; assembled with an equivalent -dWSIZE=. +; +; This code will run with registerized parameters too, unless SAS +; changes parameter passing conventions between new releases of SAS/C. + + +Cur_Match reg d0 ; Must be in d0! +Best_Len reg d1 +Loop_Counter reg d2 +Scan_Start reg d3 +Scan_End reg d4 +Limit reg d5 +Chain_Length reg d6 +Scan_Test reg d7 +Scan reg a0 +Match reg a1 +Prev_Address reg a2 +Scan_Ini reg a3 +Match_Ini reg a4 + +MAX_MATCH equ 258 +MIN_MATCH equ 3 + ifnd WSIZE +WSIZE equ 32768 + endc +MAX_DIST equ WSIZE-MAX_MATCH-MIN_MATCH-1 + + + xref _max_chain_length + xref _prev_length + xref _prev + xref _window + xref _strstart + xref _good_match + xref _match_start + xref _nice_match + + + section match,code + + xdef _match_init + xdef @match_init + xdef _longest_match + xdef @longest_match + + +_match_init: +@match_init: + rts + + +_longest_match: + move.l 4(sp),Cur_Match +@longest_match: + ifd UNALIGNED_OK + movem.l d2-d6/a2-a4,-(sp) + else + movem.l d2-d7/a2-a4,-(sp) + endc + move.l _max_chain_length,Chain_Length + move.l _prev_length,Best_Len + lea _prev,Prev_Address + lea _window+MIN_MATCH,Match_Ini + move.l _strstart,Limit + move.l Match_Ini,Scan_Ini + add.l Limit,Scan_Ini + subi.w #MAX_DIST,Limit + bhi.b limit_ok + moveq #0,Limit +limit_ok: + cmp.l _good_match,Best_Len + bcs.b length_ok + lsr.l #2,Chain_Length +length_ok: + subq.l #1,Chain_Length + + ifd UNALIGNED_OK + + move.w -MIN_MATCH(Scan_Ini),Scan_Start + move.w -MIN_MATCH-1(Scan_Ini,Best_Len.L),Scan_End + + else + + move.b -MIN_MATCH(Scan_Ini),Scan_Start + lsl.w #8,Scan_Start + move.b -MIN_MATCH+1(Scan_Ini),Scan_Start + move.b -MIN_MATCH-1(Scan_Ini,Best_Len.L),Scan_End + lsl.w #8,Scan_End + move.b -MIN_MATCH(Scan_Ini,Best_Len.L),Scan_End + + endc + + bra.b do_scan + +long_loop: + + ifd UNALIGNED_OK + + move.w -MIN_MATCH-1(Scan_Ini,Best_Len.L),Scan_End + + else + + move.b -MIN_MATCH-1(Scan_Ini,Best_Len.L),Scan_End + lsl.w #8,Scan_End + move.b -MIN_MATCH(Scan_Ini,Best_Len.L),Scan_End + + endc + +short_loop: + lsl.w #1,Cur_Match + move.w 0(Prev_Address,Cur_Match.L),Cur_Match + cmp.w Limit,Cur_Match + dbls Chain_Length,do_scan + bra.b return + +do_scan: + move.l Match_Ini,Match + add.l Cur_Match,Match + + ifd UNALIGNED_OK + + cmp.w -MIN_MATCH-1(Match,Best_Len.L),Scan_End + bne.b short_loop + cmp.w -MIN_MATCH(Match),Scan_Start + bne.b short_loop + + else + + move.b -MIN_MATCH-1(Match,Best_Len.L),Scan_Test + lsl.w #8,Scan_Test + move.b -MIN_MATCH(Match,Best_Len.L),Scan_Test + cmp.w Scan_Test,Scan_End + bne.b short_loop + move.b -MIN_MATCH(Match),Scan_Test + lsl.w #8,Scan_Test + move.b -MIN_MATCH+1(Match),Scan_Test + cmp.w Scan_Test,Scan_Start + bne.b short_loop + + endc + + move.w #(MAX_MATCH-MIN_MATCH),Loop_Counter + move.l Scan_Ini,Scan +scan_loop: + cmpm.b (Match)+,(Scan)+ + dbne Loop_Counter,scan_loop + + sub.l Scan_Ini,Scan + addq.l #(MIN_MATCH-1),Scan + cmp.l Best_Len,Scan + bls.b short_loop + move.l Scan,Best_Len + move.l Cur_Match,_match_start + cmp.l _nice_match,Best_Len + bcs.b long_loop +return: + move.l Best_Len,d0 + ifd UNALIGNED_OK + movem.l (sp)+,d2-d6/a2-a4 + else + movem.l (sp)+,d2-d7/a2-a4 + endc + rts + + end diff --git a/amiga/match_68.a b/amiga/match_68.a new file mode 100644 index 0000000..d1a6c39 --- /dev/null +++ b/amiga/match_68.a @@ -0,0 +1,273 @@ +;=========================================================================== +; Copyright (c) 1990-1999 Info-ZIP. All rights reserved. +; +; See the accompanying file LICENSE, version 1999-Oct-05 or later +; (the contents of which are also included in zip.h) for terms of use. +; If, for some reason, both of these files are missing, the Info-ZIP license +; also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html +;=========================================================================== +; This is a 68000 assembly language version of the Zip function +; longest_match(). It is written for any 680x0 based computer, but at this +; time the feature for runtime testing of CPU type is only supported for the +; Amiga. Hopefully a similar test for the Macintosh is possible, and for any +; other system that supports both 68000 and 68020+ CPUs. This is written by +; Paul Kienitz, partially derived from a simpler version by Carsten Steger, +; derived in turn from a 386 assembly function by Jean-loup Gailly and Kai Uwe +; Rommel... but also based directly on the C original. +; +; The main difference of this from other longest_match() implementations is +; that it includes both byte based and word based versions of the function, +; and various symbols can be defined to select whether to use one routine or +; the other, or to do a platform-specific test at runtime. The symbols that +; can be used to select behavior are as follows: +; +; CPU020 if defined, use 68020 instructions always +; CPUTEST if defined, check at runtime for CPU type. Another symbol +; specifying the platform-specific test must be used with this. +; If neither of these is defined, use 68000 instructions only. +; AMIGA use Amiga-specific test for 68020, if CPUTEST defined. Also +; tells it to let a0/a1/d1 be clobbered by functions. +; ATSIGN define entry symbols in @foo form as well as _foo, with +; @longest_match taking its parm in d0 instead of on the stack. +; WSIZE if defined, determines the sliding window size for deflate; +; the default is 32K. If you have reduced WSIZE for the C code, +; make sure that this module is assembled with an equivalent +; "-dWSIZE=" (or "-e...") switch. +; +; NOTE: no provision is made for 16 bit ints. All external int variables are +; treated as 32 bit values. This also assumes that longest_match's result is +; returned in D0. + + IFND CPU020 + IFND CPUTEST +CPU000 equ 1 + ENDC + ENDC + +; global variables: + xref _max_chain_length ; unsigned int + xref _prev_length ; unsigned int + xref _match_start ; unsigned int + xref _strstart ; unsigned int + xref _good_match ; signed int + xref _nice_match ; signed int + xref _window ; array of unsigned char + xref _prev ; array of unsigned short + +; our entry points: + xdef _match_init ; void match_init(void); + xdef _longest_match ; int longest_match(unsigned cur_match); + IFD ATSIGN + xdef @match_init ; for SAS assembler + xdef @longest_match ; ditto + ENDC + +; flag variable for remembering CPU type: + IFD CPUTEST + section cpuflag,data +is020: ds.w 1 + ENDC + + + section match,code +_match_init: + IFD ATSIGN +@match_init: + ENDC + + IFD CPUTEST ; now check for platform type + IFD AMIGA ; Amiga specific test for '020 CPU: + + xref _SysBase + + NOLIST + INCLUDE 'exec/execbase.i' + LIST + + clr.w is020 ; default value is 68000 + move.l _SysBase,a0 + btst #AFB_68020,AttnFlags+1(a0) + beq.s cheap + move.w #1,is020 + +cheap: + ELSE ; !AMIGA + + !! Write an '020-detector for your system here! + + ENDC ; AMIGA + ENDC ; CPUTEST + rts ; match_init consists only of rts if CPUTEST unset + + + IFD AMIGA +SAVEREGS reg d3-d7/a2/a3/a5 ; don't protect d0/d1/a0/a1 + ELSE +SAVEREGS reg d1/d3-d7/a0-a3/a5 ; protect all but d0 return val + ENDC + +Cur_Match equr d0 ; Must be in d0! +Best_Len equr d1 +Scan_Start equr d3 +Scan_End equr d4 +Limit equr d5 +Chain_Length equr d6 +Scan_Test equr d7 +Scan equr a0 +Match equr a1 +Prev_Address equr a2 +Scan_Ini equr a3 +Match_Ini equr a5 + + +MAX_MATCH equ 258 +MIN_MATCH equ 3 + IFND WSIZE +WSIZE equ 32768 + ENDC +MAX_DIST equ WSIZE-MAX_MATCH-MIN_MATCH-1 + +_longest_match: + move.l 4(sp),Cur_Match ; stack arg to register + IFD ATSIGN +@longest_match: + ENDC + movem.l SAVEREGS,-(sp) + +; setup steps common to byte and word versions: + move.l _max_chain_length,Chain_Length + move.l _prev_length,Best_Len + lea _prev,Prev_Address + lea _window,Match_Ini + move.l _strstart,Limit + move.l Match_Ini,Scan_Ini + addq #MIN_MATCH,Match_Ini + add.l Limit,Scan_Ini + subi.w #MAX_DIST,Limit + bhi.s limit_ok + moveq #0,Limit +limit_ok: + cmp.l _good_match,Best_Len + bcs.s length_ok + lsr.l #2,Chain_Length +length_ok: + subq.l #1,Chain_Length + + IFD CPUTEST + tst.w is020 ; can we use '020 stuff today? + bne WORD_match + ENDC + + IFND CPU020 + +; for 68000 or 68010, use byte operations: + moveq #0,Scan_Start ; clear 2nd and 4th bytes, use 1st & 3rd + moveq #0,Scan_End + moveq #0,Scan_Test + move.b (Scan_Ini),Scan_Start + swap Scan_Start + move.b 1(Scan_Ini),Scan_Start + move.b -1(Scan_Ini,Best_Len),Scan_End + swap Scan_End + move.b 0(Scan_Ini,Best_Len),Scan_End + bra.s bdo_scan + +blong_loop: + move.b -1(Scan_Ini,Best_Len),Scan_End + swap Scan_End + move.b 0(Scan_Ini,Best_Len),Scan_End + +bshort_loop: + add.w Cur_Match,Cur_Match + move.w 0(Prev_Address,Cur_Match.l),Cur_Match + cmp.l Limit,Cur_Match + dbls Chain_Length,bdo_scan + bra return + +bdo_scan: + move.l Match_Ini,Match + add.l Cur_Match,Match + move.b -MIN_MATCH-1(Match,Best_Len),Scan_Test + swap Scan_Test + move.b -MIN_MATCH(Match,Best_Len),Scan_Test + cmp.l Scan_Test,Scan_End + bne.s bshort_loop + move.b -MIN_MATCH(Match),Scan_Test + swap Scan_Test + move.b -MIN_MATCH+1(Match),Scan_Test + cmp.l Scan_Test,Scan_Start + bne.s bshort_loop + move.w #(MAX_MATCH-MIN_MATCH),Scan_Test + lea MIN_MATCH(Scan_Ini),Scan + +bscan_loop: + cmpm.b (Match)+,(Scan)+ + dbne Scan_Test,bscan_loop + subq #1,Scan + + sub.l Scan_Ini,Scan + cmp.l Best_Len,Scan + bls.s bshort_loop + move.l Scan,Best_Len + move.l Cur_Match,_match_start + cmp.l _nice_match,Best_Len + bcs.s blong_loop + IFD CPUTEST + bra return + ENDC + + ENDC ; !CPU020 + + IFND CPU000 + +; for 68020 or higher, use word operations even on odd addresses: +WORD_match: + move.w (Scan_Ini),Scan_Start + move.w -1(Scan_Ini,Best_Len),Scan_End + bra.s wdo_scan + +wlong_loop: + move.w -1(Scan_Ini,Best_Len),Scan_End + +wshort_loop: + add.w Cur_Match,Cur_Match + move.w (Prev_Address,Cur_Match.l),Cur_Match + cmp.l Limit,Cur_Match + dbls Chain_Length,wdo_scan + bra.s return + +wdo_scan: + move.l Match_Ini,Match + add.l Cur_Match,Match + cmp.w -MIN_MATCH-1(Match,Best_Len),Scan_End + bne.s wshort_loop + cmp.w -MIN_MATCH(Match),Scan_Start + bne.s wshort_loop + moveq #((MAX_MATCH-MIN_MATCH)/2),Scan_Test ; value = 127 + lea MIN_MATCH(Scan_Ini),Scan + +wscan_loop: + cmpm.w (Match)+,(Scan)+ + dbne Scan_Test,wscan_loop + subq #2,Scan + move.b -MIN_MATCH+1(Match),Scan_Test + cmp.b (Scan),Scan_Test + bne steven + addq #1,Scan +steven: + sub.l Scan_Ini,Scan + cmp.l Best_Len,Scan + bls.s wshort_loop + move.l Scan,Best_Len + move.l Cur_Match,_match_start + cmp.l _nice_match,Best_Len + bcs.s wlong_loop + + ENDC ; !CPU000 + +return: + move.l Best_Len,d0 ; function return value + movem.l (sp)+,SAVEREGS + rts + + end diff --git a/amiga/osdep.h b/amiga/osdep.h new file mode 100644 index 0000000..a5851e3 --- /dev/null +++ b/amiga/osdep.h @@ -0,0 +1,109 @@ +/* + Copyright (c) 1990-1999 Info-ZIP. All rights reserved. + + See the accompanying file LICENSE, version 1999-Oct-05 or later + (the contents of which are also included in zip.h) for terms of use. + If, for some reason, both of these files are missing, the Info-ZIP license + also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html +*/ +#ifndef __amiga_osdep_h +#define __amiga_osdep_h + +/* default to MEDIUM_MEM, but allow makefile override */ +#if ( (!defined(BIG_MEM)) && (!defined(SMALL_MEM))) +# define MEDIUM_MEM +#endif + +/* check that TZ environment variable is defined before using UTC times */ +#if (!defined(NO_IZ_CHECK_TZ) && !defined(IZ_CHECK_TZ)) +# define IZ_CHECK_TZ +#endif + +#define USE_CASE_MAP +#define USE_EF_UT_TIME +#define HANDLE_AMIGA_SFX +#define PROCNAME(n) (action == ADD || action == UPDATE ? wild(n) : \ + procname(n, 1)) +#define EXIT(e) ClearIOErr_exit(e) +void ClearIOErr_exit(int e); + +#include "amiga/z-stat.h" +#ifndef USE_TIME_LIB +# define NO_MKTIME +#endif + +#ifdef __SASC +# include +# include +# if (defined(_M68020) && (!defined(__USE_SYSBASE))) + /* on 68020 or higher processors it is faster */ +# define __USE_SYSBASE /* to use the pragma libcall instead of syscall */ +# endif /* to access functions of the exec.library */ +# include /* see SAS/C manual:part 2,chapter 2,pages 6-7 */ +# include +# if (defined(_M68020) && !defined(UNALIGNED_OK)) +# define UNALIGNED_OK +# endif +# ifndef REENTRANT +# define REENTRANT +# endif +# if (defined(_NEAR_DATA) && !defined(DYN_ALLOC)) +# define DYN_ALLOC +# endif +# ifdef DEBUG +# include /* profiler header file */ +# endif + /* define USE_TIME_LIB if replacement functions of time_lib are available */ + /* replaced are: tzset(), time(), localtime() and gmtime() */ +# define USE_TIME_LIB + +/* + A word on short-integers and SAS/C (a bug of [mc]alloc?) + Using short integers (i.e. compiling with option SHORT-INTEGERS) is + *not* recommended. To get maximum compression ratio the window size stored + in WSIZE should be 32k (0x8000). However, since the size of the window[] + array is 2*WSIZE, 65536 bytes must be allocated. The calloc function can + only allocate UINT_MAX (defined in limits.h) bytes which is one byte short + (65535) of the maximum window size if you are compiling with short-ints. + You'll get an error message "Out of memory (window allocation)" whenever + you try to deflate. Note that the compiler won't produce any warning. + The maximum window size with short-integers is therefore 32768 bytes. + The following is only implemented to allow the use of short-integers but + it is once again not recommended because of a loss in compression ratio. +*/ +# if (defined(_SHORTINT) && !defined(WSIZE)) +# define WSIZE 0x4000 /* only half of maximum window size */ +# endif /* possible with short-integers */ +#endif /* __SASC */ + +#ifdef AZTEC_C +# define NO_UNISTD_H +# define NO_RMDIR +# define BROKEN_FSEEK +# define USE_TIME_LIB +#endif + +#ifdef USE_TIME_LIB +extern int real_timezone_is_set; +# define VALID_TIMEZONE(tempvar) (tzset(), real_timezone_is_set) +#else +# define VALID_TIMEZONE(tempvar) ((tempvar = getenv("TZ")) && tempvar[0]) +#endif + +#ifdef ZCRYPT_INTERNAL +# ifndef CLIB_EXEC_PROTOS_H + void *FindTask(void *); +# endif +# define ZCR_SEED2 (unsigned)(ulg)FindTask(NULL) +#endif + +int Agetch(void); /* getch() like function, in amiga/filedate.c */ +char *GetComment(char *); + +#define FOPR "rb" +#define FOPM "rb+" +#define FOPW "wb" +/* prototype for ctrl-C trap function */ +void _abort(void); + +#endif /* !__amiga_osdep_h */ diff --git a/amiga/smakefile b/amiga/smakefile new file mode 100644 index 0000000..a772fcb --- /dev/null +++ b/amiga/smakefile @@ -0,0 +1,671 @@ +#=========================================================================== +# Makefile for Zip, ZipNote, ZipCloak, ZipSplit AMIGA SAS/C Version 6.58 +# Version: 2.3 last revised: 24 Aug 98 +#=========================================================================== +# -John Bush, +# or: + +# updated for SAS/C Version 6.56+ and AmigaDOS 3.1 (V40) +# by Haidinger Walter, + +# additional supplements and maintenance by Paul Kienitz + +# This makefile should work with at least AmigaDOS 2.04 (V37) (not tested) +# and will probably not work with AmigaDOS 1.3 (V34) + +# If you have any improvements, critics or else please feel free to mail. +# Any response is appreciated. Haidinger Walter + +# Available targets: +# all builds all executeables below +# zip builds zip executeable +# zipsplit builds zipsplit executeable +# zipcloak builds zipcloak executeable +# zipnote builds zipnote executeable +# ziplm builds low memory version of zip executable +# clean remove all files created by the compilation +# spotless like clean target but removes binaries too + + +########################## +# USER MACRO DEFINITIONS # +########################## + +# *** NOTE *** +# The assembly version is not implemented yet. +# (Un)commenting the assembler macros has no effect unless the +# file dependencies are changed too. +# Most of the amiga/*.a files do not assmble with 68000 instructions. +# Any help is appreciated, of course. + +# Set the processor to generate code for. +# Compiler: ANY 68000 68010 68020 68030 68040 68060 +# Assembler: 0 0 1 2 3 4 n/a +# Defaults: ANY and 0 +# +CUSECPU = ANY +AUSECPU = 0 + +# UNCOMMENT to use 68020 instructions in the assembly version of deflate.o +# Only use if code is generated for 68020 or higher processors above. +# Note: You could use CPUTEST too to enable runtime cpu detection. +# However, it is not recommended since both 68000 and 68020 code will be +# included which would be an unnecessary increase in size. +# (see amiga/deflate.a for more information) +# +#AUSE020 = CPU020 + +# To disable the assembler replacements and use the standard C source, +# you have to change the Zip and ZipLM dependencies. See below for details. +# (remember that assembler use is *not* implemented yet) + +# Uncomment both CUTIL and LUTIL to make use of utility.library of OS 2.04+ +# The utility.library is *not* used for UnZipSFX to ensure maximum portability +# between the different Amiga systems (minimal config: 68000 and OS 1.2). +# You can change this by adding the $(LUTIL) macro in the UnZipSFX linking +# rules (See below: Final output targets, UnZipSFX:). +# WARNINGS when using the utility library: +# 1. All Executables will *only* work with AmigaDOS 2.04 (v37) or higher. +# 2. You *need not* compile/link with short-integers using the +# utility.library. It will crash your machine. See Libraries below. +# +# Default: commented (not used) +# +#CUTIL = UTILLIB DEFINE=_UTILLIB +#LUTIL = WITH SC:LIB/utillib.with # include necessary linker defines +# Choose one stack-handling method (default=faster) +# StackExtend: Dynamic runtime stack extension. You won't notice stack overflows. +# StackCheck: On a stack overflow a requester appears which allows you to exit. +# Note that either stack watching will slow down your executable because of the +# extra code run on each function entry. On the other hand, you won't crash +# anymore due to stack overflows. However, you should not have *any* stack +# problems with Info-ZIP programs if you raise your stack to 10000 (which I'd +# recommend as a minimum default stack for all applications) or more using the +# shell stack command. Type 'Stack 20000' or add it to your S:Shell-Startup. +# BTW: Typing 'Stack' prints your current stack size. +# +CSTACK = NOSTACKCHECK STACKEXTEND # slow, but always works +#CSTACK = STACKCHECK NOSTACKEXTEND # slow, requester & graceful exit +#CSTACK = NOSTACKCHECK NOSTACKEXTEND # faster but relies on larger stack (>=10K) + + +# +# LIBRARIES +# --------- + +# Choose one DATAOPTS , SASLIB , ASMOPTS and LSTARTUP +# Always comment/uncomment all macros of a set. + +# Library to use with near data and 2-byte integers +# Notes: o slower than 4-byte integers with 68000 cpu +# o *not* recommended due to poor overall performance +# o see comment in amiga/osdep.h +#DATAOPTS = DATA=NEAR SHORTINTEGERS DEF=_NEAR_DATA +#SASLIB = scs +#ASMOPTS = -dINT16 +#LSTARTUP = cres.o + +# Library to use with near data and 4-byte integers (DEFAULT) +# *** use this with the utility.library *** +DATAOPTS = DATA=NEAR DEF=_NEAR_DATA +SASLIB = sc +ASMOPTS = +LSTARTUP = cres.o + +# Library to use with far data and 2-byte integers +# use if DYN_ALLOC is not defined +# old default - far data always works but is slower +#DATAOPTS = DATA=FAR SHORTINTEGERS DEF=_FAR_DATA +#SASLIB = scsnb +#ASMOPTS = -dINT16 +#LSTARTUP = c.o + +# Library to use with far data and 4-byte integers +# if everything else fails: try this +#DATAOPTS = DATA=FAR DEF=_FAR_DATA +#SASLIB = scnb +#ASMOPTS = +#LSTARTUP = c.o + + +# +# DEBUGGING +# --------- + +# Default: No debugging information added. +# The three macros below will be overwritten if you choose to add +# debug info, therefore no need to comment. + +CDBG = NODEBUG NOPROFILE NOCOVERAGE # default: no debug info +ADBG = +LDBG = STRIPDEBUG # default: no debug info + +# Compiler and loader debug flags. Uncomment as needed. Recomment when done. +# Optimization disabled for faster compilation (by using NOOPT) + +#CDBG1 = DEF=DEBUG DEF=DEBUG_TIME # enables Info-Zip's debug output + +# Enable profiling and coverage when desired. Option COVERAGE commented +# seperately because running coverage may corrupt your drive in case of a +# system crash since a file 'cover.dat' is created in your working directory. +# Note that the use of COVERAGE forces the use of the c.o startup module. + +#CDBG2 = PROFILE +#CDBG3 = COVERAGE # must use c.o startup code: +#LSTARTUP = c.o # Uncomment *only* when you use COVERAGE + +# *Uncomment* here macros CDBG, ADBG and LDBG to include debugging information + +#CDBG = $(CDBG1) $(CDBG2) $(CDBG3) ADDSYM DEBUG=FULLFLUSH STACKCHECK NOOPT +#ADBG = DEBUG +#LDBG = ADDSYM + +# Optional use of memwatch.library which can be found in your +# sc:extras/memlib directory. Please read the short docs (memlib.doc). +# Note that memwatch.library has a small bug: MWTerm() displays always +# the first entry. +# Get the latest version from aminet (dev/debug/memlib.lha) or +# contact me to get the patch. Uncomment all macros to use. +#CMEMLIB = DEFINE=MWDEBUG=1 # define to enable library +#LMEMLIB = SC:LIB/memwatch.lib # path to library +#LSTARTUP = c.o # must use c.o with memlib! + + +# +# MAPPING +# ------- + +# Map filenames used when mapping (no need to comment) +# +MAPFZ = zip.map # Zip map filename +MAPFN = zipnote.map # ZipNote map filename +MAPFC = zipcloak.map # ZipCloak map filename +MAPFS = zipsplit.map # ZipSplit map filename +MAPFL = ziplm.map # Zip low memory version map filename + +# Map file output: Uncomment to highlight and bold headings. +# +#MAPFSTYLE = FANCY + +# Map flags for each EXECUTABLE. Uncomment to enable mapping. +# For map options please refer to: +# SAS/C v6 manual, volume 1: user's guide, chapter 8, page 136: map +# Default: all options enabled: f,h,l,o,s,x +# |-> options start here +#LMAPZ = $(MAPFSTYLE) MAP $(MAPFZ) f,h,l,o,s,x # Zip maps +#LMAPN = $(MAPFSTYLE) MAP $(MAPFN) f,h,l,o,s,x # ZipNote maps +#LMAPC = $(MAPFSTYLE) MAP $(MAPFC) f,h,l,o,s,x # ZipCloak maps +#LMAPS = $(MAPFSTYLE) MAP $(MAPFS) f,h,l,o,s,x # ZipSplit maps +#LMAPL = $(MAPFSTYLE) MAP $(MAPFL) f,h,l,o,s,x # Zip lowmem maps + +# +# LISTINGS +# -------- + +# Listfile-extensions for each executable (enter *with* dot) +# +LISTEXTZ = .lst # extension for Zip listfiles +LISTEXTU = .ulst # extension for utility listfiles (ZipNote,ZipCloak,ZipSplit) +LISTEXTL = .llst # extension for Zip low memory listfiles + + +# List files and cross references for each OBJECT. +# Add/remove flags as needed. Not all listed by default. +# Use LISTINCLUDES to determine the dependencies for smake +# +CLISTOPT = LISTHEADERS LISTMACROS # LISTSYSTEM LISTINCLUDES +CXREFOPT = XHEAD XSYS +# +# Uncomment to enable listing (default: commented) +# *** WARNING: List files require *lots* of disk space! +# +#CLIST = LIST $(CLISTOPT) +#CXREF = XREF $(CXREFOPT) + + +# +# SUPPRESSED COMPILER WARNINGS +# ---------------------------- + +# Compiler warnings to ignore +# +# Warning 105 : module does not define any externally-known symbols +# Warning 304 : Dead assignment eliminated... +# Note 306 : ...function inlined... +# Warning 317 : possibly uninitialized variable... +# Comment to enable. +# +CIGNORE = IGNORE=105,304,306,317 + + +# +# OBJECT EXTENSIONS +# + +# Extensions used for objects of each executeable. +# Transformation rules require unique extensions. +# Enter *with* dot. +# +O = .o # extension for Zip objects +OU = .uo # extension for utility objects (ZipNote, ZipSplit and ZipCloak) +OL = .lo # extension for low memory Zip objects + + +# Filename used to store converted options from environment variable +# LOCAL_ZIP. Default: scoptions_local_zip +# +CWITHOPT = scoptions_local_zip + + +# Filenames to store compiler options to prevent command line overflow +# +# Common options file for Zip and other executables +CFILE = scoptions-zip + + +# Temp filenames for object lists to load using linker "WITH" command. +OBJLISTZ = zip_objlist.with # Zip object list +OBJLISTN = zipnote_objlist.with # ZipNote object list +OBJLISTC = zipcloak_objlist.with # ZipCloak object list +OBJLISTS = zipsplit_objlist.with # ZipSplit object list +OBJLISTL = ziplm_objlist.with # Zip low-mem object list + + +# Filenames to store linker options +# +LWITHZ = zip.lnk # zip linker options +LWITHN = zipnote.lnk # zipnote linker options +LWITHC = zipcloak.lnk # zipcloak linker options +LWITHS = zipsplit.lnk # zipsplit linker options +LWITHL = ziplm.lnk # zip low-mem linker options + + +# Define AMIGA_BETA to print "Beta Notice" up front. See tailor.h. +# Undefine AMIGA_BETA when building a released version. +#CDEFBETA = DEF=AMIGA_BETA + +##################################### +# NOTHING TO CHANGE BEYOND HERE ... # +##################################### +# (except for C/asm dependencies) + +# Define MEDIUM_MEM for production release (per Paul Kienitz). +# This reduces runtime memory requirement but not speed or compression. +# Note: Do *not* use BIG_MEM or MMAP since it isn't yet supported by the + assembler version of deflate.c : amiga/deflate.a +CUSEMEM = DEF=MEDIUM_MEM +AUSEMEM = -DMEDIUM_MEM # for asm deflate.o, must match above + + +# Defines for building low-memory use version of Zip +WSIZEL = WSIZE=4096 # deflate.c window size for low-mem version +CLOWMEM = DEF=SMALL_MEM DEF=$(WSIZEL) +ALOWMEM = -DSMALL_MEM -D$(WSIZEL) # for asm deflate.o, must match above + + +# Compiler definitions +# +CC = sc +# +# Optimizer flags +# +OPTPASSES = 6 # set number of global optimizer passes +# +OPT1 = OPT OPTINL OPTINLOCAL OPTTIME OPTLOOP OPTSCHED +OPT2 = OPTCOMP=$(OPTPASSES) OPTDEP=$(OPTPASSES) OPTRDEP=$(OPTPASSES) +OPT = $(OPT1) $(OPT2) + + +# Compiler flags +# +CDEFINES = $(CMEMLIB) $(CDEFBETA) DEF=AMIGA +COPTIONS = $(DATAOPTS) CODE=NEAR CPU=$(CUSECPU) VERBOSE PARAMETERS=BOTH NOMINC +COPTIONS = $(COPTIONS) ERRORREXX NOERRORCONSOLE MEMSIZE=HUGE $(CLIST) $(CXREF) +COPTIONS = $(COPTIONS) $(CSTACK) $(CUTIL) STRICT UNSCHAR NOICONS STRINGMERGE +CFLAGS = $(CDEFINES) $(COPTIONS) $(OPT) $(CDBG) $(CIGNORE) + + +# Linker definitions +# See SASLIB definition above +# +LD = slink +# special linker flags for pure (i.e. resident) binary. +LDFLAGSS = FROM SC:LIB/$(LSTARTUP) +# common linker flags for all other executeables +LDFLAGSC = FROM SC:LIB/c.o +LDFLAGS2 = NOICONS $(LDBG) +LIBFLAGS = LIB $(LMEMLIB) SC:LIB/$(SASLIB).lib SC:LIB/amiga.lib + + +# Assembler definitions +# +ASM = asm +# +# Options used for assembling amiga/deflate.a +# Must match defines in C-Source. +# +AFLAGS0 = -d__SASC -dSASC -dAMIGA +AFLAGS1 = $(AUSE020) $(ASMOPTS) $(ADBG) +AFLAGS2 = -m$(AUSECPU) -jm -iINCLUDE: +AFLAGS = $(AFLAGS0) $(AFLAGS1) $(AFLAGS2) +ASMOPTSZ = $(AFLAGS) $(AUSEMEM) -dDYN_ALLOC # Zip asm flags +ASMOPTSL = $(AFLAGS) $(ALOWMEM) # Zip low-mem version asm flags + + +################## +# TARGET OBJECTS # +################## + + +# Zip objects +OBJZ1 = zip$(O) zipfile$(O) zipup$(O) fileio$(O) util$(O) globals$(O) +OBJZ2 = crc32$(O) crctab$(O) crypt$(O) ttyio$(O) +OBJZI = deflate$(O) trees$(O) +OBJZA = amiga$(O) amigazip$(O) time_lib$(O) stat$(O) filedate$(O) +OBJZ = $(OBJZ1) $(OBJZ2) $(OBJZI) $(OBJZA) + +# Shared utility objects for ZipNote, ZipCloak and ZipSplit +OBJU1 = globals$(O) +OBJUU = zipfile$(OU) fileio$(OU) util$(OU) +OBJUA = amigazip$(OU) amiga$(O) time_lib$(O) stat$(O) filedate$(O) +OBJU = $(OBJU1) $(OBJUU) $(OBJUA) + +# ZipNote objects +OBJN1 = zipnote$(O) +OBJN = $(OBJN1) $(OBJU) + +# ZipCloak objects +OBJC1 = zipcloak$(O) +OBJCU = $(OBJU) crypt$(OU) +OBJCS = crctab$(O) ttyio$(O) +OBJC = $(OBJC1) $(OBJCU) $(OBJCS) + +#ZipSplit objects +OBJS1 = zipsplit$(O) +OBJS = $(OBJS1) $(OBJU) + +# ZipLM objects +OBJL1 = zip$(OL) zipfile$(OL) zipup$(OL) fileio$(OL) util$(OL) globals$(OL) +OBJL2 = crc32$(OL) crctab$(OL) crypt$(OL) ttyio$(OL) +OBJLI = deflate$(OL) trees$(OL) +OBJLA = amiga$(OL) amigazip$(OL) time_lib$(O) stat$(O) filedate$(O) +OBJL = $(OBJL1) $(OBJL2) $(OBJLI) $(OBJLA) + +# Common header files +ZIP_H1 = zip.h ziperr.h tailor.h +ZIP_HA = amiga/osdep.h amiga/z-stat.h amiga/z-time.h +ZIP_H = $(ZIP_H1) $(ZIP_HA) + +# Output targets +ZIPS = Zip ZipNote ZipCloak ZipSplit ZipLM + + +# Temp filenames for object lists to load using linker "WITH" command. +OBJLISTZ = zip_objlist.with # Zip object list +OBJLISTN = zipnote_objlist.with # ZipNote object list +OBJLISTC = zipcloak_objlist.with # ZipCloak object list +OBJLISTS = zipsplit_objlist.with # ZipSplit object list +OBJLISTL = ziplm_objlist.with # Zip low-mem object list + +####################################### +# DEFAULT TARGET AND PROCESSING RULES # +####################################### + +all: request flush $(ZIPS) + +# Zip transformation rules +# +.c$(O): + $(CC) WITH=$(CFILE) $(CUSEMEM) LISTFILE=$>$(LISTEXTZ) OBJNAME=$@ $*.c + +# Zip low-memory version transformation rules +# +.c$(OL): + $(CC) WITH=$(CFILE) $(CLOWMEM) LISTFILE=$>$(LISTEXTL) OBJNAME=$@ $*.c + +# Utilities (ZipNote, ZipCloak and ZipSplit) transformation rules +# +.c$(OU): + $(CC) WITH=$(CFILE) $(CUSEMEM) DEF=UTIL LISTFILE=$>$(LISTEXTU) OBJNAME=$@ $*.c + + +######################## +# Special target rules # +######################## + +# Special rule to build time_lib.o for Zip (requires NO_MKTIME define) +time_lib$(O): + $(CC) WITH=$(CFILE) $(CUSEMEM) DEF=ZIP LISTFILE=$>$(LISTEXTZ) OBJNAME=$@ $*.c + +######################### +# Final output targets. # +######################### + + +zip: local_zip CommonFlags $(OBJZ) + @Echo "$(OBJZ)" > $(OBJLISTZ) + Type $(OBJLISTZ) + @Echo "$(LDFLAGSS) $(LUTIL) WITH $(OBJLISTZ) $(LIBFLAGS)" \ + "$(LDFLAGS2) $(LMAPZ)" >$(LWITHZ) + Type $(LWITHZ) + $(LD) TO Zip WITH $(LWITHZ) + +zipnote: local_zip CommonFlags $(OBJN) + @Echo "$(OBJN)" > $(OBJLISTN) + Type $(OBJLISTN) + @Echo "$(LDFLAGSS) $(LUTIL) WITH $(OBJLISTN) $(LIBFLAGS) " \ + "$(LDFLAGS2) $(LMAPN)" >$(LWITHN) + Type $(LWITHN) + $(LD) TO ZipNote WITH $(LWITHN) + +zipcloak: local_zip CommonFlags $(OBJC) + @Echo "$(OBJC)" > $(OBJLISTC) + Type $(OBJLISTC) + @Echo "$(LDFLAGSS) $(LUTIL) WITH $(OBJLISTC) $(LIBFLAGS) " \ + "$(LDFLAGS2) $(LMAPC)" >$(LWITHC) + Type $(LWITHC) + $(LD) TO ZipCloak WITH $(LWITHC) + +zipsplit: local_zip CommonFlags $(OBJS) + @Echo "$(OBJS)" > $(OBJLISTS) + Type $(OBJLISTS) + @Echo "$(LDFLAGSS) $(LUTIL) WITH $(OBJLISTS) $(LIBFLAGS) " \ + "$(LDFLAGS2) $(LMAPS)" >$(LWITHS) + Type $(LWITHS) + $(LD) TO ZipSplit WITH $(LWITHS) + +ziplm: local_zip CommonFlags $(OBJL) + @Echo "$(OBJL)" > $(OBJLISTL) + Type $(OBJLISTL) + @Echo "$(LDFLAGSS) $(LUTIL) WITH $(OBJLISTL) $(LIBFLAGS) " \ + "$(LDFLAGS2) $(LMAPL)" >$(LWITHL) + Type $(LWITHL) + $(LD) TO ZipLM WITH $(LWITHL) + + +clean: + -Delete >nil: $(OBJZ) quiet + -Delete >nil: $(OBJN) quiet + -Delete >nil: $(OBJC) quiet + -Delete >nil: $(OBJS) quiet + -Delete >nil: $(OBJL) quiet + -Delete >nil: $(OBJLISTZ) $(OBJLISTL) $(OBJLISTN) $(OBJLISTS) $(OBJLISTC) quiet + -Delete >nil: $(MAPFZ) $(MAPFN) $(MAPFC) $(MAPFS) $(MAPFL) quiet + -Delete >nil: \#?$(LISTEXTZ) \#?$(LISTEXTU) \#?$(LISTEXTL) quiet + -Delete >nil: $(CWITHOPT) $(CFILE) quiet + -Delete >nil: $(LWITHZ) $(LWITHN) $(LWITHC) $(LWITHS) $(LWITHL) quiet + -Delete >nil: env:VersionDate quiet + -Delete >nil: \#?.q.?? \#?.tmp \#?.cov quiet + +spotless: clean + -Delete >nil: $(ZIPS) quiet + + +################ +# DEPENDENCIES # +################ + +# To change between the assembler and C sources, you have to comment/uncomment +# the approprite lines. C sources are marked by #C-src and assembler sources +# #asm-src at the end. +# Zip dependencies: +# + +zip$(O): zip.c $(ZIP_H) revision.h crypt.h ttyio.h +zipup$(O): zipup.c $(ZIP_H) revision.h crypt.h amiga/zipup.h +zipfile$(O): zipfile.c $(ZIP_H) revision.h +crypt$(O): crypt.c $(ZIP_H) crypt.h ttyio.h +ttyio$(O): ttyio.c $(ZIP_H) crypt.h ttyio.h +deflate$(O): deflate.c $(ZIP_H) #C-src +trees$(O): trees.c $(ZIP_H) +fileio$(O): fileio.c $(ZIP_H) +util$(O): util.c $(ZIP_H) mktime.c +crc32$(O): crc32.c $(ZIP_H) +crctab$(O): crctab.c $(ZIP_H) +globals$(O): globals.c $(ZIP_H) +# Amiga specific objects +stat$(O): amiga/stat.c amiga/z-stat.h amiga/z-time.h +filedate$(O): amiga/filedate.c amiga/z-time.h crypt.h +time_lib$(O): amiga/time_lib.c amiga/z-time.h +amiga$(O): amiga/amiga.c ziperr.h +amigazip$(O): amiga/amigazip.c $(ZIP_H) amiga/amiga.h env:Workbench +# Substitute assembly version of deflate.c: +#deflate$(O): amiga/deflate.a #asm-src +# $(ASM) $(ASMOPTSZ) -o$@ $*.a #asm-src + + +# Utility (ZipNote, ZipCloak, ZipSplit) dependencies: +# +zipnote$(O): zipnote.c $(ZIP_H) revision.h +zipcloak$(O): zipcloak.c $(ZIP_H) revision.h crypt.h ttyio.h +zipsplit$(O): zipsplit.c $(ZIP_H) revision.h +zipfile$(OU): zipfile.c $(ZIP_H) revision.h +fileio$(OU): fileio.c $(ZIP_H) +util$(OU): util.c $(ZIP_H) mktime.c +crypt$(OU): crypt.c $(ZIP_H) crypt.h ttyio.h +# Amiga specific objects +amigazip$(OU): amiga/amigazip.c $(ZIP_H) amiga/amiga.h env:Workbench + +# ZipLM dependencies: +# +zip$(OL): zip.c $(ZIP_H) revision.h crypt.h ttyio.h +zipup$(OL): zipup.c $(ZIP_H) revision.h crypt.h amiga/zipup.h +zipfile$(OL): zipfile.c $(ZIP_H) revision.h +crypt$(OL): crypt.c $(ZIP_H) crypt.h ttyio.h +ttyio$(OL): ttyio.c $(ZIP_H) crypt.h ttyio.h +deflate$(OL): deflate.c $(ZIP_H) +trees$(OL): trees.c $(ZIP_H) +fileio$(OL): fileio.c $(ZIP_H) +util$(OL): util.c $(ZIP_H) mktime.c +crc32$(OL): crc32.c $(ZIP_H) +crctab$(OL): crctab.c $(ZIP_H) +globals$(OL): globals.c $(ZIP_H) +# Amiga specific objects +stat$(OL): amiga/stat.c amiga/z-stat.h amiga/z-time.h +filedate$(OL): amiga/filedate.c amiga/z-time.h crypt.h +time_lib$(OL): amiga/time_lib.c amiga/z-time.h +amiga$(OL): amiga/amiga.c ziperr.h +# Substitute assembly version of deflate.c: +#deflate$(OL): amiga/deflate.a +# $(ASM) $(ASMOPTSL) -o$@ $*.a + + +######################## +# DEPENDECIES END HERE # +######################## + +# flush all libraries to provide more mem for compilation +flush: + @Avail flush >nil: + +# write common compiler flags to file and echo to user +CommonFlags: + @Echo "$(CFLAGS)" >$(CFILE) + @Type "$(CWITHOPT)" >>$(CFILE) + -Type $(CFILE) + + +# special rules for adding Amiga internal version number to amiga/amiga.c +amiga$(O): + rx > env:VersionDate "say '""'translate(date('E'),'.','/')'""'" + $(CC) WITH=$(CFILE) $(CUSEMEM) LISTFILE=$>$(LISTEXTZ) OBJNAME=$@ $*.c + -Delete env:VersionDate + +amiga$(OL): + rx > env:VersionDate "say '""'translate(date('E'),'.','/')'""'" + $(CC) WITH=$(CFILE) $(CLOWMEM) LISTFILE=$>$(LISTEXTL) OBJNAME=$@ $*.c + -Delete env:VersionDate + + +# needed in amiga/amigazip.c +# should be set in startup-sequence, but just in case: +# (only works with OS 2.0 and above) + +env\:WorkBench: + @Execute < < (Workbench_smk.tmp) + FailAt 21 + If not exists ENV:Workbench + Version >nil: + SetEnv Workbench $$Workbench + Endif + < + + +# Read environment variable LOCAL_ZIP and convert options to SAS format +# +# e.g.: to define FOO_ONE and FOO_TWO enter: +# +# SetEnv LOCAL_ZIP "-DFOO_ONE -DFOO_TWO" +# +# Put the statement into your startup-sequence or (for AmigaDOS 2.0 or higher +# only) make sure LOCAL_ZIP is stored in the ENVARC: directory +# ( Copy ENV:LOCAL_ZIP ENVARC: ) +# + +local_zip: + @Execute < < (Local_Zip_smk.tmp) + Failat 21 + If exists ENV:LOCAL_ZIP + Echo "Using environment variable LOCAL_ZIP !" + Copy >NIL: ENV:LOCAL_ZIP SASCOPTS + Else + Echo "You could use envvar ZIP_OPT to set your special compilation options." + Delete >nil: SASCOPTS quiet + Endif + ; Do not remove the lctosc command! If LOCAL_ZIP is unset, an + ; empty file is created which needed by CommonFlags ! + lctosc >$(CWITHOPT) + < + + + +# Echo request to the user +# +request: + @Echo "" + @Echo " This makefile is for use with SAS/C version 6.58." + @Echo " If you still have an older version, please upgrade!" + @Echo " Patches are available on the Aminet under biz/patch/sc\#?." + @Echo "" + @Echo " Just a simple request..." + @Echo " Please give me a mail that you compiled whether you encounter any errors" + @Echo " or not. I'd just like to know how many Amiga users actually make use of" + @Echo " this makefile." + @Echo " If you mail me, I'll put you on my mailing-list and notify you whenever" + @Echo " new versions of Info-Zip are released." + @Echo " Have a look at the makefile for changes like CPU type, UtilLib, etc." + @Echo " Feel free to mail comments, suggestions, etc." + @Echo " Enjoy Info-Zip !" + @Echo " Haidinger Walter, " + @Echo "" + + +# Echo help in case of an error +# +.ONERROR: + @Echo "" + @Echo "[sigh] An error running this makefile was detected." + @Echo "This message may also appear if you interrupted smake by pressing CTRL-C." + @Echo "Contact Info-Zip authors at Zip-Bugs@lists.wku.edu or me for help." + @Echo "Haidinger Walter, " + diff --git a/amiga/stat.c b/amiga/stat.c new file mode 100644 index 0000000..c453273 --- /dev/null +++ b/amiga/stat.c @@ -0,0 +1,293 @@ +/* + Copyright (c) 1990-2005 Info-ZIP. All rights reserved. + + See the accompanying file LICENSE, version 2004-May-22 or later + (the contents of which are also included in zip.h) for terms of use. + If, for some reason, both of these files are missing, the Info-ZIP license + also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html +*/ +/* Here we have a handmade stat() function because Aztec's c.lib stat() */ +/* does not support an st_mode field, which we need... also a chmod(). */ + +/* This stat() is by Paul Wells, modified by Paul Kienitz. */ +/* Originally for use with Aztec C >= 5.0 and Lattice C <= 4.01 */ +/* Adapted for SAS/C 6.5x by Haidinger Walter */ + +/* POLICY DECISION: We will not attempt to remove global variables from */ +/* this source file for Aztec C. These routines are essentially just */ +/* augmentations of Aztec's c.lib, which is itself not reentrant. If */ +/* we want to produce a fully reentrant UnZip, we will have to use a */ +/* suitable startup module, such as purify.a for Aztec by Paul Kienitz. */ + +#ifndef __amiga_stat_c +#define __amiga_stat_c + +#include +#include +#include "amiga/z-stat.h" /* fake version of stat.h */ +#include + +#ifdef AZTEC_C +# include +# include +# include +# include +# include +# include +#endif +#ifdef __SASC +# include /* SAS/C dir function prototypes */ +# include +# include +# include +#endif + +#ifndef SUCCESS +# define SUCCESS (-1) +# define FAILURE (0) +#endif + + +void close_leftover_open_dirs(void); /* prototype */ + +static DIR *dir_cleanup_list = NULL; /* for resource tracking */ + +/* CALL THIS WHEN HANDLING CTRL-C OR OTHER UNEXPECTED EXIT! */ +void close_leftover_open_dirs(void) +{ + while (dir_cleanup_list) + closedir(dir_cleanup_list); +} + + +unsigned short disk_not_mounted; + +extern int stat(const char *file, struct stat *buf); + +stat(file,buf) +const char *file; +struct stat *buf; +{ + + struct FileInfoBlock *inf; + BPTR lock; + time_t ftime; + struct tm local_tm; + + if( (lock = Lock((char *)file,SHARED_LOCK))==0 ) + /* file not found */ + return(-1); + + if( !(inf = (struct FileInfoBlock *)AllocMem( + (long)sizeof(struct FileInfoBlock),MEMF_PUBLIC|MEMF_CLEAR)) ) + { + UnLock(lock); + return(-1); + } + + if( Examine(lock,inf)==FAILURE ) + { + FreeMem((char *)inf,(long)sizeof(*inf)); + UnLock(lock); + return(-1); + } + + /* fill in buf */ + buf->st_dev = + buf->st_nlink = + buf->st_uid = + buf->st_gid = + buf->st_rdev = 0; + buf->st_ino = inf->fib_DiskKey; + buf->st_blocks = inf->fib_NumBlocks; + buf->st_size = inf->fib_Size; + + /* now the date. AmigaDOS has weird datestamps--- + * ds_Days is the number of days since 1-1-1978; + * however, as Unix wants date since 1-1-1970... + */ + + ftime = + (inf->fib_Date.ds_Days * 86400 ) + + (inf->fib_Date.ds_Minute * 60 ) + + (inf->fib_Date.ds_Tick / TICKS_PER_SECOND ) + + (86400 * 8 * 365 ) + + (86400 * 2 ); /* two leap years */ + + tzset(); + /* ftime += timezone; */ + local_tm = *gmtime(&ftime); + local_tm.tm_isdst = -1; + ftime = mktime(&local_tm); + + buf->st_ctime = + buf->st_atime = + buf->st_mtime = ftime; + + buf->st_mode = (inf->fib_DirEntryType < 0 ? S_IFREG : S_IFDIR); + + /* lastly, throw in the protection bits */ + buf->st_mode |= ((inf->fib_Protection ^ 0xF) & 0xFF); + + FreeMem((char *)inf, (long)sizeof(*inf)); + UnLock((BPTR)lock); + + return(0); + +} + +int fstat(int handle, struct stat *buf) +{ + /* fake some reasonable values for stdin */ + buf->st_mode = (S_IREAD|S_IWRITE|S_IFREG); + buf->st_size = -1; + buf->st_mtime = time(&buf->st_mtime); + return 0; +} + + +/* opendir(), readdir(), closedir(), rmdir(), and chmod() by Paul Kienitz. */ + +DIR *opendir(const char *path) +{ + DIR *dd = AllocMem(sizeof(DIR), MEMF_PUBLIC); + if (!dd) return NULL; + if (!(dd->d_parentlock = Lock((char *)path, MODE_OLDFILE))) { + disk_not_mounted = IoErr() == ERROR_DEVICE_NOT_MOUNTED; + FreeMem(dd, sizeof(DIR)); + return NULL; + } else + disk_not_mounted = 0; + if (!Examine(dd->d_parentlock, &dd->d_fib) || dd->d_fib.fib_EntryType < 0) { + UnLock(dd->d_parentlock); + FreeMem(dd, sizeof(DIR)); + return NULL; + } + dd->d_cleanuplink = dir_cleanup_list; /* track them resources */ + if (dir_cleanup_list) + dir_cleanup_list->d_cleanupparent = &dd->d_cleanuplink; + dd->d_cleanupparent = &dir_cleanup_list; + dir_cleanup_list = dd; + return dd; +} + +void closedir(DIR *dd) +{ + if (dd) { + if (dd->d_cleanuplink) + dd->d_cleanuplink->d_cleanupparent = dd->d_cleanupparent; + *(dd->d_cleanupparent) = dd->d_cleanuplink; + if (dd->d_parentlock) + UnLock(dd->d_parentlock); + FreeMem(dd, sizeof(DIR)); + } +} + +struct dirent *readdir(DIR *dd) +{ + return (ExNext(dd->d_parentlock, &dd->d_fib) ? (struct dirent *)dd : NULL); +} + + +#ifdef AZTEC_C + +int rmdir(const char *path) +{ + return (DeleteFile((char *)path) ? 0 : IoErr()); +} + +int chmod(const char *filename, int bits) /* bits are as for st_mode */ +{ + long protmask = (bits & 0xFF) ^ 0xF; + return !SetProtection((char *)filename, protmask); +} + + +/* This here removes unnecessary bulk from the executable with Aztec: */ +void _wb_parse(void) { } + +/* fake a unix function that does not apply to amigados: */ +int umask(void) { return 0; } + + +# include + +/* C library signal() messes up debugging yet adds no actual usefulness */ +typedef void (*__signal_return_type)(int); +__signal_return_type signal() { return SIG_ERR; } + + +/* The following replaces Aztec's argv-parsing function for compatibility with +Unix-like syntax used on other platforms. It also fixes the problem the +standard _cli_parse() has of accepting only lower-ascii characters. */ + +int _argc, _arg_len; +char **_argv, *_arg_lin; + +void _cli_parse(struct Process *pp, long alen, register UBYTE *aptr) +{ + register UBYTE *cp; + register struct CommandLineInterface *cli; + register short c; + register short starred = 0; +# ifdef PRESTART_HOOK + void Prestart_Hook(void); +# endif + + cli = (struct CommandLineInterface *) (pp->pr_CLI << 2); + cp = (UBYTE *) (cli->cli_CommandName << 2); + _arg_len = cp[0] + alen + 2; + if (!(_arg_lin = AllocMem((long) _arg_len, 0L))) + return; + c = cp[0]; + strncpy(_arg_lin, cp + 1, c); + _arg_lin[c] = 0; + for (cp = _arg_lin + c + 1; alen && (*aptr < '\n' || *aptr > '\r'); alen--) + *cp++ = *aptr++; + *cp = 0; + aptr = cp = _arg_lin + c + 1; + for (_argc = 1; ; _argc++) { + while (*cp == ' ' || *cp == '\t') + cp++; + if (!*cp) + break; + if (*cp == '"') { + cp++; + while (c = *cp++) { + if (c == '"' && !starred) { + *aptr++ = 0; + starred = 0; + break; + } else if (c == '\\' && !starred) + starred = 1; + else { + *aptr++ = c; + starred = 0; + } + } + } else { + while ((c = *cp++) && c != ' ' && c != '\t') + *aptr++ = c; + *aptr++ = 0; + } + if (c == 0) + --cp; + } + *aptr = 0; + if (!(_argv = AllocMem((_argc + 1) * sizeof(*_argv), 0L))) { + _argc = 0; + return; + } + for (c = 0, cp = _arg_lin; c < _argc; c++) { + _argv[c] = cp; + cp += strlen(cp) + 1; + } + _argv[c] = NULL; +# ifdef PRESTART_HOOK + Prestart_Hook(); +# endif +} + +#endif /* AZTEC_C */ + +#endif /* __amiga_stat_c */ diff --git a/amiga/time_lib.c b/amiga/time_lib.c new file mode 100644 index 0000000..2804c05 --- /dev/null +++ b/amiga/time_lib.c @@ -0,0 +1,541 @@ +#define __amiga_time_lib_c + +/* ----------------------------------------------------------------------------- +This source is copyrighted by Norbert Pueschel +From 'clockdaemon.readme': +(available from Aminet, main site is ftp.wustl.edu:/pub/aminet/ under + util/time/clockdaemon.lha) +"The original SAS/C functions gmtime, localtime, mktime and time do not +work correctly. The supplied link library time.lib contains replacement +functions for them." +The time.lib library consists of three parts (time.c, timezone.c and version.c), +all included here. [time.lib 1.2 (1997-04-02)] +Permission is granted to the Info-ZIP group to redistribute the time.lib source. +The use of time.lib functions in own, noncommercial programs is permitted. +It is only required to add the timezone.doc to such a distribution. +Using the time.lib library in commercial software (including Shareware) is only +permitted after prior consultation of the author. +------------------------------------------------------------------------------*/ +/* History */ +/* 30 Mar 1997, Haidinger Walter, added AVAIL_GETVAR macro to support OS +# include +# include + /* this setenv() is in amiga/filedate.c */ + extern int setenv(const char *var, const char *value, int overwrite); +#else +# include +# include +# include +# include +# include +# include +/* Info-ZIP accesses these by their standard names: */ +# define __timezone timezone +# define __daylight daylight +# define __tzset tzset +#endif +#define NO_TIME_H +#include "amiga/z-time.h" +#include +#include +#include +#include + +extern struct ExecBase *SysBase; +extern char *getenv(const char *var); + +typedef unsigned long time_t; +struct tm { + int tm_sec; /* seconds after the minute */ + int tm_min; /* minutes after the hour */ + int tm_hour; /* hours since midnight */ + int tm_mday; /* day of the month */ + int tm_mon; /* months since January */ + int tm_year; /* years since 1900 */ + int tm_wday; /* days since Sunday */ + int tm_yday; /* days since January 1 */ + int tm_isdst; /* Daylight Savings Time flag */ +}; +struct dstdate { + enum { JULIAN0, JULIAN, MWD } dd_type; + int dd_day; + int dd_week; + int dd_month; + int dd_secs; +}; +static struct dstdate __dststart; +static struct dstdate __dstend; + +#define isleapyear(y) (((y)%4==0&&(!((y)%100==0)||((y)%400==0)))?1:0) +#define yearlen(y) (isleapyear(y)?366:365) +#define weekday(d) (((d)+4)%7) +#define jan1ofyear(y) (((y)-70)*365+((y)-69)/4-((y)-1)/100+((y)+299)/400) +#define wdayofyear(y) weekday(jan1ofyear(y)) +#define AMIGA2UNIX 252460800 /* seconds between 1.1.1970 and 1.1.1978 */ +#define CHECK 300 /* min. time between checks of IXGMTOFFSET */ +#define GETVAR_REQVERS 36L /* required OS version for GetVar() */ +#define AVAIL_GETVAR (SysBase->LibNode.lib_Version >= GETVAR_REQVERS) +#ifndef TZ_ENVVAR +# define TZ_ENVVAR "TZ" /* environment variable to parse */ +#endif + +#ifdef __SASC + extern int __daylight; + extern long __timezone; + extern char *__tzname[2]; + extern char *_TZ; +#else + int __daylight; + long __timezone; + char *__tzname[2]; + char *_TZ = NULL; +#endif +int real_timezone_is_set = FALSE; /* globally visible TZ_is_valid signal */ +char __tzstn[MAXTIMEZONELEN]; +char __tzdtn[MAXTIMEZONELEN]; +/* the following 4 variables are only used internally; make them static ? */ +int __isdst; +time_t __nextdstchange; +long __stdoffset; +long __dstoffset; +#define TZLEN 64 +static char TZ[TZLEN]; +static struct tm TM; +static const unsigned short days[2][13] = { + { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 }, + { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 } +}; +#ifndef NO_MKTIME /* only used by mktime() */ +static const unsigned short monlen[2][12] = { + { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }, + { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } +}; +#endif + +/* internal prototypes */ +static time_t dst2time(int year,struct dstdate *dst); +static void time2tm(time_t time); +static int checkdst(time_t time); +#ifndef NO_MKTIME +static void normalize(int *i,int *j,int norm); +#endif +static long gettime(char **s); +static void getdstdate(char **s,struct dstdate *dst); +#ifdef __SASC +void set_TZ(long time_zone, int day_light); +#endif + +/* prototypes for sc.lib replacement functions */ +struct tm *gmtime(const time_t *t); +struct tm *localtime(const time_t *t); +#ifndef NO_MKTIME +time_t mkgmtime(struct tm *tm); +time_t mktime(struct tm *tm); +#endif +time_t time(time_t *tm); +void __tzset(void); + + +static time_t dst2time(int year,struct dstdate *dst) +{ + int isleapyear,week,mon,mday; + mon = 0; + mday = dst->dd_day; + isleapyear = isleapyear(year); + switch(dst->dd_type) { + case JULIAN: + if(!isleapyear || dst->dd_day <= 59) break; + default: + mday++; + break; + case MWD: + mon = dst->dd_month-1; + week = dst->dd_week; + if(week == 5) { + mon++; + week = 0; + } + mday = dst->dd_day - weekday(jan1ofyear(year)+days[isleapyear][mon]); + if(mday < 0) mday += 7; + mday += (week - 1) * 7 + 1; + break; + } + return((time_t)(jan1ofyear(year)+days[isleapyear][mon]+mday-1)*(time_t)86400L+ + (time_t)dst->dd_secs); +} + +static void time2tm(time_t time) +{ + int isleapyear; + TM.tm_sec = time % 60; + time /= 60; + TM.tm_min = time % 60; + time /= 60; + TM.tm_hour = time % 24; + time /= 24; + TM.tm_year = time/365 + 70; /* guess year */ + while((TM.tm_yday = time - jan1ofyear(TM.tm_year)) < 0) TM.tm_year--; + isleapyear = isleapyear(TM.tm_year); + for(TM.tm_mon = 0; + TM.tm_yday >= days[isleapyear][TM.tm_mon+1]; + TM.tm_mon++); + TM.tm_mday = TM.tm_yday - days[isleapyear][TM.tm_mon] + 1; + TM.tm_wday = (time+4)%7; +} + +static int checkdst(time_t time) +{ + int year,day; + time_t t,u; + day = time / 86400L; + year = day / 365 + 70; /* guess year */ + while(day - jan1ofyear(year) < 0) year--; + t = dst2time(year,&__dststart) + __stdoffset; + u = dst2time(year,&__dstend) + __dstoffset; + if(u > t) { + return((time >= t && time < u)?1:0); + } + else { + return((time < u || time >= t)?1:0); + } +} + +struct tm *gmtime(const time_t *t) +{ + TM.tm_isdst = 0; + time2tm(*t); + return(&TM); +} + +struct tm *localtime(const time_t *t) +{ + if(!_TZ) __tzset(); + TM.tm_isdst = checkdst(*t); + time2tm(*t - (TM.tm_isdst ? __dstoffset : __stdoffset)); + return(&TM); +} + +#ifndef NO_MKTIME /* normalize() only used by mktime() */ +static void normalize(int *i,int *j,int norm) +{ + while(*i < 0) { + *i += norm; + (*j)--; + } + while(*i >= norm) { + *i -= norm; + (*j)++; + } +} + +time_t mkgmtime(struct tm *tm) +{ + time_t t; + normalize(&tm->tm_sec,&tm->tm_min,60); + normalize(&tm->tm_min,&tm->tm_hour,60); + normalize(&tm->tm_hour,&tm->tm_mday,24); + normalize(&tm->tm_mon,&tm->tm_year,12); + while(tm->tm_mday > monlen[isleapyear(tm->tm_year)][tm->tm_mon]) { + tm->tm_mday -= monlen[isleapyear(tm->tm_year)][tm->tm_mon]; + tm->tm_mon++; + if(tm->tm_mon == 12) { + tm->tm_mon = 0; + tm->tm_year++; + } + } + while(tm->tm_mday < 0) { + tm->tm_mon--; + if(tm->tm_mon == -1) { + tm->tm_mon = 11; + tm->tm_year--; + } + tm->tm_mday += monlen[isleapyear(tm->tm_year)][tm->tm_mon]; + } + tm->tm_yday = tm->tm_mday + days[isleapyear(tm->tm_year)][tm->tm_mon] - 1; + t = jan1ofyear(tm->tm_year) + tm->tm_yday; + tm->tm_wday = weekday(t); + if(tm->tm_year < 70) return((time_t)0); + t = t * 86400L + tm->tm_hour * 3600L + tm->tm_min * 60L + (time_t)tm->tm_sec; + return(t); +} + +time_t mktime(struct tm *tm) +{ + time_t t; + if(!_TZ) __tzset(); + t = mkgmtime(tm); + if(tm->tm_isdst < 0) tm->tm_isdst = checkdst(t); + t += tm->tm_isdst ? __dstoffset : __stdoffset; + return(t); +} +#endif /* !NO_MKTIME */ + +static long gettime(char **s) +{ + long num,time; + for(num = 0;**s >= '0' && **s <= '9';(*s)++) { + num = 10*num + (**s - '0'); + } + time = 3600L * num; + if(**s == ':') { + (*s)++; + for(num = 0;**s >= '0' && **s <= '9';(*s)++) { + num = 10*num + (**s - '0'); + } + time += 60 * num; + if(**s == ':') { + (*s)++; + for(num = 0;**s >= '0' && **s <= '9';(*s)++) { + num = 10*num + (**s - '0'); + } + time += num; + } + } + return(time); +} + +static void getdstdate(char **s,struct dstdate *dst) +{ + switch(**s) { + case 'J': + case 'j': + (*s)++; + dst->dd_type = JULIAN; + for(dst->dd_day = 0;**s >= '0' && **s <= '9';(*s)++) { + dst->dd_day = 10*dst->dd_day + (**s - '0'); + } + break; + case 'M': + case 'm': + (*s)++; + dst->dd_type = MWD; + for(dst->dd_month = 0;**s >= '0' && **s <= '9';(*s)++) { + dst->dd_month = 10*dst->dd_month + (**s - '0'); + } + if(**s != '.') return; + (*s)++; + for(dst->dd_week = 0;**s >= '0' && **s <= '9';(*s)++) { + dst->dd_week = 10*dst->dd_week + (**s - '0'); + } + if(**s != '.') return; + (*s)++; + for(dst->dd_day = 0;**s >= '0' && **s <= '9';(*s)++) { + dst->dd_day = 10*dst->dd_day + (**s - '0'); + } + break; + default: + dst->dd_type = JULIAN0; + for(dst->dd_day = 0;**s >= '0' && **s <= '9';(*s)++) { + dst->dd_day = 10*dst->dd_day + (**s - '0'); + } + break; + } + if(**s == '/') { + (*s)++; + dst->dd_secs = gettime(s); + } +} + +void __tzset(void) +{ + char *s,*t; + int minus = 0; + time_t tm; + struct Library *LocaleBase; + struct Locale *loc = NULL; + if (real_timezone_is_set) + return; + real_timezone_is_set = TRUE; + __dststart.dd_secs = __dstend.dd_secs = 7200; + __dststart.dd_type = __dstend.dd_type = MWD; + __dststart.dd_month = 4; + __dststart.dd_week = 1; + __dstend.dd_month = 10; + __dstend.dd_week = 5; + __dststart.dd_day = __dstend.dd_day = 0; /* sunday */ + _TZ = NULL; + if (AVAIL_GETVAR) { /* GetVar() available? */ + if(GetVar(TZ_ENVVAR,TZ,TZLEN,GVF_GLOBAL_ONLY) > 0) + _TZ = TZ; + } else + _TZ = getenv(TZ_ENVVAR); + if (_TZ == NULL || !_TZ[0]) { + static char gmt[MAXTIMEZONELEN] = DEFAULT_TZ_STR; + LocaleBase = OpenLibrary("locale.library",0); + if(LocaleBase) { + loc = OpenLocale(0); /* cannot return null */ + if (loc->loc_GMTOffset == -300 || loc->loc_GMTOffset == 300) { + BPTR eh; + if (eh = Lock("ENV:sys/locale.prefs", ACCESS_READ)) + UnLock(eh); + else { + real_timezone_is_set = FALSE; + loc->loc_GMTOffset = 300; /* Amigados bug: default when locale is */ + } /* not initialized can have wrong sign */ + } + sprintf(gmt, "GMT%ld:%02ld", loc->loc_GMTOffset / 60L, + labs(loc->loc_GMTOffset) % 60L); + CloseLocale(loc); + CloseLibrary(LocaleBase); + } else + real_timezone_is_set = FALSE; + _TZ = gmt; + } + for(s = _TZ,t = __tzstn;*s && *s != '+' && *s != '-' && *s != ',' && + (*s < '0' || *s > '9');s++) { + if(t-__tzstn < MAXTIMEZONELEN-1) *(t++) = *s; + } + *t = '\0'; + if(*s == '+') { + s++; + } + else { + if(*s == '-') { + minus = 1; + s++; + } + } + __stdoffset = gettime(&s); + if(minus) { + __stdoffset *= -1; + } + if(*s) { + minus = 0; + for(t = __tzdtn;*s && *s != '+' && *s != '-' && *s != ',' && + (*s < '0' || *s > '9');s++) { + if(t-__tzdtn < MAXTIMEZONELEN-1) *(t++) = *s; + } + *t = '\0'; + if(*s == '+') { + s++; + } + else { + if(*s == '-') { + minus = 1; + s++; + } + } + if(*s && *s != ',') { + __dstoffset = gettime(&s); + if(minus) { + __dstoffset *= -1; + } + } + else { + __dstoffset = __stdoffset - 3600L; + } + if(*s == ',') { + s++; + getdstdate(&s,&__dststart); + if(*s == ',') { + s++; + getdstdate(&s,&__dstend); + } + } + } + else { + __dstoffset = __stdoffset; + } + time2tm(time(&tm)); + __isdst = checkdst(tm); + __daylight = (__dstoffset != __stdoffset); + __timezone = __stdoffset; + __nextdstchange = dst2time(TM.tm_year, __isdst ? &__dstend : &__dststart); + if(tm >= __nextdstchange) { + __nextdstchange = dst2time(TM.tm_year+1, + __isdst ? &__dstend : &__dststart); + } + __tzname[0] = __tzstn; + __tzname[1] = __tzdtn; +#ifdef __SASC + if (loc) /* store TZ envvar if data read from locale */ + set_TZ(__timezone, __daylight); +#endif +} + +time_t time(time_t *tm) +{ + static time_t last_check = 0; + static struct _ixgmtoffset { + LONG Offset; + UBYTE DST; + UBYTE Null; + } ixgmtoffset; + static char *envvarstr; /* ptr to environm. string (used if !AVAIL_GETVAR) */ + struct DateStamp ds; + time_t now; + DateStamp(&ds); + now = ds.ds_Days * 86400L + ds.ds_Minute * 60L + + ds.ds_Tick / TICKS_PER_SECOND; + if(now - last_check > CHECK) { + last_check = now; + if (AVAIL_GETVAR) /* GetVar() available? */ + if(GetVar("IXGMTOFFSET",(STRPTR)&ixgmtoffset,6, + GVF_BINARY_VAR|GVF_GLOBAL_ONLY) == -1) { + __tzset(); + ixgmtoffset.Offset = __isdst ? __dstoffset : __stdoffset; + } + else + if (envvarstr=getenv("IXGMTOFFSET")) { + ixgmtoffset = *((struct _ixgmtoffset *)envvarstr); /* copy to struct */ + __tzset(); + ixgmtoffset.Offset = __isdst ? __dstoffset : __stdoffset; + } + } + now += AMIGA2UNIX; + now += ixgmtoffset.Offset; + if(tm) *tm = now; + return(now); +} + +#ifdef __SASC + +/* Stores data from timezone and daylight to ENV:TZ. */ +/* ENV:TZ is required to exist by some other SAS/C library functions, */ +/* like stat() or fstat(). */ +void set_TZ(long time_zone, int day_light) +{ + char put_tz[MAXTIMEZONELEN]; /* string for putenv: "TZ=aaabbb:bb:bbccc" */ + int offset; + void *exists; /* dummy ptr to see if global envvar TZ already exists */ + if (AVAIL_GETVAR) + exists = (void *)FindVar(TZ_ENVVAR,GVF_GLOBAL_ONLY); /* OS V36+ */ + else + exists = (void *)getenv(TZ_ENVVAR); + /* see if there is already an envvar TZ_ENVVAR. If not, create it */ + if (exists == NULL) { + /* create TZ string by pieces: */ + sprintf(put_tz, "GMT%+ld", time_zone / 3600L); + if (time_zone % 3600L) { + offset = (int) labs(time_zone % 3600L); + sprintf(put_tz + strlen(put_tz), ":%02d", offset / 60); + if (offset % 60) + sprintf(put_tz + strlen(put_tz), ":%02d", offset % 60); + } + if (day_light) + strcat(put_tz,"DST"); + if (AVAIL_GETVAR) /* store TZ to ENV:TZ. */ + SetVar(TZ_ENVVAR,put_tz,-1,GVF_GLOBAL_ONLY); /* OS V36+ */ + else + setenv(TZ_ENVVAR,put_tz, 1); + } +} +#endif /* __SASC */ diff --git a/amiga/timezone.doc b/amiga/timezone.doc new file mode 100644 index 0000000..7868093 --- /dev/null +++ b/amiga/timezone.doc @@ -0,0 +1,85 @@ +Timezone strings: +----------------- +This is a description of valid timezone strings for ENV[ARC]:TZ: +"XPG3TZ - time zone information" +The form of the time zone information is based on the XPG3 specification of +the TZ environment variable. Spaces are allowed only in timezone +designations, where they are significant. The following description +closely follows the XPG3 specification, except for the paragraphs starting +**CLARIFICATION**. + +[[],[/