home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume31 / zip19 / part04 < prev    next >
Encoding:
Text File  |  1992-08-22  |  60.3 KB  |  1,728 lines

  1. Newsgroups: comp.sources.misc
  2. From: zip-bugs@cs.ucla.edu (Info-ZIP group)
  3. Subject:  v31i096:  zip19 - Info-ZIP portable Zip, version 1.9, Part04/11
  4. Message-ID: <1992Aug23.064628.29121@sparky.imd.sterling.com>
  5. X-Md4-Signature: fb99faa1e8171758728591c8da715b75
  6. Date: Sun, 23 Aug 1992 06:46:28 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: zip-bugs@cs.ucla.edu (Info-ZIP group)
  10. Posting-number: Volume 31, Issue 96
  11. Archive-name: zip19/part04
  12. Supersedes: zip: Volume 23, Issue 88-96
  13. Environment: UNIX, VMS, OS/2, MS-DOS, MACINTOSH, WIN-NT, LINUX, MINIX, XOS, !AMIGA, ATARI, symlink, SGI, DEC, Cray, Convex, Amdahl, Sun, PC
  14.  
  15. #! /bin/sh
  16. # This is a shell archive.  Remove anything before this line, then feed it
  17. # into a shell via "sh file" or similar.  To overwrite existing files,
  18. # type "sh file -c".
  19. # The tool that generated this appeared in the comp.sources.unix newsgroup;
  20. # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
  21. # Contents:  mac/macstat.h zip.c zip.doc
  22. # Wrapped by kent@sparky on Sun Aug 23 01:00:44 1992
  23. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  24. echo If this archive is complete, you will see the following message:
  25. echo '          "shar: End of archive 4 (of 11)."'
  26. if test -f 'mac/macstat.h' -a "${1}" != "-c" ; then 
  27.   echo shar: Will not clobber existing file \"'mac/macstat.h'\"
  28. else
  29.   echo shar: Extracting \"'mac/macstat.h'\" \(974 characters\)
  30.   sed "s/^X//" >'mac/macstat.h' <<'END_OF_FILE'
  31. X/*****************************************************************
  32. X *
  33. X *                stat.h
  34. X *
  35. X *****************************************************************/
  36. X
  37. X#include <time.h>
  38. Xextern int macstat(char *path, struct stat *buf, short nVRefNum, long lDirID );
  39. Xtypedef long dev_t;
  40. Xtypedef long ino_t;
  41. Xtypedef long off_t;
  42. X
  43. Xstruct stat {
  44. X    dev_t    st_dev;
  45. X    ino_t    st_ino;
  46. X    unsigned short    st_mode;
  47. X    short    st_nlink;
  48. X    short    st_uid;
  49. X    short    st_gid;
  50. X    dev_t    st_rdev;
  51. X    off_t    st_size;
  52. X    time_t   st_atime, st_mtime, st_ctime;
  53. X    long     st_blksize;
  54. X    long     st_blocks;
  55. X};
  56. X
  57. X#define S_IFMT     0xF000
  58. X#define S_IFIFO    0x1000
  59. X#define S_IFCHR    0x2000
  60. X#define S_IFDIR    0x4000
  61. X#define S_IFBLK    0x6000
  62. X#define S_IFREG    0x8000
  63. X#define S_IFLNK    0xA000
  64. X#define S_IFSOCK   0xC000
  65. X#define S_ISUID    0x800
  66. X#define S_ISGID    0x400
  67. X#define S_ISVTX    0x200
  68. X#define S_IREAD    0x100
  69. X#define S_IWRITE   0x80
  70. X#define S_IEXEC    0x40
  71. END_OF_FILE
  72.   if test 974 -ne `wc -c <'mac/macstat.h'`; then
  73.     echo shar: \"'mac/macstat.h'\" unpacked with wrong size!
  74.   fi
  75.   # end of 'mac/macstat.h'
  76. fi
  77. if test -f 'zip.c' -a "${1}" != "-c" ; then 
  78.   echo shar: Will not clobber existing file \"'zip.c'\"
  79. else
  80.   echo shar: Extracting \"'zip.c'\" \(32880 characters\)
  81.   sed "s/^X//" >'zip.c' <<'END_OF_FILE'
  82. X/*
  83. X
  84. X Copyright (C) 1990-1992 Mark Adler, Richard B. Wales, Jean-loup Gailly,
  85. X Kai Uwe Rommel and Igor Mandrichenko.
  86. X Permission is granted to any individual or institution to use, copy, or
  87. X redistribute this software so long as all of the original files are included
  88. X unmodified, that it is not sold for profit, and that this copyright notice
  89. X is retained.
  90. X
  91. X*/
  92. X
  93. X/*
  94. X *  zip.c by Mark Adler.
  95. X */
  96. X
  97. X#include "revision.h"
  98. X#include "zip.h"
  99. X#ifdef VMS
  100. X#  include "VMSmunch.h"
  101. X#  define echon() echo(1)
  102. X#endif
  103. X#include <signal.h>
  104. X
  105. X#ifdef MACOS
  106. X#  include <console.h>
  107. X#endif
  108. X
  109. X#define PWLEN 80        /* Input buffer size for reading encryption key */
  110. X#define MAXCOM 256      /* Maximum one-line comment size */
  111. X
  112. X
  113. X/* Local option flags */
  114. X#define DELETE  0
  115. X#define ADD     1
  116. X#define UPDATE  2
  117. X#define FRESHEN 3
  118. Xlocal int action = ADD; /* one of ADD, UPDATE, FRESHEN, or DELETE */
  119. Xlocal int comadd = 0;   /* 1=add comments for new files */
  120. Xlocal int zipedit = 0;  /* 1=edit zip comment and all file comments */
  121. Xlocal int dispose = 0;  /* 1=remove files after put in zip file */
  122. Xlocal int latest = 0;   /* 1=set zip file time to time of latest file */
  123. Xlocal ulg before = 0;   /* 0=ignore, else exclude files before this time */
  124. X
  125. X
  126. X/* Temporary zip file name and file pointer */
  127. Xlocal char *tempzip;
  128. Xlocal FILE *tempzf;
  129. X
  130. X
  131. X/* Local functions */
  132. X#ifdef PROTO
  133. X   local void freeup(void);
  134. X   local void leave(int);
  135. X   local void handler(int);
  136. X   local void license(void);
  137. X   local void help(void);
  138. X   local void zipstdout(void);
  139. X   void main(int, char **);
  140. X   local int count_args(char *s);
  141. X   local void envargs(int *Pargc, char ***Pargv, char *envstr);
  142. X#endif /* PROTO */
  143. X
  144. X
  145. X
  146. Xlocal void freeup()
  147. X/* Free all allocations in the found list and the zfiles list */
  148. X{
  149. X  struct flist far *f;  /* steps through found list */
  150. X  struct zlist far *z;  /* pointer to next entry in zfiles list */
  151. X
  152. X  for (f = found; f != NULL; f = fexpel(f))
  153. X    ;
  154. X  while (zfiles != NULL)
  155. X  {
  156. X    z = zfiles->nxt;
  157. X    free((voidp *)(zfiles->name));
  158. X    free((voidp *)(zfiles->zname));
  159. X    if (zfiles->ext)
  160. X      free((voidp *)(zfiles->extra));
  161. X    if (zfiles->cext && zfiles->cextra != zfiles->extra)
  162. X      free((voidp *)(zfiles->cextra));
  163. X    if (zfiles->com)
  164. X      free((voidp *)(zfiles->comment));
  165. X    farfree((voidp far *)zfiles);
  166. X    zfiles = z;
  167. X    zcount--;
  168. X  }
  169. X}
  170. X
  171. X
  172. Xlocal void leave(e)
  173. Xint e;                  /* exit code */
  174. X/* Process -o and -m options (if specified), free up malloc'ed stuff, and
  175. X   exit with the code e. */
  176. X{
  177. X  int r;                /* return value from trash() */
  178. X  ulg t;                /* latest time in zip file */
  179. X  struct zlist far *z;  /* pointer into zfile list */
  180. X
  181. X  /* If latest, set time to zip file to latest file in zip file */
  182. X  if (latest && strcmp(zipfile, "-"))
  183. X  {
  184. X    diag("changing time of zip file to time of latest file in it");
  185. X    /* find latest time in zip file */
  186. X    if (zfiles == NULL)
  187. X       warn("zip file is empty, can't make it as old as latest entry", "");
  188. X    else {
  189. X      t = zfiles->tim;
  190. X      for (z = zfiles->nxt; z != NULL; z = z->nxt)
  191. X        if (t < z->tim)
  192. X          t = z->tim;
  193. X      /* set modified time of zip file to that time */
  194. X      stamp(zipfile, t);
  195. X    }
  196. X  }
  197. X  if (tempath != NULL)
  198. X  {
  199. X    free((voidp *)tempath);
  200. X    tempath = NULL;
  201. X  }
  202. X  if (zipfile != NULL)
  203. X  {
  204. X    free((voidp *)zipfile);
  205. X    zipfile = NULL;
  206. X  }
  207. X
  208. X
  209. X  /* If dispose, delete all files in the zfiles list that are marked */
  210. X  if (dispose)
  211. X  {
  212. X    diag("deleting files that were added to zip file");
  213. X    if ((r = trash()) != ZE_OK)
  214. X      err(r, "was deleting moved files and directories");
  215. X  }
  216. X
  217. X
  218. X  /* Done! */
  219. X  freeup();
  220. X#ifdef VMS
  221. X  exit(0);
  222. X#else /* !VMS */
  223. X  exit(e);
  224. X#endif /* ?VMS */
  225. X}
  226. X
  227. X
  228. Xvoid err(c, h)
  229. Xint c;                  /* error code from the ZE_ class */
  230. Xchar *h;                /* message about how it happened */
  231. X/* Issue a message for the error, clean up files and memory, and exit. */
  232. X{
  233. X  static int error_level;
  234. X  if (error_level++ > 0) exit(0);  /* avoid recursive err() */
  235. X
  236. X  if (PERR(c))
  237. X    perror("zip error");
  238. X  fprintf(stderr, "zip error: %s (%s)\n", errors[c-1], h);
  239. X  if (tempzip != NULL)
  240. X  {
  241. X    if (tempzip != zipfile) {
  242. X      if (tempzf != NULL)
  243. X        fclose(tempzf);
  244. X#ifndef DEBUG
  245. X      destroy(tempzip);
  246. X#endif
  247. X      free((voidp *)tempzip);
  248. X    } else {
  249. X      /* -g option, attempt to restore the old file */
  250. X      int k = 0;                        /* keep count for end header */
  251. X      ulg cb = cenbeg;                  /* get start of central */
  252. X      struct zlist far *z;  /* steps through zfiles linked list */
  253. X
  254. X      fprintf(stderr, "attempting to restore %s to its previous state\n",
  255. X         zipfile);
  256. X      fseek(tempzf, cenbeg, SEEK_SET);
  257. X      tempzn = cenbeg;
  258. X      for (z = zfiles; z != NULL; z = z->nxt)
  259. X      {
  260. X        putcentral(z, tempzf);
  261. X        tempzn += 4 + CENHEAD + z->nam + z->cext + z->com;
  262. X        k++;
  263. X      }
  264. X      putend(k, tempzn - cb, cb, zcomlen, zcomment, tempzf);
  265. X      tempzf = NULL;
  266. X      fclose(tempzf);
  267. X    }
  268. X  }
  269. X  if (key != NULL)
  270. X    free((voidp *)key);
  271. X  if (tempath != NULL)
  272. X    free((voidp *)tempath);
  273. X  if (zipfile != NULL)
  274. X    free((voidp *)zipfile);
  275. X  freeup();
  276. X#ifdef VMS
  277. X  c = 0;
  278. X#endif
  279. X  exit(c);
  280. X}
  281. X
  282. X
  283. Xvoid error(h)
  284. X  char *h;
  285. X/* Internal error, should never happen */
  286. X{
  287. X  err(ZE_LOGIC, h);
  288. X}
  289. X
  290. Xlocal void handler(s)
  291. Xint s;                  /* signal number (ignored) */
  292. X/* Upon getting a user interrupt, turn echo back on for tty and abort
  293. X   cleanly using err(). */
  294. X{
  295. X#ifndef MSDOS
  296. X# ifdef CRYPT
  297. X   echon();
  298. X# endif
  299. X  putc('\n', stderr);
  300. X#endif /* !MSDOS */
  301. X  err(ZE_ABORT, "aborting");
  302. X  s++;                                  /* keep some compilers happy */
  303. X}
  304. X
  305. X
  306. Xvoid warn(a, b)
  307. Xchar *a, *b;            /* message strings juxtaposed in output */
  308. X/* Print a warning message to stderr and return. */
  309. X{
  310. X  fprintf(stderr, "zip warning: %s%s\n", a, b);
  311. X}
  312. X
  313. X
  314. Xlocal void license()
  315. X/* Print license information to stdout. */
  316. X{
  317. X  extent i;             /* counter for copyright array */
  318. X
  319. X  for (i = 0; i < sizeof(copyright)/sizeof(char *); i++) {
  320. X    printf(copyright[i], "zip");
  321. X    putchar('\n');
  322. X  }
  323. X  for (i = 0; i < sizeof(disclaimer)/sizeof(char *); i++)
  324. X    puts(disclaimer[i]);
  325. X}
  326. X
  327. X
  328. Xlocal void help()
  329. X/* Print help (along with license info) to stdout. */
  330. X{
  331. X  extent i;             /* counter for help array */
  332. X
  333. X  /* help array */
  334. X  static char *text[] = {
  335. X"",
  336. X"Zip %d.%d (%s). Usage:",
  337. X"zip [-options] [-b path] [-t mmddyy] [-n suffixes] [zipfile list] [-x list]",
  338. X"  The default action is to add or replace zipfile entries from list, which",
  339. X"  can include the special name - to compress standard input.",
  340. X"  If zipfile and list are ommitted, zip compresses stdin to stdout.",
  341. X"  -f   freshen: only changed files  -u   update: only changed or new files",
  342. X"  -d   delete entries in zipfile    -m   move into zipfile (delete files)",
  343. X"  -k   simulate PKZIP made zipfile  -g   allow growing existing zipfile",
  344. X"  -h   show this help               -L   show software license",
  345. X"  -r   recurse into directories     -j   junk (don't record) directory names",
  346. X"  -0   store only                   -l   translate end-of-line",
  347. X"  -1   compress faster              -9   compress better",
  348. X"  -q   quiet operation              -n   don't compress these suffixes",
  349. X"  -c   add one-line comments        -z   add zipfile comment",
  350. X"  -b   use \"path\" for temp files    -t   only do files after \"mmddyy\"",
  351. X"  -@   read names from stdin        -o   make zipfile as old as latest entry",
  352. X#ifdef CRYPT
  353. X"  -e   encrypt  (-ee verify key)",
  354. X#endif
  355. X#ifdef VMS
  356. X"  -w   append the VMS version number to the name stored in the zip file",
  357. X"  -V   save VMS file attributes",
  358. X#endif /* VMS */
  359. X#ifdef OS2
  360. X"  -E   use the .LONGNAME Extended attribute (if found) as filename",
  361. X#endif /* OS2 */
  362. X#ifdef S_IFLNK
  363. X"  -y   store symbolic links as the link instead of the referenced file",
  364. X#endif /* !S_IFLNK */
  365. X"  -x   exclude the names that follow from those operated on"
  366. X  };
  367. X
  368. X  for (i = 0; i < sizeof(copyright)/sizeof(char *); i++)
  369. X  {
  370. X    printf(copyright[i], "zip");
  371. X    putchar('\n');
  372. X  }
  373. X  for (i = 0; i < sizeof(text)/sizeof(char *); i++)
  374. X  {
  375. X    printf(text[i], REVISION / 10, REVISION % 10, REVDATE);
  376. X    putchar('\n');
  377. X  }
  378. X}
  379. X
  380. X
  381. X/* Do command line expansion for MSDOS and VMS */
  382. X#if defined(MSVMS) && !defined(__GO32__)
  383. X#  define PROCNAME(n) (action==ADD||action==UPDATE?wild(n):procname(n))
  384. X#else /* !MSVMS */
  385. X#  define PROCNAME(n) procname(n)
  386. X#endif /* ?MSVMS */
  387. X
  388. Xlocal void zipstdout()
  389. X/* setup for writing zip file on stdout */
  390. X{
  391. X  int r;
  392. X  mesg = stderr;
  393. X  if (isatty(1))
  394. X    err(ZE_PARMS, "no zip file provided");
  395. X  if ((zipfile = malloc(4)) == NULL)
  396. X    err(ZE_MEM, "was processing arguments");
  397. X  strcpy(zipfile, "-");
  398. X  if ((r = readzipfile()) != ZE_OK)
  399. X    err(r, zipfile);
  400. X}
  401. X
  402. X
  403. Xvoid main(argc, argv)
  404. Xint argc;               /* number of tokens in command line */
  405. Xchar **argv;            /* command line tokens */
  406. X/* Add, update, freshen, or delete zip entries in a zip file.  See the
  407. X   command help in help() above. */
  408. X{
  409. X  int a;                /* attributes of zip file */
  410. X  ulg c;                /* start of central directory */
  411. X  int d;                /* true if just adding to a zip file */
  412. X  char *e;              /* malloc'd comment buffer */
  413. X  struct flist far *f;  /* steps through found linked list */
  414. X  int i;                /* arg counter, root directory flag */
  415. X  int k;                /* next argument type, marked counter,
  416. X                           comment size, entry count */
  417. X  ulg n;                /* total of entry len's */
  418. X  int o;                /* true if there were any ZE_OPEN errors */
  419. X  char *p;              /* steps through option arguments */
  420. X  char *pp;             /* temporary pointer */
  421. X  int r;                /* temporary variable */
  422. X  ulg t;                /* file time, length of central directory */
  423. X  struct zlist far *v;  /* temporary variable */
  424. X  struct zlist far * far *w;    /* pointer to last link in zfiles list */
  425. X  FILE *x, *y;          /* input and output zip files */
  426. X  struct zlist far *z;  /* steps through zfiles linked list */
  427. X  char *zipbuf;         /* stdio buffer for the zip file */
  428. X
  429. X  mesg = (FILE *) stdout; /* cannot be made at link time for VMS */
  430. X  init_upper();           /* build case map table */
  431. X
  432. X#ifdef MACOS
  433. X   argc = ccommand(&argv);
  434. X#endif
  435. X
  436. X  /* Process arguments */
  437. X  diag("processing arguments");
  438. X  if (argc == 1 && isatty(1))
  439. X  {
  440. X    help();
  441. X    exit(0);
  442. X  }
  443. X  envargs(&argc, &argv, "ZIPOPT"); /* get options from environment */
  444. X
  445. X  zipfile = tempzip = NULL;
  446. X  tempzf = NULL;
  447. X  d = 0;                        /* disallow adding to a zip file */
  448. X  signal(SIGINT, handler);
  449. X  signal(SIGTERM, handler);
  450. X  k = 0;                        /* Next non-option argument type */
  451. X  for (i = 1; i < argc; i++)
  452. X  {
  453. X    if (argv[i][0] == '-')
  454. X      if (argv[i][1])
  455. X        for (p = argv[i]+1; *p; p++)
  456. X          switch(*p)
  457. X          {
  458. X            case '0':
  459. X              method = STORE; level = 0; break;
  460. X            case '1':  case '2':  case '3':  case '4':
  461. X            case '5':  case '6':  case '7':  case '8':  case '9':
  462. X                        /* Set the compression efficacy */
  463. X              level = *p - '0';  break;
  464. X            case 'b':   /* Specify path for temporary file */
  465. X              if (k != 0)
  466. X                err(ZE_PARMS, "use -b before zip file name");
  467. X              else
  468. X                k = 1;          /* Next non-option is path */
  469. X              break;
  470. X            case 'c':   /* Add comments for new files in zip file */
  471. X              comadd = 1;  break;
  472. X            case 'd':   /* Delete files from zip file */
  473. X              if (action != ADD)
  474. X                err(ZE_PARMS, "specify just one action");
  475. X              action = DELETE;
  476. X              break;
  477. X#ifdef CRYPT
  478. X            case 'e':   /* Encrypt */
  479. X              e = key == NULL ? (char *)NULL : key;
  480. X              if ((key = malloc(PWLEN+1)) == NULL)
  481. X                err(ZE_MEM, "was getting encryption password");
  482. X              if (getp(e == NULL ? "Enter password: " : "Verify password: ",
  483. X                       key, PWLEN+1) == NULL)
  484. X                err(ZE_PARMS, "stderr is not a tty");
  485. X              if (e != NULL)
  486. X              {
  487. X                r = strcmp(key, e);
  488. X                free((voidp *)e);
  489. X                if (r)
  490. X                  err(ZE_PARMS, "password not verified");
  491. X              }
  492. X              latest = 1;               /* to make breaking the code harder */
  493. X              break;
  494. X#endif /* CRYPT */
  495. X            case 'f':   /* Freshen zip file--overwrite only */
  496. X              if (action != ADD)
  497. X                err(ZE_PARMS, "specify just one action");
  498. X              action = FRESHEN;
  499. X              break;
  500. X            case 'g':   /* Allow appending to a zip file */
  501. X              d = 1;  break;
  502. X            case 'h': case 'H': case '?':  /* Help */
  503. X              help();
  504. X              leave(ZE_OK);
  505. X            case 'j':   /* Junk directory names */
  506. X              pathput = 0;  break;
  507. X            case 'k':   /* Make entries using DOS names (k for Katz) */
  508. X              dosify = 1;  break;
  509. X            case 'l':   /* Translate end-of-line */
  510. X              translate_eol = 1; break;
  511. X            case 'L':   /* Show license, version */
  512. X              license();
  513. X              leave(ZE_OK);
  514. X            case 'm':   /* Delete files added or updated in zip file */
  515. X              dispose = 1;  break;
  516. X            case 'n':   /* Don't compress files with a special suffix */
  517. X              special = NULL;
  518. X              break;
  519. X            case 'o':   /* Set zip file time to time of latest file in it */
  520. X              latest = 1;  break;
  521. X            case 'p':   /* Store path with name */
  522. X              break;            /* (do nothing as annoyance avoidance) */
  523. X            case 'q':   /* Quiet operation */
  524. X              noisy = 0;  break;
  525. X            case 'r':   /* Recurse into subdirectories */
  526. X              recurse = 1;  break;
  527. X            case 't':   /* Exclude files earlier than specified date */
  528. X              if (before)
  529. X                err(ZE_PARMS, "can only have one -t");
  530. X              k = 2;  break;
  531. X            case 'u':   /* Update zip file--overwrite only if newer */
  532. X              if (action != ADD)
  533. X                err(ZE_PARMS, "specify just one action");
  534. X              action = UPDATE;
  535. X              break;
  536. X            case 'v':   /* Mention oddities in zip file structure */
  537. X              verbose++;
  538. X              break;
  539. X#ifdef VMS
  540. X            case 'w':   /* Append the VMS version number */
  541. X              vmsver = 1;  break;
  542. X            case 'V':   /* Store in VMS format */
  543. X              vms_native = 1; break;
  544. X#endif /* VMS */
  545. X            case 'x':   /* Exclude following files */
  546. X              if (k != 4 &&
  547. X                  (k != 3 || (action != UPDATE && action != FRESHEN)))
  548. X                err(ZE_PARMS, "nothing to exclude (-x) from");
  549. X              if (k == 3)       /* must be -u or -f */
  550. X                for (z = zfiles; z != NULL; z = z->nxt)
  551. X                  z->mark = 1;  /* mark all of them */
  552. X              k = 5;
  553. X              if ((r = exclude()) != ZE_OK)
  554. X                if (r == ZE_PARMS)
  555. X                  err(r, "cannot repeat names in zip file");
  556. X                else
  557. X                  err(r, "was processing list of files");
  558. X              break;
  559. X#ifdef S_IFLNK
  560. X            case 'y':   /* Store symbolic links as such */
  561. X              linkput = 1;  break;
  562. X#endif /* S_IFLNK */
  563. X            case 'z':   /* Edit zip file comment */
  564. X              zipedit = 1;  break;
  565. X            case '@':   /* read file names from stdin */
  566. X              while ((pp = getnam(errbuf)) != NULL)
  567. X              {
  568. X                if ((r = PROCNAME(pp)) != ZE_OK)
  569. X                  if (r == ZE_MISS)
  570. X                    warn("name not matched: ", pp);
  571. X                  else
  572. X                    err(r, pp);
  573. X              }
  574. X              break;
  575. X#ifdef OS2
  576. X            case 'E':
  577. X              /* use the .LONGNAME EA (if any) as the file's name. */
  578. X              use_longname_ea = 1;
  579. X              break;
  580. X#endif
  581. X            default:
  582. X            {
  583. X              sprintf(errbuf, "no such option: %c", *p);
  584. X              err(ZE_PARMS, errbuf);
  585. X            }
  586. X          }
  587. X      else              /* just a dash */
  588. X        switch (k)
  589. X        {
  590. X        case 0:
  591. X          zipstdout();
  592. X          k = 3;
  593. X          break;
  594. X        case 1:
  595. X          err(ZE_PARMS, "invalid path");
  596. X          break;
  597. X        case 2:
  598. X          err(ZE_PARMS, "invalid time");
  599. X          break;
  600. X        case 3:  case 4:  case 5:
  601. X          if ((r = PROCNAME(argv[i])) != ZE_OK)
  602. X            if (r == ZE_MISS)
  603. X              warn("name not matched: ", argv[i]);
  604. X            else
  605. X              err(r, argv[i]);
  606. X          if (k == 3)
  607. X            k = 4;
  608. X        }
  609. X    else                /* not an option */
  610. X    {
  611. X      if (special == NULL)
  612. X        special = argv[i];
  613. X      else
  614. X        switch (k)
  615. X      {
  616. X        case 0:
  617. X          if ((zipfile = ziptyp(argv[i])) == NULL)
  618. X            err(ZE_MEM, "was processing arguments");
  619. X          if ((r = readzipfile()) != ZE_OK)
  620. X            err(r, zipfile);
  621. X          k = 3;
  622. X          break;
  623. X        case 1:
  624. X          if ((tempath = malloc(strlen(argv[i]) + 1)) == NULL)
  625. X            err(ZE_MEM, "was processing arguments");
  626. X          strcpy(tempath, argv[i]);
  627. X          k = 0;
  628. X          break;
  629. X        case 2:
  630. X        {
  631. X          int yy, mm, dd;       /* results of sscanf() */
  632. X
  633. X          if (sscanf(argv[i], "%2d%2d%2d", &mm, &dd, &yy) != 3 ||
  634. X              mm < 1 || mm > 12 || dd < 1 || dd > 31)
  635. X            err(ZE_PARMS, "invalid date entered for -t option");
  636. X          before = dostime(yy + (yy < 80 ? 2000 : 1900), mm, dd, 0, 0, 0);
  637. X          k = 0;
  638. X          break;
  639. X        }
  640. X        case 3:  case 4:  case 5:
  641. X          if ((r = PROCNAME(argv[i])) != ZE_OK)
  642. X            if (r == ZE_MISS)
  643. X              warn("name not matched: ", argv[i]);
  644. X            else
  645. X              err(r, argv[i]);
  646. X          if (k == 3)
  647. X            k = 4;
  648. X      }
  649. X    }
  650. X  }
  651. X  if (k < 3) {               /* zip used as filter */
  652. X    zipstdout();
  653. X    if ((r = procname("-")) != ZE_OK)
  654. X      if (r == ZE_MISS)
  655. X        warn("name not matched: ", "-");
  656. X      else
  657. X        err(r, "-");
  658. X    k = 4;
  659. X  }
  660. X
  661. X  if (k != 5)                   /* Clean up selections */
  662. X  {
  663. X    if (k == 3 && (action == UPDATE || action == FRESHEN))
  664. X      for (z = zfiles; z != NULL; z = z->nxt)
  665. X        z->mark = 1;                    /* if -u or -f with no args, do all */
  666. X    if ((r = exclude()) != ZE_OK)       /* remove duplicates in found list */
  667. X      if (r == ZE_PARMS)
  668. X        err(r, "cannot repeat names in zip file");
  669. X      else
  670. X        err(r, "was processing list of files");
  671. X  }
  672. X  if (zcount)
  673. X    free((voidp *)zsort);
  674. X
  675. X  /* Check option combinations */
  676. X  if (action == DELETE && (method != BEST || dispose || recurse ||
  677. X      key != NULL || comadd || zipedit))
  678. X    err(ZE_PARMS, "invalid option(s) used with -d");
  679. X  if (linkput && dosify)
  680. X    err(ZE_PARMS, "can't use -y with -k");
  681. X  if ((action != ADD || d) && !strcmp(zipfile, "-"))
  682. X    err(ZE_PARMS, "can't use -d,-f,-u or -g on standard output");
  683. X#ifdef VMS
  684. X  if (vms_native && translate_eol)
  685. X    err(ZE_PARMS, "can't use -V with -l");
  686. X#endif
  687. X  if (zcount == 0 && (action != ADD || d))
  688. X    warn(zipfile, " not found or empty");
  689. X
  690. X
  691. X  /* If -b not specified, make temporary path the same as the zip file */
  692. X#ifdef MSDOS
  693. X  if (tempath == NULL && ((p = strrchr(zipfile, '/')) != NULL ||
  694. X                          (p = strrchr(zipfile, '\\')) != NULL ||
  695. X                          (p = strrchr(zipfile, ':')) != NULL))
  696. X  {
  697. X    if (*p == ':')
  698. X      p++;
  699. X#else /* !MSDOS */
  700. X  if (tempath == NULL && (p = strrchr(zipfile, '/')) != NULL)
  701. X  {
  702. X#endif /* ?MSDOS */
  703. X    if ((tempath = malloc((int)(p - zipfile) + 1)) == NULL)
  704. X      err(ZE_MEM, "was processing arguments");
  705. X    r = *p;  *p = 0;
  706. X    strcpy(tempath, zipfile);
  707. X    *p = (char)r;
  708. X  }
  709. X
  710. X  /* For each marked entry, if not deleting, check if it exists, and if
  711. X     updating or freshening, compare date with entry in old zip file.
  712. X     Unmark if it doesn't exist or is too old, else update marked count. */
  713. X  diag("stating marked entries");
  714. X  k = 0;                        /* Initialize marked count */
  715. X  for (z = zfiles; z != NULL; z = z->nxt)
  716. X    if (z->mark)
  717. X      if (action != DELETE &&
  718. X                ((t = filetime(z->name, (ulg *)NULL, (long *)NULL)) == 0 ||
  719. X                 t < before ||
  720. X                 ((action == UPDATE || action == FRESHEN) && t <= z->tim)))
  721. X      {
  722. X        z->mark = 0;
  723. X        z->trash = t && t >= before;    /* delete if -um or -fm */
  724. X        if (verbose)
  725. X          fprintf(mesg, "zip diagnostic: %s %s\n", z->name,
  726. X                 z->trash ? "up to date" : "missing or early");
  727. X      }
  728. X      else
  729. X        k++;
  730. X
  731. X
  732. X  /* Remove entries from found list that do not exist or are too old */
  733. X  diag("stating new entries");
  734. X  for (f = found; f != NULL;)
  735. X    if (action == DELETE || action == FRESHEN ||
  736. X        (t = filetime(f->name, (ulg *)NULL, (long *)NULL)) == 0 ||
  737. X        t < before || (namecmp(f->name, zipfile) == 0 && strcmp(zipfile, "-")))
  738. X      f = fexpel(f);
  739. X    else
  740. X      f = f->nxt;
  741. X
  742. X  /* Make sure there's something left to do */
  743. X  if (k == 0 && found == NULL && !(zfiles != NULL && (latest || zipedit)))
  744. X    if (action == UPDATE || action == FRESHEN)
  745. X      leave(ZE_OK);
  746. X    else if (zfiles == NULL && latest)
  747. X      err(ZE_NAME, zipfile);
  748. X    else
  749. X      err(ZE_NONE, zipfile);
  750. X  d = (d && k == 0 && (zipbeg || zfiles != NULL)); /* d true if appending */
  751. X
  752. X
  753. X  /* Before we get carried away, make sure zip file is writeable */
  754. X  if (strcmp(zipfile, "-"))
  755. X  {
  756. X    x = zfiles == NULL && zipbeg == 0 ? fopen(zipfile, FOPW) : 
  757. X                                        fopen(zipfile, FOPM);
  758. X    /* Note: FOPW and FOPM expand to several parameters for VMS */
  759. X    if (x == NULL)
  760. X      err(ZE_CREAT, zipfile);
  761. X    fclose(x);
  762. X    a = getfileattr(zipfile);
  763. X    if (zfiles == NULL && zipbeg == 0)
  764. X      destroy(zipfile);
  765. X  }
  766. X  else
  767. X    a = 0;
  768. X
  769. X
  770. X  /* Open zip file and temporary output file */
  771. X  diag("opening zip file and creating temporary zip file");
  772. X  x = NULL;
  773. X  tempzn = 0;
  774. X  if (strcmp(zipfile, "-") == 0)
  775. X  {
  776. X#ifdef MSDOS
  777. X    /* Set stdout mode to binary for MSDOS systems */
  778. X    setmode(fileno(stdout), O_BINARY);
  779. X    tempzf = y = fdopen(fileno(stdout), FOPW);
  780. X#else
  781. X    tempzf = y = stdout;
  782. X#endif
  783. X    tempzip = "-";
  784. X  }
  785. X  else if (d) /* d true if just appending (-g) */
  786. X  {
  787. X    if ((y = fopen(zipfile, FOPM)) == NULL)
  788. X      err(ZE_NAME, zipfile);
  789. X    tempzip = zipfile;
  790. X    tempzf = y;
  791. X    if (fseek(y, cenbeg, SEEK_SET))
  792. X      err(ferror(y) ? ZE_READ : ZE_EOF, zipfile);
  793. X    tempzn = cenbeg;
  794. X  }
  795. X  else
  796. X  {
  797. X    if ((zfiles != NULL || zipbeg) && (x = fopen(zipfile, FOPR_EX)) == NULL)
  798. X      err(ZE_NAME, zipfile);
  799. X    if ((tempzip = tempname(zipfile)) == NULL)
  800. X      err(ZE_MEM, tempzip);
  801. X    if ((tempzf = y = fopen(tempzip, FOPW)) == NULL)
  802. X      err(ZE_TEMP, tempzip);
  803. X    if (zipbeg && (r = fcopy(x, y, zipbeg)) != ZE_OK)
  804. X      err(r, r == ZE_TEMP ? tempzip : zipfile);
  805. X    tempzn = zipbeg;
  806. X  }
  807. X#ifndef VMS
  808. X  /* Use large buffer to speed up stdio: */
  809. X  zipbuf = (char *)malloc(ZBSZ);
  810. X  if (zipbuf == NULL)
  811. X    err(ZE_MEM, tempzip);
  812. X# ifdef _IOFBF
  813. X  setvbuf(y, zipbuf, _IOFBF, ZBSZ);
  814. X# else
  815. X  setbuf(y, zipbuf);
  816. X# endif /* _IOBUF */
  817. X#endif /* VMS */
  818. X  o = 0;                                /* no ZE_OPEN errors yet */
  819. X
  820. X
  821. X  /* Process zip file, updating marked files */
  822. X  if (zfiles != NULL)
  823. X    diag("going through old zip file");
  824. X  w = &zfiles;
  825. X  while ((z = *w) != NULL)
  826. X    if (z->mark)
  827. X    {
  828. X      /* if not deleting, zip it up */
  829. X      if (action != DELETE)
  830. X      {
  831. X        if (noisy)
  832. X        {
  833. X          fprintf(mesg, "updating %s", z->zname);
  834. X          fflush(mesg);
  835. X        }
  836. X        if ((r = zipup(z, y)) != ZE_OK && r != ZE_OPEN)
  837. X        {
  838. X          if (noisy)
  839. X          {
  840. X            putc('\n', mesg);
  841. X            fflush(mesg);
  842. X          }
  843. X          sprintf(errbuf, "was zipping %s", z->name);
  844. X          err(r, errbuf);
  845. X        }
  846. X        if (r == ZE_OPEN)
  847. X        {
  848. X          o = 1;
  849. X          if (noisy)
  850. X          {
  851. X            putc('\n', mesg);
  852. X            fflush(mesg);
  853. X          }
  854. X          perror("zip warning");
  855. X          warn("could not open for reading: ", z->name);
  856. X          warn("will just copy entry over: ", z->zname);
  857. X          if ((r = zipcopy(z, x, y)) != ZE_OK)
  858. X          {
  859. X            sprintf(errbuf, "was copying %s", z->zname);
  860. X            err(r, errbuf);
  861. X          }
  862. X          z->mark = 0;
  863. X        }
  864. X        w = &z->nxt;
  865. X      }
  866. X      else
  867. X      {
  868. X        if (noisy)
  869. X        {
  870. X          fprintf(mesg, "deleting %s\n", z->zname);
  871. X          fflush(mesg);
  872. X        }
  873. X        v = z->nxt;                     /* delete entry from list */
  874. X        free((voidp *)(z->name));
  875. X        free((voidp *)(z->zname));
  876. X        if (z->ext)
  877. X          free((voidp *)(z->extra));
  878. X        if (z->cext && z->cextra != z->extra)
  879. X          free((voidp *)(z->cextra));
  880. X        if (z->com)
  881. X          free((voidp *)(z->comment));
  882. X        farfree((voidp far *)z);
  883. X        *w = v;
  884. X        zcount--;
  885. X      }
  886. X    }
  887. X    else
  888. X    {
  889. X      /* copy the original entry verbatim */
  890. X      if (!d && (r = zipcopy(z, x, y)) != ZE_OK)
  891. X      {
  892. X        sprintf(errbuf, "was copying %s", z->zname);
  893. X        err(r, errbuf);
  894. X      }
  895. X      w = &z->nxt;
  896. X    }
  897. X
  898. X
  899. X  /* Process the edited found list, adding them to the zip file */
  900. X  diag("zipping up new entries, if any");
  901. X  for (f = found; f != NULL; f = fexpel(f))
  902. X  {
  903. X    /* add a new zfiles entry and set the name */
  904. X    if ((z = (struct zlist far *)farmalloc(sizeof(struct zlist))) == NULL)
  905. X      err(ZE_MEM, "was adding files to zip file");
  906. X    z->nxt = NULL;
  907. X    z->name = f->name;
  908. X    f->name = NULL;
  909. X    z->zname = f->zname;
  910. X    f->zname = NULL;
  911. X    z->ext = z->cext = z->com = 0;
  912. X    z->mark = 1;
  913. X    z->dosflag = f->dosflag;
  914. X    /* zip it up */
  915. X    if (noisy)
  916. X    {
  917. X      fprintf(mesg, "adding %s", z->zname);
  918. X      fflush(mesg);
  919. X    }
  920. X    if ((r = zipup(z, y)) != ZE_OK  && r != ZE_OPEN)
  921. X    {
  922. X      if (noisy)
  923. X      {
  924. X        putc('\n', mesg);
  925. X        fflush(mesg);
  926. X      }
  927. X      sprintf(errbuf, "was zipping %s", z->name);
  928. X      err(r, errbuf);
  929. X    }
  930. X    if (r == ZE_OPEN)
  931. X    {
  932. X      o = 1;
  933. X      if (noisy)
  934. X      {
  935. X        putc('\n', mesg);
  936. X        fflush(mesg);
  937. X      }
  938. X      perror("zip warning");
  939. X      warn("could not open for reading: ", z->name);
  940. X      free((voidp *)(z->name));
  941. X      free((voidp *)(z->zname));
  942. X      farfree((voidp far *)z);
  943. X    }
  944. X    else
  945. X    {
  946. X      *w = z;
  947. X      w = &z->nxt;
  948. X      zcount++;
  949. X    }
  950. X  }
  951. X  if (key != NULL)
  952. X  {
  953. X    free((voidp *)key);
  954. X    key = NULL;
  955. X  }
  956. X
  957. X
  958. X  /* Get one line comment for each new entry */
  959. X  if (comadd)
  960. X  {
  961. X    if ((e = malloc(MAXCOM + 1)) == NULL)
  962. X      err(ZE_MEM, "was reading comment lines");
  963. X    for (z = zfiles; z != NULL; z = z->nxt)
  964. X      if (z->mark)
  965. X      {
  966. X        if (noisy)
  967. X          fprintf(mesg, "Enter comment for %s:\n", z->name);
  968. X        /* ??? reopen /dev/tty if one file was zipped from stdin
  969. X         * or if file names were read from stdin.
  970. X         */
  971. X        if (fgets(e, MAXCOM+1, stdin) != NULL)
  972. X        {
  973. X          if ((p = malloc((k = strlen(e))+1)) == NULL)
  974. X          {
  975. X            free((voidp *)e);
  976. X            err(ZE_MEM, "was reading comment lines");
  977. X          }
  978. X          strcpy(p, e);
  979. X          if (p[k-1] == '\n')
  980. X            p[--k] = 0;
  981. X          z->comment = p;
  982. X          z->com = k;
  983. X        }
  984. X      }
  985. X    free((voidp *)e);
  986. X  }
  987. X
  988. X  /* Get multi-line comment for the zip file */
  989. X  if (zipedit)
  990. X  {
  991. X    if ((e = malloc(MAXCOM + 1)) == NULL)
  992. X      err(ZE_MEM, "was reading comment lines");
  993. X    if (noisy && zcomlen)
  994. X    {
  995. X      fputs("current zip file comment is:\n", mesg);
  996. X      fwrite(zcomment, 1, zcomlen, mesg);
  997. X      if (zcomment[zcomlen-1] != '\n')
  998. X        putc('\n', mesg);
  999. X      free((voidp *)zcomment);
  1000. X    }
  1001. X    zcomment = malloc(1);
  1002. X    *zcomment = 0;
  1003. X    if (noisy)
  1004. X      fputs("enter new zip file comment (end with .):\n", mesg);
  1005. X     /* ??? reopen /dev/tty if one file was zipped from stdin
  1006. X      * or if file names were read from stdin.
  1007. X      */
  1008. X    while (fgets(e, MAXCOM+1, stdin) != NULL && strcmp(e, ".\n"))
  1009. X    {
  1010. X      if (e[(r = strlen(e)) - 1] == '\n')
  1011. X        e[--r] = 0;
  1012. X      if ((p = malloc((*zcomment ? strlen(zcomment) + 3 : 1) + r)) == NULL)
  1013. X      {
  1014. X        free((voidp *)e);
  1015. X        err(ZE_MEM, "was reading comment lines");
  1016. X      }
  1017. X      if (*zcomment)
  1018. X        strcat(strcat(strcpy(p, zcomment), "\r\n"), e);
  1019. X      else
  1020. X        strcpy(p, *e ? e : "\r\n");
  1021. X      free((voidp *)zcomment);
  1022. X      zcomment = p;
  1023. X    }
  1024. X    zcomlen = strlen(zcomment);
  1025. X    free((voidp *)e);
  1026. X  }
  1027. X
  1028. X
  1029. X  /* Write central directory and end header to temporary zip */
  1030. X  diag("writing central directory");
  1031. X  k = 0;                        /* keep count for end header */
  1032. X  c = tempzn;                   /* get start of central */
  1033. X  n = t = 0;
  1034. X  for (z = zfiles; z != NULL; z = z->nxt)
  1035. X  {
  1036. X    if ((r = putcentral(z, y)) != ZE_OK)
  1037. X      err(r, tempzip);
  1038. X    tempzn += 4 + CENHEAD + z->nam + z->cext + z->com;
  1039. X    n += z->len;
  1040. X    t += z->siz;
  1041. X    k++;
  1042. X  }
  1043. X  if (k == 0)
  1044. X    warn("zip file empty", "");
  1045. X  if (verbose)
  1046. X    fprintf(mesg, "total bytes=%lu, compressed=%lu -> %d%% savings\n",
  1047. X           n, t, percent(n, t));
  1048. X  t = tempzn - c;               /* compute length of central */
  1049. X  diag("writing end of central directory");
  1050. X  if ((r = putend(k, t, c, zcomlen, zcomment, y)) != ZE_OK)
  1051. X    err(r, tempzip);
  1052. X  tempzf = NULL;
  1053. X  if (fclose(y))
  1054. X    err(d ? ZE_WRITE : ZE_TEMP, tempzip);
  1055. X  if (x != NULL)
  1056. X    fclose(x);
  1057. X
  1058. X
  1059. X  /* Replace old zip file with new zip file, leaving only the new one */
  1060. X  if (strcmp(zipfile, "-") && !d)
  1061. X  {
  1062. X    diag("replacing old zip file with new zip file");
  1063. X    if ((r = replace(zipfile, tempzip)) != ZE_OK)
  1064. X    {
  1065. X      warn("new zip file left as: ", tempzip);
  1066. X      free((voidp *)tempzip);
  1067. X      tempzip = NULL;
  1068. X      err(r, "was replacing the original zip file");
  1069. X    }
  1070. X    free((voidp *)tempzip);
  1071. X  }
  1072. X  tempzip = NULL;
  1073. X  if (strcmp(zipfile, "-")) {
  1074. X    setfileattr(zipfile, a);
  1075. X#ifdef VMS
  1076. X    /* If the zip file existed previously, restore its record format: */
  1077. X    if (x != NULL)
  1078. X      VMSmunch(zipfile, RESTORE_RTYPE, NULL);
  1079. X#endif
  1080. X  }
  1081. X
  1082. X  /* Finish up (process -o, -m, clean up).  Exit code depends on o. */
  1083. X  leave(o ? ZE_OPEN : ZE_OK);
  1084. X}
  1085. X
  1086. X/*****************************************************************
  1087. X | envargs - add default options from environment to command line
  1088. X |----------------------------------------------------------------
  1089. X | Author: Bill Davidsen, original 10/13/91, revised 23 Oct 1991.
  1090. X | This program is in the public domain.
  1091. X |----------------------------------------------------------------
  1092. X | Minor program notes:
  1093. X |  1. Yes, the indirection is a tad complex
  1094. X |  2. Parenthesis were added where not needed in some cases
  1095. X |     to make the action of the code less obscure.
  1096. X ****************************************************************/
  1097. X
  1098. Xlocal void
  1099. Xenvargs(Pargc, Pargv, envstr)
  1100. Xint *Pargc;
  1101. Xchar ***Pargv;
  1102. Xchar *envstr;
  1103. X{
  1104. X    char *getenv();
  1105. X    char *envptr;                               /* value returned by getenv */
  1106. X    char *bufptr;                               /* copy of env info */
  1107. X    int argc = 0;                               /* internal arg count */
  1108. X    int ch;                                             /* spare temp value */
  1109. X    char **argv;                                /* internal arg vector */
  1110. X    char **argvect;                             /* copy of vector address */
  1111. X
  1112. X    /* see if anything in the environment */
  1113. X    envptr = getenv(envstr);
  1114. X    if (envptr == NULL || *envptr == 0) return;
  1115. X
  1116. X    /* count the args so we can allocate room for them */
  1117. X    argc = count_args(envptr);
  1118. X    bufptr = malloc(1+strlen(envptr));
  1119. X    if (bufptr == NULL)
  1120. X        err(ZE_MEM, "Can't get memory for arguments");
  1121. X
  1122. X    strcpy(bufptr, envptr);
  1123. X
  1124. X    /* allocate a vector large enough for all args */
  1125. X    argv = (char **)malloc((argc+*Pargc+1)*sizeof(char *));
  1126. X    if (argv == NULL)
  1127. X        err(ZE_MEM, "Can't get memory for arguments");
  1128. X    argvect = argv;
  1129. X
  1130. X    /* copy the program name first, that's always true */
  1131. X    *(argv++) = *((*Pargv)++);
  1132. X
  1133. X    /* copy the environment args first, may be changed */
  1134. X    do {
  1135. X        *(argv++) = bufptr;
  1136. X        /* skip the arg and any trailing blanks */
  1137. X        while ((ch = *bufptr) != '\0' && ch != ' ') ++bufptr;
  1138. X        if (ch == ' ') *(bufptr++) = '\0';
  1139. X        while ((ch = *bufptr) != '\0' && ch == ' ') ++bufptr;
  1140. X    } while (ch);
  1141. X
  1142. X    /* now save old argc and copy in the old args */
  1143. X    argc += *Pargc;
  1144. X    while (--(*Pargc)) *(argv++) = *((*Pargv)++);
  1145. X
  1146. X    /* finally, add a NULL after the last arg, like UNIX */
  1147. X    *argv = NULL;
  1148. X
  1149. X    /* save the values and return */
  1150. X    *Pargv = argvect;
  1151. X    *Pargc = argc;
  1152. X}
  1153. X
  1154. Xstatic int
  1155. Xcount_args(s)
  1156. Xchar *s;
  1157. X{
  1158. X    int count = 0;
  1159. X    int ch;
  1160. X
  1161. X    do {
  1162. X        /* count and skip args */
  1163. X        ++count;
  1164. X        while ((ch = *s) != '\0' && ch != ' ') ++s;
  1165. X        while ((ch = *s) != '\0' && ch == ' ') ++s;
  1166. X    } while (ch);
  1167. X
  1168. X    return count;
  1169. X}
  1170. END_OF_FILE
  1171.   if test 32880 -ne `wc -c <'zip.c'`; then
  1172.     echo shar: \"'zip.c'\" unpacked with wrong size!
  1173.   fi
  1174.   # end of 'zip.c'
  1175. fi
  1176. if test -f 'zip.doc' -a "${1}" != "-c" ; then 
  1177.   echo shar: Will not clobber existing file \"'zip.doc'\"
  1178. else
  1179.   echo shar: Extracting \"'zip.doc'\" \(23559 characters\)
  1180.   sed "s/^X//" >'zip.doc' <<'END_OF_FILE'
  1181. X
  1182. XZIP(1)                   USER COMMANDS                     ZIP(1)
  1183. X
  1184. XNAME
  1185. X     zip, zipcloak, zipnote,  zipsplit  -  package  and  compress
  1186. X     (archive) files
  1187. X
  1188. XSYNOPSIS
  1189. X     zip [ -cdeEfghjklmoqruwyz@ ] [ -b temppath ] [ -n suffixes ]
  1190. X     [ -t mmddyy ] [ zipfile list ] [ -x list ]
  1191. X
  1192. X     zipcloak [ -d ] [ -b path ] zipfile
  1193. X
  1194. X     zipnote [ -w ] [ -b path ] zipfile
  1195. X
  1196. X     zipsplit [ -ti ] [ -n size ] [ -b path ] zipfile
  1197. X
  1198. XDESCRIPTION
  1199. X     zip is a compression and file packaging  utility  for  Unix,
  1200. X     VMS,  MSDOS,  OS/2,  Windows NT, Minix, Atari and Macintosh.
  1201. X     It is analogous to a combination of tar and compress and  is
  1202. X     compatible with PKZIP (Phil Katz ZIP) for MSDOS systems.
  1203. X
  1204. X     There is a companion to zip called unzip (of  course)  which
  1205. X     you  should  be able to find the same place you got zip. zip
  1206. X     and unzip can work with files produced by PKZIP under MSDOS,
  1207. X     and PKZIP and PKUNZIP can work with files produced by zip.
  1208. X
  1209. X     zip version 1.9 is compatible with pkzip 1.93a.   Note  that
  1210. X     pkunzip 1.10 cannot extract files produced by pkzip 1.93a or
  1211. X     zip 1.9b. You must use pkunzip 1.93a or unzip 5.0 to extract
  1212. X     them.
  1213. X
  1214. X     For a brief help on zip and unzip, run each without specify-
  1215. X     ing any parameters on the command line.
  1216. X
  1217. X     zip puts one or more compressed files  into  a  single  "zip
  1218. X     file"  along with information about the files, including the
  1219. X     name, path if requested, date and time last  modified,  pro-
  1220. X     tection,  and  check  information  to verify the fidelity of
  1221. X     each entry.  zip can also be used as a  filter,  compressing
  1222. X     standard  input  to standard output.  zip can pack an entire
  1223. X     directory structure in a zip file  with  a  single  command.
  1224. X     Compression  ratios of 2:1 to 3:1 are common for text files.
  1225. X     zip has one compression  method  (deflation)  and  can  also
  1226. X     store  files  without  compression. It automatically chooses
  1227. X     the better of the two for each file to be compressed.
  1228. X
  1229. X     zip is useful for packaging a set of files to send to  some-
  1230. X     one  or for distribution; for archiving or backing up files;
  1231. X     and for saving disk space by temporarily compressing  unused
  1232. X     files or directories.
  1233. X
  1234. XHOW TO USE ZIP
  1235. X     The simplest use of zip is as follows:
  1236. X
  1237. X          zip stuff *
  1238. X
  1239. X     This will create the file "stuff.zip" (assuming it does  not
  1240. X     exist)  and  put  all  the files in the current directory in
  1241. X     stuff.zip in a compressed form.  The .zip  suffix  is  added
  1242. X     automatically,  unless  that  file name given contains a dot
  1243. X     already.  This allows specifying suffixes other than ".zip".
  1244. X
  1245. X     Because of the way the  shell  does  filename  substitution,
  1246. X     files  that  start  with a "." are not included.  To include
  1247. X     those as well, you can:
  1248. X
  1249. X          zip stuff .* *
  1250. X
  1251. X     Even this will not include any subdirectories  that  are  in
  1252. X     the  current  directory.  To zip up an entire directory, the
  1253. X     command:
  1254. X
  1255. X          zip -r foo foo
  1256. X
  1257. X     will create the file "foo.zip" containing all the files  and
  1258. X     directories  in  the  directory "foo" that is in the current
  1259. X     directory. (The first "foo" denotes the zip file, the second
  1260. X     one  denotes  the  directory.)  The "r" option means recurse
  1261. X     through the directory structure.   In  this  case,  all  the
  1262. X     files  and directories in foo are zipped, including the ones
  1263. X     that start with a ".", since the recursion does not use  the
  1264. X     shell's  file-name substitution.  You should not use -r with
  1265. X     the name ".*", since that matches ".." which will attempt to
  1266. X     zip up the parent directory--probably not what was intended.
  1267. X
  1268. X     You may want to make a zip file that contains the  files  in
  1269. X     foo,  but  not  record the directory name, foo.  You can use
  1270. X     the -j (junk path) option to leave off the path:
  1271. X
  1272. X          zip -j foo foo/*
  1273. X
  1274. X     The -y option (only under Unix) will store symbolic links as
  1275. X     such in the zip file, instead of compressing and storing the
  1276. X     file referred to in the link.
  1277. X
  1278. X     You might be zipping to save disk space, in which  case  you
  1279. X     could:
  1280. X
  1281. X          zip -rm foo foo
  1282. X
  1283. X     where the "m" option means "move".  This will delete foo and
  1284. X     its  contents  after  making  foo.zip.  No deletions will be
  1285. X     done until the zip  has  completed  with  no  errors.   This
  1286. X     option  is  obviously more dangerous and should be used with
  1287. X     care.
  1288. X
  1289. X     If the zip file already exists, these commands will  replace
  1290. X     existing  or  add new entries to the zip file.  For example,
  1291. X     if you were really short on disk space, you might  not  have
  1292. X     enough room simultaneously to hold the directory foo and the
  1293. X     compressed foo.zip.  In this case, you could do it in steps.
  1294. X     If  foo  contained  the subdirectories tom, dick, and harry,
  1295. X     then you could:
  1296. X
  1297. X          zip -rm foo foo/tom
  1298. X          zip -rm foo foo/dick
  1299. X          zip -rm foo foo/harry
  1300. X
  1301. X     where the first command would create foo.zip, and  the  next
  1302. X     two would add to it.  At the completion of each zip command,
  1303. X     the directory just zipped would be deleted, making  room  in
  1304. X     which the next zip command could work.
  1305. X
  1306. X     zip will also accept a single dash ("-")  as  the  zip  file
  1307. X     name,  in  which  case it will write the zip file to stdout,
  1308. X     allowing the output to be  piped  to  another  program.  For
  1309. X     example:
  1310. X
  1311. X          zip -r - . | dd of=/dev/nrst0 obs=16k
  1312. X
  1313. X     would write the zip output  directly  to  a  tape  with  the
  1314. X     specified  block  size  for  the  purpose  of backing up the
  1315. X     current directory.
  1316. X
  1317. X     zip also accepts a single dash ("-") as the name of  a  file
  1318. X     to  be  compressed,  in which case it will read the zip file
  1319. X     from stdin, allowing zip to take input from another program.
  1320. X     For example:
  1321. X
  1322. X          tar cf - . | zip backup -
  1323. X
  1324. X     would compress the output of the tar command for the purpose
  1325. X     of backing up the current directory. This generally produces
  1326. X     better compression than the previous example  using  the  -r
  1327. X     option, because zip can take advantage of redundancy between
  1328. X     files. The backup can be restored using the command
  1329. X
  1330. X          unzip -p backup | tar xf -
  1331. X
  1332. X     When no zip file name is given and stdout is not a terminal,
  1333. X     zip acts as a filter, compressing standard input to standard
  1334. X     output.  For example,
  1335. X
  1336. X          tar cf - . | zip | dd of=/dev/nrst0
  1337. X
  1338. X     is equivalent to
  1339. X
  1340. X          tar cf - . | zip - - | dd of=/dev/nrst0
  1341. X
  1342. X     Zip archives created in this manner can  be  extracted  with
  1343. X     the  program  funzip which is provided in the unzip package.
  1344. X     For example,
  1345. X
  1346. X             dd if=/dev/nrst0 | funzip | tar xvf -
  1347. X
  1348. XMODIFYING EXISTING ZIP FILES
  1349. X     When given the name of an existing zip file with  the  above
  1350. X     commands,  zip will replace identically named entries in the
  1351. X     zip file or add entries for  new  names.   For  example,  if
  1352. X     foo.zip exists and contains foo/file1 and foo/file2, and the
  1353. X     directory foo contains the files  foo/file1  and  foo/file3,
  1354. X     then:
  1355. X
  1356. X          zip -r foo foo
  1357. X
  1358. X     will replace foo/file1  in  foo.zip  and  add  foo/file3  to
  1359. X     foo.zip.  After this, foo.zip contains foo/file1, foo/file2,
  1360. X     and foo/file3, with foo/file2 unchanged from before.
  1361. X
  1362. X     When changing an existing zip file, zip will  write  a  tem-
  1363. X     porary  file with the new contents, and only replace the old
  1364. X     one when the zip has completed with no errors. You  can  use
  1365. X     the  -b  option  to specify a different path (usually a dif-
  1366. X     ferent device) to put the temporary file in.  For example:
  1367. X
  1368. X          zip -b /tmp stuff *
  1369. X
  1370. X     will put the temporary zip file and the  temporary  compres-
  1371. X     sion  files  in the directory "/tmp", copying over stuff.zip
  1372. X     in the current directory when done.
  1373. X
  1374. X     If you are only adding entries to a zip file, not replacing,
  1375. X     and  the -g option is given, then zip grows (appends to) the
  1376. X     file instead of copying it.  The danger of this is  that  if
  1377. X     the  operation fails, the original zip file is corrupted and
  1378. X     lost.
  1379. X
  1380. X     There are two other ways to change or add entries in  a  zip
  1381. X     file  that  are  restrictions of simple addition or replace-
  1382. X     ment.  The first is -u (update) which will add  new  entries
  1383. X     to  the zip file as before but will replace existing entries
  1384. X     only if the modified date of the file is  more  recent  than
  1385. X     the  date recorded for that name in the zip file.  For exam-
  1386. X     ple:
  1387. X
  1388. X          zip -u stuff *
  1389. X
  1390. X     will add any new files in the current directory, and  update
  1391. X     any  changed files in the zip file stuff.zip.  Note that zip
  1392. X     will not try to pack stuff.zip into itself when you do this.
  1393. X     zip will always exclude the zip file from the files on which
  1394. X     to be operated.
  1395. X
  1396. X     The second restriction is -f (freshen) which,  like  update,
  1397. X     will  only  replace entries with newer files; unlike update,
  1398. X     will not add files that are not already  in  the  zip  file.
  1399. X     For  this  option, you may want to simply freshen all of the
  1400. X     files that are in the specified zip file.  To  do  this  you
  1401. X     would simply:
  1402. X
  1403. X          zip -f foo
  1404. X
  1405. X     Note that the -f option with no arguments freshens  all  the
  1406. X     entries  in the zip file.  The same is true of -u, and hence
  1407. X     "zip -u foo" and "zip -f foo" both do the same thing.
  1408. X
  1409. X     This command should be run  from  the  same  directory  from
  1410. X     which  the  original zip command was run, since paths stored
  1411. X     in zip files are always relative.
  1412. X
  1413. X     Another restriction that can be used with adding,  updating,
  1414. X     or  freshening is -t (time), which will not operate on files
  1415. X     modified earlier than the specified date.  For example:
  1416. X
  1417. X          zip -rt 120791 infamy foo
  1418. X
  1419. X     will add all the files in foo and  its  subdirectories  that
  1420. X     were  last modified on December 7, 1991, or later to the zip
  1421. X     file infamy.zip.
  1422. X
  1423. X     Also, files can be explicitly excluded using the -x option:
  1424. X
  1425. X          zip -r foo foo -x \*.o
  1426. X
  1427. X     which will zip up the  contents  of  foo  into  foo.zip  but
  1428. X     exclude  all the files that end in ".o".  Here the backslash
  1429. X     causes zip to match file names that were found when foo  was
  1430. X     searched.
  1431. X
  1432. X     The last operation is -d (delete) which will remove  entries
  1433. X     from a zip file.  An example might be:
  1434. X
  1435. X          zip -d foo foo/tom/junk foo/harry/\* \*.o
  1436. X
  1437. X     which will remove the entry foo/tom/junk, all of  the  files
  1438. X     that  start with "foo/harry/", and all of the files that end
  1439. X     with ".o" (in any path).  Note that once  again,  the  shell
  1440. X     expansion  has  been inhibited with backslashes, so that zip
  1441. X     can see the asterisks. zip can then match on the contents of
  1442. X     the  zip  file instead of the contents of the current direc-
  1443. X     tory.
  1444. X
  1445. X     Under MSDOS, -d is case sensitive when it matches  names  in
  1446. X     the  zip  file.  This allows deleting names that were zipped
  1447. X     on other systems, but requires that the names be entered  in
  1448. X     upper  case  if they were zipped on an MSDOS system, so that
  1449. X     the names can be found in the zip file and deleted.
  1450. X
  1451. XMORE OPTIONS
  1452. X     As mentioned before, zip will use the best of  two  methods:
  1453. X     deflate or store.
  1454. X
  1455. X     The option -0 will force zip to use store on all files.  For
  1456. X     example:
  1457. X
  1458. X          zip -r0 foo foo
  1459. X
  1460. X     will zip up the directory foo into foo.zip using only store.
  1461. X
  1462. X     The speed of deflation can also be controlled  with  options
  1463. X     -1  (fastest  method  but  less  compression)  to  -9  (best
  1464. X     compression but slower). The default value is -5. For  exam-
  1465. X     ple:
  1466. X
  1467. X          zip -r8 foo foo
  1468. X
  1469. X     In nearly all cases, a file that is already compressed  can-
  1470. X     not  be  compressed further by zip, or if it can, the effect
  1471. X     is minimal.  The -n  option  prevents  zip  from  trying  to
  1472. X     compress files that have the given suffixes.  Such files are
  1473. X     simply stored (0% compression) in the output  zip  file,  so
  1474. X     that  zip  doesn't  waste  its time trying to compress them.
  1475. X     The suffixes are separated by either colons  or  semicolons.
  1476. X     For example:
  1477. X
  1478. X          zip -rn ".Z:.zip:.tiff:.gif:.snd"  foo foo
  1479. X
  1480. X     will put everything in foo into foo.zip, but will store  any
  1481. X     files  that  end  in  .Z, .zip, .tiff, .gif, or .snd without
  1482. X     trying to compress them.  (Image and sound files often  have
  1483. X     their own specialized compression methods.) The default suf-
  1484. X     fix list is ".Z:.zip;.zoo:.arc:.lzh:.arj".  The  environment
  1485. X     variable  ZIPOPT  can  be  used  to change this default. For
  1486. X     example under Unix with csh:
  1487. X
  1488. X          setenv ZIPOPT "-n .gif:.zip"
  1489. X
  1490. X     The variable ZIPOPT can be  used  for  any  option  and  can
  1491. X     include several options.
  1492. X
  1493. X     Under Unix and  under  OS/2  (if  files  from  an  HPFS  are
  1494. X     stored),  zip  will  store  the  full  path (relative to the
  1495. X     current path) and name of the file (or just the name  if  -j
  1496. X     is   specified)   in  the  zip  file  along  with  the  Unix
  1497. X     attributes, and it will mark the entry as made  under  Unix.
  1498. X     If  the  zip  file is intended for PKUNZIP under MSDOS, then
  1499. X     the -k (Katz) option should be used to  attempt  to  convert
  1500. X     the  names  and  paths  to  conform to MSDOS, store only the
  1501. X     MSDOS attribute (just the user write attribute  from  Unix),
  1502. X     and  mark  the  entry  as  made  under MSDOS (even though it
  1503. X     wasn't).
  1504. X
  1505. X     The -o (older) option will set the "last modified"  time  of
  1506. X     the  zip  file  to  the  latest  "last modified" time of the
  1507. X     entries in the zip file.  This can be used without any other
  1508. X     operations, if desired.  For example:
  1509. X
  1510. X          zip -o foo
  1511. X
  1512. X     will change the last modified time of foo.zip to the  latest
  1513. X     time of the entries in foo.zip.
  1514. X
  1515. X     The -e and -c options operate on all files updated or  added
  1516. X     to the zip file.  Encryption (-e) will prompt for a password
  1517. X     on the terminal and will not echo  the  password  as  it  is
  1518. X     typed (if stderr is not a TTY, zip will exit with an error).
  1519. X     New zip entries will be encrypted using that password.   For
  1520. X     added  peace of mind, you can use -ee, which will prompt for
  1521. X     the password twice, checking  that  the  two  are  the  same
  1522. X     before   using   it.  The  encryption  code  is  distributed
  1523. X     separately, so the -e option may not be  available  in  your
  1524. X     version.
  1525. X
  1526. X     One-line comments can be added for each  file  with  the  -c
  1527. X     option.   The  zip file operations (adding or updating) will
  1528. X     be done first, and you will then be prompted for a  one-line
  1529. X     comment  for each file.  You can then enter the comment fol-
  1530. X     lowed by return, or just return for no comment.
  1531. X
  1532. X     The -z option will prompt you for a multi-line  comment  for
  1533. X     the  entire zip file.  This option can be used by itself, or
  1534. X     in combination with other options.  The comment is ended  by
  1535. X     a line containing just a period, or an end of file condition
  1536. X     (^D on Unix, ^Z on MSDOS,  OS/2,  and  VAX/VMS).   Since  -z
  1537. X     reads  the lines from stdin, you can simply take the comment
  1538. X     from a file:
  1539. X
  1540. X          zip -z foo < foowhat
  1541. X
  1542. X     The -q (quiet) option eliminates the informational  messages
  1543. X     and  comment  prompts while zip is operating.  This might be
  1544. X     used in shell scripts, for example, or if the zip  operation
  1545. X     is  being  performed  as  a background task ("zip -q foo *.c
  1546. X     &").
  1547. X
  1548. X     zip can take a list of file names to operate on  from  stdin
  1549. X     using  the -@ option.  In Unix, this option can be used with
  1550. X     the find command to extend greatly the functionality of zip.
  1551. X     For example, to zip up all the C source files in the current
  1552. X     directory and its subdirectories, you can:
  1553. X
  1554. X          find . -type f -name "*.[ch]" -print | zip source -@
  1555. X
  1556. X     Note that the pattern must be quoted to keep the shell  from
  1557. X     expanding it.
  1558. X
  1559. X     Under VMS only, the -w option will append the version number
  1560. X     of  the  files  to  the name and zip up multiple versions of
  1561. X     files.  Without -w, zip will only use the most  recent  ver-
  1562. X     sion of the specified file(s).
  1563. X
  1564. X     The -l option translates the Unix end-of-line  character  LF
  1565. X     into  the  MSDOS convention CR LF. This option should not be
  1566. X     used on binary files.  This option can be used  on  Unix  if
  1567. X     the  zip  file  is  intended for PKUNZIP under MSDOS. If the
  1568. X     input files already contain CR LF, this option adds an extra
  1569. X     CR.  This  ensure  that  "unzip -a" on Unix will get back an
  1570. X     exact copy of the original file, to undo the effect of  "zip
  1571. X     -l".
  1572. X
  1573. X     If zip is run with the -h option, or with no  arguments  and
  1574. X     standard  output is a terminal, the license and the command-
  1575. X     argument and option help is shown.  The -L option just shows
  1576. X     the license.
  1577. X
  1578. XABOUT PATTERN MATCHING
  1579. X     (Note: this section applies to Unix.  Watch this  space  for
  1580. X     details on MSDOS and VMS operation.)
  1581. X
  1582. X     The Unix shell (sh or csh)  does  filename  substitution  on
  1583. X     command  arguments.   The  special  characters  are ?, which
  1584. X     matches any single character; * which matches any number  of
  1585. X     characters  (including none); and [] which matches any char-
  1586. X     acter in the  range  inside  the  brackets  (like  [a-f]  or
  1587. X     [0-9]).   When  these  characters  are  encountered (and not
  1588. X     escaped with a backslash or quotes), the shell will look for
  1589. X     files  relative  to the current path that match the pattern,
  1590. X     and replace the argument with  a  list  of  the  names  that
  1591. X     matched.
  1592. X
  1593. X     zip can do the same matching on names that are  in  the  zip
  1594. X     file  being  modified  or,  in  the case of the -x (exclude)
  1595. X     option, on the list of files to be  operated  on,  by  using
  1596. X     backslashes  or  quotes to tell the shell not to do the name
  1597. X     expansion.  In general, when zip encounters a  name  in  the
  1598. X     list of files to do, it first looks for the name in the file
  1599. X     system.  If it finds it, it then adds  it  to  the  list  of
  1600. X     files  to  do.  If it does not find it, it will look for the
  1601. X     name in the zip file being modified (if  it  exists),  using
  1602. X     the  pattern  matching  characters  above, if any.  For each
  1603. X     match, it will add that name to the list  of  files  to  do.
  1604. X     After  -x  (exclude),  the  names are removed from the to-do
  1605. X     list instead of added.
  1606. X
  1607. X     The pattern matching includes the path, and so patterns like
  1608. X     \*.o  match  names that end in ".o", no matter what the path
  1609. X     prefix is.  Note that the backslash must precede every  spe-
  1610. X     cial  character  (i.e. ?*[]), or the entire argument must be
  1611. X     enclosed in double quotes ("").
  1612. X
  1613. X     In general, using backslash  to  make  zip  do  the  pattern
  1614. X     matching  is  used  with  the  -f  (freshen) and -d (delete)
  1615. X     options, and sometimes after the -x  (exclude)  option  when
  1616. X     used  with  any  operation  (add,  -u, -f, or -d).  zip will
  1617. X     never use pattern matching to search the  file  system.   If
  1618. X     zip has recursed into a directory, all files (and all direc-
  1619. X     tories) in there are fair game.
  1620. X
  1621. XCOPYRIGHT
  1622. X     Copyright (C) 1990-1992 Mark Adler, Richard B. Wales,  Jean-
  1623. X     loup  Gailly, Kai Uwe Rommel and Igor Mandrichenko.  Permis-
  1624. X     sion is granted to any individual  or  institution  to  use,
  1625. X     copy,  or  redistribute  this software so long as all of the
  1626. X     original files are included unmodified, that it is not  sold
  1627. X     for profit, and that this copyright notice is retained.
  1628. X
  1629. XACKNOWLEDGEMENTS
  1630. X     Thanks to R. P.  Byrne  for  his  Shrink.Pas  program  which
  1631. X     inspired  this project; to Phil Katz for making the zip file
  1632. X     format, compression format, and .zip filename extension  all
  1633. X     public  domain;  to  Steve  Burg  and  Phil Katz for help on
  1634. X     unclear points of the deflate format; to Keith Petersen  and
  1635. X     Rich Wales for providing a mailing list and ftp site for the
  1636. X     INFO-ZIP group to use; and most importantly, to the INFO-ZIP
  1637. X     group  itself (listed in the file infozip.who) without whose
  1638. X     tireless testing and bug-fixing efforts a portable zip would
  1639. X     not have been possible.  Finally we should thank (blame) the
  1640. X     INFO-ZIP moderator, David Kirschbaum  for  getting  us  into
  1641. X     this mess in the first place.
  1642. X
  1643. XSEE ALSO
  1644. X     unzip(1), tar(1), compress(1)
  1645. X
  1646. XBUGS
  1647. X     WARNING: zip files produced by this version of zip must  not
  1648. X     be  *updated*  by  zip  1.0 or pkzip 1.10 or pkzip 1.93a, if
  1649. X     they contain encrypted members, or if they  have  been  pro-
  1650. X     duced  in  a  pipe or on a non seekable device. The old ver-
  1651. X     sions of zip or pkzip would destroy the zip  structure.  The
  1652. X     old  versions can list the contents of the zip file but can-
  1653. X     not extract it anyway (because of the new compression  algo-
  1654. X     rithm).   If  you do not use encryption and use regular disk
  1655. X     files, you do not have to care about this problem.
  1656. X
  1657. X     zip 1.9 is compatible with  pkzip  1.93a,  except  when  two
  1658. X     features  are used: encryption or zip file created in a pipe
  1659. X     or on a non seekable device. pkzip versions above  2.0  will
  1660. X     support such files, and unzip 5.0 already supports them.
  1661. X
  1662. X     Without -y, when zip must compress a symbolic link to an non
  1663. X     existing   file,  it  only  displays  a  warning  "name  not
  1664. X     matched". A better warnign should be given.
  1665. X
  1666. X     Under VMS, not all of the odd file formats are treated prop-
  1667. X     erly.   Only  zip files of format stream-LF and fixed length
  1668. X     512 are expected to work with zip.  Others can be  converted
  1669. X     using  Rahul Dhesi's BILF program.  This version of zip does
  1670. X     handle some of the conversion internally.  When using Kermit
  1671. X     to transfer zip files from Vax to MSDOS, type "set file type
  1672. X     block" on the Vax.  When transfering from MSDOS to Vax, type
  1673. X     "set  file type fixed" on the Vax.  In both cases, type "set
  1674. X     file type binary" on MSDOS.
  1675. X
  1676. X     Under VMS, zip hangs for file specification that uses DECnet
  1677. X     syntax (foo::*.*).
  1678. X
  1679. X     Under OS/2, the amount of External Attributes  displayed  by
  1680. X     DIR is (for compatibility) the amount returned by the 16-bit
  1681. X     version of DosQueryPathInfo(). Otherwise OS/2  1.3  and  2.0
  1682. X     would  report  different  EA sizes when DIRing a file.  How-
  1683. X     ever,  the  structure  layout   returned   by   the   32-bit
  1684. X     DosQueryPathInfo() is a bit different, it uses extra padding
  1685. X     bytes and link pointers (it's a linked  list)  to  have  all
  1686. X     fields  on  4-byte boundaries for portability to future RISC
  1687. X     OS/2 versions. Therefore the value reported  by  ZIP  (which
  1688. X     uses  this  32-bit-mode  size) differs from that reported by
  1689. X     DIR.  ZIP stores the 32-bit format for portability, even the
  1690. X     16-bit  MS-C-compiled  version  running on OS/2 1.3, so even
  1691. X     this one shows the 32-bit-mode size.
  1692. X
  1693. X     LIKE ANYTHING ELSE THAT'S FREE, ZIP AND ITS ASSOCIATED UTIL-
  1694. X     ITIES  ARE  PROVIDED  AS IS AND COME WITH NO WARRANTY OF ANY
  1695. X     KIND, EITHER EXPRESSED OR IMPLIED.  IN  NO  EVENT  WILL  THE
  1696. X     COPYRIGHT  HOLDERS  BE LIABLE FOR ANY DAMAGES RESULTING FROM
  1697. X     THE USE OF THIS SOFTWARE.
  1698. X
  1699. X     That having been said, please send any problems or  comments
  1700. X     via email to the Internet address zip-bugs@cs.ucla.edu.  For
  1701. X     bug reports, please include the version  of  zip,  the  make
  1702. X     options  you  used  to compile it, the machine and operating
  1703. X     system you are using, and as much additional information  as
  1704. X     possible.  Thank you for your support.
  1705. END_OF_FILE
  1706.   if test 23559 -ne `wc -c <'zip.doc'`; then
  1707.     echo shar: \"'zip.doc'\" unpacked with wrong size!
  1708.   fi
  1709.   # end of 'zip.doc'
  1710. fi
  1711. echo shar: End of archive 4 \(of 11\).
  1712. cp /dev/null ark4isdone
  1713. MISSING=""
  1714. for I in 1 2 3 4 5 6 7 8 9 10 11 ; do
  1715.     if test ! -f ark${I}isdone ; then
  1716.     MISSING="${MISSING} ${I}"
  1717.     fi
  1718. done
  1719. if test "${MISSING}" = "" ; then
  1720.     echo You have unpacked all 11 archives.
  1721.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1722. else
  1723.     echo You still must unpack the following archives:
  1724.     echo "        " ${MISSING}
  1725. fi
  1726. exit 0
  1727. exit 0 # Just in case...
  1728.