home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume44 / unzip / part15 < prev    next >
Encoding:
Internet Message Format  |  1994-09-19  |  71.0 KB

  1. From: zip-bugs@wkuvx1.wku.edu (Info-ZIP group)
  2. Newsgroups: comp.sources.misc
  3. Subject: v44i080:  unzip - Info-ZIP portable UnZip, version 5.12, Part15/20
  4. Date: 18 Sep 1994 23:16:35 -0500
  5. Organization: Sterling Software
  6. Sender: kent@sparky.sterling.com
  7. Approved: kent@sparky.sterling.com
  8. Message-ID: <35j3b3$qqk@sparky.sterling.com>
  9. X-Md4-Signature: c7739000dd02e82faf0f3a3e70ff5601
  10.  
  11. Submitted-by: zip-bugs@wkuvx1.wku.edu (Info-ZIP group)
  12. Posting-number: Volume 44, Issue 80
  13. Archive-name: unzip/part15
  14. Environment: UNIX, VMS, OS/2, MS-DOS, MACINTOSH, WIN-NT, LINUX, MINIX, COHERENT, AMIGA?, ATARI TOS, SGI, DEC, Cray, Convex, Amdahl, Sun
  15. Supersedes: unzip50: Volume 31, Issue 104-117
  16.  
  17. #! /bin/sh
  18. # This is a shell archive.  Remove anything before this line, then feed it
  19. # into a shell via "sh file" or similar.  To overwrite existing files,
  20. # type "sh file -c".
  21. # Contents:  unzip-5.12/ZipPorts unzip-5.12/human68k/options.s.UU
  22. #   unzip-5.12/os2/wat_met.dif unzip-5.12/unix/unzipsfx.1
  23. #   unzip-5.12/unshrink.c
  24. # Wrapped by kent@sparky on Sat Sep 17 23:33:45 1994
  25. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin:$PATH ; export PATH
  26. echo If this archive is complete, you will see the following message:
  27. echo '          "shar: End of archive 15 (of 20)."'
  28. if test -f 'unzip-5.12/ZipPorts' -a "${1}" != "-c" ; then 
  29.   echo shar: Will not clobber existing file \"'unzip-5.12/ZipPorts'\"
  30. else
  31.   echo shar: Extracting \"'unzip-5.12/ZipPorts'\" \(13591 characters\)
  32.   sed "s/^X//" >'unzip-5.12/ZipPorts' <<'END_OF_FILE'
  33. X__________________________________________________________________________
  34. X
  35. X  This is the Info-ZIP file ZipPorts, last updated on 15 August 1994.
  36. X__________________________________________________________________________
  37. X
  38. X
  39. XThis document defines a set of rules and guidelines for those who wish to
  40. Xcontribute patches to Zip and UnZip (or even entire ports to new operating
  41. Xsystems).  The list below is something between a style sheet and a "Miss 
  42. XManners" etiquette guide.  While Info-ZIP encourages contributions and 
  43. Xfixes from anyone who finds something worth changing, we are also aware
  44. Xof the fact that no two programmers have the programming style and that 
  45. Xunrestrained changes by a few dozen contributors would result in hideously
  46. Xugly (and unmaintainable) Frankenstein code.  So consider the following an
  47. Xattempt by the maintainers to maintain sanity as well as useful code.
  48. X
  49. X(The first version of this document was called either "ZipRules" or the
  50. X"No Feelthy ..." file and was compiled by David Kirschbaum in consulta-
  51. Xtion with Mark Adler, Cave McNewt and others.  The current incarnation
  52. Xexpands upon the original with insights gained from a few more years of
  53. Xhappy hacking...)
  54. X
  55. X
  56. XSummary:
  57. X
  58. X  (0) The Platinum Rule:  DON'T BREAK EXISTING PORTS
  59. X(0.1) The Golden Rule:    DO UNTO THE CODE AS OTHERS HAVE DONE BEFORE
  60. X(0.2) The Silver Rule:    DO UNTO THE LATEST BETA CODE
  61. X(0.3) The Bronze Rule:    NO FEELTHY PIGGYBACKS
  62. X
  63. X  (1) NO FEELTHY TABS
  64. X  (2) NO FEELTHY CARRIAGE RETURNS
  65. X  (3) NO FEELTHY 8-BIT CHARS
  66. X  (4) NO FEELTHY LEFT-JUSTIFIED DASHES
  67. X  (5) NO FEELTHY FANCY_FILENAMES
  68. X  (6) NO FEELTHY NON-ZIPFILES AND NO FEELTHY E-MAIL BETAS
  69. X  (7) NO FEELTHY E-MAIL BINARIES
  70. X
  71. X
  72. XExplanations:
  73. X
  74. X  (0) The Platinum Rule:  DON'T BREAK EXISTING PORTS
  75. X
  76. X      No doubt about it, this is the one which really pisses us off and
  77. X      pretty much guarantees that your port or patch will be ignored and/
  78. X      or laughed at.  Examples range from the *really* severe cases which
  79. X      "port" by ripping out all of the existing multi-OS code, to more
  80. X      subtle oopers like relying on a local capability which doesn't exist
  81. X      on other OSes or in older compilers (e.g., the use of ANSI "#elif"
  82. X      constructs, C++ comments, GNU extensions, etc.).  As to the former,
  83. X      use #ifdefs for your new code (see rule 0.3).  And as to the latter,
  84. X      trust us--there are few things we'd like better than to be able to
  85. X      use some of the elegant "new" features out there (many of which have
  86. X      been around for a decade or more).  But our code still compiles on
  87. X      machines dating back even longer, at least in spirit--e.g., the AT&T
  88. X      3B1 family and Dynix/ptx.  Until we say otherwise, dinosaurs are
  89. X      supported.
  90. X
  91. X
  92. X(0.1) The Golden Rule:  DO UNTO THE CODE AS OTHERS HAVE DONE BEFORE
  93. X
  94. X      In other words, try to fit into the local style of programming--no
  95. X      matter how painful it may be.  This includes cosmetic aspects like
  96. X      indenting the same amount (both in the main C code and in the in-
  97. X      clude files), using braces and comments similarly, NO TABS (see rule
  98. X      #1), etc.; but also more substantive things like (for UnZip) putting
  99. X      character strings into static (far) variables and using the LoadFar-
  100. X      String macros to avoid overflowing limited MS-DOS data segments, and
  101. X      using the PRINTF/FPRINTF/PUTC macros instead of the corresponding
  102. X      functions so that dynamic-link-library ports are simpler.
  103. X
  104. X      Note that not only do Zip and UnZip differ in these respects, so do
  105. X      individual parts of each program.  While it would be nice to have
  106. X      global consistency, cosmetic changes are not a high priority; for
  107. X      now we'll settle for local consistency--i.e., don't make things any
  108. X      worse than they already are.
  109. X
  110. X      Exception (BIG exception):  single-letter variable names.  Despite
  111. X      the prevailing practice in much of Zip and parts of UnZip, and de-
  112. X      spite the fact that one-letter variables allow you to pack really
  113. X      cool, compact and complicated expressions onto one line, they also
  114. X      make the code very difficult to maintain and are therefore *strongly*
  115. X      discouraged.  Don't ask us who is responsible in the first place;
  116. X      while this sort of brain damage is not uncommon among former BASIC
  117. X      programmers, it is nevertheless a lifelong embarrassment, and we do
  118. X      try to pity the poor sod (that is, when we're not chasing bugs and
  119. X      cursing him).  :-)
  120. X
  121. X
  122. X(0.2) The Silver Rule:  DO UNTO THE LATEST BETA CODE
  123. X
  124. X      Few things are as annoying as receiving a large patch which obviously
  125. X      represents a lot of time and careful work but which is relative to
  126. X      an old version of Info-ZIP code.  As wonderful as Larry Wall's patch
  127. X      program is at applying context diffs to modified code, we regularly
  128. X      make near-global changes and/or reorganize big chunks of the sources
  129. X      (particularly in UnZip), and "patch" can't work miracles--big changes
  130. X      invariably break any patch which is relative to an old version of the
  131. X      code.
  132. X
  133. X      Bottom line:  contact the Info-ZIP core team FIRST (via the zip-bugs
  134. X      e-mail address) and get up to date with the latest code before begin-
  135. X      ning a big new port.
  136. X
  137. X      
  138. X(0.3) The Bronze Rule:  NO FEELTHY PIGGYBACKS
  139. X
  140. X      UnZip is currently ported to something like 10 operating systems
  141. X      (a few more or less depending on how one counts), and each of these
  142. X      has a unique macro identifying it:  AMIGA, ATARI_ST, __human68k__,
  143. X      MACOS, MSDOS, OS2, NT (or WIN32), TOPS20, UNIX, VMS.  Zip is moving
  144. X      in the same direction.  New ports should NOT piggyback one of the
  145. X      existing ports unless they are substantially similar--for example,
  146. X      Minix and Coherent are basically Unix and therefore are included in
  147. X      the UNIX macro, but DOS djgpp ports and OS/2 emx ports (both of which
  148. X      use the Unix-originated GNU C compiler and often have "unix" defined
  149. X      by default) are obviously *not* Unix.  [The existing MTS port is a
  150. X      special exception; basically only one person knows what MTS really
  151. X      is, and he's not telling.  Presumably it's not very close to Unix,
  152. X      but it's not worth arguing about it now.]  Along the same lines,
  153. X      neither OS/2 nor Human68K is the same as (or even close to) MS-DOS.
  154. X
  155. X      Bottom line:  when adding a new port (e.g., MVS), create a new macro
  156. X      for it ("MVS"), a new subdirectory ("mvs") and a new source file for
  157. X      OS-specific code ("mvs/mvs.c").  Use #ifdefs to fit any OS-specific
  158. X      changes into the existing code (e.g., unzip.h).  If it's close enough
  159. X      to an existing port that piggybacking is a temptation, define a new
  160. X      "combination macro" (e.g., "MVS_UNIX") and replace the old macros as
  161. X      required.  (This last applies to UnZip, at least; Jean-loup prefers
  162. X      fewer macros and long #ifdef lines, so talk to him about Zip.)  See
  163. X      also rule 0.1.
  164. X
  165. X      (Note that, for UnZip, new ports need not attempt to deal with all
  166. X      features.  Among other things, the wildcard-zipfile code in do_wild()
  167. X      may be replaced with a supplied dummy version, since opendir/readdir/
  168. X      closedir() or the equivalent can be difficult to implement.)
  169. X
  170. X
  171. X  (1) NO FEELTHY TABS
  172. X
  173. X      Some editors and e-mail systems either have no capability to use
  174. X      and/or display tab characters (ASCII 9) correctly, or they use non-
  175. X      standard or variable-width tab columns, or other horrors.  Some edi-
  176. X      tors auto-convert spaces to tabs, after which the blind use of "diff
  177. X      -c" results in a huge and mostly useless patch.  Yes, *we* know about
  178. X      diff's "-b" option, but not everyone does.  And yes, we also know this
  179. X      makes the source files bigger, even after compression; so be it.
  180. X
  181. X      Bottom line:  use spaces, not tabs.
  182. X
  183. X      Exception:  some of the makefiles (the Unix one in particular), for
  184. X      which tabs are required as part of the syntax.
  185. X
  186. X      Related utility programs:
  187. X          Unix, OS/2 and MS-DOS:  expand, unexpand.
  188. X          MS-DOS:  Buerg's TABS; Toad Hall's TOADSOFT.
  189. X          And some editors have the conversion built-in.
  190. X
  191. X
  192. X  (2) NO FEELTHY CARRIAGE RETURNS
  193. X
  194. X      All source, documentation and other text files shall have Unix style
  195. X      line endings (LF only, a.k.a. ctrl-J), not the DOS/OS2/NT CR+LF or Mac
  196. X      CR-only line endings.
  197. X
  198. X      Reason:  "real programmers" in any environment can convert back and
  199. X      forth between Unix and DOS/Mac style.  All PC compilers but a few old
  200. X      Borland versions can use either Unix or MS-DOS end-of-lines.  Buerg's
  201. X      LIST (file-display utility) for MS-DOS can use Unix or MS-DOS EOLs.
  202. X      Both Zip and UnZip can convert line-endings as appropriate.  But Unix
  203. X      utilities like diff and patch die a horrible death (or produce horrible
  204. X      output) if the target files have CRs.
  205. X
  206. X      Related utilities:  flip for Unix, OS/2 and MS-DOS; Unix "tr".
  207. X
  208. X      Exceptions:  documentation in pre-compiled binary distributions should
  209. X      be in the local (target) format.
  210. X
  211. X
  212. X  (3) NO FEELTHY 8-BIT CHARS
  213. X
  214. X      Do all your editing in a plain-text ASCII editor.  No WordPerfect, MS
  215. X      Word, WordStar document mode, or other word processor files, thenkyew.
  216. X      No desktop publishing.  *Especially* no EBCDIC.  No TIFFs, no GIFs, no
  217. X      embedded pictures or dancing ladies (too bad, Cave Newt).  [Sigh... -CN]
  218. X
  219. X      Reason:  compatibility with different consoles.  My old XT clone is
  220. X      the most limited!
  221. X
  222. X      Exceptions:  some Macintosh makefiles apparently require some 8-bit
  223. X      characters; the Human68k port uses 8-bit characters to Kanji or Kana
  224. X      comments (I think); etc.
  225. X
  226. X      Related utilities:  vi, emacs, EDLIN, Turbo C editor, other programmers'
  227. X      editors, various word processor -> text conversion utilities.
  228. X
  229. X
  230. X  (4) NO FEELTHY LEFT-JUSTIFIED DASHES
  231. X
  232. X      Always precede repeated dashes (------) with one or more leading non-
  233. X      dash characters:  spaces, tabs, pound signs (#), comments (/*), what-
  234. X      ever.
  235. X
  236. X      Reason:  sooner or later your source file will be e-mailed through an
  237. X      undigestifier utility, most of which treat leading dashes as end-of-
  238. X      message separators.  We'd rather not have your code broken up into a
  239. X      dozen separate untitled messages, thank you.
  240. X
  241. X
  242. X  (5) NO FEELTHY FANCY_FILENAMES
  243. X
  244. X      Assume the worst:  that someone on a brain-damaged DOS system has to
  245. X      work with everything your magic fingers produced.  Keep the filenames
  246. X      unimaginative and within MS-DOS limits (i.e., ordinary A..Z, 1..9,
  247. X      "-$_!"-type characters, in the 8.3 "filename.ext" format).  Mac and
  248. X      Unix users, giggle all you want, but no spaces or multiple dots.
  249. X
  250. X      Reason:  compatibility with different file systems.  MS-DOS FAT is the
  251. X      most limited, with the exception of CompuServe (6.3, argh).
  252. X
  253. X      Exceptions:  slightly longer names are occasionally acceptable within
  254. X      OS-specific subdirectories, but don't do that unless there's a good
  255. X      reason for it.
  256. X
  257. X
  258. X  (6) NO FEELTHY NON-ZIPFILES AND NO FEELTHY E-MAIL BETAS
  259. X
  260. X      Beta testers and developers are in general expected to have both
  261. X      ftp capability and the ability to deal with zipfiles.  Those without
  262. X      should either find a friend who does or else learn about ftp-mailers.
  263. X
  264. X      Reason:  the core development team barely has time to work on the
  265. X      code, much less prepare oddball formats and/or mail betas out (and
  266. X      the situation is getting worse, sigh).
  267. X
  268. X      Exceptions:  anyone seriously proposing to do a new port will be
  269. X      given special treatment, particularly with respect to UnZip; we
  270. X      obviously realize that bootstrapping a completely new port can be
  271. X      quite difficult and have no desire to make it even harder due to
  272. X      lack of access to the latest code (rule 0.2).
  273. X
  274. X      Public releases of UnZip, on the other hand, will be available in
  275. X      the following formats:  .tar.Z (16-bit compress'd tar), .zoo (ver-
  276. X      sion 2.10, available for Unix, OS/2, MS-DOS, VMS, etc.), and .zip
  277. X      (either "plain" or self-extracting).  Zip sources and executables
  278. X      will generally only be distributed in .zip format, since Zip is
  279. X      pretty much useless without UnZip.
  280. X
  281. X
  282. X  (7) NO FEELTHY E-MAIL BINARIES
  283. X
  284. X      Binary files (e.g., executables, test zipfiles, etc.) should NEVER
  285. X      be mailed raw.  Where possible, they should be uploaded via ftp in
  286. X      BINARY mode; if that's impossible, Mark's "ship" ASCII-encoder should
  287. X      be used; and if that's unavailable, uuencode or xxencode should be
  288. X      used.  Weirdo NeXTmail, mailtool and MIME formats are also Right Out.
  289. X
  290. X      Files larger than 50KB may need to be broken into pieces for mailing
  291. X      (be sure to label them in order!), unless "ship" is used (it can
  292. X      auto-split, label and mail files if told to do so).  If Down Under
  293. X      is involved, files must be broken into under-20KB chunks.
  294. X
  295. X      Reasons:  to prevent sounds of gagging mailers from resounding through-
  296. X      out the land.  To be relatively efficient in the binary->ASCII conver-
  297. X      sion.  (Yeah, yeah, I know, there's better conversions out there.  But
  298. X      not as widely known, and they often break on BITNET gateways.)
  299. X
  300. X      Related utilities:  ship, uuencode, uudecode, uuxfer20, quux, others.
  301. X      Just make sure they don't leave embedded or trailing spaces (that is,
  302. X      they should use the "`" character in place of ASCII 32).  Otherwise
  303. X      mailers are prone to truncate or whatever.
  304. X
  305. X
  306. XGreg Roelofs (a.k.a. Cave Newt)
  307. XInfo-ZIP UnZip guy
  308. X
  309. XDavid Kirschbaum
  310. Xformer Info-ZIP Coordinator
  311. END_OF_FILE
  312.   if test 13591 -ne `wc -c <'unzip-5.12/ZipPorts'`; then
  313.     echo shar: \"'unzip-5.12/ZipPorts'\" unpacked with wrong size!
  314.   fi
  315.   # end of 'unzip-5.12/ZipPorts'
  316. fi
  317. if test -f 'unzip-5.12/human68k/options.s.UU' -a "${1}" != "-c" ; then 
  318.   echo shar: Will not clobber existing file \"'unzip-5.12/human68k/options.s.UU'\"
  319. else
  320.   echo shar: Extracting \"'unzip-5.12/human68k/options.s.UU'\" \(3262 characters\)
  321.   sed "s/^X//" >'unzip-5.12/human68k/options.s.UU' <<'END_OF_FILE'
  322. Xbegin 644 unzip-5.12/human68k/options.s
  323. XM*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BH**@D)
  324. XM"0D)*@HJ"51W96YT>4]N92YX((%U@L:"HX*E@LF"H8+M@O&!=@DJ"BH)<&%T
  325. XM8V@@9F]R(&AU;6%N(%9E<B R+C R+#(N,#,)*@HJ"0D)"0DJ"BHJ*BHJ*BHJ
  326. XM*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ"BH**@EF:6QE(&YA
  327. XM;64Z"6]P=&EO;G,N<PHJ"6%U=&AO<CH)"8)D@IB"E" H5"Y+87=A;6]T;RD*
  328. XM*@EL87-T(&UO9&EF>3H).3(O,R\Q"BH)"0DY,B\S+S$W('1H86YK<R!9554H
  329. XM2$%254M!*0HJ"F)L<&5E:SH);6%C<F\*"6UO=F5Q+FP)(R0X-"QD, H)=')A
  330. XM< DC,34*"65N9&T**@IG971P9&(Z"6UA8W)O"@ED8RYW"21F9C4Q"@EE;F1M
  331. XM"BH*"2YX9&5F"5]4=V5N='E/;F5/<'1I;VYS"BH*"2YT97AT"BH*7U1W96YT
  332. XM>4]N94]P=&EO;G,Z"@EM;W9E;2YL"6$P+6$R+"TH<W I"@EB<W()<V5A<F-H
  333. XM7VUE;6]R>5]B;&EN9&QY"@ET<W0N; ED, H)8FYE"7)E='5R;@H)8G-R"7-E
  334. XM87)C:%]D979I8V5?8FQI;F1L>0IR971U<FXZ"@EM;W9E;2YL"2AS<"DK+&$P
  335. XM+6$R"@ER=',**@IS96%R8VA?9&5V:6-E7V)L:6YD;'DZ"@EL96$))# P,# V
  336. XM.# P+&$Q"G-E87)C:%].54Q?9&5V:6-E7VQO;W Z"@EC;7 N; DC)# P,#(P
  337. XM,# P+&$Q"@EB8V,)<V1?;F]T7V9O=6YD"@EB;'!E96L*"6-M<"YL"2,G3E5,
  338. XM("<L9# *"6)E<0EF;W5N9%].54Q?9&5V:6-E"BH);&5A"30H83$I+&$Q"0D)
  339. XM*B"(R(FZ@LR7=I?,@N:"Z H)"0D)"0DJ((*Q@K&"Q8-#@Y.#3H.*@X&#DX-G
  340. XM@K>"Z95+EW:"S0H)"0D)"0DJ((*@@NB"W(*Y@O$),3DY,BXP,RXQ-R!9554H
  341. XM2$%254M!*2X*"6-M<"YW"2,G3E4G+&0P"@EB;F4)<V5A<F-H7TY53%]D979I
  342. XM8V5?;&]O< H);&5A"2TR*&$Q*2QA,0H)8G)A"7-E87)C:%].54Q?9&5V:6-E
  343. XM7VQO;W **@IF;W5N9%].54Q?9&5V:6-E.@HJ"6QE80DM,30H83$I+&$Q"0D)
  344. XM*B"!J2""L8*Q@JJ"J(*I@K6"H@H);&5A"2TQ."AA,2DL83$)"0DJ($E/0U,@
  345. XM0E],4$5%2R""S);?@NB2;"!A,0H)"0D)"0DJ((+-(&0P((+,DFR"\([FD[Z"
  346. XMM8*]@T&#:(.,@U@@*R T"@D)"0D)"2H@@LB"S(+%CI^"S(-F@V^#0X-8@M:"
  347. XMS(-!@VB#C(-8@LT*"0D)"0D)*B M,3@H83$I((+&@LB"Z(+<@K<),3DY,BXP
  348. XM,RXQ-R!9554N"G-E87)C:%]D979I8V4Z"@EB;'!E96L*<V1?;&]O<#H*"6UO
  349. XM=F4N; ED,"QA, H);&5A"20P,#!%*&$P*2QA,@H)8G-R"6-H96-K7U17"@ET
  350. XM<W0N; ED, H)8FYE"7-D7V5N9 H);&5A+FP)*&$P*2QA,0H)8FQP965K"@EC
  351. XM;7 N; DC)&9F9F9F9F9F+&0P"@EB;F4)<V1?;&]O< IS9%]N;W1?9F]U;F0Z
  352. XM"@EM;W9E<2YL"2,P+&0P"G-D7V5N9#H*"7)T<PHJ"G-E87)C:%]M96UO<GE?
  353. XM8FQI;F1L>3H*"6=E='!D8@H);6]V92YL"60P+&$Q"@EL96$)+3$V*&$Q*2QA
  354. XM,0IS96%R8VA?=&]P7VQO;W Z"@EL96$)-"AA,2DL83$*"6)L<&5E:PH)='-T
  355. XM+FP)9# *"6)E<0EF;W5N9%]T;W *"6UO=F4N; ED,"QA,0H)8G)A"7-E87)C
  356. XM:%]T;W!?;&]O< HJ"F9O=6YD7W1O<#H*"6QE80DM."AA,2DL83$)"0DJ((+(
  357. XM@KJ"J8*Q@LR-<X*J@U*#@8.3@V>-<X+)@LB"P8+$@J*"W(*U@KT**@EL96$)
  358. XM."AA,2DL83$)"0DJ()&]E:J"L8+!@K^"JH-2@X&#DX-GC7."OH+&CG:"HH+<
  359. XM@K<*"0D)"0D)*B Q.3DR+C S+C$W(%E552A(05)52T$I+@IS96%R8VA?;65M
  360. XM;W)Y.@H);&5A"3$R*&$Q*2QA,0H)8FQP965K"G-M7VQO;W Z"@EM;W9E+FP)
  361. XM9# L83 *"6QE80DD,#$P12AA,"DL83(*"6)S<@EC:&5C:U]45PH)='-T+FP)
  362. XM9# *"6)N90ES;5]E;F0*"6QE80DD,# P0RAA,"DL83$*"6)L<&5E:PH)='-T
  363. XM+FP)9# *"6)N90ES;5]L;V]P"@EM;W9E<2YL"2,P+&0P"G-M7V5N9#H*"7)T
  364. XM<PHJ"F-H96-K7U17.@H);&5A"2AA,BDL83$*"6)L<&5E:PH)8VUP+FP)(R<_
  365. XM5'=E)RQD, H)8F5Q"6-H96-K7VYE=PH)8VUP+FP)(R<J5'=E)RQD, H)8FYE
  366. XM"6-H96-K7V5R<F]R"F-H96-K7V]L9#H*"6QE80DD,# P-"AA,BDL83$*"6)L
  367. XM<&5E:PH)8VUP+FP)(R=N='DJ)RQD, H)8FYE"6-H96-K7V5R<F]R"@EM;W9E
  368. XM<2YL"2,M,2QD, H)<G1S"BH*8VAE8VM?;F5W.@H);&5A"20P,# T*&$R*2QA
  369. XM,0H)8FQP965K"@EC;7 N; DC)VYT>3\G+&0P"@EB97$)8VAE8VM?;F5W7T4*
  370. XM"6-M<"YL"2,G;G1Y12<L9# *"6)N90EC:&5C:U]E<G)O<@IC:&5C:U]N97=?
  371. XM13H*"6QE80DD,# P."AA,BDL83$*"6)L<&5E:PH)<G1S"BH*8VAE8VM?97)R
  372. XM;W(Z"@EM;W9E<2YL"2,P+&0P"@ER=',**@H)9&,N8@DG5'=E;G1Y3VYE($]P
  373. XM=&EO;B!#:&5C:V5R(%9E<B Q+C P("<*"61C+F())T-O<'ER:6=H=" Q.3DQ
  374. XE+#DR(()D@IB"E" H@G,N@FIA=V%M;W1O*2<L, HJ"@DN96YD"F=H
  375. Xend
  376. END_OF_FILE
  377.   if test 3262 -ne `wc -c <'unzip-5.12/human68k/options.s.UU'`; then
  378.     echo shar: \"'unzip-5.12/human68k/options.s.UU'\" unpacked with wrong size!
  379.   else
  380.     echo shar: Uudecoding \"'unzip-5.12/human68k/options.s'\" \(2332 characters\)
  381.     cat unzip-5.12/human68k/options.s.UU | uudecode
  382.     if test 2332 -ne `wc -c <'unzip-5.12/human68k/options.s'`; then
  383.       echo shar: \"'unzip-5.12/human68k/options.s'\" uudecoded with wrong size!
  384.     else
  385.       rm unzip-5.12/human68k/options.s.UU
  386.     fi
  387.   fi
  388.   # end of 'unzip-5.12/human68k/options.s.UU'
  389. fi
  390. if test -f 'unzip-5.12/os2/wat_met.dif' -a "${1}" != "-c" ; then 
  391.   echo shar: Will not clobber existing file \"'unzip-5.12/os2/wat_met.dif'\"
  392. else
  393.   echo shar: Extracting \"'unzip-5.12/os2/wat_met.dif'\" \(19538 characters\)
  394.   sed "s/^X//" >'unzip-5.12/os2/wat_met.dif' <<'END_OF_FILE'
  395. XDate:     Wed, 3 Aug 1994 19:34:23 +0200
  396. XFrom: Kai Uwe Rommel <rommel@ars.muc.de>
  397. X
  398. XEnclosed I send the revised set of patches. That does now also include
  399. Xsome changes required for MetaWare High C++ for OS/2.
  400. X
  401. X
  402. Xdiff -cbr unzip/envargs.c unzip-2/envargs.c
  403. X*** unzip/envargs.c    Thu Apr 21 10:02:16 1994
  404. X--- unzip-2/envargs.c    Tue Aug 02 11:48:46 1994
  405. X***************
  406. X*** 180,186 ****
  407. X--- 180,188 ----
  408. X      char ***argvp;
  409. X  {
  410. X  #ifndef MSC /* declared differently in MSC 7.0 headers, at least */
  411. X+ #ifndef __WATCOMC__
  412. X      extern char **environ;          /* environment */
  413. X+ #endif
  414. X  #endif
  415. X      char        **envp;             /* pointer into environment */
  416. X      char        **newargv;          /* new argument list */
  417. Xdiff -cbr unzip/extract.c unzip-2/extract.c
  418. X*** unzip/extract.c    Fri Jul 22 13:03:48 1994
  419. X--- unzip-2/extract.c    Tue Aug 02 11:48:46 1994
  420. X***************
  421. X*** 863,869 ****
  422. X--- 863,873 ----
  423. X          if (cflag) {
  424. X              outfile = stdout;
  425. X  #ifdef DOS_NT_OS2
  426. X+ #ifdef __HIGHC__
  427. X+             setmode(outfile, _BINARY);
  428. X+ #else
  429. X              setmode(fileno(outfile), O_BINARY);
  430. X+ #endif
  431. X  #           define NEWLINE "\r\n"
  432. X  #else
  433. X  #           define NEWLINE "\n"
  434. Xdiff -cbr unzip/funzip.c unzip-2/funzip.c
  435. X*** unzip/funzip.c    Sun Jul 31 20:28:52 1994
  436. X--- unzip-2/funzip.c    Tue Aug 02 11:48:48 1994
  437. X***************
  438. X*** 238,250 ****
  439. X--- 238,258 ----
  440. X    else
  441. X    {
  442. X  #ifdef DOS_NT_OS2
  443. X+ #ifdef __HIGHC__
  444. X+     setmode(stdin, _BINARY);
  445. X+ #else
  446. X      setmode(0, O_BINARY);  /* some buggy C libraries require BOTH setmode() */
  447. X+ #endif
  448. X  #endif                     /*  call AND the fdopen() in binary mode :-( */
  449. X      if ((in = fdopen(0, FOPR)) == (FILE *)NULL)
  450. X        err(2, "cannot find stdin");
  451. X    }
  452. X  #ifdef DOS_NT_OS2
  453. X+ #ifdef __HIGHC__
  454. X+   setmode(stdout, _BINARY);
  455. X+ #else
  456. X    setmode(1, O_BINARY);
  457. X+ #endif
  458. X  #endif
  459. X    if ((out = fdopen(1, FOPW)) == (FILE *)NULL)
  460. X      err(2, "cannot write to stdout");
  461. Xdiff -cbr unzip/msdos/msdos.c unzip-2/msdos/msdos.c
  462. X*** unzip/msdos/msdos.c    Wed Jul 27 22:20:06 1994
  463. X--- unzip-2/msdos/msdos.c    Tue Aug 02 11:48:52 1994
  464. X***************
  465. X*** 37,45 ****
  466. X  static int renamed_fullpath;   /* ditto */
  467. X  static unsigned nLabelDrive;   /* ditto, plus volumelabel() */
  468. X  
  469. X! #if (defined(__GO32__) || defined(__EMX__))
  470. X! #  define MKDIR(path,mode)   mkdir(path,mode)
  471. X  #  include <dirent.h>        /* use readdir() */
  472. X  #  define direct dirent
  473. X  #  define Opendir opendir
  474. X  #  define Readdir readdir
  475. X--- 37,57 ----
  476. X  static int renamed_fullpath;   /* ditto */
  477. X  static unsigned nLabelDrive;   /* ditto, plus volumelabel() */
  478. X  
  479. X! #if (defined(__WATCOMC__) && defined(__386__))
  480. X! #  define WREGS(v,r) (v##.w.##r)
  481. X! #  define int86x int386x
  482. X! #else
  483. X! #  define WREGS(v,r) (v##.x.##r)
  484. X! #endif
  485. X! 
  486. X! #if (defined(__GO32__) || defined(__EMX__) || defined(__WATCOMC__))
  487. X! #  ifdef __WATCOMC__
  488. X! #    include <direct.h>
  489. X! #    define MKDIR(path,mode)   mkdir(path)
  490. X! #  else
  491. X  #  include <dirent.h>        /* use readdir() */
  492. X+ #    define MKDIR(path,mode)   mkdir(path,mode)
  493. X+ #  endif
  494. X  #  define direct dirent
  495. X  #  define Opendir opendir
  496. X  #  define Readdir readdir
  497. X***************
  498. X*** 774,791 ****
  499. X      regs.h.bl = (uch)nDrive;
  500. X  #ifdef __EMX__
  501. X      _int86(0x21, ®s, ®s);
  502. X!     if (regs.x.flags & 1)
  503. X  #else
  504. X      intdos(®s, ®s);
  505. X!     if (regs.x.cflag)        /* error:  do default a/b check instead */
  506. X  #endif
  507. X      {
  508. X          Trace((stderr,
  509. X            "error in DOS function 0x44 (AX = 0x%04x):  guessing instead...\n",
  510. X!           regs.x.ax));
  511. X          return (nDrive == 1 || nDrive == 2)? TRUE : FALSE;
  512. X      } else
  513. X!         return regs.x.ax? FALSE : TRUE;
  514. X  }
  515. X  
  516. X  
  517. X--- 786,803 ----
  518. X      regs.h.bl = (uch)nDrive;
  519. X  #ifdef __EMX__
  520. X      _int86(0x21, ®s, ®s);
  521. X!     if (WREGS(regs,flags) & 1)
  522. X  #else
  523. X      intdos(®s, ®s);
  524. X!     if (WREGS(regs,cflag))        /* error:  do default a/b check instead */
  525. X  #endif
  526. X      {
  527. X          Trace((stderr,
  528. X            "error in DOS function 0x44 (AX = 0x%04x):  guessing instead...\n",
  529. X!           WREGS(regs,ax)));
  530. X          return (nDrive == 1 || nDrive == 2)? TRUE : FALSE;
  531. X      } else
  532. X!         return WREGS(regs,ax)? FALSE : TRUE;
  533. X  }
  534. X  
  535. X  
  536. X***************
  537. X*** 854,874 ****
  538. X  
  539. X      /* set the disk transfer address for subsequent FCB calls */
  540. X      sregs.ds = FP_SEG(pdta);
  541. X!     regs.x.dx = FP_OFF(pdta);
  542. X!     Trace((stderr, "segment:offset of pdta = %x:%x\n", sregs.ds, regs.x.dx));
  543. X      Trace((stderr, "&dta = %lx, pdta = %lx\n", (ulg)&dta, (ulg)pdta));
  544. X      regs.h.ah = 0x1a;
  545. X      intdosx(®s, ®s, &sregs);
  546. X  
  547. X      /* fill in the FCB */
  548. X      sregs.ds = FP_SEG(pfcb);
  549. X!     regs.x.dx = FP_OFF(pfcb);
  550. X      pfcb->flag = 0xff;          /* extended FCB */
  551. X      pfcb->vattr = 0x08;         /* attribute:  disk volume label */
  552. X      pfcb->drive = (uch)nLabelDrive;
  553. X  
  554. X  #ifdef DEBUG
  555. X!     Trace((stderr, "segment:offset of pfcb = %x:%x\n", sregs.ds, regs.x.dx));
  556. X      Trace((stderr, "&fcb = %lx, pfcb = %lx\n", (ulg)&fcb, (ulg)pfcb));
  557. X      Trace((stderr, "(2nd check:  labelling drive %c:)\n", pfcb->drive-1+'A'));
  558. X      if (pfcb->flag != fcb.flag)
  559. X--- 866,886 ----
  560. X  
  561. X      /* set the disk transfer address for subsequent FCB calls */
  562. X      sregs.ds = FP_SEG(pdta);
  563. X!     WREGS(regs,dx) = FP_OFF(pdta);
  564. X!     Trace((stderr, "segment:offset of pdta = %x:%x\n", sregs.ds, WREGS(regs,dx)));
  565. X      Trace((stderr, "&dta = %lx, pdta = %lx\n", (ulg)&dta, (ulg)pdta));
  566. X      regs.h.ah = 0x1a;
  567. X      intdosx(®s, ®s, &sregs);
  568. X  
  569. X      /* fill in the FCB */
  570. X      sregs.ds = FP_SEG(pfcb);
  571. X!     WREGS(regs,dx) = FP_OFF(pfcb);
  572. X      pfcb->flag = 0xff;          /* extended FCB */
  573. X      pfcb->vattr = 0x08;         /* attribute:  disk volume label */
  574. X      pfcb->drive = (uch)nLabelDrive;
  575. X  
  576. X  #ifdef DEBUG
  577. X!     Trace((stderr, "segment:offset of pfcb = %x:%x\n", sregs.ds, WREGS(regs,dx)));
  578. X      Trace((stderr, "&fcb = %lx, pfcb = %lx\n", (ulg)&fcb, (ulg)pfcb));
  579. X      Trace((stderr, "(2nd check:  labelling drive %c:)\n", pfcb->drive-1+'A'));
  580. X      if (pfcb->flag != fcb.flag)
  581. X***************
  582. X*** 894,900 ****
  583. X      strncpy((char *)fcb.vn, "???????????", 11);   /* i.e., "*.*" */
  584. X      Trace((stderr, "fcb.vn = %lx\n", (ulg)fcb.vn));
  585. X      Trace((stderr, "regs.h.ah = %x, regs.x.dx = %04x, sregs.ds = %04x\n",
  586. X!       regs.h.ah, regs.x.dx, sregs.ds));
  587. X      Trace((stderr, "flag = %x, drive = %d, vattr = %x, vn = %s = %s.\n",
  588. X        fcb.flag, fcb.drive, fcb.vattr, fcb.vn, pfcb->vn));
  589. X      intdosx(®s, ®s, &sregs);
  590. X--- 906,912 ----
  591. X      strncpy((char *)fcb.vn, "???????????", 11);   /* i.e., "*.*" */
  592. X      Trace((stderr, "fcb.vn = %lx\n", (ulg)fcb.vn));
  593. X      Trace((stderr, "regs.h.ah = %x, regs.x.dx = %04x, sregs.ds = %04x\n",
  594. X!       regs.h.ah, WREGS(regs,dx), sregs.ds));
  595. X      Trace((stderr, "flag = %x, drive = %d, vattr = %x, vn = %s = %s.\n",
  596. X        fcb.flag, fcb.drive, fcb.vattr, fcb.vn, pfcb->vn));
  597. X      intdosx(®s, ®s, &sregs);
  598. X***************
  599. X*** 1058,1065 ****
  600. X      union REGS regs;
  601. X  
  602. X      sregs.ds  = FP_SEG(CountryInfo);
  603. X!     regs.x.dx = FP_OFF(CountryInfo);
  604. X!     regs.x.ax = 0x3800;
  605. X      int86x(0x21, ®s, ®s, &sregs);
  606. X  
  607. X  #else /* __GO32__ || __EMX__ */
  608. X--- 1070,1077 ----
  609. X      union REGS regs;
  610. X  
  611. X      sregs.ds  = FP_SEG(CountryInfo);
  612. X!     WREGS(regs,dx) = FP_OFF(CountryInfo);
  613. X!     WREGS(regs,ax) = 0x3800;
  614. X      int86x(0x21, ®s, ®s, &sregs);
  615. X  
  616. X  #else /* __GO32__ || __EMX__ */
  617. Xdiff -cbr unzip/os2/makefile.os2 unzip-2/os2/makefile.os2
  618. X*** unzip/os2/makefile.os2    Sat Jul 23 13:42:04 1994
  619. X--- unzip-2/os2/makefile.os2    Tue Aug 02 11:53:42 1994
  620. X***************
  621. X*** 32,43 ****
  622. X  #   For Watcom C/386, edit the os2$(OBJ) target so that os2/os2.c reads
  623. X  #   os2\os2.c instead.  Watcom can't handle forward slashes; gcc can't
  624. X  #   handle backslashes.  We'll see about making this a macro next time...
  625. X  
  626. X  default:
  627. X      @echo "Enter `$(MAKE) -f makefile.os2 target' with makefile.os2 copied"
  628. X      @echo "to the main UnZip directory and where target is one of:"
  629. X      @echo "   msc mscdos ibm ibmdyn ibmdebug ibmprof"
  630. X!     @echo "   watcom borland gcc gccdyn gccdebug gccdos"
  631. X  
  632. X  # MS C 6.00 for OS/2, 16-bit (should figure out way to split unzip/funzip 
  633. X  # compiles so former is always large model and latter always small model...)
  634. X--- 32,45 ----
  635. X  #   For Watcom C/386, edit the os2$(OBJ) target so that os2/os2.c reads
  636. X  #   os2\os2.c instead.  Watcom can't handle forward slashes; gcc can't
  637. X  #   handle backslashes.  We'll see about making this a macro next time...
  638. X+ #   Same for msdos/msdos.c ...
  639. X  
  640. X  default:
  641. X      @echo "Enter `$(MAKE) -f makefile.os2 target' with makefile.os2 copied"
  642. X      @echo "to the main UnZip directory and where target is one of:"
  643. X      @echo "   msc mscdos ibm ibmdyn ibmdebug ibmprof"
  644. X!     @echo "   metaware borland gcc gccdyn gccdebug gccdos"
  645. X!     @echo "   watcom watcom16 watcomdos watcom16dos"
  646. X  
  647. X  # MS C 6.00 for OS/2, 16-bit (should figure out way to split unzip/funzip 
  648. X  # compiles so former is always large model and latter always small model...)
  649. X***************
  650. X*** 52,57 ****
  651. X--- 54,71 ----
  652. X      OBJ=".obj" \
  653. X      DEF="os2\unzip16.def"
  654. X  
  655. X+ # MS C 6.00 for OS/2, debug version
  656. X+ mscdebug:
  657. X+     $(MAKE) -f makefile.os2 all \
  658. X+     CC="cl -nologo -AL -Zi -Od -I. $(FP)" \
  659. X+     CFLAGS="-G2 -Zp1 -W3 -DOS2 -DMSC" \
  660. X+     NFLAGS="" \
  661. X+     LDFLAGS="-Lp -Fe" \
  662. X+     LDFLAGS2="-link /noe" \
  663. X+     OUT="-Fo" \
  664. X+     OBJ=".obj" \
  665. X+     DEF="os2\unzip16.def"
  666. X+ 
  667. X  # cross-compilation for MS-DOS with MS C 6.00 (same comment as above...formerly;
  668. X  # now unzip is small model again, with [almost] all strings in far memory)
  669. X  mscdos:
  670. X***************
  671. X*** 59,65 ****
  672. X      CC="cl -nologo -AS -Oaict -Gs -I. $(FP)" \
  673. X      CFLAGS="-Zp1 -W3 $(LOCAL_UNZIP)" \
  674. X      NFLAGS="" \
  675. X!     LDFLAGS="-F 0c00 -Lr -Fe" \
  676. X      LDFLAGS2="-link /noe /exe" \
  677. X      OUT="-Fo" \
  678. X      OBJ=".obj" \
  679. X--- 73,79 ----
  680. X      CC="cl -nologo -AS -Oaict -Gs -I. $(FP)" \
  681. X      CFLAGS="-Zp1 -W3 $(LOCAL_UNZIP)" \
  682. X      NFLAGS="" \
  683. X!     LDFLAGS="-F 0C00 -Lr -Fe" \
  684. X      LDFLAGS2="-link /noe /exe" \
  685. X      OUT="-Fo" \
  686. X      OBJ=".obj" \
  687. X***************
  688. X*** 114,131 ****
  689. X      OBJ=".obj" \
  690. X      DEF="os2\unzip.def"
  691. X  
  692. X! # Watcom C/386 9.0
  693. X  watcom:
  694. X      $(MAKE) -f makefile.os2 all \
  695. X      CC="wcl386 -zq -Ox -s -I." \
  696. X      CFLAGS="-Zp1 -DOS2 $(LOCAL_UNZIP)" \
  697. X      NFLAGS="" \
  698. X!     LDFLAGS="-k0x40000 -x -Fe=" \
  699. X      LDFLAGS2="" \
  700. X      OUT="-Fo" \
  701. X      OBJ=".obj" \
  702. X      DEF=""
  703. X  
  704. X  # Borland C++
  705. X  borland:
  706. X      $(MAKE) -f makefile.os2 all \
  707. X--- 128,194 ----
  708. X      OBJ=".obj" \
  709. X      DEF="os2\unzip.def"
  710. X  
  711. X! # Watcom C/386 9.0 or higher
  712. X  watcom:
  713. X      $(MAKE) -f makefile.os2 all \
  714. X      CC="wcl386 -zq -Ox -s -I." \
  715. X      CFLAGS="-Zp1 -DOS2 $(LOCAL_UNZIP)" \
  716. X      NFLAGS="" \
  717. X!     LDFLAGS="-k0x40000 -x -l=os2v2 -Fe=" \
  718. X      LDFLAGS2="" \
  719. X      OUT="-Fo" \
  720. X      OBJ=".obj" \
  721. X      DEF=""
  722. X  
  723. X+ # Watcom C/286 9.0 or higher
  724. X+ watcom16:
  725. X+     $(MAKE) -f makefile.os2 all \
  726. X+     CC="wcl -zq -ml -Ox -s -I." \
  727. X+     CFLAGS="-Zp1 -DOS2" \
  728. X+     NFLAGS="" \
  729. X+     LDFLAGS="-k0x2000 -x -l=os2 -Fe=" \
  730. X+     LDFLAGS2="" \
  731. X+     OUT="-Fo" \
  732. X+     OBJ=".obj"
  733. X+ 
  734. X+ # Watcom C/386 9.0 or higher, crosscompilation for DOS
  735. X+ watcomdos:
  736. X+     $(MAKE) -f makefile.os2 all \
  737. X+     CC="wcl386 -zq -Ox -s -I." \
  738. X+     CFLAGS="-Zp1 -DMSDOS" \
  739. X+     NFLAGS="" \
  740. X+     LDFLAGS="-k0x40000 -x -l=dos4g -Fe=" \
  741. X+     LDFLAGS2="" \
  742. X+     OUT="-Fo" \
  743. X+     OBJ=".obj" \
  744. X+     OBJU2="msdos.obj" \
  745. X+     OBJX2="msdos_.obj"
  746. X+ 
  747. X+ # Watcom C/286 9.0 or higher, crosscompilation for DOS
  748. X+ watcom16dos:
  749. X+     $(MAKE) -f makefile.os2 all \
  750. X+     CC="wcl -zq -mm -Ox -s -I." \
  751. X+     CFLAGS="-Zp1 -DMSDOS" \
  752. X+     NFLAGS="" \
  753. X+     LDFLAGS="-k0xC00 -x -l=dos -Fe=" \
  754. X+     LDFLAGS2="" \
  755. X+     OUT="-Fo" \
  756. X+     OBJ=".obj" \
  757. X+     OBJU2="msdos.obj" \
  758. X+     OBJX2="msdos_.obj"
  759. X+ 
  760. X+ # MetaWare High C/C++ 3.2
  761. X+ metaware:
  762. X+     $(MAKE) -f makefile.os2 all \
  763. X+     CC="hc -O2 -I." \
  764. X+     CFLAGS="-D__32BIT__ -DOS2" \
  765. X+     NFLAGS="" \
  766. X+     LDFLAGS="-o " \
  767. X+     LDFLAGS2="" \
  768. X+     OUT="-o ./" \
  769. X+     OBJ=".obj" \
  770. X+     DEF="-Hdef=os2\unzip.def"
  771. X+ 
  772. X  # Borland C++
  773. X  borland:
  774. X      $(MAKE) -f makefile.os2 all \
  775. X***************
  776. X*** 192,198 ****
  777. X      extract$(OBJ) file_io$(OBJ) inflate$(OBJ) match$(OBJ) \
  778. X      unreduce$(OBJ) unshrink$(OBJ) zipinfo$(OBJ)
  779. X  OBJU2 = os2$(OBJ)
  780. X! OBJX  = unzip_$(OBJ) crypt$(OBJ) extract_$(OBJ) file_io$(OBJ) \
  781. X      inflate$(OBJ) match$(OBJ)
  782. X  OBJX2 = os2_$(OBJ)
  783. X  OBJF  = funzip$(OBJ) crypt_$(OBJ) inflate_$(OBJ)
  784. X--- 255,261 ----
  785. X      extract$(OBJ) file_io$(OBJ) inflate$(OBJ) match$(OBJ) \
  786. X      unreduce$(OBJ) unshrink$(OBJ) zipinfo$(OBJ)
  787. X  OBJU2 = os2$(OBJ)
  788. X! OBJX  = unzipsfx$(OBJ) crypt$(OBJ) extract_$(OBJ) file_io$(OBJ) \
  789. X      inflate$(OBJ) match$(OBJ)
  790. X  OBJX2 = os2_$(OBJ)
  791. X  OBJF  = funzip$(OBJ) crypt_$(OBJ) inflate_$(OBJ)
  792. X***************
  793. X*** 252,256 ****
  794. X  inflate_$(OBJ):    inflate.c inflate.h unzip.h crypt.h    # funzip only
  795. X      $(CC) -c $(CFLAGS) -DFUNZIP $(OUT)$@ inflate.c
  796. X  
  797. X! unzip_$(OBJ):    unzip.c unzip.h crypt.h version.h    # unzipsfx only
  798. X      $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ unzip.c
  799. X--- 315,319 ----
  800. X  inflate_$(OBJ):    inflate.c inflate.h unzip.h crypt.h    # funzip only
  801. X      $(CC) -c $(CFLAGS) -DFUNZIP $(OUT)$@ inflate.c
  802. X  
  803. X! unzipsfx$(OBJ):    unzip.c unzip.h crypt.h version.h    # unzipsfx only
  804. X      $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ unzip.c
  805. Xdiff -cbr unzip/os2/os2.c unzip-2/os2/os2.c
  806. X*** unzip/os2/os2.c    Wed Jul 27 22:23:02 1994
  807. X--- unzip-2/os2/os2.c    Tue Aug 02 11:48:54 1994
  808. X***************
  809. X*** 73,78 ****
  810. X--- 73,79 ----
  811. X  #define INCL_DOSDEVICES
  812. X  #define INCL_DOSDEVIOCTL
  813. X  #define INCL_DOSERRORS
  814. X+ #define INCL_DOSMISC
  815. X  #include <os2.h>
  816. X  
  817. X  #ifdef __32BIT__
  818. X***************
  819. X*** 229,238 ****
  820. X  #endif
  821. X  
  822. X  
  823. X- #ifdef __WATCOMC__
  824. X-    unsigned char __near _osmode = OS2_MODE;
  825. X- #endif
  826. X- 
  827. X  #ifndef SFX
  828. X     static char *getdirent(char *);
  829. X     static void free_dircontents(struct _dircontents *);
  830. X--- 230,235 ----
  831. X***************
  832. X*** 387,394 ****
  833. X    if ( (pFEA2list = (PFEA2LIST) malloc((size_t) pEAblock -> lSize)) == NULL )
  834. X      return;
  835. X  
  836. X!   if ( memextract((char *) pFEA2list, pEAblock -> lSize,
  837. X!                   (char *) (pEAblock + 1), 
  838. X                    pEAblock -> nSize - sizeof(pEAblock -> lSize)) )
  839. X    {
  840. X      free(pFEA2list);
  841. X--- 384,391 ----
  842. X    if ( (pFEA2list = (PFEA2LIST) malloc((size_t) pEAblock -> lSize)) == NULL )
  843. X      return;
  844. X  
  845. X!   if ( memextract((uch *) pFEA2list, pEAblock -> lSize,
  846. X!                   (uch *) (pEAblock + 1), 
  847. X                    pEAblock -> nSize - sizeof(pEAblock -> lSize)) )
  848. X    {
  849. X      free(pFEA2list);
  850. X***************
  851. X*** 450,474 ****
  852. X  char *GetLoadPath(void) 
  853. X  {
  854. X  #ifdef __32BIT__ /* generic for 32-bit API */
  855. X- 
  856. X    PTIB pptib;
  857. X    PPIB pppib;
  858. X    char *szPath;
  859. X  
  860. X    DosGetInfoBlocks(&pptib, &pppib);
  861. X    szPath = pppib -> pib_pchenv;
  862. X  
  863. X    while (*szPath) /* find end of process environment */
  864. X      szPath = strchr(szPath, 0) + 1;
  865. X  
  866. X    return szPath + 1; /* .exe file name follows environment */
  867. X  
  868. X- #else /* 16-bit, specific for MS C 6.00, note: requires large data model */
  869. X- 
  870. X-   extern char _far *_pgmptr;
  871. X-   return _pgmptr;
  872. X- 
  873. X- #endif
  874. X  } /* end function GetLoadPath() */
  875. X  
  876. X  
  877. X--- 447,472 ----
  878. X  char *GetLoadPath(void) 
  879. X  {
  880. X  #ifdef __32BIT__ /* generic for 32-bit API */
  881. X    PTIB pptib;
  882. X    PPIB pppib;
  883. X    char *szPath;
  884. X  
  885. X    DosGetInfoBlocks(&pptib, &pppib);
  886. X    szPath = pppib -> pib_pchenv;
  887. X+ #else /* 16-bit, note: requires large data model */
  888. X+   SEL selEnv;
  889. X+   USHORT offCmd;
  890. X+   char *szPath;
  891. X+ 
  892. X+   DosGetEnv(&selEnv, &offCmd);
  893. X+   szPath = MAKEP(selEnv, 0);
  894. X+ #endif
  895. X  
  896. X    while (*szPath) /* find end of process environment */
  897. X      szPath = strchr(szPath, 0) + 1;
  898. X  
  899. X    return szPath + 1; /* .exe file name follows environment */
  900. X  
  901. X  } /* end function GetLoadPath() */
  902. X  
  903. X  
  904. X***************
  905. X*** 680,686 ****
  906. X  {
  907. X    static USHORT nLastDrive=(USHORT)(-1), nResult;
  908. X    ULONG lMap;
  909. X!   BYTE bData[64], bName[3];
  910. X  #ifdef __32BIT__
  911. X    ULONG nDrive, cbData;
  912. X    PFSQBUFFER2 pData = (PFSQBUFFER2) bData;
  913. X--- 678,685 ----
  914. X  {
  915. X    static USHORT nLastDrive=(USHORT)(-1), nResult;
  916. X    ULONG lMap;
  917. X!   BYTE bData[64];
  918. X!   char bName[3];
  919. X  #ifdef __32BIT__
  920. X    ULONG nDrive, cbData;
  921. X    PFSQBUFFER2 pData = (PFSQBUFFER2) bData;
  922. X***************
  923. X*** 689,698 ****
  924. X    PFSQBUFFER pData = (PFSQBUFFER) bData;
  925. X  #endif
  926. X  
  927. X-   if ( _osmode == DOS_MODE )
  928. X-     return TRUE;
  929. X-   else
  930. X-   {
  931. X      /* We separate FAT and HPFS+other file systems here.
  932. X         at the moment I consider other systems to be similar to HPFS,
  933. X         i.e. support long file names and case sensitive */
  934. X--- 688,693 ----
  935. X***************
  936. X*** 713,725 ****
  937. X      cbData = sizeof(bData);
  938. X  
  939. X      if ( !DosQueryFSAttach(bName, 0, FSAIL_QUERYNAME, (PVOID) pData, &cbData) )
  940. X!       nResult = !strcmp(pData -> szFSDName + pData -> cbName, "FAT");
  941. X      else
  942. X        nResult = FALSE;
  943. X  
  944. X      /* End of this ugly code */
  945. X      return nResult;
  946. X-   }
  947. X  } /* end function IsFileSystemFAT() */
  948. X  
  949. X  
  950. X--- 708,719 ----
  951. X      cbData = sizeof(bData);
  952. X  
  953. X      if ( !DosQueryFSAttach(bName, 0, FSAIL_QUERYNAME, (PVOID) pData, &cbData) )
  954. X!     nResult = !strcmp((char *) (pData -> szFSDName) + pData -> cbName, "FAT");
  955. X      else
  956. X        nResult = FALSE;
  957. X  
  958. X      /* End of this ugly code */
  959. X      return nResult;
  960. X  } /* end function IsFileSystemFAT() */
  961. X  
  962. X  
  963. X***************
  964. X*** 1398,1404 ****
  965. X      ULONG action;
  966. X  #else
  967. X      USHORT rc;
  968. X!     UINT action;
  969. X  #endif
  970. X  
  971. X  
  972. X--- 1392,1398 ----
  973. X      ULONG action;
  974. X  #else
  975. X      USHORT rc;
  976. X!     USHORT action;
  977. X  #endif
  978. X  
  979. X  
  980. X***************
  981. X*** 1579,1597 ****
  982. X    eaop.fpGEAList = NULL;
  983. X    eaop.oError = 0;
  984. X  
  985. X!   strcpy(fealst.szName, ".LONGNAME");
  986. X!   strcpy(fealst.szValue, longname);
  987. X  
  988. X!   fealst.cbList  = sizeof(fealst) - CCHMAXPATH + strlen(fealst.szValue);
  989. X!   fealst.cbName  = (BYTE) strlen(fealst.szName);
  990. X!   fealst.cbValue = sizeof(USHORT) * 2 + strlen(fealst.szValue);
  991. X  
  992. X  #ifdef __32BIT__
  993. X    fealst.oNext   = 0;
  994. X  #endif
  995. X    fealst.fEA     = 0;
  996. X    fealst.eaType  = 0xFFFD;
  997. X!   fealst.eaSize  = strlen(fealst.szValue);
  998. X  
  999. X    return DosSetPathInfo(name, FIL_QUERYEASIZE,
  1000. X                          (PBYTE) &eaop, sizeof(eaop), 0);
  1001. X--- 1573,1591 ----
  1002. X    eaop.fpGEAList = NULL;
  1003. X    eaop.oError = 0;
  1004. X  
  1005. X!   strcpy((char *) fealst.szName, ".LONGNAME");
  1006. X!   strcpy((char *) fealst.szValue, longname);
  1007. X  
  1008. X!   fealst.cbList  = sizeof(fealst) - CCHMAXPATH + strlen((char *) fealst.szValue);
  1009. X!   fealst.cbName  = (BYTE) strlen((char *) fealst.szName);
  1010. X!   fealst.cbValue = sizeof(USHORT) * 2 + strlen((char *) fealst.szValue);
  1011. X  
  1012. X  #ifdef __32BIT__
  1013. X    fealst.oNext   = 0;
  1014. X  #endif
  1015. X    fealst.fEA     = 0;
  1016. X    fealst.eaType  = 0xFFFD;
  1017. X!   fealst.eaSize  = strlen((char *) fealst.szValue);
  1018. X  
  1019. X    return DosSetPathInfo(name, FIL_QUERYEASIZE,
  1020. X                          (PBYTE) &eaop, sizeof(eaop), 0);
  1021. X***************
  1022. X*** 1880,1886 ****
  1023. X  
  1024. X    if (!bInitialized)
  1025. X      InitNLS();
  1026. X!   for ( szPtr = szArg; *szPtr; szPtr++ )
  1027. X      *szPtr = cLowerCase[*szPtr];
  1028. X    return szArg;
  1029. X  }
  1030. X--- 1874,1880 ----
  1031. X  
  1032. X    if (!bInitialized)
  1033. X      InitNLS();
  1034. X!   for ( szPtr = (unsigned char *) szArg; *szPtr; szPtr++ )
  1035. X      *szPtr = cLowerCase[*szPtr];
  1036. X    return szArg;
  1037. X  }
  1038. Xdiff -cbr unzip/unzip.h unzip-2/unzip.h
  1039. X*** unzip/unzip.h    Sun Jul 31 20:09:44 1994
  1040. X--- unzip-2/unzip.h    Tue Aug 02 11:48:56 1994
  1041. X***************
  1042. X*** 437,447 ****
  1043. X--- 437,449 ----
  1044. X  #endif
  1045. X  
  1046. X  #ifdef __WATCOMC__
  1047. X+ #  ifdef __386__
  1048. X  #  define __32BIT__
  1049. X  #  undef far
  1050. X  #  define far
  1051. X  #  undef near
  1052. X  #  define near
  1053. X+ #  endif
  1054. X  #  define PIPE_ERROR (errno == -1)
  1055. X  #endif
  1056. X  
  1057. X***************
  1058. X*** 770,776 ****
  1059. X  #endif
  1060. X  
  1061. X  /* GRR:  NT defines MSDOS?? */
  1062. X! #if (!defined(MSDOS) && !defined(__IBMC__)) || defined(NT)
  1063. X  #  define near
  1064. X  #  define far
  1065. X  #endif
  1066. X--- 772,778 ----
  1067. X  #endif
  1068. X  
  1069. X  /* GRR:  NT defines MSDOS?? */
  1070. X! #if (!defined(MSDOS) && !defined(__IBMC__) && defined(__32BIT__)) || defined(NT)
  1071. X  #  define near
  1072. X  #  define far
  1073. X  #endif
  1074. END_OF_FILE
  1075.   if test 19538 -ne `wc -c <'unzip-5.12/os2/wat_met.dif'`; then
  1076.     echo shar: \"'unzip-5.12/os2/wat_met.dif'\" unpacked with wrong size!
  1077.   fi
  1078.   # end of 'unzip-5.12/os2/wat_met.dif'
  1079. fi
  1080. if test -f 'unzip-5.12/unix/unzipsfx.1' -a "${1}" != "-c" ; then 
  1081.   echo shar: Will not clobber existing file \"'unzip-5.12/unix/unzipsfx.1'\"
  1082. else
  1083.   echo shar: Extracting \"'unzip-5.12/unix/unzipsfx.1'\" \(12523 characters\)
  1084.   sed "s/^X//" >'unzip-5.12/unix/unzipsfx.1' <<'END_OF_FILE'
  1085. X.\" Info-ZIP grants permission to any individual or institution to use, copy,
  1086. X.\" or redistribute this software, so long as:  (1) all of the original files
  1087. X.\" are included; (2) it is not sold for profit; and (3) this notice is re-
  1088. X.\" tained.
  1089. X.\"
  1090. X.\" unzipsfx.1 by Greg Roelofs
  1091. X.\"
  1092. X.\" =========================================================================
  1093. X.\" define .Y macro (for user-command examples; normal Courier font):
  1094. X.de Y
  1095. X.ft CW
  1096. X.in +4n
  1097. X.nf
  1098. X\&\\$1
  1099. X.ft
  1100. X.in
  1101. X.fi
  1102. X..
  1103. X.\" =========================================================================
  1104. X.TH UNZIPSFX 1L "28 Aug 94 (v5.12)"
  1105. X.SH NAME
  1106. Xunzipsfx \- self-extracting stub for prepending to ZIP archives
  1107. X.PD
  1108. X.\" =========================================================================
  1109. X.SH SYNOPSIS
  1110. X\fB<name of unzipsfx+archive combo>\fP [\fB\-cfptuz\fP[\fBajnoqsCLV$\fP]]
  1111. X[\fIfile(s)\fP\ .\|.\|. [\fB\-x\fP\ \fIxfile(s)\fP\ .\|.\|.]]
  1112. X.PD
  1113. X.\" =========================================================================
  1114. X.SH DESCRIPTION
  1115. X\fIunzipsfx\fP is a modified version of \fIunzip\fP(1L) designed to be prepended
  1116. Xto existing ZIP archives in order to form self-extracting archives.  Instead
  1117. Xof taking its first non-flag argument to be the zipfile(s) to be extracted, 
  1118. X\fIunzipsfx\fP seeks itself under the name by which it was invoked 
  1119. Xand tests or extracts the contents of the appended archive.  Because the
  1120. Xexecutable stub adds bulk to the archive (the whole purpose of which is to
  1121. Xbe as small as possible), a number of the regular version's less-vital 
  1122. Xcapabilities have been removed.  Among these are the usage (or help) screen,
  1123. Xthe listing and diagnostic functions (\fB\-l\fP and \fB\-v\fP), the ability 
  1124. Xto decompress older compression formats (the ``reduce,'' ``shrink'' and 
  1125. X``implode'' methods), and the ability to extract to a directory other than 
  1126. Xthe current one.  Decryption is supported as a compile-time option but 
  1127. Xshould be avoided unless the attached archive contains encrypted files.
  1128. X.LP
  1129. X\fBNote that
  1130. Xself-extracting archives made with\fP \fIunzipsfx\fP \fBare no more (or less)
  1131. Xportable across different operating systems than is 
  1132. Xthe\fP \fIunzip\fP \fBexecutable itself.\fP  In general a self-extracting 
  1133. Xarchive made on
  1134. Xa particular Unix system, for example, will only self-extract under the same
  1135. Xflavor of Unix.  Regular \fIunzip\fP may still be used to extract the
  1136. Xembedded archive as with any normal zipfile, although it will generate
  1137. Xa harmless warning about extra bytes at the beginning of the zipfile.
  1138. X.PD
  1139. X.\" =========================================================================
  1140. X.SH ARGUMENTS
  1141. X.IP [\fIfile(s)\fP]
  1142. XAn optional list of archive members to be processed.
  1143. XRegular expressions (wildcards) similar to those in Unix \fIegrep\fP(1)
  1144. Xmay be used to match multiple members.  These wildcards may contain:
  1145. X.RS
  1146. X.IP *
  1147. Xmatches a sequence of 0 or more characters
  1148. X.IP ?
  1149. Xmatches exactly 1 character
  1150. X.IP [.\|.\|.]
  1151. Xmatches any single character found inside the brackets; ranges are specified
  1152. Xby a beginning character, a hyphen, and an ending character.  If an exclamation
  1153. Xpoint or a caret (`!' or `^') follows the left bracket, then the range of 
  1154. Xcharacters within the brackets is complemented (that is, anything \fIexcept\fP
  1155. Xthe characters inside the brackets is considered a match).
  1156. X.RE
  1157. X.IP
  1158. X(Be sure to quote any character which might otherwise be interpreted or
  1159. Xmodified by the operating system, particularly under Unix and VMS.)
  1160. X.IP [\fB\-x\fP\ \fIxfile(s)\fP]
  1161. XAn optional list of archive members to be excluded from processing.
  1162. XSince wildcard characters match directory separators (`/'), this option
  1163. Xmay be used to exclude any files which are in subdirectories.  For
  1164. Xexample, ``\fCfoosfx *.[ch] -x */*\fR'' would extract all C source files
  1165. Xin the main directory, but none in any subdirectories.  Without the \fB\-x\fP
  1166. Xoption, all C source files in all directories within the zipfile would be
  1167. Xextracted.
  1168. XUnlike in \fIunzip\fP(1L), the \fB\-x\fP option may only be used if one or
  1169. Xmore \fIfiles\fP are given.  This is because there is no zipfile separating
  1170. Xthe normal options from the \fB\-x\fP option, so \fIunzipsfx\fP sees it as
  1171. Xanother normal option.  For historical reasons, the ``normal'' \fB\-x\fP is 
  1172. Xsilently ignored.  See the \fBEXAMPLES\fP section below.
  1173. X.LP
  1174. XIf \fIunzipsfx\fP is compiled with SFX_EXDIR defined, the following option
  1175. Xis also enabled:
  1176. X.IP [\fB\-d\fP\ \fIexdir\fP]
  1177. XAn optional directory to which to extract files.  By default, all files
  1178. Xand subdirectories are recreated in the current directory; the \fB\-d\fP
  1179. Xoption allows extraction in an arbitrary directory (always assuming one
  1180. Xhas permission to write to the directory).  The option and directory may
  1181. Xbe concatenated without any white space between them, but note that this
  1182. Xmay cause normal shell behavior to be suppressed.  In particular,
  1183. X``\fC\-d\ ~\fR'' (tilde) is expanded by Unix C shells into the name 
  1184. Xof the user's home directory, but ``\fC\-d~\fR'' is treated as a
  1185. Xliteral subdirectory ``\fB~\fP'' of the current directory.  As with 
  1186. X\fB\-x\fP, the \fB\-d\fP option may only be used if one or more \fIfiles\fP
  1187. Xare given.
  1188. X.PD
  1189. X.\" =========================================================================
  1190. X.SH OPTIONS
  1191. X\fIunzipsfx\fP supports the following \fIunzip\fP(1L) options:  \fB\-c\fP
  1192. Xand \fB\-p\fP (extract to standard output/screen), \fB\-f\fP and \fB\-u\fP
  1193. X(freshen and update existing files upon extraction), \fB\-t\fP (test
  1194. Xarchive) and \fB\-z\fP (print archive comment).  All normal listing options
  1195. X(\fB\-l\fP, \fB\-v\fP and \fB\-Z\fP) have been removed, but the testing
  1196. Xoption (\fB\-t\fP) may be used as a ``poor man's'' listing.  Alternatively,
  1197. Xthose creating self-extracting archives may wish to include a short listing 
  1198. Xin the zipfile comment.
  1199. X.LP
  1200. XSee \fIunzip\fP(1L) for a more complete description of these options.
  1201. X.PD
  1202. X.\" =========================================================================
  1203. X.SH MODIFIERS
  1204. X\fIunzipsfx\fP currently supports all \fIunzip\fP(1L) modifiers:  \fB\-a\fP 
  1205. X(convert text files), \fB\-n\fP (never overwrite), \fB\-o\fP (overwrite 
  1206. Xwithout prompting), \fB\-q\fP (operate quietly), \fB\-C\fP (match names 
  1207. Xcase-insenstively), \fB\-L\fP (convert uppercase-OS names to lowercase),
  1208. X\fB\-j\fP (junk paths) and \fB\-V\fP (retain version numbers); plus the
  1209. Xfollowing operating-system specific options:  \fB\-X\fP (restore VMS 
  1210. Xowner/protection info), \fB\-s\fP (convert spaces in filenames to underscores
  1211. X[DOS, OS/2, NT]) and \fB\-$\fP (restore volume label [DOS, OS/2, NT, Amiga]).
  1212. X.LP
  1213. X(Support for regular ASCII text-conversion may be removed in future versions, 
  1214. Xsince it is simple enough for the archive's creator to ensure that text 
  1215. Xfiles have the appropriate format for the local OS.  EBCDIC conversion will 
  1216. Xof course continue to be supported since the zipfile format implies ASCII 
  1217. Xstorage of text files.)
  1218. X.LP
  1219. XSee \fIunzip\fP(1L) for a more complete description of these modifiers.
  1220. X.PD
  1221. X.\" =========================================================================
  1222. X.SH ENVIRONMENT OPTIONS
  1223. X\fIunzipsfx\fP uses the same environment variables as \fIunzip\fP(1L) does,
  1224. Xalthough this is likely to be an issue only for the person creating and
  1225. Xtesting the self-extracting archive.  See \fIunzip\fP(1L) for details.
  1226. X.PD
  1227. X.\" =========================================================================
  1228. X.SH DECRYPTION
  1229. XDecryption is supported exactly as in \fIunzip\fP(1L); that is, interactively
  1230. Xwith a non-echoing prompt for the password(s).  See \fIunzip\fP(1L) for 
  1231. Xdetails.  Once again, note that if the archive has no encrypted files there 
  1232. Xis no reason to use a version of \fIunzipsfx\fP with decryption support;
  1233. Xthat only adds to the size of the archive.
  1234. X.PD
  1235. X.\" =========================================================================
  1236. X.SH EXAMPLES
  1237. XTo create a self-extracting archive \fIletters\fP from a regular zipfile 
  1238. X\fIletters.zip\fP and change the new archive's permissions to be 
  1239. Xworld-executable under Unix:
  1240. X.LP
  1241. X.PD 0
  1242. X.Y "cat unzipsfx letters.zip > letters"
  1243. X.Y "chmod 755 letters"
  1244. X.PD
  1245. X.LP
  1246. XTo create the same archive under MS-DOS, OS/2 or NT (note the use of the
  1247. X\fB/b\fP [binary] option to the \fIcopy\fP command):
  1248. X.LP
  1249. X.Y "copy /b unzipsfx.exe+letters.zip letters.exe"
  1250. X.LP
  1251. XUnder VMS:
  1252. X.LP
  1253. X.Y "copy unzipsfx.exe,letters.zip letters.exe"
  1254. X.Y "letters == ""$currentdisk:[currentdir]letters.exe"""
  1255. X.LP
  1256. X(The VMS \fIappend\fP command may also be used.  The second command installs
  1257. Xthe new program as a ``foreign command'' capable of taking arguments.)
  1258. XTo test (or list) the newly created self-extracting archive:
  1259. X.LP
  1260. X.Y "letters \-t"
  1261. X.LP
  1262. XTo test \fIletters\fP quietly, printing only a summary message indicating
  1263. Xwhether the archive is OK or not:
  1264. X.LP
  1265. X.Y "letters \-tq"
  1266. X.LP
  1267. XTo extract the complete contents into the current directory, recreating all
  1268. Xfiles and subdirectories as necessary:
  1269. X.LP
  1270. X.Y "letters"
  1271. X.LP
  1272. XTo extract all \fC*.txt\fP files (in Unix quote the `*'):
  1273. X.LP
  1274. X.Y "letters *.txt"
  1275. X.LP
  1276. XTo extract everything \fIexcept\fP the \fC*.txt\fP files:
  1277. X.LP
  1278. X.Y "letters * -x *.txt"
  1279. X.LP
  1280. X(Note that with regular \fIunzip\fP(1L) it would not be necessary to use 
  1281. Xthe first `*'; ``\fCunzip letters -x *.txt\fP'' would work equally well.
  1282. XWith \fIunzipsfx\fP the \fB\-x\fP option would be silently ignored and 
  1283. Xthe effect would be the same as in the previous example, i.e., the opposite
  1284. Xof what was intended.)
  1285. XTo extract only the README file to standard output (the screen):
  1286. X.LP
  1287. X.Y "letters -c README"
  1288. X.LP
  1289. XTo print only the zipfile comment:
  1290. X.LP
  1291. X.Y "letters \-z"
  1292. X.PD
  1293. X.\" =========================================================================
  1294. X.SH LIMITATIONS
  1295. XThe principle and fundamental limitation of \fIunzipsfx\fP is that it is
  1296. Xnot portable across architectures or operating systems, and therefore
  1297. Xneither are the resulting archives.  For some architectures there is 
  1298. Xlimited portability, however (e.g., between some flavors of Intel-based Unix).
  1299. X.LP
  1300. X\fIunzipsfx\fP has no knowledge of the user's PATH, so in general an archive 
  1301. Xmust either be in the current directory when it is invoked, or else a full
  1302. Xor relative path must be given.  If a user attempts to extract the archive
  1303. Xfrom a directory in the PATH other than the current one, \fIunzipsfx\fP will
  1304. Xprint a warning to the effect, ``can't find myself.''  This is always true 
  1305. Xunder Unix and may be true in some cases under MS-DOS, depending on the 
  1306. Xcompiler used (Microsoft C fully qualifies the program name, but other 
  1307. Xcompilers may not).  Under OS/2 and NT there are operating-system calls 
  1308. Xavailable which provide the full path name, so the archive may be invoked 
  1309. Xfrom anywhere in the user's path.  The situation is not known for Atari TOS, 
  1310. XMacOS, etc.
  1311. X.LP
  1312. XAs noted above, a number of the normal \fIunzip\fP(1L) functions have
  1313. Xbeen removed in order to make \fIunzipsfx\fP smaller:  usage and diagnostic
  1314. Xinfo, listing functions and extraction to other directories.  Also, only
  1315. Xstored and deflated files are supported.  The latter limitation is mainly
  1316. Xrelevant to those who create SFX archives, however.
  1317. X.LP
  1318. XVMS users must know how to set up self-extracting archives as foreign 
  1319. Xcommands in order to use any of \fIunzipsfx\fP's options.  This is not
  1320. Xnecessary for simple extraction, but the command to do so then becomes,
  1321. Xe.g., ``\fCrun letters\fR'' (to continue the examples given above).
  1322. X.LP
  1323. X\fIunzipsfx\fP is not supported on the Amiga because of the way the loader
  1324. Xworks; the entire archive contents would be loaded into memory by default.
  1325. XIt may be possible to work around this by defining the attached archive to
  1326. Xbe a ``debug hunk,'' but compatibility problems between the ROM levels of
  1327. Xolder Amigas and newer ones are likely to cause problems regardless.
  1328. X.LP
  1329. XAll current bugs in \fIunzip\fP(1L) exist in \fIunzipsfx\fP as well.
  1330. X.PD
  1331. X.\" =========================================================================
  1332. X.SH DIAGNOSTICS
  1333. X\fIunzipsfx\fP's exit status (error level) is identical to that of
  1334. X\fIunzip\fP(1L); see the corresponding man page.
  1335. X.PD
  1336. X.\" =========================================================================
  1337. X.SH SEE ALSO
  1338. X\fIfunzip\fP(1L), \fIunzip\fP(1L), \fIzip\fP(1L), \fIzipcloak\fP(1L),
  1339. X\fIzipgrep\fP(1L), \fIzipinfo\fP(1L), \fIzipnote\fP(1L), \fIzipsplit\fP(1L)
  1340. X.PD
  1341. X.\" =========================================================================
  1342. X.SH AUTHORS
  1343. XGreg Roelofs was responsible for the basic modifications to UnZip necessary
  1344. Xto create UnZipSFX.  See \fIunzip\fP(1L) for the current list of zip-bugs
  1345. Xauthors, or the file CONTRIBS in the UnZip source distribution for the
  1346. Xfull list of Info-ZIP contributors.
  1347. X.PD
  1348. END_OF_FILE
  1349.   if test 12523 -ne `wc -c <'unzip-5.12/unix/unzipsfx.1'`; then
  1350.     echo shar: \"'unzip-5.12/unix/unzipsfx.1'\" unpacked with wrong size!
  1351.   fi
  1352.   # end of 'unzip-5.12/unix/unzipsfx.1'
  1353. fi
  1354. if test -f 'unzip-5.12/unshrink.c' -a "${1}" != "-c" ; then 
  1355.   echo shar: Will not clobber existing file \"'unzip-5.12/unshrink.c'\"
  1356. else
  1357.   echo shar: Extracting \"'unzip-5.12/unshrink.c'\" \(17522 characters\)
  1358.   sed "s/^X//" >'unzip-5.12/unshrink.c' <<'END_OF_FILE'
  1359. X#include "unzip.h"
  1360. X
  1361. X#ifdef NEW_UNSHRINK
  1362. X
  1363. X/*---------------------------------------------------------------------------
  1364. X
  1365. X  unshrink.c                     version 0.94                     26 Apr 94
  1366. X
  1367. X  Shrinking is basically a dynamic LZW algorithm with allowed code sizes of
  1368. X  up to 13 bits; in addition, there is provision for partial clearing of
  1369. X  leaf nodes.  PKWARE uses the special code 256 (decimal) to indicate a
  1370. X  change in code size or a partial clear of the code tree:  256,1 for the
  1371. X  former and 256,2 for the latter.  See the notes in the code below about
  1372. X  orphaned nodes after partial clearing.
  1373. X
  1374. X  This replacement version of unshrink.c was written from scratch.  It is
  1375. X  based only on the algorithms described in Mark Nelson's _The Data Compres-
  1376. X  sion Book_ and in Terry Welch's original paper in the June 1984 issue of
  1377. X  IEEE _Computer_; no existing source code, including any in Nelson's book,
  1378. X  was used.
  1379. X
  1380. X  Memory requirements are fairly large.  While the NODE struct could be mod-
  1381. X  ified to fit in a single 64KB segment (as a "far" data structure), for now
  1382. X  it is assumed that a flat, 32-bit address space is available.  outbuf2 is
  1383. X  always malloc'd, and flush() is always called with unshrink == FALSE.
  1384. X
  1385. X  Copyright (C) 1994 Greg Roelofs.  See the accompanying file "COPYING" in
  1386. X  the UnZip 5.11 (or later) source distribution.
  1387. X
  1388. X  ---------------------------------------------------------------------------*/
  1389. X
  1390. X
  1391. X/* #include "unzip.h" */
  1392. X
  1393. X#ifdef DEBUG
  1394. X#  define OUTDBG(c)  if ((c)=='\n') {PUTC('^',stderr); PUTC('J',stderr);}\
  1395. X                     else PUTC((c),stderr);
  1396. X#else
  1397. X#  define OUTDBG(c)
  1398. X#endif
  1399. X
  1400. Xtypedef struct leaf {
  1401. X    struct leaf *parent;
  1402. X    struct leaf *next_sibling;
  1403. X    struct leaf *first_child;
  1404. X    uch value;
  1405. X} NODE;
  1406. X
  1407. Xstatic void  partial_clear  __((NODE *cursib));
  1408. X
  1409. Xstatic NODE *node, *bogusnode, *lastfreenode;
  1410. X
  1411. X
  1412. Xint unshrink()
  1413. X{
  1414. X#ifdef MACOS
  1415. X    static uch *stacktop = NULL;
  1416. X#else
  1417. X    static uch *stacktop = stack + 8192 - 1;
  1418. X#endif
  1419. X    register uch *newstr;
  1420. X    int codesize=9, code, oldcode=0, len, KwKwK;
  1421. X    unsigned int outbufsiz;
  1422. X    NODE *freenode, *curnode, *lastnode=node, *oldnode;
  1423. X
  1424. X
  1425. X/*---------------------------------------------------------------------------
  1426. X    Initialize various variables.
  1427. X  ---------------------------------------------------------------------------*/
  1428. X
  1429. X#ifdef MACOS
  1430. X    if (stacktop == NULL) stacktop = stack + 8192 - 1;
  1431. X#endif
  1432. X
  1433. X    if ((node = (NODE *)malloc(8192*sizeof(NODE))) == (NODE *)NULL)
  1434. X        return PK_MEM3;
  1435. X    bogusnode = node + 256;
  1436. X    lastfreenode = node + 256;
  1437. X
  1438. X#ifndef SMALL_MEM   /* always true, at least for now */
  1439. X    /* non-memory-limited machines:  allocate second (large) buffer for
  1440. X     * textmode conversion in flush(), but only if needed */
  1441. X    if (pInfo->textmode && !outbuf2 &&
  1442. X        (outbuf2 = (uch *)malloc(TRANSBUFSIZ)) == (uch *)NULL)
  1443. X    {
  1444. X        free(node);
  1445. X        return PK_MEM3;
  1446. X    }
  1447. X#endif
  1448. X
  1449. X    /* this stuff was an attempt to debug compiler errors(?) when had
  1450. X     * node[8192] in union work area...no clues what was wrong (SGI worked)
  1451. X    Trace((stderr, "\nsizeof(NODE) = %d\n", sizeof(NODE)));
  1452. X    Trace((stderr, "sizeof(node) = %d\n", sizeof(node)));
  1453. X    Trace((stderr, "sizeof(area) = %d\n", sizeof(area)));
  1454. X    Trace((stderr, "address of node[0] = %d\n", (int)&node[0]));
  1455. X    Trace((stderr, "address of node[6945] = %d\n", (int)&node[6945]));
  1456. X     */
  1457. X
  1458. X    for (code = 0;  code < 256;  ++code) {
  1459. X        node[code].value = code;
  1460. X        node[code].parent = bogusnode;
  1461. X        node[code].next_sibling = &node[code+1];
  1462. X        node[code].first_child = (NODE *)NULL;
  1463. X    }
  1464. X    node[255].next_sibling = (NODE *)NULL;
  1465. X    for (code = 257;  code < 8192;  ++code)
  1466. X        node[code].parent = node[code].next_sibling = (NODE *)NULL;
  1467. X
  1468. X    outptr = outbuf;
  1469. X    outcnt = 0L;
  1470. X    if (pInfo->textmode)
  1471. X        outbufsiz = RAWBUFSIZ;
  1472. X    else
  1473. X        outbufsiz = OUTBUFSIZ;
  1474. X
  1475. X/*---------------------------------------------------------------------------
  1476. X    Get and output first code, then loop over remaining ones.
  1477. X  ---------------------------------------------------------------------------*/
  1478. X
  1479. X    READBITS(codesize, oldcode)
  1480. X    if (!zipeof) {
  1481. X        *outptr++ = (uch)oldcode;
  1482. X        OUTDBG((uch)oldcode)
  1483. X        if (++outcnt == outbufsiz) {
  1484. X            flush(outbuf, outcnt, FALSE);
  1485. X            outptr = outbuf;
  1486. X            outcnt = 0L;
  1487. X        }
  1488. X    }
  1489. X
  1490. X    do {
  1491. X        READBITS(codesize, code)
  1492. X        if (zipeof)
  1493. X            break;
  1494. X        if (code == 256) {   /* GRR:  possible to have consecutive escapes? */
  1495. X            READBITS(codesize, code)
  1496. X            if (code == 1) {
  1497. X                ++codesize;
  1498. X                Trace((stderr, " (codesize now %d bits)\n", codesize));
  1499. X            } else if (code == 2) {
  1500. X                Trace((stderr, " (partial clear code)\n"));
  1501. X#ifdef DEBUG
  1502. X                fprintf(stderr, "   should clear:\n");
  1503. X                for (curnode = node+257;  curnode < node+8192;  ++curnode)
  1504. X                    if (!curnode->first_child)
  1505. X                        fprintf(stderr, "%d\n", curnode-node);
  1506. X                fprintf(stderr, "   did clear:\n");
  1507. X#endif
  1508. X                partial_clear(node);       /* recursive clear of leafs */
  1509. X                lastfreenode = bogusnode;  /* reset start of free-node search */
  1510. X            }
  1511. X            continue;
  1512. X        }
  1513. X
  1514. X    /*-----------------------------------------------------------------------
  1515. X        Translate code:  traverse tree from leaf back to root.
  1516. X      -----------------------------------------------------------------------*/
  1517. X
  1518. X        curnode = &node[code];
  1519. X        newstr = stacktop;
  1520. X
  1521. X        if (curnode->parent)
  1522. X            KwKwK = FALSE;
  1523. X        else {
  1524. X            KwKwK = TRUE;
  1525. X            Trace((stderr, " (found a KwKwK code %d; oldcode = %d)\n", code,
  1526. X              oldcode));
  1527. X            --newstr;   /* last character will be same as first character */
  1528. X            curnode = &node[oldcode];
  1529. X        }
  1530. X
  1531. X        do {
  1532. X            *newstr-- = curnode->value;
  1533. X            curnode = curnode->parent;
  1534. X        } while (curnode != bogusnode);
  1535. X
  1536. X        len = stacktop - newstr++;
  1537. X        if (KwKwK)
  1538. X            *stacktop = *newstr;
  1539. X
  1540. X    /*-----------------------------------------------------------------------
  1541. X        Write expanded string in reverse order to output buffer.
  1542. X      -----------------------------------------------------------------------*/
  1543. X
  1544. X        Trace((stderr, "code %4d; oldcode %4d; char %3d (%c); string [", code,
  1545. X          oldcode, (int)(*newstr), *newstr));
  1546. X        {
  1547. X            register uch *p;
  1548. X
  1549. X            for (p = newstr;  p < newstr+len;  ++p) {
  1550. X                *outptr++ = *p;
  1551. X                OUTDBG(*p)
  1552. X                if (++outcnt == outbufsiz) {
  1553. X                    flush(outbuf, outcnt, FALSE);
  1554. X                    outptr = outbuf;
  1555. X                    outcnt = 0L;
  1556. X                }
  1557. X            }
  1558. X        }
  1559. X
  1560. X    /*-----------------------------------------------------------------------
  1561. X        Add new leaf (first character of newstr) to tree as child of oldcode.
  1562. X      -----------------------------------------------------------------------*/
  1563. X
  1564. X        /* search for freenode */
  1565. X        freenode = lastfreenode + 1;
  1566. X        while (freenode->parent)       /* add if-test before loop for speed? */
  1567. X            ++freenode;
  1568. X        lastfreenode = freenode;
  1569. X        Trace((stderr, "]; newcode %d\n", freenode-node));
  1570. X
  1571. X        oldnode = &node[oldcode];
  1572. X        if (!oldnode->first_child) {   /* no children yet:  add first one */
  1573. X            if (!oldnode->parent) {
  1574. X                /*
  1575. X                 * oldnode is itself a free node:  the only way this can happen
  1576. X                 * is if a partial clear occurred immediately after oldcode was
  1577. X                 * received and therefore immediately before this step (adding
  1578. X                 * freenode).  This is subtle:  even though the parent no longer
  1579. X                 * exists, it is treated as if it does, and pointers are set as
  1580. X                 * usual.  Thus freenode is an orphan, *but only until the tree
  1581. X                 * fills up to the point where oldnode is reused*.  At that
  1582. X                 * point the reborn oldnode "adopts" the orphaned node.  Such
  1583. X                 * wacky guys at PKWARE...
  1584. X                 *
  1585. X                 * To mark this, we set oldnode->next_sibling to point at the
  1586. X                 * bogus node (256) and then check for this in the freenode sec-
  1587. X                 * tion just below.
  1588. X                 */
  1589. X                Trace((stderr, "  [%d's parent (%d) was just cleared]\n",
  1590. X                  freenode-node, oldcode));
  1591. X                oldnode->next_sibling = bogusnode;
  1592. X            }
  1593. X            oldnode->first_child = freenode;
  1594. X        } else {
  1595. X            curnode = oldnode->first_child;
  1596. X            while (curnode) {          /* find last child in sibling chain */
  1597. X                lastnode = curnode;
  1598. X                curnode = curnode->next_sibling;
  1599. X            }
  1600. X            lastnode->next_sibling = freenode;
  1601. X        }
  1602. X        freenode->value = *newstr;
  1603. X        freenode->parent = oldnode;
  1604. X        if (freenode->next_sibling != bogusnode)  /* no adoptions today... */
  1605. X            freenode->first_child = (NODE *)NULL;
  1606. X        freenode->next_sibling = (NODE *)NULL;
  1607. X
  1608. X        oldcode = code;
  1609. X    } while (!zipeof);
  1610. X
  1611. X/*---------------------------------------------------------------------------
  1612. X    Flush any remaining data, free malloc'd space and return to sender...
  1613. X  ---------------------------------------------------------------------------*/
  1614. X
  1615. X    if (outcnt > 0L)
  1616. X        flush(outbuf, outcnt, FALSE);
  1617. X
  1618. X    free(node);
  1619. X    return PK_OK;
  1620. X
  1621. X} /* end function unshrink() */
  1622. X
  1623. X
  1624. X
  1625. X
  1626. X
  1627. Xstatic void partial_clear(cursib)   /* like, totally recursive, eh? */
  1628. X    NODE *cursib;
  1629. X{
  1630. X    NODE *lastsib=(NODE *)NULL;
  1631. X
  1632. X    /* Loop over siblings, removing any without children; recurse on those
  1633. X     * which do have children.  This hits even the orphans because they're
  1634. X     * always adopted (parent node is reused) before tree becomes full and
  1635. X     * needs clearing.
  1636. X     */
  1637. X    do {
  1638. X        if (cursib->first_child) {
  1639. X            partial_clear(cursib->first_child);
  1640. X            lastsib = cursib;
  1641. X        } else if ((cursib - node) > 256) {  /* no children (leaf):  clear it */
  1642. X            Trace((stderr, "%d\n", cursib-node));
  1643. X            if (!lastsib)
  1644. X                cursib->parent->first_child = cursib->next_sibling;
  1645. X            else
  1646. X                lastsib->next_sibling = cursib->next_sibling;
  1647. X            cursib->parent = (NODE *)NULL;
  1648. X        }
  1649. X        cursib = cursib->next_sibling;
  1650. X    } while (cursib);
  1651. X    return;
  1652. X}
  1653. X
  1654. X
  1655. X
  1656. X#else /* !NEW_UNSHRINK */
  1657. X
  1658. X
  1659. X
  1660. X/*---------------------------------------------------------------------------
  1661. X
  1662. X  unshrink.c
  1663. X
  1664. X  Shrinking is a dynamic Lempel-Ziv-Welch compression algorithm with partial
  1665. X  clearing.  Sadly, it uses more memory than any of the other algorithms (at
  1666. X  a minimum, 8K+8K+16K, assuming 16-bit short ints), and this does not even
  1667. X  include the output buffer (the other algorithms leave the uncompressed data
  1668. X  in the work area, typically called slide[]).  For machines with a 64KB data
  1669. X  space, this is a problem, particularly when text conversion is required and
  1670. X  line endings have more than one character.  UnZip's solution is to use two
  1671. X  roughly equal halves of outbuf for the ASCII conversion in such a case; the
  1672. X  "unshrink" argument to flush() signals that this is the case.
  1673. X
  1674. X  For large-memory machines, a second outbuf is allocated for translations,
  1675. X  but only if unshrinking and only if translations are required.
  1676. X
  1677. X              | binary mode  |        text mode
  1678. X    ---------------------------------------------------
  1679. X    big mem   |  big outbuf  | big outbuf + big outbuf2  <- malloc'd here
  1680. X    small mem | small outbuf | half + half small outbuf
  1681. X
  1682. X  This version contains code which is copyright (C) 1989 Samuel H. Smith.
  1683. X  See the accompanying file "COPYING" in the UnZip 5.11 (or later) source
  1684. X  distribution.
  1685. X
  1686. X  ---------------------------------------------------------------------------*/
  1687. X
  1688. X
  1689. X/* #include "unzip.h" */
  1690. X
  1691. X/*      MAX_BITS   13   (in unzip.h; defines size of global work area)  */
  1692. X#define INIT_BITS  9
  1693. X#define FIRST_ENT  257
  1694. X#define CLEAR      256
  1695. X
  1696. X#define OUTB(c) {\
  1697. X    *outptr++=(uch)(c);\
  1698. X    if (++outcnt==outbufsiz) {\
  1699. X        flush(outbuf,outcnt,TRUE);\
  1700. X        outcnt=0L;\
  1701. X        outptr=outbuf;\
  1702. X    }\
  1703. X}
  1704. X
  1705. Xstatic void partial_clear __((void));
  1706. X
  1707. Xint codesize, maxcode, maxcodemax, free_ent;
  1708. X
  1709. X
  1710. X
  1711. X
  1712. X/*************************/
  1713. X/*  Function unshrink()  */
  1714. X/*************************/
  1715. X
  1716. Xint unshrink()   /* return PK-type error code */
  1717. X{
  1718. X    register int code;
  1719. X    register int stackp;
  1720. X    int finchar;
  1721. X    int oldcode;
  1722. X    int incode;
  1723. X    unsigned int outbufsiz;
  1724. X
  1725. X
  1726. X    /* non-memory-limited machines:  allocate second (large) buffer for
  1727. X     * textmode conversion in flush(), but only if needed */
  1728. X#ifndef SMALL_MEM
  1729. X    if (pInfo->textmode && !outbuf2 &&
  1730. X        (outbuf2 = (uch *)malloc(TRANSBUFSIZ)) == (uch *)NULL)
  1731. X        return PK_MEM3;
  1732. X#endif
  1733. X
  1734. X    outptr = outbuf;
  1735. X    outcnt = 0L;
  1736. X    if (pInfo->textmode)
  1737. X        outbufsiz = RAWBUFSIZ;
  1738. X    else
  1739. X        outbufsiz = OUTBUFSIZ;
  1740. X
  1741. X    /* decompress the file */
  1742. X    codesize = INIT_BITS;
  1743. X    maxcode = (1 << codesize) - 1;
  1744. X    maxcodemax = HSIZE;         /* (1 << MAX_BITS) */
  1745. X    free_ent = FIRST_ENT;
  1746. X
  1747. X    code = maxcodemax;
  1748. X/*
  1749. X    OvdL: -Ox with SCO's 3.2.0 cc gives
  1750. X    a. warning: overflow in constant multiplication
  1751. X    b. segmentation fault (core dumped) when using the executable
  1752. X    for (code = maxcodemax; code > 255; code--)
  1753. X        prefix_of[code] = -1;
  1754. X */
  1755. X    do {
  1756. X        prefix_of[code] = -1;
  1757. X    } while (--code > 255);
  1758. X
  1759. X    for (code = 255; code >= 0; code--) {
  1760. X        prefix_of[code] = 0;
  1761. X        suffix_of[code] = (uch)code;
  1762. X    }
  1763. X
  1764. X    READBITS(codesize,oldcode)  /* ; */
  1765. X    if (zipeof)
  1766. X        return PK_COOL;
  1767. X    finchar = oldcode;
  1768. X
  1769. X    OUTB(finchar)
  1770. X
  1771. X    stackp = HSIZE;
  1772. X
  1773. X    while (!zipeof) {
  1774. X        READBITS(codesize,code)  /* ; */
  1775. X        if (zipeof) {
  1776. X            if (outcnt > 0L)
  1777. X                flush(outbuf, outcnt, TRUE);   /* flush last, partial buffer */
  1778. X            return PK_COOL;
  1779. X        }
  1780. X
  1781. X        while (code == CLEAR) {
  1782. X            READBITS(codesize,code)  /* ; */
  1783. X            switch (code) {
  1784. X                case 1:
  1785. X                    codesize++;
  1786. X                    if (codesize == MAX_BITS)
  1787. X                        maxcode = maxcodemax;
  1788. X                    else
  1789. X                        maxcode = (1 << codesize) - 1;
  1790. X                    break;
  1791. X
  1792. X                case 2:
  1793. X                    partial_clear();
  1794. X                    break;
  1795. X            }
  1796. X
  1797. X            READBITS(codesize,code)  /* ; */
  1798. X            if (zipeof) {
  1799. X                if (outcnt > 0L)
  1800. X                    flush(outbuf, outcnt, TRUE);   /* partial buffer */
  1801. X                return PK_COOL;
  1802. X            }
  1803. X        }
  1804. X
  1805. X
  1806. X        /* special case for KwKwK string */
  1807. X        incode = code;
  1808. X        if (prefix_of[code] == -1) {
  1809. X            stack[--stackp] = (uch)finchar;
  1810. X            code = oldcode;
  1811. X        }
  1812. X        /* generate output characters in reverse order */
  1813. X        while (code >= FIRST_ENT) {
  1814. X            if (prefix_of[code] == -1) {
  1815. X                stack[--stackp] = (uch)finchar;
  1816. X                code = oldcode;
  1817. X            } else {
  1818. X                stack[--stackp] = suffix_of[code];
  1819. X                code = prefix_of[code];
  1820. X            }
  1821. X        }
  1822. X
  1823. X        finchar = suffix_of[code];
  1824. X        stack[--stackp] = (uch)finchar;
  1825. X
  1826. X
  1827. X        /* and put them out in forward order, block copy */
  1828. X        if ((HSIZE - stackp + outcnt) < outbufsiz) {
  1829. X            /* GRR:  this is not necessarily particularly efficient:
  1830. X             *       typically output only 2-5 bytes per loop (more
  1831. X             *       than a dozen rather rare?) */
  1832. X            memcpy(outptr, &stack[stackp], HSIZE - stackp);
  1833. X            outptr += HSIZE - stackp;
  1834. X            outcnt += HSIZE - stackp;
  1835. X            stackp = HSIZE;
  1836. X        }
  1837. X        /* output byte by byte if we can't go by blocks */
  1838. X        else
  1839. X            while (stackp < HSIZE)
  1840. X                OUTB(stack[stackp++])
  1841. X
  1842. X
  1843. X        /* generate new entry */
  1844. X        code = free_ent;
  1845. X        if (code < maxcodemax) {
  1846. X            prefix_of[code] = oldcode;
  1847. X            suffix_of[code] = (uch)finchar;
  1848. X
  1849. X            do
  1850. X                code++;
  1851. X            while ((code < maxcodemax) && (prefix_of[code] != -1));
  1852. X
  1853. X            free_ent = code;
  1854. X        }
  1855. X        /* remember previous code */
  1856. X        oldcode = incode;
  1857. X    }
  1858. X
  1859. X    /* never reached? */
  1860. X    /* flush last, partial buffer */
  1861. X    if (outcnt > 0L)
  1862. X        flush(outbuf, outcnt, TRUE);
  1863. X
  1864. X    return PK_OK;
  1865. X
  1866. X} /* end function unshrink() */
  1867. X
  1868. X
  1869. X
  1870. X/******************************/
  1871. X/*  Function partial_clear()  */
  1872. X/******************************/
  1873. X
  1874. Xstatic void partial_clear()
  1875. X{
  1876. X    register int pr;
  1877. X    register int cd;
  1878. X
  1879. X    /* mark all nodes as potentially unused */
  1880. X    for (cd = FIRST_ENT; cd < free_ent; cd++)
  1881. X        prefix_of[cd] |= 0x8000;
  1882. X
  1883. X    /* unmark those that are used by other nodes */
  1884. X    for (cd = FIRST_ENT; cd < free_ent; cd++) {
  1885. X        pr = prefix_of[cd] & 0x7fff;    /* reference to another node? */
  1886. X        if (pr >= FIRST_ENT)    /* flag node as referenced */
  1887. X            prefix_of[pr] &= 0x7fff;
  1888. X    }
  1889. X
  1890. X    /* clear the ones that are still marked */
  1891. X    for (cd = FIRST_ENT; cd < free_ent; cd++)
  1892. X        if ((prefix_of[cd] & 0x8000) != 0)
  1893. X            prefix_of[cd] = -1;
  1894. X
  1895. X    /* find first cleared node as next free_ent */
  1896. X    cd = FIRST_ENT;
  1897. X    while ((cd < maxcodemax) && (prefix_of[cd] != -1))
  1898. X        cd++;
  1899. X    free_ent = cd;
  1900. X}
  1901. X
  1902. X
  1903. X#endif /* ?NEW_UNSHRINK */
  1904. END_OF_FILE
  1905.   if test 17522 -ne `wc -c <'unzip-5.12/unshrink.c'`; then
  1906.     echo shar: \"'unzip-5.12/unshrink.c'\" unpacked with wrong size!
  1907.   fi
  1908.   # end of 'unzip-5.12/unshrink.c'
  1909. fi
  1910. echo shar: End of archive 15 \(of 20\).
  1911. cp /dev/null ark15isdone
  1912. MISSING=""
  1913. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ; do
  1914.     if test ! -f ark${I}isdone ; then
  1915.     MISSING="${MISSING} ${I}"
  1916.     fi
  1917. done
  1918. if test "${MISSING}" = "" ; then
  1919.     echo You have unpacked all 20 archives.
  1920.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1921. else
  1922.     echo You still must unpack the following archives:
  1923.     echo "        " ${MISSING}
  1924. fi
  1925. exit 0
  1926. exit 0 # Just in case...
  1927.