home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume31 / zcrypt19 / part01 < prev    next >
Encoding:
Internet Message Format  |  1992-09-02  |  41.9 KB

  1. From: jloup@chorus.fr (Jean-loup Gailly)
  2. Newsgroups: comp.sources.misc
  3. Subject: v31i128: zcrypt19 - Info-zip portable zip/unzip (encryption code), Part01/01
  4. Message-ID: <1992Aug28.130023.10695@aber.ac.uk>
  5. Date: 28 Aug 92 13:00:23 GMT
  6. Approved: aem@aber.ac.uk
  7. X-Md4-Signature: ee93897e7d384163fcb1c9df64a0654a
  8.  
  9. Submitted-by: Jean-loup Gailly <jloup@chorus.fr>
  10. Posting-number: Volume 31, Issue 128
  11. Archive-name: zcrypt19/part01
  12. Environment: UNIX, VMS, MS-DOS, OS/2
  13.  
  14. The files described below contain the encryption code for zip 1.9 and
  15. unzip 5.0.  They constitute only an add-on to the exportable versions
  16. (generally named zip19.zip or zip19.tar.Z, and unzip50.tar.Z)
  17. and cannot be used without the complete zip package.
  18.  
  19. The encryption code is a direct transcription of the algorithm from
  20. Roger Schlafly, described by Phil Katz in the file appnote.txt. This
  21. file is distributed with the PKZIP program (even in the version
  22. without encryption capabilities). Note that the encryption will
  23. probably resist attacks by amateurs if the password is well chosen and
  24. long enough (at least 8 characters) but it will probably not resist
  25. attacks by experts.  Short passwords consisting of lower case letters
  26. only can be recovered in a few hours on any workstation. But for casual
  27. cryptography designed to keep your mother from reading your mail, it's
  28. OK.
  29.  
  30. All bug reports should go to zip-bugs@cs.ucla.edu, and suggestions for
  31. new features can be sent to info-zip@cs.ucla.edu.
  32.  
  33. Jean-loup Gailly
  34. jloup@chorus.fr
  35.  
  36. #! /bin/sh
  37. # This is a shell archive.  Remove anything before this line, then unpack
  38. # it by saving it into a file and typing "sh file".  To overwrite existing
  39. # files, type "sh file -c".  You can also feed this as standard input via
  40. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  41. # will see the following message at the end:
  42. #        "End of shell archive."
  43. # Contents:  Readme Where crypt.c msdos unzpatch vms zipcloak.c
  44. #   zippatch msdos/zip_cr.prj msdos/zipcloak.prj vms/descrip.mms
  45. #   vms/make_gcc.com vms/make_vaxc.com
  46. # Wrapped by jloup@nocturne on Fri Aug 21 16:18:24 1992
  47. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  48. if test -f 'Readme' -a "${1}" != "-c" ; then 
  49.   echo shar: Will not clobber existing file \"'Readme'\"
  50. else
  51. echo shar: Extracting \"'Readme'\" \(4437 characters\)
  52. sed "s/^X//" >'Readme' <<'END_OF_FILE'
  53. XThe files described below contain the encryption code for zip 1.9 and
  54. Xunzip 5.0.  They constitute only an add-on to the exportable versions
  55. X(generally named zip19.zip or zip19.tar.Z, and unzip50.tar.Z)
  56. Xand cannot be used without the complete zip package.
  57. X
  58. XThis encryption code is not copyrighted and is put in the public domain. It
  59. Xwas originally written in Europe and can be freely distributed from
  60. Xany country except the U.S.A. If this code is imported in the U.S.A,
  61. Xit cannot be re-exported from the U.S.A to another country. (This
  62. Xrestriction might seem curious but this is what US law requires.)
  63. XHowever, Phil Katz has said that he got an export license for his
  64. Xalgorithm, so this hassle of separate distribution may cease one day.
  65. X
  66. XLIKE ANYTHING ELSE THAT'S FREE, ZIP AND ITS ASSOCIATED UTILITIES ARE
  67. XPROVIDED AS IS AND COME WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR
  68. XIMPLIED. IN NO EVENT WILL THE AUTHORS BE LIABLE FOR ANY DAMAGES
  69. XRESULTING FROM THE USE OF THIS SOFTWARE.
  70. X
  71. XThe encryption code is a direct transcription of the algorithm from
  72. XRoger Schlafly, described by Phil Katz in the file appnote.txt. This
  73. Xfile is distributed with the PKZIP program (even in the version
  74. Xwithout encryption capabilities). Note that the encryption will
  75. Xprobably resist attacks by amateurs if the password is well chosen and
  76. Xlong enough (at least 8 characters) but it will probably not resist
  77. Xattacks by experts.  Short passwords consisting of lower case letters
  78. Xonly can be recovered in a few hours on any workstation. But for casual
  79. Xcryptography designed to keep your mother from reading your mail, it's
  80. XOK.
  81. X
  82. XIMPORTANT NOTES:
  83. X
  84. X- zip 1.9 is is compatible with pkzip 1.93a, except when two features
  85. X  are used: encryption or zip file created in a pipe or on a non
  86. X  seekable device. pkzip versions of 2.0 will support such files, and
  87. X  unzip 5.0 already supports them. (Thanks to Phil Katz for accepting
  88. X  our suggested minor changes to the zip file format.)
  89. X
  90. X- zip files produced by zip 1.9 must not be *updated* by zip 1.0 or
  91. X  pkzip 1.10 or pkzip 1.93a, if they contain encrypted members, or if
  92. X  they have been produced in a pipe or on a non seekable device. The
  93. X  old versions of zip or pkzip would destroy the zip structure. The
  94. X  old versions can list the contents of the zip file but cannot
  95. X  extract it anyway (because of the new compression algorithm).  If
  96. X  you do not use encryption and use regular disk files, you do not
  97. X  have to care about this problem.
  98. X
  99. X
  100. XContents:
  101. X
  102. Xfile               what it is
  103. X----               ----------
  104. XReadme             This file.
  105. XWhere              where Zip/UnZip can be found
  106. Xcrypt.c            Code for encryption and decryption
  107. Xzippatch           Patch to zip 1.9 makefile
  108. Xunzpatch           Patch to unzip 5.0 Makefile
  109. Xzipcloak.c         Main routine for ZipCloak.
  110. Xmsdos/zipcloak.prj Project file for Borland (Turbo) C++.
  111. Xmsdos/zip_cr.prj   Project file for Borland (Turbo) C++ (zip with encryption)
  112. Xvms/descrip.mms    VMS makefile
  113. Xvms/make_vaxc.com  VMS command file for compilation with Vax C.
  114. Xvms/make_gcc.com   VMS command file for compilation with gcc.
  115. X
  116. XThe makefiles not given here should be taken from the original zip 1.9
  117. Xand unzip 5.0 distributions. They require only minor modifications.
  118. XFollow the instructions given at the beginning of the makefiles. For
  119. Xexample, for the zip 1.9 Unix makefile, remove the comment symbol (#) in:
  120. X
  121. X# MAKE = make CRYPTO="crypt.o" CLOAK="zipcloak" CRFLAG="-DCRYPT"
  122. X
  123. Xto get:
  124. X
  125. XMAKE = make CRYPTO="crypt.o" CLOAK="zipcloak" CRFLAG="-DCRYPT"
  126. X
  127. Xor for the MSDOS makefiles, replace:
  128. X
  129. X#CRYPTO=crypt.obj
  130. X#CLOAK=zipcloak.exe
  131. X#CRFLAG=-DCRYPT
  132. X
  133. Xwith:
  134. X
  135. XCRYPTO=crypt.obj
  136. XCLOAK=zipcloak.exe
  137. XCRFLAG=-DCRYPT
  138. X
  139. XIf you have the 'patch' utility, you can just do: patch < zippatch
  140. XSimilar changes must be made for the unzip Makefile.
  141. X
  142. XIf you are using the Turbo C integrated environment, you must add
  143. XCRYPT to the compilation flags and use the project file zip_cr.prj.
  144. X
  145. XAll of the files are in Unix (LF only) format. On MSDOS systems, you
  146. Xcan use the -a option of unzip to convert the source files to CRLF
  147. Xformat.  This is only necessary if you wish to edit the files -- they
  148. Xwill compile as is with Microsoft C and Turbo/Borland C++ 1.0 or
  149. Xlater.  However, you will have to convert the files (using unzip -a)
  150. Xto the CRLF format to compile with the older Turbo C 1.0 or 2.0.  You
  151. Xshould be able to find unzip the same place you found this (see the file
  152. XWhere for details).
  153. END_OF_FILE
  154. if test 4437 -ne `wc -c <'Readme'`; then
  155.     echo shar: \"'Readme'\" unpacked with wrong size!
  156. fi
  157. # end of 'Readme'
  158. fi
  159. if test -f 'Where' -a "${1}" != "-c" ; then 
  160.   echo shar: Will not clobber existing file \"'Where'\"
  161. else
  162. echo shar: Extracting \"'Where'\" \(4412 characters\)
  163. sed "s/^X//" >'Where' <<'END_OF_FILE'
  164. X__________________________________________________________________________
  165. X
  166. X  This is the Info-ZIP file ``Where,'' last updated on 20 August 1992.
  167. X__________________________________________________________________________
  168. X
  169. X
  170. X  SITE OWNERS:  If you're listed in here but the information is not
  171. X  correct (or if you're a big site but aren't listed at all), please
  172. X  let us know!  E-mail to zip-bugs at the address given in Readme
  173. X  and we'll update this file.
  174. X
  175. XBasic source-archive names for Info-ZIP's portable Zip, UnZip, and related
  176. Xutilities (on some ftp sites, the .zip files may have a .zoo equivalent
  177. Xin zoo 2.10 format):
  178. X
  179. X    zip19.zip    Zip 1.9 (includes zipnote and zipsplit)
  180. X    zip19.tar.Z    ditto, compress'd tar format
  181. X
  182. X    unzip50.zip    UnZip 5.0 (includes zipinfo and funzip)
  183. X    unzip50.tar.Z    ditto, compress'd tar format
  184. X
  185. X    wunz12sr.zip    WizUnZip 1.2 support files for Windows 3.1, UnZip 5.0
  186. X
  187. X    zcrypt19.zip    encryption/decryption support (includes zipcloak)
  188. X
  189. XRelated archives and files:
  190. X
  191. X    UnzpHist.zip    changes history of UnZip, back to 2.0
  192. X
  193. X    zip19x.zip      MSDOS executables and docs for zip, zipnote, zipsplit
  194. X    unzip50.exe     MSDOS executable for unzip
  195. X
  196. X    zip19_16.zip    OS/2 1.x 16-bit executables and docs
  197. X    zip19_32.zip    OS/2 2.x 32-bit executables and docs
  198. X    unz50_16.exe    OS/2 1.x 16-bit executable
  199. X    unz50_32.exe    OS/2 2.x 32-bit executable
  200. X
  201. X    zip19vms.zip    VMS executables and docs for zip, zipnote, zipsplit
  202. X    unz50vms.exe    VMS executable for unzip
  203. X
  204. X    zip_unzip.hqx   Macinstosh executables (zip 1.0 only, 1.9 not ready)
  205. X
  206. X    winunz12.zip    Windows 3.1 executables (zip 1.0 only, 1.9 not ready)
  207. X
  208. X    pkz110eu.exe    MS-DOS PKZIP/PKUNZIP 1.1 (self-extracting archive)
  209. X    pkz193a.exe    MS-DOS PKZIP/PKUNZIP beta 1.93 (self-extracting)
  210. X    pkz102-2.exe    OS/2 PKZIP/PKUNZIP 1.02 (self-extracting)
  211. X
  212. Xftp sites for the US-exportable sources and executables.  Look for
  213. Xthe file names given above in the following directories.  Some sites
  214. Xlike to use slightly different names, such as zip-1.9.tar-z instead
  215. Xof zip19.tar.Z.
  216. X
  217. X    wuarchive.wustl.edu:/packages/compression/...
  218. X    wuarchive.wustl.edu:/mirrors/misc/unix/...
  219. X    wuarchive.wustl.edu:/mirrors/misc/vaxvms/...
  220. X    wuarchive.wustl.edu:/mirrors/msdos/zip/...
  221. X    wuarchive.wustl.edu:/mirrors/msdos/windows3/...
  222. X
  223. X    ftp.uu.net:/pub/zip/...
  224. X
  225. X    ftp-os2.nmsu.edu:/pub/os2/2.0/archivers/...
  226. X    ftp-os2.nmsu.edu:/pub/os2/all/archivers/...
  227. X
  228. X    Zip 1.9 and UnZip 5.0 will also be available at any comp.sources.misc
  229. X    archive site as soon as they are posted.
  230. X
  231. X    wuarchive.wustl.edu:/mirrors/msdos/zip/pkz110eu.exe
  232. X    ux1.cso.uiuc.edu:/pc/exec-pc/pkz193a.exe    [128.174.5.59]
  233. X
  234. Xftp sites for the encryption and decryption sources:
  235. X
  236. X    NOTE:  Non-US users, please do NOT ftp from the US site (US
  237. X    regulations and all that).  Likewise, US users, please do not
  238. X    ftp from the European sites (it's not illegal, but it sure is
  239. X    a waste of expensive bandwidth).
  240. X
  241. X    From the US:
  242. X       wuarchive.wustl.edu:/mirrors3/garbo.uwasa.fi/arcutil/zcrypt19.zip
  243. X
  244. X    Outside the US:
  245. X       garbo.uwasa.fi:/pc/arcutil/zcrypt19.zip
  246. X       ftp.win.tue.nl:/pub/compression/zip/zcrypt19.zip
  247. X       ftp.inria.fr:/system/arch-compr/zcrypt19.zip
  248. X       ftp.informatik.tu-muenchen.de:/pub/utils/archiver/zcrypt19.zip
  249. X         (mail server at ftp-mailer@ftp.informatik.tu-muenchen.de)
  250. X
  251. XTo find other ftp sites:
  252. X
  253. X    The "archie" ftp database utility can be used to find an ftp site
  254. X    near you.  If you don't know how to use it, DON'T ASK US--check the
  255. X    Usenet groups news.newusers.questions or news.answers or some such,
  256. X    or ask your system administrator.
  257. X
  258. XUUCP sites:
  259. X
  260. X    uunet!~/pub/zip/ ...
  261. X
  262. XMail servers:
  263. X
  264. X    If you don't have anonymous FTP capability, you can mail one
  265. X    of the following commands (in the body of an e-mail message) to
  266. X    listserv@vm1.nodak.edu or listserv@vm.ecs.rpi.edu in order to
  267. X    get a copy via e-mail:
  268. X
  269. X    /pdget mail pd:<misc.unix>unzip50.tar-z uuencode
  270. X    /pdget mail pd:<misc.unix>zip19.zip uuencode
  271. X   or:    /pdget mail pd:<misc.unix>zip19.tar-z uuencode
  272. X
  273. X    To get the encryption source by email, send the following commands
  274. X    to ftp-mailer@ftp.informatik.tu-muenchen.de:
  275. X
  276. X    get /pub/utils/archiver/zcrypt19.zip
  277. X        quit
  278. X
  279. X__________________________________________________________________________
  280. X
  281. XAgain, if someone repackages any of the source or executable archives in
  282. XVMS-, Mac- or Atari-specific formats, please let us know (send e-mail to 
  283. Xzip-bugs at the address listed in README).
  284. X__________________________________________________________________________
  285. X
  286. END_OF_FILE
  287. if test 4412 -ne `wc -c <'Where'`; then
  288.     echo shar: \"'Where'\" unpacked with wrong size!
  289. fi
  290. # end of 'Where'
  291. fi
  292. if test -f 'crypt.c' -a "${1}" != "-c" ; then 
  293.   echo shar: Will not clobber existing file \"'crypt.c'\"
  294. else
  295. echo shar: Extracting \"'crypt.c'\" \(9271 characters\)
  296. sed "s/^X//" >'crypt.c' <<'END_OF_FILE'
  297. X/*
  298. X   This code is not copyrighted and is put in the public domain. It
  299. X   was originally written in Europe and can be freely distributed from
  300. X   any country except the U.S.A. If this code is imported in the U.S.A,
  301. X   it cannot be re-exported from the U.S.A to another country. (This
  302. X   restriction might seem curious but this is what US law requires.)
  303. X */
  304. X
  305. X/* This encryption code is a direct transcription of the algorithm from
  306. X   Roger Schlafly, described by Phil Katz in the file appnote.txt. This
  307. X   file is distributed with the PKZIP program (even in the version without
  308. X   encryption capabilities).
  309. X */
  310. X
  311. X#include "zip.h"
  312. X
  313. X#ifndef SKIP_TIME_H   /* time.h already included in UnZip version */
  314. X#  include <time.h>
  315. X#endif /* !SKIP_TIME_H */
  316. X
  317. X#if ((defined(MSDOS) || defined(__MSDOS__) || defined(WIN32)) && !defined(__GO32__))
  318. X#  include <process.h>
  319. X#else
  320. X   int  getpid OF((void));
  321. X#endif
  322. X
  323. X#ifndef __GNUC__
  324. Xvoid srand  OF((unsigned int));
  325. X#endif
  326. Xint  rand   OF((void));
  327. X
  328. Xint  decrypt_byte OF((void));
  329. Xvoid update_keys OF((int c));
  330. Xvoid init_keys OF((char *passwd));
  331. Xint  zencode OF((int c));
  332. Xint  zdecode OF((int c));
  333. X
  334. Xlocal ulg keys[3]; /* keys defining the pseudo random sequence */
  335. X
  336. X/***********************************************************************
  337. X * Return the next byte in the pseudo-random sequence
  338. X */
  339. Xint decrypt_byte()
  340. X{
  341. X   ush temp;
  342. X
  343. X   temp = (ush)keys[2] | 2;
  344. X   return (int)(((ush)(temp * (temp ^ 1)) >> 8) & 0xff);
  345. X}
  346. X
  347. X/***********************************************************************
  348. X * Update the encryption keys with the next byte of plain text
  349. X */
  350. Xvoid update_keys(c)
  351. X    int c;                  /* byte of plain text */
  352. X{
  353. X    keys[0] = crc32(keys[0], c);
  354. X    keys[1] += keys[0] & 0xff;
  355. X    keys[1] = keys[1] * 134775813L + 1;
  356. X    keys[2] = crc32(keys[2], (int)(keys[1] >> 24));
  357. X}
  358. X
  359. X
  360. X/***********************************************************************
  361. X * Initialize the encryption keys and the random header according to
  362. X * the given password.
  363. X */
  364. Xvoid init_keys(passwd)
  365. X    char *passwd;             /* password string to modify keys with */
  366. X{
  367. X    keys[0] = 305419896L;
  368. X    keys[1] = 591751049L;
  369. X    keys[2] = 878082192L;
  370. X    while (*passwd != '\0') {
  371. X        update_keys((int)*passwd);
  372. X        passwd++;
  373. X    }
  374. X}
  375. X
  376. X/***********************************************************************
  377. X * Return the encoded value of the byte c of the plain text
  378. X */
  379. Xint zencode(c)
  380. X    int c;
  381. X{
  382. X    int temp = decrypt_byte();
  383. X
  384. X    update_keys(c);
  385. X    return temp ^ c;
  386. X}
  387. X
  388. X/***********************************************************************
  389. X * Return the decoded value of the byte c of the cypher text
  390. X */
  391. Xint zdecode(c)
  392. X    int c;
  393. X{
  394. X    int temp = c ^ decrypt_byte();
  395. X
  396. X    update_keys(temp);
  397. X    return temp;
  398. X}
  399. X
  400. X
  401. X/***********************************************************************
  402. X * Write encryption header to file zfile using the password passwd
  403. X * and the cyclic redundancy check crc. Note: we use the rand() library
  404. X * function, which is quite bad on many systems. But since we only
  405. X * need 10 values, this is not important.
  406. X */
  407. Xvoid crypthead(passwd, crc, zfile)
  408. X    char *passwd;             /* password string */
  409. X    ulg crc;                  /* crc of file being encrypted */
  410. X    FILE *zfile;              /* where to write header to */
  411. X{
  412. X    int n = 10;               /* size of random header */
  413. X
  414. X    init_keys(passwd);
  415. X
  416. X    /* Encrypt random header (last two bytes is high word of crc) */
  417. X
  418. X    srand((unsigned int)time(NULL) ^ getpid()); /* initialize generator */
  419. X    while (n--) {
  420. X        putc(zencode(rand() >> 7), zfile);
  421. X    }
  422. X    putc(zencode((int)(crc >> 16) & 0xff), zfile);
  423. X    putc(zencode((int)(crc >> 24)), zfile);
  424. X}
  425. X
  426. X
  427. X#ifdef UTIL
  428. X
  429. X/***********************************************************************
  430. X * Encrypt the zip entry described by z from file source to file dest
  431. X * using the password passwd.  Return an error code in the ZE_ class.
  432. X */
  433. Xint zipcloak(z, source, dest, passwd)
  434. X    struct zlist far *z;    /* zip entry to encrypt */
  435. X    FILE *source, *dest;    /* source and destination files */
  436. X    char *passwd;           /* password string */
  437. X{
  438. X    int c;                  /* input byte */
  439. X    int res;                /* result code */
  440. X    ulg n;                  /* holds offset and counts size */
  441. X    ush flag;               /* previous flags */
  442. X
  443. X    /* Set encrypted bit, clear extended local header bit and write local
  444. X       header to output file */
  445. X    if ((n = ftell(dest)) == -1L) return ZE_TEMP;
  446. X    z->off = n;
  447. X    flag = z->flg;
  448. X    z->flg |= 1,  z->flg &= ~8;
  449. X    z->lflg |= 1, z->lflg &= ~8;
  450. X    z->siz += 12;
  451. X    if ((res = putlocal(z, dest)) != ZE_OK) return res;
  452. X
  453. X    /* Initialize keys with password and write random header */
  454. X    crypthead(passwd, z->crc, dest);
  455. X
  456. X    /* Skip local header in input file */
  457. X    if (fseek(source, (long)(4 + LOCHEAD + (ulg)z->nam + (ulg)z->ext),
  458. X              SEEK_CUR)) {
  459. X        return ferror(source) ? ZE_READ : ZE_EOF;
  460. X    }
  461. X
  462. X    /* Encrypt data */
  463. X    for (n = z->siz - 12; n; n--) {
  464. X        if ((c = getc(source)) == EOF) {
  465. X            return ferror(source) ? ZE_READ : ZE_EOF;
  466. X        }
  467. X        putc(zencode(c), dest);
  468. X    }
  469. X    /* Skip extended local header in input file if there is one */
  470. X    if ((flag & 8) != 0 && fseek(source, 16L, SEEK_CUR)) {
  471. X        return ferror(source) ? ZE_READ : ZE_EOF;
  472. X    }
  473. X    if (fflush(dest) == EOF) return ZE_TEMP;
  474. X    return ZE_OK;
  475. X}
  476. X
  477. X/***********************************************************************
  478. X * Decrypt the zip entry described by z from file source to file dest
  479. X * using the password passwd.  Return an error code in the ZE_ class.
  480. X */
  481. Xint zipbare(z, source, dest, passwd)
  482. X    struct zlist far *z;  /* zip entry to encrypt */
  483. X    FILE *source, *dest;  /* source and destination files */
  484. X    char *passwd;         /* password string */
  485. X{
  486. X    int c0, c1;           /* last two input bytes */
  487. X    ulg offset;           /* used for file offsets */
  488. X    ulg size;             /* size of input data */
  489. X    int r;                /* size of encryption header */
  490. X    int res;              /* return code */
  491. X    ush flag;             /* previous flags */
  492. X
  493. X    /* Save position and skip local header in input file */
  494. X    if ((offset = ftell(source)) == -1L ||
  495. X        fseek(source, (long)(4 + LOCHEAD + (ulg)z->nam + (ulg)z->ext),
  496. X              SEEK_CUR)) {
  497. X        return ferror(source) ? ZE_READ : ZE_EOF;
  498. X    }
  499. X    /* Initialize keys with password */
  500. X    init_keys(passwd);
  501. X
  502. X    /* Decrypt encryption header, save last two bytes */
  503. X    c1 = 0;
  504. X    for (r = 12; r; r--) {
  505. X        c0 = c1;
  506. X        if ((c1 = zdecode(getc(source))) == EOF) {
  507. X            return ferror(source) ? ZE_READ : ZE_EOF;
  508. X        }
  509. X    }
  510. X
  511. X    /* If last two bytes of header don't match crc (or file time in the
  512. X       case of an extended local header), back up and just copy */
  513. X    if ((ush)(c0 | (c1<<8)) !=
  514. X        (z->flg & 8 ? (ush) z->tim & 0xffff : (ush)(z->crc >> 16))) {
  515. X        if (fseek(source, offset, SEEK_SET)) {
  516. X            return ferror(source) ? ZE_READ : ZE_EOF;
  517. X        }
  518. X        if ((res = zipcopy(z, source, dest)) != ZE_OK) return res;
  519. X        return ZE_MISS;
  520. X    }
  521. X
  522. X    /* Clear encrypted bit and local header bit, and write local header to
  523. X       output file */
  524. X    if ((offset = ftell(dest)) == -1L) return ZE_TEMP;
  525. X    z->off = offset;
  526. X    flag = z->flg;
  527. X    z->flg &= ~9;
  528. X    z->lflg &= ~9;
  529. X    z->siz -= 12;
  530. X    if ((res = putlocal(z, dest)) != ZE_OK) return res;
  531. X
  532. X    /* Decrypt data */
  533. X    for (size = z->siz; size; size--) {
  534. X        if ((c1 = getc(source)) == EOF) {
  535. X            return ferror(source) ? ZE_READ : ZE_EOF;
  536. X        }
  537. X        putc(zdecode(c1), dest);
  538. X    }
  539. X    /* Skip extended local header in input file if there is one */
  540. X    if ((flag & 8) != 0 && fseek(source, 16L, SEEK_CUR)) {
  541. X        return ferror(source) ? ZE_READ : ZE_EOF;
  542. X    }
  543. X    if (fflush(dest) == EOF) return ZE_TEMP;
  544. X
  545. X    return ZE_OK;
  546. X}
  547. X
  548. X
  549. X#else /* !UTIL */
  550. X
  551. X/***********************************************************************
  552. X * If requested, encrypt the data in buf, and in any case call fwrite()
  553. X * with the arguments to zfwrite().  Return what fwrite() returns.
  554. X */
  555. Xunsigned zfwrite(buf, item_size, nb, f)
  556. X    voidp *buf;                /* data buffer */
  557. X    extent item_size;          /* size of each item in bytes */
  558. X    extent nb;                 /* number of items */
  559. X    FILE *f;                   /* file to write to */
  560. X{
  561. X    if (key != (char *)NULL) { /* key is the global password pointer */
  562. X        ulg size;              /* buffer size */
  563. X        char *p = (char*)buf;  /* steps through buffer */
  564. X
  565. X        /* Encrypt data in buffer */
  566. X        for (size = item_size*(ulg)nb; size != 0; p++, size--) {
  567. X            *p = (char)zencode(*p);
  568. X        }
  569. X    }
  570. X    /* Write the buffer out */
  571. X    return fwrite(buf, item_size, nb, f);
  572. X}
  573. X
  574. X/***********************************************************************
  575. X * Encrypt the byte c and then do a putc().  The macro zputc defined in
  576. X * crypt.h checks keys and calls zfputc if needed.  Return what putc()
  577. X * returns. This function is only provided for compatibility with zip 1.0.
  578. X */
  579. Xint zfputc(c, f)
  580. X    int c;                  /* character to write */
  581. X    FILE *f;                /* file to write it to */
  582. X{
  583. X    return putc(zencode(c), f);
  584. X}
  585. X
  586. X#endif /* ?UTIL */
  587. END_OF_FILE
  588. if test 9271 -ne `wc -c <'crypt.c'`; then
  589.     echo shar: \"'crypt.c'\" unpacked with wrong size!
  590. fi
  591. # end of 'crypt.c'
  592. fi
  593. if test ! -d 'msdos' ; then
  594.     echo shar: Creating directory \"'msdos'\"
  595.     mkdir 'msdos'
  596. fi
  597. if test -f 'unzpatch' -a "${1}" != "-c" ; then 
  598.   echo shar: Will not clobber existing file \"'unzpatch'\"
  599. else
  600. echo shar: Extracting \"'unzpatch'\" \(540 characters\)
  601. sed "s/^X//" >'unzpatch' <<'END_OF_FILE'
  602. X*** old/Makefile    Thu Aug 20 11:09:22 1992
  603. X--- new/Makefile    Thu Aug 20 11:09:39 1992
  604. X***************
  605. X*** 60,67 ****
  606. X  CRYPTF =
  607. X  CRYPTO =
  608. X  # Uncomment next two lines for decryption version:
  609. X! #CRYPTF = -DCRYPT
  610. X! #CRYPTO = crypt$O
  611. X  
  612. X  # UnZip flags
  613. X  CC = cc#    try using "gcc" target rather than changing this (if you do,
  614. X--- 60,67 ----
  615. X  CRYPTF =
  616. X  CRYPTO =
  617. X  # Uncomment next two lines for decryption version:
  618. X! CRYPTF = -DCRYPT
  619. X! CRYPTO = crypt$O
  620. X  
  621. X  # UnZip flags
  622. X  CC = cc#    try using "gcc" target rather than changing this (if you do,
  623. END_OF_FILE
  624. if test 540 -ne `wc -c <'unzpatch'`; then
  625.     echo shar: \"'unzpatch'\" unpacked with wrong size!
  626. fi
  627. # end of 'unzpatch'
  628. fi
  629. if test ! -d 'vms' ; then
  630.     echo shar: Creating directory \"'vms'\"
  631.     mkdir 'vms'
  632. fi
  633. if test -f 'zipcloak.c' -a "${1}" != "-c" ; then 
  634.   echo shar: Will not clobber existing file \"'zipcloak.c'\"
  635. else
  636. echo shar: Extracting \"'zipcloak.c'\" \(9746 characters\)
  637. sed "s/^X//" >'zipcloak.c' <<'END_OF_FILE'
  638. X/*
  639. X   This code is not copyrighted and is put in the public domain. It
  640. X   was originally written in Europe and can be freely distributed from
  641. X   any country except the U.S.A. If this code is imported in the U.S.A,
  642. X   it cannot be re-exported from the U.S.A to another country. (This
  643. X   restriction might seem curious but this is what US law requires.)
  644. X */
  645. X
  646. X#define UTIL
  647. X#include "revision.h"
  648. X#include "zip.h"
  649. X#include <signal.h>
  650. X
  651. X#define PWLEN 80        /* Input buffer size for reading encryption key */
  652. X
  653. X#ifdef VMS
  654. X#  define echon() echo(1)
  655. X#endif
  656. X
  657. X
  658. X/* Temporary zip file name and file pointer */
  659. Xlocal char *tempzip;
  660. Xlocal FILE *tempzf;
  661. X
  662. X
  663. X/* Local functions */
  664. Xvoid err OF((int code, char *msg));
  665. Xlocal void handler OF((int sig));
  666. Xlocal void license OF((void));
  667. Xlocal void help OF((void));
  668. Xvoid main OF((int argc, char **argv));
  669. X
  670. X
  671. X
  672. X/***********************************************************************
  673. X * Issue a message for the error, clean up files and memory, and exit.
  674. X */
  675. Xvoid err(code, msg)
  676. X    int code;               /* error code from the ZE_ class */
  677. X    char *msg;              /* message about how it happened */
  678. X{
  679. X    if (PERR(code)) perror("zipcloak error");
  680. X    fprintf(stderr, "zipcloak error: %s (%s)\n", errors[code-1], msg);
  681. X    if (tempzf != NULL) fclose(tempzf);
  682. X    if (tempzip != NULL) {
  683. X        destroy(tempzip);
  684. X        free((voidp *)tempzip);
  685. X    }
  686. X    if (zipfile != NULL) free((voidp *)zipfile);
  687. X#ifdef VMS
  688. X    exit(0);
  689. X#else
  690. X    exit(code);
  691. X#endif
  692. X}
  693. X
  694. X
  695. X/***********************************************************************
  696. X * Upon getting a user interrupt, turn echo back on for tty and abort
  697. X * cleanly using err().
  698. X */
  699. Xlocal void handler(sig)
  700. X    int sig;                  /* signal number (ignored) */
  701. X{
  702. X#ifndef MSDOS
  703. X    echon();
  704. X    putc('\n', stderr);
  705. X#endif
  706. X    err(ZE_ABORT +sig-sig, "aborting");
  707. X    /* dummy usage of sig to avoid compiler warnings */
  708. X}
  709. X
  710. X
  711. X/***********************************************************************
  712. X * Print a warning message to stderr and return.
  713. X */
  714. Xvoid warn(msg1, msg2)
  715. X    char *msg1, *msg2;        /* message strings juxtaposed in output */
  716. X{
  717. X    fprintf(stderr, "zipcloak warning: %s%s\n", msg1, msg2);
  718. X}
  719. X
  720. X
  721. Xstatic char *public[] = {
  722. X"The encryption code of this program is not copyrighted and is put in the",
  723. X"public domain. It was originally written in Europe and can be freely",
  724. X"distributed from any country except the U.S.A. If this program is imported",
  725. X"in the U.S.A, it cannot be re-exported from the U.S.A to another country.",
  726. X"The copyright notice of the zip program applies to the rest of the code."
  727. X};
  728. X
  729. X/***********************************************************************
  730. X * Print license information to stdout.
  731. X */
  732. Xlocal void license()
  733. X{
  734. X    extent i;             /* counter for copyright array */
  735. X
  736. X    for (i = 0; i < sizeof(public)/sizeof(char *); i++) {
  737. X        puts(public[i]);
  738. X    }
  739. X    for (i = 0; i < sizeof(disclaimer)/sizeof(char *); i++) {
  740. X        puts(disclaimer[i]);
  741. X    }
  742. X}
  743. X
  744. X
  745. Xstatic char *help_info[] = {
  746. X"",
  747. X"ZipCloak %d.%d (%s)",
  748. X"Usage:  zipcloak [-d] [-b path] zipfile",
  749. X"  the default action is to encrypt all unencrypted entries in the zip file",
  750. X"  -d   decrypt--decrypt encrypted entries (copy if given wrong password)",
  751. X"  -b   use \"path\" for the temporary zip file",
  752. X"  -h   show this help               -l   show software license"
  753. X  };
  754. X
  755. X/***********************************************************************
  756. X * Print help (along with license info) to stdout.
  757. X */
  758. Xlocal void help()
  759. X{
  760. X    extent i;             /* counter for help array */
  761. X
  762. X    for (i = 0; i < sizeof(public)/sizeof(char *); i++) {
  763. X        puts(public[i]);
  764. X    }
  765. X    for (i = 0; i < sizeof(help_info)/sizeof(char *); i++) {
  766. X        printf(help_info[i], REVISION / 10, REVISION % 10, REVDATE);
  767. X        putchar('\n');
  768. X    }
  769. X}
  770. X
  771. X/***********************************************************************
  772. X * Encrypt or decrypt all of the entries in a zip file.  See the command
  773. X * help in help() above.
  774. X */
  775. X
  776. Xvoid main(argc, argv)
  777. X    int argc;             /* number of tokens in command line */
  778. X    char **argv;          /* command line tokens */
  779. X{
  780. X    int attr;             /* attributes of zip file */
  781. X    ulg start_offset;     /* start of central directory */
  782. X    int decrypt;          /* decryption flag */
  783. X    int temp_path;        /* 1 if next argument is path for temp files */
  784. X    char passwd[PWLEN+1]; /* password for encryption or decryption */
  785. X    char *q;              /* steps through option arguments */
  786. X    int r;                /* arg counter */
  787. X    int res;              /* result code */
  788. X    ulg length;           /* length of central directory */
  789. X    FILE *inzip, *outzip; /* input and output zip files */
  790. X    struct zlist far *z;  /* steps through zfiles linked list */
  791. X
  792. X
  793. X    /* If no args, show help */
  794. X    if (argc == 1) {
  795. X        help();
  796. X        exit(0);
  797. X    }
  798. X
  799. X    init_upper();           /* build case map table */
  800. X
  801. X    /* Go through args */
  802. X    zipfile = tempzip = NULL;
  803. X    tempzf = NULL;
  804. X    signal(SIGINT, handler);
  805. X    signal(SIGTERM, handler);
  806. X    temp_path = decrypt = 0;
  807. X    for (r = 1; r < argc; r++) {
  808. X        if (*argv[r] == '-') {
  809. X            if (!argv[r][1]) err(ZE_PARMS, "zip file cannot be stdin");
  810. X            for (q = argv[r]+1; *q; q++) {
  811. X                switch(*q) {
  812. X                case 'b':   /* Specify path for temporary file */
  813. X                    if (temp_path) {
  814. X                        err(ZE_PARMS, "use -b before zip file name");
  815. X                    }
  816. X                    temp_path = 1;          /* Next non-option is path */
  817. X                    break;
  818. X                case 'd':
  819. X                    decrypt = 1;  break;
  820. X                case 'h':   /* Show help */
  821. X                    help();
  822. X                    exit(0);
  823. X                case 'l': case 'L':  /* Show copyright and disclaimer */
  824. X                    license();
  825. X                    exit(0);
  826. X                default:
  827. X                    err(ZE_PARMS, "unknown option");
  828. X                } /* switch */
  829. X            } /* for */
  830. X
  831. X        } else if (temp_path == 0) {
  832. X            if (zipfile != NULL) {
  833. X                err(ZE_PARMS, "can only specify one zip file");
  834. X
  835. X            } else if ((zipfile = ziptyp(argv[r])) == NULL) {
  836. X                err(ZE_MEM, "was processing arguments");
  837. X            }
  838. X        } else {
  839. X            tempath = argv[r];
  840. X            temp_path = 0;
  841. X        } /* if */
  842. X    } /* for */
  843. X
  844. X    if (zipfile == NULL) err(ZE_PARMS, "need to specify zip file");
  845. X
  846. X    /* Read zip file */
  847. X    if ((res = readzipfile()) != ZE_OK) err(res, zipfile);
  848. X    if (zfiles == NULL) err(ZE_NAME, zipfile);
  849. X
  850. X    /* Check for something to do */
  851. X    for (z = zfiles; z != NULL; z = z->nxt) {
  852. X        if (decrypt ? z->flg & 1 : !(z->flg & 1)) break;
  853. X    }
  854. X    if (z == NULL) {
  855. X        err(ZE_NONE, decrypt ? "no encrypted files"
  856. X                       : "all files encrypted already");
  857. X    }
  858. X
  859. X    /* Before we get carried away, make sure zip file is writeable */
  860. X    if ((inzip = fopen(zipfile, "a")) == NULL) err(ZE_CREAT, zipfile);
  861. X    fclose(inzip);
  862. X    attr = getfileattr(zipfile);
  863. X
  864. X    /* Open output zip file for writing */
  865. X    if ((tempzf = outzip = fopen(tempzip = tempname(zipfile), FOPW)) == NULL) {
  866. X        err(ZE_TEMP, tempzip);
  867. X    }
  868. X
  869. X    /* Get password */
  870. X    if (getp("Enter password: ", passwd, PWLEN+1) == NULL) {
  871. X        err(ZE_PARMS, "stderr is not a tty (you may never see this message!)");
  872. X    }
  873. X
  874. X    /* Open input zip file again, copy preamble if any */
  875. X    if ((inzip = fopen(zipfile, FOPR)) == NULL) err(ZE_NAME, zipfile);
  876. X
  877. X    if (zipbeg && (res = fcopy(inzip, outzip, zipbeg)) != ZE_OK) {
  878. X        err(res, res == ZE_TEMP ? tempzip : zipfile);
  879. X    }
  880. X    /* Go through local entries, copying, encrypting, or decrypting */
  881. X    for (z = zfiles; z != NULL; z = z->nxt) {
  882. X        if (decrypt && (z->flg & 1)) {
  883. X            printf("decrypting %s", z->zname);
  884. X            fflush(stdout);
  885. X            if ((res = zipbare(z, inzip, outzip, passwd)) != ZE_OK) {
  886. X                if (res != ZE_MISS) err(res, "was decrypting an entry");
  887. X                printf(" (wrong password--just copying)");
  888. X            }
  889. X            putchar('\n');
  890. X
  891. X        } else if ((!decrypt) && !(z->flg & 1)) {
  892. X            printf("encrypting %s\n", z->zname);
  893. X            fflush(stdout);
  894. X            if ((res = zipcloak(z, inzip, outzip, passwd)) != ZE_OK) {
  895. X                err(res, "was encrypting an entry");
  896. X            }
  897. X        } else {
  898. X            printf("copying %s\n", z->zname);
  899. X            fflush(stdout);
  900. X            if ((res = zipcopy(z, inzip, outzip)) != ZE_OK) {
  901. X                err(res, "was copying an entry");
  902. X            }
  903. X        } /* if */
  904. X    } /* for */
  905. X    fclose(inzip);
  906. X
  907. X    /* Write central directory and end of central directory */
  908. X
  909. X    /* get start of central */
  910. X    if ((start_offset = ftell(outzip)) == -1L) err(ZE_TEMP, tempzip);
  911. X
  912. X    for (z = zfiles; z != NULL; z = z->nxt) {
  913. X        if ((res = putcentral(z, outzip)) != ZE_OK) err(res, tempzip);
  914. X    }
  915. X
  916. X    /* get end of central */
  917. X    if ((length = ftell(outzip)) == -1L) err(ZE_TEMP, tempzip);
  918. X
  919. X    length -= start_offset;               /* compute length of central */
  920. X    if ((res = putend((int)zcount, length, start_offset, zcomlen,
  921. X                       zcomment, outzip)) != ZE_OK) {
  922. X        err(res, tempzip);
  923. X    }
  924. X    tempzf = NULL;
  925. X    if (fclose(outzip)) err(ZE_TEMP, tempzip);
  926. X    if ((res = replace(zipfile, tempzip)) != ZE_OK) {
  927. X        warn("new zip file left as: ", tempzip);
  928. X        free((voidp *)tempzip);
  929. X        tempzip = NULL;
  930. X        err(res, "was replacing the original zip file");
  931. X    }
  932. X    free((voidp *)tempzip);
  933. X    tempzip = NULL;
  934. X    setfileattr(zipfile, attr);
  935. X    free((voidp *)zipfile);
  936. X    zipfile = NULL;
  937. X
  938. X    /* Done! */
  939. X    exit(0);
  940. X}
  941. END_OF_FILE
  942. if test 9746 -ne `wc -c <'zipcloak.c'`; then
  943.     echo shar: \"'zipcloak.c'\" unpacked with wrong size!
  944. fi
  945. # end of 'zipcloak.c'
  946. fi
  947. if test -f 'zippatch' -a "${1}" != "-c" ; then 
  948.   echo shar: Will not clobber existing file \"'zippatch'\"
  949. else
  950. echo shar: Extracting \"'zippatch'\" \(812 characters\)
  951. sed "s/^X//" >'zippatch' <<'END_OF_FILE'
  952. X*** old/makefile    Wed Aug 19 18:17:38 1992
  953. X--- new/makefile    Thu Aug 20 19:27:20 1992
  954. X***************
  955. X*** 14,23 ****
  956. X  CRYPTO =
  957. X  CLOAK =
  958. X  CRFLAG =
  959. X! MAKE = make
  960. X  #  **********************************************************************
  961. X  #  *** For encryption version, remove the # at the front of next line ***
  962. X! # MAKE = make CRYPTO="crypt.o" CLOAK="zipcloak" CRFLAG="-DCRYPT"
  963. X  
  964. X  # (to use the Gnu compiler, change cc to gcc in CC and BIND)
  965. X  CC = cc
  966. X--- 14,23 ----
  967. X  CRYPTO =
  968. X  CLOAK =
  969. X  CRFLAG =
  970. X! # MAKE = make
  971. X  #  **********************************************************************
  972. X  #  *** For encryption version, remove the # at the front of next line ***
  973. X! MAKE = make CRYPTO="crypt.o" CLOAK="zipcloak" CRFLAG="-DCRYPT"
  974. X  
  975. X  # (to use the Gnu compiler, change cc to gcc in CC and BIND)
  976. X  CC = cc
  977. END_OF_FILE
  978. if test 812 -ne `wc -c <'zippatch'`; then
  979.     echo shar: \"'zippatch'\" unpacked with wrong size!
  980. fi
  981. # end of 'zippatch'
  982. fi
  983. if test -f 'msdos/zip_cr.prj' -a "${1}" != "-c" ; then 
  984.   echo shar: Will not clobber existing file \"'msdos/zip_cr.prj'\"
  985. else
  986. echo shar: Extracting \"'msdos/zip_cr.prj'\" \(433 characters\)
  987. sed "s/^X//" >'msdos/zip_cr.prj' <<'END_OF_FILE'
  988. Xzip.c        (zip.h ziperr.h tailor.h revision.h)
  989. Xzipfile.c    (zip.h ziperr.h tailor.h)
  990. Xzipup.c      (zip.h ziperr.h tailor.h revision.h)
  991. Xfileio.c     (zip.h ziperr.h tailor.h)
  992. Xutil.c       (zip.h ziperr.h tailor.h)
  993. Xglobals.c    (zip.h ziperr.h tailor.h)
  994. Xdeflate.c    (zip.h ziperr.h tailor.h)
  995. Xbits.c       (zip.h ziperr.h tailor.h)
  996. Xtrees.c      (zip.h ziperr.h tailor.h)
  997. Xcrypt.c      (zip.h ziperr.h tailor.h)
  998. Xmatch.obj
  999. END_OF_FILE
  1000. if test 433 -ne `wc -c <'msdos/zip_cr.prj'`; then
  1001.     echo shar: \"'msdos/zip_cr.prj'\" unpacked with wrong size!
  1002. fi
  1003. # end of 'msdos/zip_cr.prj'
  1004. fi
  1005. if test -f 'msdos/zipcloak.prj' -a "${1}" != "-c" ; then 
  1006.   echo shar: Will not clobber existing file \"'msdos/zipcloak.prj'\"
  1007. else
  1008. echo shar: Extracting \"'msdos/zipcloak.prj'\" \(266 characters\)
  1009. sed "s/^X//" >'msdos/zipcloak.prj' <<'END_OF_FILE'
  1010. Xzipcloak.c    (zip.h ziperr.h tailor.h revision.h)
  1011. Xzipfile.c    (zip.h ziperr.h tailor.h)
  1012. Xzipup.c        (zip.h ziperr.h tailor.h)
  1013. Xfileio.c    (zip.h ziperr.h tailor.h)
  1014. Xcrypt.c     (zip.h ziperr.h tailor.h)
  1015. Xutil.c        (zip.h ziperr.h tailor.h)
  1016. Xglobals.c    (zip.h ziperr.h tailor.h)
  1017. END_OF_FILE
  1018. if test 266 -ne `wc -c <'msdos/zipcloak.prj'`; then
  1019.     echo shar: \"'msdos/zipcloak.prj'\" unpacked with wrong size!
  1020. fi
  1021. # end of 'msdos/zipcloak.prj'
  1022. fi
  1023. if test -f 'vms/descrip.mms' -a "${1}" != "-c" ; then 
  1024.   echo shar: Will not clobber existing file \"'vms/descrip.mms'\"
  1025. else
  1026. echo shar: Extracting \"'vms/descrip.mms'\" \(1605 characters\)
  1027. sed "s/^X//" >'vms/descrip.mms' <<'END_OF_FILE'
  1028. X# VMS Makefile for Zip, ZipNote, ZipCloak and ZipSplit
  1029. X
  1030. XCDEB = !    /DEBUG/NOOPT
  1031. XLDEB = !    /DEBUG
  1032. X
  1033. XOBJZ = zip.obj,zipfile.obj,zipup.obj,fileio.obj,util.obj,globals.obj,-
  1034. X    crypt.obj,vms.obj,VMSmunch.obj
  1035. XOBJI = deflate.obj,trees.obj,bits.obj
  1036. XOBJN = zipnote.obj,zipfile.obj_,zipup.obj_,fileio.obj_,globals.obj,-
  1037. X    util_.obj_,vmsmunch.obj
  1038. XOBJS = zipsplit.obj,zipfile.obj_,zipup.obj_,fileio.obj_,globals.obj,-
  1039. X    util_.obj_,vmsmunch.obj
  1040. XOBJC = zipcloak.obj,zipfile.obj_,zipup.obj_,fileio.OBJ_,util_.obj,-
  1041. X        crypt.obj_,globals.obj,vmsmunch.obj
  1042. X
  1043. XCC    =    cc $(CDEB)
  1044. X
  1045. XLINK    =    link $(LDEB)
  1046. X
  1047. X.suffixes
  1048. X.suffixes : .obj .obj_ .c .exe
  1049. X
  1050. X.c.obj_ :
  1051. X    $(CC)/define=("CRYPT","UTIL")/OBJ=$(mms$target) $(mms$source)
  1052. X.c.obj :
  1053. X    $(cc)/define="CRYPT"/OBJ=$(mms$target) $(mms$source)
  1054. X.obj.exe :
  1055. X    $(LINK)/exe=$(mms$target) vaxclib.opt/opt,$(mms$source)
  1056. X
  1057. X# rules for zip, zipnote, zipsplit, and zip.doc.
  1058. X
  1059. Xdefautl :    zip.exe,zipnote.exe,zipsplit.exe,zipcloak.exe
  1060. X @ !
  1061. X
  1062. Xzipfile.obj_ :    zipfile.c
  1063. Xzipup.obj_   :    zipup.c
  1064. Xfileio.obj_  :    fileio.c
  1065. Xutil.obj_    :    util.c
  1066. Xcrypt.obj_   :    crypt.c
  1067. X
  1068. X$(OBJZ) : zip.h,ziperr.h,tailor.h
  1069. X$(OBJI) : zip.h,ziperr.h,tailor.h
  1070. X$(OBJN) : zip.h,ziperr.h,tailor.h
  1071. X$(OBJS) : zip.h,ziperr.h,tailor.h
  1072. X
  1073. Xzip.obj,zipcloak.obj,zipup.obj,zipnote.obj,zipsplit.obj : revision.h
  1074. X
  1075. Xzipfile.obj, fileio.obj, VMSmunch.obj : VMSmunch.h
  1076. X
  1077. Xzip.exe : $(OBJZ),$(OBJI)
  1078. X    $(LINK)/exe=zip.exe vaxclib.opt/opt,$(OBJZ),$(OBJI)
  1079. X
  1080. Xzipnote.exe : $(OBJN)
  1081. X    $(LINK)/exe=zipnote.exe vaxclib.opt/opt,$(OBJN)
  1082. X
  1083. Xzipsplit.exe : $(OBJS)
  1084. X    $(LINK)/exe=zipsplit.exe vaxclib.opt/opt,$(OBJS)
  1085. X
  1086. Xzipcloak.exe : $(OBJC)
  1087. X    $(LINK)/exe=zipcloak.exe vaxclib.opt/opt,$(OBJC)
  1088. END_OF_FILE
  1089. if test 1605 -ne `wc -c <'vms/descrip.mms'`; then
  1090.     echo shar: \"'vms/descrip.mms'\" unpacked with wrong size!
  1091. fi
  1092. # end of 'vms/descrip.mms'
  1093. fi
  1094. if test -f 'vms/make_gcc.com' -a "${1}" != "-c" ; then 
  1095.   echo shar: Will not clobber existing file \"'vms/make_gcc.com'\"
  1096. else
  1097. echo shar: Extracting \"'vms/make_gcc.com'\" \(2175 characters\)
  1098. sed "s/^X//" >'vms/make_gcc.com' <<'END_OF_FILE'
  1099. X$ !
  1100. X$ !     "Makefile" for VMS versions of Zip, ZipCloak, ZipNote,
  1101. X$ !      and ZipSplit (stolen from Unzip)
  1102. X$ !
  1103. X$ !      IMPORTANT NOTE: do not forget to set the symbols as said below
  1104. X$ !                      in the Symbols section.
  1105. X$ !
  1106. X$ set verify    ! like "echo on", eh?
  1107. X$ !
  1108. X$ !------------------------------- Zip section --------------------------------
  1109. X$ !
  1110. X$ gcc /def=CRYPT zip
  1111. X$ gcc /def=CRYPT crypt
  1112. X$ gcc /def=CRYPT zipfile
  1113. X$ gcc /def=CRYPT zipup
  1114. X$ gcc /def=CRYPT fileio
  1115. X$ gcc /def=CRYPT util
  1116. X$ gcc /def=CRYPT deflate
  1117. X$ gcc /def=CRYPT globals
  1118. X$ gcc /def=CRYPT trees
  1119. X$ gcc /def=CRYPT bits
  1120. X$ gcc /def=CRYPT vms
  1121. X$ gcc /def=CRYPT VMSmunch
  1122. X$ ! add /def=CRYPT and crypt for crypt version
  1123. X$ link zip,crypt,zipfile,zipup,fileio,util,deflate,globals,trees,bits, -
  1124. X   vms,VMSmunch, gnu_cc:[000000]gcclib.olb/lib, sys$input:/opt
  1125. Xsys$share:vaxcrtl.exe/shareable
  1126. X$ !
  1127. X$ !-------------------------- Zip utilities section ---------------------------
  1128. X$ !
  1129. X$ gcc /def=(CRYPT,UTIL) zipnote
  1130. X$ gcc /def=(CRYPT,UTIL) zipsplit
  1131. X$ gcc /def=(CRYPT,UTIL) /obj=zipfile_.obj zipfile
  1132. X$ gcc /def=(CRYPT,UTIL) /obj=zipup_.obj zipup
  1133. X$ gcc /def=(CRYPT,UTIL) /obj=fileio_.obj fileio
  1134. X$ gcc /def=(CRYPT,UTIL) /obj=util_.obj util
  1135. X$ ! uncomment crypt and zipcloak lines for crypt version
  1136. X$ gcc /def=(CRYPT,UTIL) zipcloak
  1137. X$ gcc /def=(CRYPT,UTIL) /obj=crypt_.obj crypt
  1138. X$ link zipcloak, zipfile_, zipup_, fileio_, util, crypt_, globals, -
  1139. X   VMSmunch, gnu_cc:[000000]gcclib.olb/lib, sys$input:/opt
  1140. Xsys$share:vaxcrtl.exe/shareable
  1141. X$ link zipnote, zipfile_, zipup_, fileio_, util_, globals, VMSmunch, -
  1142. X   sys$input:/opt
  1143. Xsys$share:vaxcrtl.exe/shareable
  1144. X$ link zipsplit, zipfile_, zipup_, fileio_, util_, globals, VMSmunch, -
  1145. X   gnu_cc:[000000]gcclib.olb/lib, sys$input:/opt
  1146. Xsys$share:vaxcrtl.exe/shareable
  1147. X$ !
  1148. X$ !----------------------------- Symbols section ------------------------------
  1149. X$ !
  1150. X$ ! Set up symbols for the various executables.  Edit the example below,
  1151. X$ ! changing "disk:[directory]" as appropriate.
  1152. X$ !
  1153. X$ zip        == "$disk:[directory]zip.exe"
  1154. X$ zipcloak    == "$disk:[directory]zipcloak.exe"
  1155. X$ zipnote    == "$disk:[directory]zipnote.exe"
  1156. X$ zipsplit    == "$disk:[directory]zipsplit.exe"
  1157. X$ !
  1158. X$ set noverify
  1159. END_OF_FILE
  1160. if test 2175 -ne `wc -c <'vms/make_gcc.com'`; then
  1161.     echo shar: \"'vms/make_gcc.com'\" unpacked with wrong size!
  1162. fi
  1163. # end of 'vms/make_gcc.com'
  1164. fi
  1165. if test -f 'vms/make_vaxc.com' -a "${1}" != "-c" ; then 
  1166.   echo shar: Will not clobber existing file \"'vms/make_vaxc.com'\"
  1167. else
  1168. echo shar: Extracting \"'vms/make_vaxc.com'\" \(1744 characters\)
  1169. sed "s/^X//" >'vms/make_vaxc.com' <<'END_OF_FILE'
  1170. X$ !
  1171. X$ !     "Makefile" for VMS versions of Zip, ZipCloak, ZipNote,
  1172. X$ !     and ZipSplit (stolen from Unzip)
  1173. X$ !
  1174. X$ !      IMPORTANT NOTE: do not forget to set the symbols as said below
  1175. X$ !                      in the Symbols section.
  1176. X$ !
  1177. X$ set verify    ! like "echo on", eh?
  1178. X$ !
  1179. X$ !------------------------------- Zip section --------------------------------
  1180. X$ !
  1181. X$ cc/def=CRYPT zip, zipfile, zipup, crypt, fileio, util, deflate, globals,-
  1182. X    trees, bits, vms, VMSmunch
  1183. X$ link zip, zipfile, zipup, crypt, fileio, util, deflate, globals,-
  1184. X    trees, bits, vms, VMSmunch, sys$input:/opt
  1185. Xsys$share:vaxcrtl.exe/shareable
  1186. X$ !
  1187. X$ !-------------------------- Zip utilities section ---------------------------
  1188. X$ !
  1189. X$ cc /def=(UTIL,CRYPT) /obj=zipfile_.obj zipfile.c
  1190. X$ cc /def=(UTIL,CRYPT) /obj=zipup_.obj zipup.c
  1191. X$ cc /def=(UTIL,CRYPT) /obj=fileio_.obj fileio.c
  1192. X$ cc /def=(UTIL,CRYPT) /obj=util_.obj util.c
  1193. X$ cc /def=(UTIL,CRYPT) /obj=crypt_.obj crypt.c
  1194. X$ cc zipcloak
  1195. X$ cc zipnote, zipsplit
  1196. X$ link zipcloak, zipfile_, zipup_, fileio_, util, crypt_, globals, -
  1197. X    VMSmunch, sys$input:/opt
  1198. Xsys$share:vaxcrtl.exe/shareable
  1199. X$ link zipnote, zipfile_, zipup_, fileio_, util_, globals, VMSmunch,-
  1200. X    sys$input:/opt
  1201. Xsys$share:vaxcrtl.exe/shareable
  1202. X$ link zipsplit, zipfile_, zipup_, fileio_, util_, globals, VMSmunch,-
  1203. X    sys$input:/opt
  1204. Xsys$share:vaxcrtl.exe/shareable
  1205. X$ !
  1206. X$ !----------------------------- Symbols section ------------------------------
  1207. X$ !
  1208. X$ ! Set up symbols for the various executables.  Edit the example below,
  1209. X$ ! changing "disk:[directory]" as appropriate.
  1210. X$ !
  1211. X$ zip        == "$disk:[directory]zip.exe"
  1212. X$ zipcloak    == "$disk:[directory]zipcloak.exe"
  1213. X$ zipnote    == "$disk:[directory]zipnote.exe"
  1214. X$ zipsplit    == "$disk:[directory]zipsplit.exe"
  1215. X$ !
  1216. X$ set noverify
  1217. END_OF_FILE
  1218. if test 1744 -ne `wc -c <'vms/make_vaxc.com'`; then
  1219.     echo shar: \"'vms/make_vaxc.com'\" unpacked with wrong size!
  1220. fi
  1221. # end of 'vms/make_vaxc.com'
  1222. fi
  1223. echo shar: End of shell archive.
  1224. exit 0
  1225. exit 0 # Just in case...
  1226.