home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume14 / unzip-3.1 / part02 / unzip.os2 < prev   
Text File  |  1990-09-20  |  10KB  |  350 lines

  1. [These patches have NOT been installed as of v3.10.
  2.  David Kirschbaum
  3.  Info-ZIP Coordinator
  4. ]
  5.  
  6. Received: by mcsun.EU.net via EUnet; Fri, 18 May 90 20:50:40 +0200 (MET)
  7. Received: from lena by kestrel.Ukc.AC.UK   with UUCP  id aa00758;
  8.           18 May 90 18:19 BST
  9. Received: by lena with netmail(8.73); Fri May 18 14:30:13 BST 1990
  10. Date: Fri May 18 14:30:13 BST 1990
  11. X-Mailer: Mail User's Shell (7.0.4 1/26/90)
  12. From: Mike O'Carroll <mike@elec-eng.leeds.ac.uk>
  13. Message-Id: <4867.9005181430.lena@lena.uucp>
  14. To: kirsch@usasoc.soc.mil
  15. Subject: unzip30
  16.  
  17. I'm not sure if anyone else has done this, but I have made a Dos & OS/2
  18. version of unzip.  The cdiffs are below.  The supplied makefile (unzip)
  19. generates a family program which executes in both Dos and OS/2 modes.
  20. I can supply the .exe if required (31K).
  21.  
  22. The mods took 15 minutes, and the result has undergone 35 seconds
  23. testing (:-) ; I had one .ZIP file to unzip, and it worked OK, but no
  24. great confidence yet.
  25.  
  26. BTW, can I get a corresponding ZIP from somewhere?  Simtel20?
  27.  
  28. Regards,
  29.         Mike
  30.  
  31. -------------------------
  32. #       This is a shell archive.
  33. #       Remove everything above and including the cut line.
  34. #       Then run the rest of the file through sh.
  35. #-----cut here-----cut here-----cut here-----cut here-----
  36. #!/bin/sh
  37. # shar: Shell Archiver
  38. #       Run the following text with /bin/sh to create:
  39. #       match.dif
  40. #       unzip.dif
  41. #       unzip
  42. # This archive created: Fri May 18 14:20:18 BST 1990
  43. if [ -f 'match.dif' ] ; then
  44. echo shar: will not overwrite existing file \'match.dif\' >&2
  45. else
  46. cat << \SHAR_EOF >'match.dif'
  47. *** match.c     Fri May 18 13:54:07 1990
  48. --- Dmatch.c    Fri May 18 13:54:15 1990
  49. ***************
  50. *** 10,15
  51.    * 11/13/89  C. Mascott     adapt for use with unzip
  52.    * 01/25/90  J. Cowan       match case-insensitive
  53.    * 03/17/90  D. Kirschbaum      Prototypes, other tweaks for Turbo C.
  54.    *
  55.    */
  56.   
  57.  
  58. --- 10,16 -----
  59.    * 11/13/89  C. Mascott     adapt for use with unzip
  60.    * 01/25/90  J. Cowan       match case-insensitive
  61.    * 03/17/90  D. Kirschbaum      Prototypes, other tweaks for Turbo C.
  62. +  * 18-may-90 M. O'Carroll   Dos & OS/2 family version
  63.    *
  64.    */
  65.   
  66. ***************
  67. *** 24,29
  68.    *        This file contains service routines needed to maintain an archive.
  69.    */
  70.   
  71.   #include <sys/types.h>
  72.   #include <sys/dir.h>
  73.   #include <ctype.h>
  74.  
  75. --- 25,31 -----
  76.    *        This file contains service routines needed to maintain an archive.
  77.    */
  78.   
  79. + #ifdef MSC
  80.   #include <sys/types.h>
  81.   #include <ctype.h>
  82.   #include <stdio.h>
  83. ***************
  84. *** 25,30
  85.    */
  86.   
  87.   #include <sys/types.h>
  88.   #include <sys/dir.h>
  89.   #include <ctype.h>
  90.   
  91.  
  92. --- 27,36 -----
  93.   
  94.   #ifdef MSC
  95.   #include <sys/types.h>
  96. + #include <ctype.h>
  97. + #include <stdio.h>
  98. + #else
  99. + #include <sys/types.h>
  100.   #include <sys/dir.h>
  101.   #include <ctype.h>
  102.   #endif
  103. ***************
  104. *** 27,32
  105.   #include <sys/types.h>
  106.   #include <sys/dir.h>
  107.   #include <ctype.h>
  108.   
  109.   #ifdef __TURBOC__               /* v2.0b */
  110.   #include <stdio.h>      /* for printf() */
  111.  
  112. --- 33,39 -----
  113.   #include <sys/types.h>
  114.   #include <sys/dir.h>
  115.   #include <ctype.h>
  116. + #endif
  117.   
  118.   #ifdef __TURBOC__               /* v2.0b */
  119.   #include <stdio.h>      /* for printf() */
  120. SHAR_EOF
  121. fi
  122. if [ -f 'unzip.dif' ] ; then
  123. echo shar: will not overwrite existing file \'unzip.dif\' >&2
  124. else
  125. cat << \SHAR_EOF >'unzip.dif'
  126. *** unzip.c     Fri May 18 13:52:51 1990
  127. --- Dunzip.c    Fri May 18 13:53:00 1990
  128. ***************
  129. *** 63,68
  130.   
  131.   #endif
  132.   
  133.   #define min(a,b) ((a) < (b) ? (a) : (b))
  134.   
  135.   #ifndef ZMEM                            /* v2.0f use your system's stuff */
  136.  
  137. --- 63,77 -----
  138.   
  139.   #endif
  140.   
  141. + /* Added stuff for MSC Dos & OS/2 family version - Mike O'Carroll, 18-May-90
  142. +  */
  143. + #ifdef MSC
  144. + #include <os2.h>
  145. + #include <sys/types.h>
  146. + #include <io.h>         /* for setftime(), dup(), creat() */
  147. + #include <sys/stat.h>   /* for S_IWRITE, S_IREAD */
  148. + #include <memory.h>     /* for memcpy() */
  149. + #else
  150.   #define min(a,b) ((a) < (b) ? (a) : (b))
  151.   #endif /* MSC */
  152.   
  153. ***************
  154. *** 64,69
  155.   #endif
  156.   
  157.   #define min(a,b) ((a) < (b) ? (a) : (b))
  158.   
  159.   #ifndef ZMEM                            /* v2.0f use your system's stuff */
  160.   #define zmemcpy memcpy
  161.  
  162. --- 73,79 -----
  163.   #include <memory.h>     /* for memcpy() */
  164.   #else
  165.   #define min(a,b) ((a) < (b) ? (a) : (b))
  166. + #endif /* MSC */
  167.   
  168.   #ifndef ZMEM                            /* v2.0f use your system's stuff */
  169.   #define zmemcpy memcpy
  170. ***************
  171. *** 473,478
  172.     */
  173.   {
  174.   #ifndef UNIX
  175.       union {
  176.           struct ftime ft;        /* system file time record */
  177.           struct {
  178.  
  179. --- 483,489 -----
  180.     */
  181.   {
  182.   #ifndef UNIX
  183. + #   ifdef MSC
  184.       union {
  185.           FDATE fd;               /* system file date record */
  186.           UWORD zdate;            /* date word */
  187. ***************
  188. *** 474,479
  189.   {
  190.   #ifndef UNIX
  191.       union {
  192.           struct ftime ft;        /* system file time record */
  193.           struct {
  194.                   UWORD ztime;     /* date and time words */
  195.  
  196. --- 485,511 -----
  197.   #ifndef UNIX
  198.   #   ifdef MSC
  199.       union {
  200. +         FDATE fd;               /* system file date record */
  201. +         UWORD zdate;            /* date word */
  202. +     } ud;
  203. +     union {
  204. +         FTIME ft;               /* system file time record */
  205. +         UWORD ztime;            /* time word */
  206. +     } ut;
  207. +     FILESTATUS fs;
  208. +     DosQFileInfo(outfd, 1, &fs, sizeof(fs));
  209. +     ud.zdate = lrec.last_mod_file_date;
  210. +     fs.fdateLastWrite = ud.fd;
  211. +     ut.ztime = lrec.last_mod_file_time;
  212. +     fs.ftimeLastWrite = ut.ft;
  213. +     DosSetFileInfo(outfd, 1, &fs, sizeof(fs));
  214. + #   else /* MSC */
  215. +     union {
  216.           struct ftime ft;        /* system file time record */
  217.           struct {
  218.                   UWORD ztime;     /* date and time words */
  219. ***************
  220. *** 490,495
  221.       td.zt.zdate = lrec.last_mod_file_date;
  222.   
  223.       setftime(outfd, &td.ft);
  224.   
  225.   #else   /* UNIX */
  226.   
  227.  
  228. --- 522,529 -----
  229.       td.zt.zdate = lrec.last_mod_file_date;
  230.   
  231.       setftime(outfd, &td.ft);
  232. + #   endif /* MSC */
  233.   
  234.   #else   /* UNIX */
  235.   
  236. SHAR_EOF
  237. fi
  238. if [ -f 'unzip' ] ; then
  239. echo shar: will not overwrite existing file \'unzip\' >&2
  240. else
  241. cat << \SHAR_EOF >'unzip'
  242. # For MSC brian damaged (:-) make.  To generate Dos & OS/2 version, type
  243. # "make unzip"
  244. #
  245. # I used Microsoft C V5.1, with the SDK.
  246. #
  247. # The following comments come from the Unix Makefile, and most may
  248. # well be irrelevant to the Dos version.
  249. #       Mike O'Carroll 18-May-90 <mike@ee.leeds.ac.uk>
  250. # -----------------------------------------------------------------------
  251. #
  252. # "make vaxbsd" -- makes unzip on a VAX 11-780 BSD 4.3 in current directory
  253. # "make"        -- uses environment variable SYSTEM to set the type
  254. #                  system to compile for.
  255. # "make wombat" -- Chokes and dies if you haven't added the specifics
  256. #                  for your Wombat 68000 (or whatever) to the systems list.
  257. #
  258. # CFLAGS are flags for the C compiler.  LDFLAGS are flags for the loader.
  259. #
  260. # My host (a VAX 11-780 running BSD 4.3) is hereafter referred to as
  261. # "my host."
  262. #
  263. # My host's /usr/include/sys/param.h defines BSD for me.
  264. # You may have to add "-DBSD" to the list of CFLAGS for your system.
  265. #
  266. # You MAY need to define "-DNOTINT16" if the program produces crc errors
  267. # during a "-t" run or extraction.  (This involves structure alignment.)
  268. # It won't HURT to define "-dNOTINT16" anyway .. but if you don't need it,
  269. # why add to the program size, complexity, etc.?
  270. #
  271. # If your host is "big-endian" (as in the 68000 family) and does NOT order
  272. # its integers and long integers in Intel fashion (low .. high), you should
  273. # define "-DHIGH_LOW".  This insures key structure values will be "swapped"
  274. # low end for high end.
  275. # Some mainframes DO require this.
  276. #
  277. # Some systems have a shell-defined "$MAKE" (my host did not).  If not,
  278. # use "make" instead of the "$MAKE" or "$(MAKE)" in your system's makerule.
  279. # Or try adding the following line to your .login file:
  280. #   setenv MAKE "make"
  281. # (It didn't help on my host.)
  282. #
  283. # zmemcpy has been added to the list of required files for some systems.
  284. # memcpy() is a normal C function that works just fine in Turbo C
  285. # and some Unix systems, but has a problem in others (producing CRC errors).
  286. #
  287. # You can try a compile without zmemcpy.c, and if it works .. fine.
  288. # (To do this, you may have to remove zmemcpy.o from your system's list
  289. # of required OBJS files, and the "-DZMEM" from the list of CFLAGS defines.)
  290. #
  291. # Else use the included zmemcpy.c.
  292. # (Again, you may have to add zmemcpy.o to your system's list of required
  293. # OBJS files, and the "-DZMEM" to the list of CFLAGS defines.)
  294.  
  295. # To test, insure your zip file includes some LARGE members.  Many systems
  296. # ran just fine with zip file members <512 bytes, but failed with larger ones.
  297. #
  298.  
  299. CC = cl
  300. CFLAGS = -DMSC
  301. LD = link
  302. LDFLAGS = /NOI
  303. RM = del
  304. LIBC = c:\m5\lib\p\slibce
  305. LIBD = c:\m5\lib\doscalls.lib
  306. LIBA = c:\m5\lib\api.lib
  307. INCL = -Ic:\m5\include
  308.  
  309. OBJ1 = unzip.obj crc32.obj match.obj ascebc.obj mapname.obj
  310. OBJ2 = zmemset.obj zmemcpy.obj
  311.  
  312. .c.obj:
  313.         $(CC) -c $(CFLAGS) $(INCL) $*.c
  314.  
  315. unzip.obj:      unzip.c
  316.  
  317. crc32.obj:      crc32.c
  318.  
  319. match.obj:      match.c
  320.  
  321. ascebc.obj:     ascebc.c
  322.  
  323. mapname.obj:    mapname.c
  324.  
  325. zmemset.obj:    zmemset.c
  326.  
  327. zmemcpy.obj:    zmemcpy.c
  328.  
  329. unziptmp.exe:   $(OBJ1) $(OBJ2)
  330.         $(LD) $(LDFLAGS) $(OBJ1) $(OBJ2), $*.exe,,$(LIBC)+$(LIBD);
  331.  
  332. unzip.exe:      unziptmp.exe
  333.         bind unziptmp.exe $(LIBD) $(LIBA) -o unzip.exe
  334.         $(RM) unziptmp.exe
  335.         $(RM) *.obj
  336.         $(RM) *.map
  337. SHAR_EOF
  338. fi
  339.  
  340. -- 
  341. Mike O'Carroll, Microsystems Unit, University of Leeds, LS2 9JT, UK
  342. E-mail: @ukc.ac.uk:mike@ee.leeds.ac.uk
  343. UUCP:   ...!mcsun!ukc!lena!mike or mike@lena.uucp
  344.