home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume11 / zoo / part04 < prev    next >
Encoding:
Internet Message Format  |  1987-08-16  |  55.0 KB

  1. Path: uunet!rs
  2. From: rs@uunet.UU.NET (Rich Salz)
  3. Newsgroups: comp.sources.unix
  4. Subject: v11i013:  File archive program, Part04/07
  5. Message-ID: <968@uunet.UU.NET>
  6. Date: 18 Aug 87 02:01:57 GMT
  7. Organization: UUNET Communications Services, Arlington, VA
  8. Lines: 1965
  9. Approved: rs@uunet.UU.NET
  10.  
  11. Submitted-by: iuvax!bsu-cs!dhesi@seismo.CSS.GOV (Rahul Dhesi)
  12. Posting-number: Volume 11, Issue 13
  13. Archive-name: zoo/Part04
  14.  
  15. #! /bin/sh
  16. #
  17. # This is a shell archive, meaning:
  18. # 1. Remove everything above the #! /bin/sh line.
  19. # 2. Save the resulting text in a file.
  20. # 3. Execute the file with /bin/sh (not csh) to create:
  21. #    Readme.1st
  22. #    portable.c
  23. #    portable.h
  24. #    prterror.c
  25. #    sysv.c
  26. #    various.h
  27. #    version.c
  28. #    version.h
  29. #    zoo.1
  30. export PATH; PATH=/bin:/usr/bin:$PATH
  31. if test -f 'Readme.1st'
  32. then
  33.     echo shar: "will not over-write existing file 'Readme.1st'"
  34. else
  35. sed 's/^X//' << \SHAR_EOF > 'Readme.1st'
  36. X
  37. X                            READ ME FIRST
  38. X
  39. XHere is version 1.51 of the zoo archiver in C source form.  
  40. X
  41. XThe zoo archiver provides most of the functionality of the utilities
  42. X"tar" and "cpio" with some restrictions (file protections and
  43. Xmultiple links are not currently preserved and archives cannot be
  44. Xread from standard input or sent to standard ouput); in addition, it
  45. Xsupports storage of files in compressed form.  Long filenames of up
  46. Xto 255 characters can be handled.
  47. X
  48. XAll implementations create compatible archives.  Thus it is possible
  49. Xto move files, and file hierarchies, between dissimilar systems.
  50. X
  51. XThis package includes files as listed below.
  52. X
  53. XThe following are general information files:
  54. X
  55. XBugs            Known bugs in zoo 1.51
  56. XChanges         Changes from version 1.41 to version 1.51
  57. XCopyright       Copyright policy
  58. XInstall         Installation sugestions
  59. XReadme.1st      You're reading this
  60. Xzoo.1           User manual for formatting with tbl and nroff/troff
  61. Xzoo.man         Formatted user manual
  62. X
  63. XThe following makefile and make scripts are used for building zoo:
  64. X
  65. Xmakefile      mkgenric       mksysvsh        mkx68
  66. Xmkbsd         mksysv         mkuport         mkx86
  67. X
  68. XThe following are the source files in C:
  69. X
  70. Xaddbfcrc.c    lzc.c          options.c       zoo.h
  71. Xaddfname.c    lzconst.h      options.h       zooadd.c
  72. Xassert.h      lzd.c          parse.c         zooadd2.c
  73. Xbasename.c    machine.c      parse.h         zoodel.c
  74. Xbsd.c         machine.h      portable.c      zooext.c
  75. Xcomment.c     makelist.c     portable.h      zoofns.h
  76. Xcrcdefs.c     misc.c         prterror.c      zoolist.c
  77. Xdebug.h       misc2.c        sysv.c          zoomem.h
  78. Xerrors.i      mstime.i       various.h       zoopack.c
  79. Xfiz.c         needed.c       version.c
  80. Xgeneric.c     nextfile.c     version.h
  81. Xgetfile.c     nixtime.i      zoo.c
  82. X
  83. XOther programs of interest, not part of this package, are:
  84. X
  85. X   - [AmigaDOS] zoo 1.42b is the current latest version for AmigaDOS,
  86. X     ported by J. Brian Waters
  87. X
  88. X   - [MS-DOS] zoo 1.50 is distributed as an executable file and
  89. X     documentation.
  90. X
  91. X   - [MS-DOS] Sez 2.20 is the current version of Sez, the self-
  92. X     extracting zoo utility, which can convert any zoo archive into
  93. X     an executable file that will extract itself when executed
  94. X
  95. X   - [MS-DOS] Atoz 1.11 is a program that will help do automated
  96. X     conversion of archives, libraries, and squeezed files from any
  97. X     other format into zoo format
  98. X
  99. X   - [MS-DOS] Looz 2.00 is a program that will list, extract,
  100. X     and test zoo archives, and also extract archived programs
  101. X     directly into memory for immediate execution.
  102. X
  103. X   - [VAX/VMS] Vooz 1.00 permits zoo archives to be extracted under
  104. X     VAX/VMS
  105. X
  106. X   - [Generic] Booz 1.01 is a small, fast zoo extractor that needs
  107. X     a C compiler with much less functionality that needed by the
  108. X     full zoo code
  109. X
  110. X                                      -- Rahul Dhesi 1987/07/12
  111. SHAR_EOF
  112. fi
  113. if test -f 'portable.c'
  114. then
  115.     echo shar: "will not over-write existing file 'portable.c'"
  116. else
  117. sed 's/^X//' << \SHAR_EOF > 'portable.c'
  118. X#ifndef LINT
  119. Xstatic char sccsid[]="@(#) portable.c 1.5 87/05/03 16:01:05";
  120. X#endif /* LINT */
  121. X
  122. X#include "options.h"
  123. X/*
  124. XCopyright (C) 1986, 1987 Rahul Dhesi -- All rights reserved
  125. X*/
  126. X/**********************
  127. Xportable.c contains functions needed to make Zoo portable to various
  128. Ximplementations of C.
  129. X
  130. XNote:  Provided a 2's complement machine is used, all functions in
  131. Xthis file are themselves machine-independent and need not be changed
  132. Xwhen implementing Zoo on a different machine.  Some code will choke
  133. Xon 1's complement machines--I think.  
  134. X
  135. XFor machine-dependent declarations see files "machine.h" and "options.h". 
  136. X
  137. XFor machine-dependent functions see file "machine.c"
  138. X*/
  139. X
  140. X/* See if we could just use these for MSC */
  141. X#ifdef MSC
  142. X#ifndef PORTABLE
  143. X#define PORTABLE
  144. X#endif
  145. X#endif
  146. X
  147. X
  148. X#ifdef PORTABLE
  149. X#include <stdio.h>
  150. X#include "various.h"
  151. X#include "zoofns.h"
  152. X
  153. X#include "machine.h"
  154. X#include "zoo.h"
  155. X#include "debug.h"
  156. X#include "assert.h"
  157. X
  158. X#ifdef NEEDCTYP
  159. X#include <ctype.h>              /* for tolower() */
  160. X#endif
  161. X
  162. X#ifdef DEBUG
  163. Xextern int verbose;
  164. X#endif
  165. X
  166. X/* Functions defined for use within this file only.  */
  167. X#ifdef LINT_ARGS
  168. Xlong to_long (BYTE[]);
  169. Xint to_int (BYTE[]);
  170. Xvoid b_to_zooh(struct zoo_header *, BYTE[]);
  171. Xvoid b_to_dir(struct direntry *, BYTE[]);
  172. Xint dir_to_b(BYTE[], struct direntry *);
  173. Xvoid zooh_to_b(BYTE[], struct zoo_header *);
  174. Xvoid splitlong(BYTE[], long);
  175. Xvoid splitint(BYTE[], int);
  176. X#else
  177. Xlong to_long ();
  178. Xint to_int ();
  179. Xvoid b_to_zooh();
  180. Xvoid b_to_dir();
  181. Xint dir_to_b();
  182. Xvoid zooh_to_b();
  183. Xvoid splitlong();
  184. Xvoid splitint();
  185. X#endif
  186. X
  187. Xextern unsigned int crccode;
  188. X
  189. X
  190. X/************************************************************************/
  191. X/*** Following are functions that make up for various implementations ***/
  192. X/*** of C not having certain library routines.                        ***/
  193. X/************************************************************************/
  194. X
  195. X#ifndef STRLWR
  196. X/**********************
  197. Xstrlwr() converts a string to lowercase and returns a pointer to the string 
  198. X*/
  199. Xchar *strlwr (str)
  200. Xchar *str;
  201. X{
  202. X   register char *s;
  203. X   s = str;
  204. X   while (*s != '\0') {
  205. X      *s = toascii(*s);
  206. X      if (isupper(*s))
  207. X         *s = tolower(*s);
  208. X      s++;
  209. X   }
  210. X   return (str);
  211. X}
  212. X#endif /* STRLWR */
  213. X
  214. X/**********************
  215. Xstrcmpi() compares strings just like strcmp() but it does it without regard to
  216. Xcase.
  217. X*/
  218. Xint strcmpi (s1, s2)
  219. Xregister char *s1, *s2;
  220. X{
  221. X   for ( ; tolower(*s1) == tolower(*s2);  s1++, s2++)
  222. X      if (*s1 == '\0')
  223. X         return(0);
  224. X   return(tolower(*s1) - tolower(*s2));
  225. X}
  226. X
  227. X#ifndef MEMSET
  228. X/**********************
  229. Xmemset() exists in Microsoft C and UNIX System V but not in Xenix.  It sets 
  230. Xthe first "cnt" bytes of "dest" to the character "c" and returns a pointer to
  231. X"dest".
  232. X*/
  233. Xchar *memset (dest, c, cnt)
  234. Xchar *dest;
  235. Xint c;
  236. Xunsigned cnt;
  237. X{
  238. X   register unsigned i;
  239. X   for (i = 0; i < cnt; i++) {
  240. X      *(dest + i) = c;
  241. X   }
  242. X}
  243. X#endif /* MEMSET */
  244. X
  245. X#ifndef FPUTCHAR
  246. X/**********************
  247. Xfputchar() writes a character to stdout.  It is identical to putchar
  248. Xbut is a function, not a macro.
  249. X*/
  250. Xint fputchar (c)
  251. Xint c;
  252. X{
  253. X   return (fputc(c, stdout));
  254. X}
  255. X#endif /* FPUTCHAR */
  256. X
  257. X#ifndef TELL
  258. X/**********************
  259. Xtell() returns the current position of the file handle supplied
  260. X*/
  261. Xlong tell (handle)
  262. Xint handle;
  263. X{
  264. X   return (lseek (handle, 0L, 1));     /* seek to current position */
  265. X}
  266. X#endif /* TELL */
  267. X
  268. X/***********************************************************************/
  269. X/*** Following are declarations and functions that are written in a  ***/
  270. X/*** machine-independent way but they implement machine-dependent    ***/
  271. X/*** activities                                                      ***/
  272. X/***********************************************************************/
  273. X
  274. X#ifndef MSC
  275. X/**********************
  276. Xto_long() converts four consecutive bytes, in order of increasing
  277. Xsignificance, to a long integer.  It is used to make Zoo independent of the
  278. Xbyte order of the system.  
  279. X*/
  280. Xlong to_long(data)
  281. XBYTE data[];
  282. X{
  283. X   return (long) ((unsigned long) data[0] | ((unsigned long) data[1] << 8) |
  284. X         ((unsigned long) data[2] << 16) | ((unsigned long) data[3] << 24));
  285. X}
  286. X
  287. X/********************
  288. Xsplitlong() converts a long integer to four consecutive BYTEs in order
  289. Xof increasing significance.
  290. X*/
  291. Xvoid splitlong(bytes, bigword)
  292. XBYTE bytes[];
  293. Xlong bigword;
  294. X{
  295. X   int i;
  296. X   for (i = 0; i < 4; i++) {
  297. X      bytes[i] = bigword & 0xff;
  298. X      bigword = (unsigned long) bigword >> 8;
  299. X   }
  300. X}     
  301. X
  302. X/*******************
  303. Xsplitint() converts an integer to two consecutive BYTEs in order
  304. Xof increasing significance.
  305. X*/
  306. Xvoid splitint(bytes, word)
  307. XBYTE bytes[];
  308. Xint word;
  309. X{
  310. X   bytes[0] = word & 0xff;
  311. X   word = (unsigned int) word >> 8;
  312. X   bytes[1] = word & 0xff;
  313. X}
  314. X
  315. X/**********************
  316. Xto_int() converts two consecutive bytes, in order of increasing
  317. Xsignificance, to an integer, in a machine-independent manner
  318. X*/
  319. Xint to_int(data)
  320. XBYTE data[];
  321. X{
  322. X   return (int) ((unsigned int) data[0] | ((unsigned int) data[1] << 8));
  323. X}
  324. X
  325. X#else /* else of ifndef MSC */
  326. X
  327. Xlong to_long(data)
  328. XBYTE data[];
  329. X{
  330. X   return ( * (long *) data );
  331. X}
  332. X
  333. X/********************
  334. Xsplitlong() converts a long integer to four consecutive BYTEs in order
  335. Xof increasing significance.
  336. X*/
  337. Xvoid splitlong(bytes, bigword)
  338. XBYTE bytes[];
  339. Xlong bigword;
  340. X{
  341. X   * (long *) bytes = bigword;
  342. X}     
  343. X
  344. X/*******************
  345. Xsplitint() converts an integer to two consecutive BYTEs in order
  346. Xof increasing significance.
  347. X*/
  348. Xvoid splitint(bytes, word)
  349. XBYTE bytes[];
  350. Xint word;
  351. X{
  352. X   * (int *) bytes = word;
  353. X}
  354. X
  355. X/**********************
  356. Xto_int() converts two consecutive bytes, in order of increasing
  357. Xsignificance, to an integer.
  358. X*/
  359. Xint to_int(data)
  360. XBYTE data[];
  361. X{
  362. X   return (*(int *) data);
  363. X}
  364. X
  365. X#endif /* ifndef MSC .. else ... */
  366. X
  367. X
  368. X#ifndef FIZ
  369. X/**********************
  370. XFunction frd_zooh() reads the header of a Zoo archive in a machine-
  371. Xindependent manner, from a FILE.
  372. X*/
  373. Xint frd_zooh(zoo_header, zoo_file)
  374. Xstruct zoo_header *zoo_header;
  375. XFILE *zoo_file;
  376. X{
  377. X   int status;
  378. X   BYTE bytes[SIZ_ZOOH];         /* canonical header representation */
  379. X#ifdef DEBUG
  380. X   if (verbose) {
  381. X      printf("At file position [%8lx] ", ftell(zoo_file));
  382. X   }
  383. X#endif
  384. X   status = fread ((char *) bytes, 1, SIZ_ZOOH, zoo_file);
  385. X   b_to_zooh (zoo_header, bytes);   /* convert array to structure */
  386. X#ifdef DEBUG
  387. X   if (verbose) {
  388. X      printf("frd_zooh: reading\n");
  389. X      show_h(zoo_header);
  390. X   }
  391. X#endif
  392. X   if (status < SIZ_ZOOH)
  393. X      return (-1);
  394. X   else
  395. X      return (0);
  396. X}
  397. X#endif /* ifndef FIZ */
  398. X
  399. X
  400. X/**********************
  401. XFunction frd_dir() reads a directory entry in a machine-independent manner,
  402. Xfrom a FILE.
  403. X*/
  404. Xint frd_dir(direntry, zoo_file) 
  405. Xstruct direntry *direntry; 
  406. XFILE *zoo_file;
  407. X{
  408. X   int status;
  409. X   BYTE bytes[MAXDIRSIZE];    /* big enough to hold variable part too */
  410. X
  411. X   /* To simplify things, we read the maximum possible size of the
  412. X   directory entry including the variable size and discard what is not
  413. X   needed */
  414. X#ifdef DEBUG
  415. X   if (verbose) {
  416. X      printf("At file position [%8lx] ", ftell(zoo_file));
  417. X   }
  418. X#endif
  419. X   status = fread ((char *) bytes, 1, MAXDIRSIZE, zoo_file);
  420. X   if (status < SIZ_DIR)
  421. X      return (-1);
  422. X   b_to_dir (direntry, bytes);
  423. X#ifdef DEBUG
  424. X   if (verbose) {
  425. X      printf("frd_dir: reading\n");
  426. X      show_dir(direntry);
  427. X   }
  428. X#endif
  429. X   return (0);
  430. X}
  431. X
  432. X#ifndef FIZ
  433. X/**********************
  434. XFunction rd_zooh() reads a Zoo archive header in a machine-dependent manner,
  435. Xfrom a file handle.
  436. X*/
  437. Xint rd_zooh (header, zoo_han)
  438. Xstruct zoo_header *header;
  439. Xint zoo_han;
  440. X{
  441. X   int status;
  442. X   BYTE bytes[SIZ_ZOOH];
  443. X#ifdef DEBUG
  444. X   if (verbose) {
  445. X      printf("At file position [%8lx] ", tell(zoo_han));
  446. X   }
  447. X#endif
  448. X   status = read (zoo_han, (char *) bytes, SIZ_ZOOH);
  449. X   b_to_zooh (header, bytes);
  450. X#ifdef DEBUG
  451. X   if (verbose) {
  452. X      printf("rd_zooh: reading\n");
  453. X      show_h(header);
  454. X   }
  455. X#endif
  456. X   return (status);
  457. X}
  458. X
  459. X/**********************
  460. XFunction rd_dir() reads a directory entry in a machine-independent manner
  461. Xfrom a handle.
  462. X*/
  463. Xint rd_dir(direntry, zoo_han)
  464. Xstruct direntry *direntry;
  465. Xint zoo_han;
  466. X{
  467. X   int status;
  468. X   BYTE bytes[MAXDIRSIZE];    /* big enough to hold variable part too */
  469. X   /* To simplify things, we read the maximum possible size of the
  470. X   directory entry including the variable size and discard what is not
  471. X   needed */
  472. X#ifdef DEBUG
  473. X   if (verbose) {
  474. X      printf("At file position [%8lx] ", tell(zoo_han));
  475. X   }
  476. X#endif
  477. X   status = read (zoo_han, (char *) bytes, MAXDIRSIZE);
  478. X   if (status < SIZ_DIR)
  479. X      return (-1);
  480. X   b_to_dir (direntry, bytes);
  481. X#ifdef DEBUG
  482. X   if (verbose) {
  483. X      printf("rd_dir: reading\n");
  484. X      show_dir(direntry);
  485. X   }
  486. X#endif
  487. X   return (0);
  488. X}
  489. X
  490. X/***********************
  491. XFunction fwr_dir() writes a directory entry in a machine-independent manner
  492. Xto a FILE.  Return value is -1 on error, else 0.
  493. X*/
  494. Xint fwr_dir(direntry, zoo_file)
  495. Xstruct direntry *direntry;
  496. XFILE *zoo_file;
  497. X{
  498. X   int size;
  499. X   BYTE bytes[MAXDIRSIZE];
  500. X   assert (direntry->type <= 2);
  501. X   size = dir_to_b (bytes, direntry);
  502. X#ifdef DEBUG
  503. X   if (verbose) {
  504. X      printf("At file position [%8lx] ", ftell(zoo_file));
  505. X      printf("fwr_dir: writing\n");
  506. X      show_dir(direntry);
  507. X   }
  508. X#endif
  509. X
  510. X   if (fwrite ((char *) bytes, 1, size, zoo_file) != size)
  511. X      return (-1);
  512. X   else
  513. X      return (0);
  514. X}
  515. X
  516. X/***********************
  517. XFunction wr_dir() writes a directory entry in a machine-independent manner
  518. Xto a handle.  Return value is -1 on error else 0.
  519. X*/
  520. Xint wr_dir(direntry, zoo_han)
  521. Xstruct direntry *direntry;
  522. Xint zoo_han;
  523. X{
  524. X   int size;
  525. X   BYTE bytes[MAXDIRSIZE];
  526. X   assert (direntry->type <= 2);
  527. X   size = dir_to_b (bytes, direntry);
  528. X#ifdef DEBUG
  529. X   if (verbose) {
  530. X      printf("At file position [%8lx] ", tell(zoo_han));
  531. X      printf("wr_dir:  writing\n");
  532. X      show_dir(direntry);
  533. X   }
  534. X#endif
  535. X   if (write (zoo_han, (char *) bytes, size) != size)
  536. X      return (-1);
  537. X   else
  538. X      return (0);
  539. X}
  540. X
  541. X/***********************
  542. XFunction wr_zooh() writes an archive header in a machine-independent manner
  543. Xto a handle.  Return value -1 if error else 0.
  544. X*/
  545. Xint wr_zooh(zoo_header, zoo_han)
  546. Xstruct zoo_header *zoo_header;
  547. Xint zoo_han;
  548. X{
  549. X   BYTE bytes[SIZ_DIR];
  550. X   zooh_to_b (bytes, zoo_header);
  551. X   if (write (zoo_han, (char *) bytes, SIZ_ZOOH) != SIZ_ZOOH)
  552. X      return (-1);
  553. X   else
  554. X      return (0);
  555. X}
  556. X
  557. X/***********************
  558. XFunction fwr_zooh() writes an archive header in a machine-independent manner
  559. Xto a FILE.  Return value is -1 if error else 0.
  560. X*/
  561. Xint fwr_zooh(zoo_header, zoo_file)
  562. Xstruct zoo_header *zoo_header;
  563. XFILE *zoo_file;
  564. X{
  565. X   BYTE bytes[SIZ_DIR];
  566. X   zooh_to_b (bytes, zoo_header);
  567. X   if (fwrite ((char *) bytes, 1, SIZ_ZOOH, zoo_file) != SIZ_ZOOH)
  568. X      return (-1);
  569. X   else
  570. X      return (0);
  571. X}
  572. X
  573. X/***********************
  574. Xb_to_zooh() converts an array of BYTE to a zoo_header structure.
  575. X*/
  576. Xvoid b_to_zooh (zoo_header, bytes)
  577. Xstruct zoo_header *zoo_header;
  578. XBYTE bytes[];
  579. X{
  580. X   int i;
  581. X   for (i = 0; i < SIZ_TEXT; i++)                     /* copy text */
  582. X      zoo_header->text[i] = bytes[TEXT_I + i];
  583. X   zoo_header->zoo_tag = to_long(&bytes[ZTAG_I]);     /* copy zoo_tag */
  584. X   zoo_header->zoo_start = to_long(&bytes[ZST_I]);    /* copy zoo_start */
  585. X   zoo_header->zoo_minus = to_long(&bytes[ZSTM_I]);
  586. X   zoo_header->major_ver = bytes[MAJV_I];          /* copy versions */
  587. X   zoo_header->minor_ver = bytes[MINV_I];
  588. X}
  589. X
  590. X/***********************
  591. Xzooh_to_b() converts a zoo_header structure to an array of BYTE.
  592. X*/
  593. Xvoid zooh_to_b (bytes, zoo_header)
  594. Xstruct zoo_header *zoo_header;
  595. XBYTE bytes[];
  596. X{
  597. X   int i;
  598. X   for (i = 0; i < SIZ_TEXT; i++)                     /* copy text */
  599. X      bytes[TEXT_I + i] = zoo_header->text[i];
  600. X   splitlong (&bytes[ZTAG_I], zoo_header->zoo_tag);
  601. X   splitlong (&bytes[ZST_I], zoo_header->zoo_start);
  602. X   splitlong (&bytes[ZSTM_I], zoo_header->zoo_minus);
  603. X   bytes[MAJV_I] =   zoo_header->major_ver;           /* copy versions */ 
  604. X   bytes[MINV_I] =   zoo_header->minor_ver;
  605. X} /* zooh_to_b() */
  606. X
  607. X/************************
  608. Xdir_to_b() converts a directory entry structure to an array of BYTE.
  609. X*/
  610. Xint dir_to_b (bytes, direntry)
  611. Xstruct direntry *direntry;
  612. XBYTE bytes[];
  613. X{
  614. X   int i;
  615. X   int cursize;
  616. X   int fixsize;
  617. X   splitlong(&bytes[DTAG_I], direntry->zoo_tag);
  618. X   bytes[DTYP_I] = direntry->type ;
  619. X   bytes[PKM_I] = direntry->packing_method ;
  620. X   splitlong(&bytes[NXT_I], direntry->next);
  621. X   splitlong(&bytes[OFS_I], direntry->offset);
  622. X   splitint(&bytes[DAT_I], direntry->date);
  623. X   splitint(&bytes[TIM_I], direntry->time);
  624. X   splitint(&bytes[CRC_I], direntry->file_crc);
  625. X   splitlong(&bytes[ORGS_I], direntry->org_size);
  626. X   splitlong(&bytes[SIZNOW_I], direntry->size_now);
  627. X   bytes[DMAJ_I] = direntry->major_ver;
  628. X   bytes[DMIN_I] = direntry->minor_ver;
  629. X   bytes[DEL_I] = direntry->deleted;
  630. X   bytes[STRUC_I] = direntry->struc;
  631. X   splitlong(&bytes[CMT_I], direntry->comment);
  632. X   splitint(&bytes[CMTSIZ_I], direntry->cmt_size);
  633. X   for (i = 0; i < FNM_SIZ; i++)
  634. X      bytes[FNAME_I + i] = direntry->fname[i];
  635. X   bytes[TZ_I] = NO_TZ;       /* assume unknown */
  636. X   bytes[NAMLEN_I] = 0;
  637. X   bytes[DIRLEN_I] = 0;
  638. X
  639. X   cursize = SIZ_DIR;         /* to count size of directory */
  640. X   fixsize = SIZ_DIR;         /* size of fixed part */
  641. X   assert (direntry->type <= 2);
  642. X   if (direntry->type == 2) { /* handle stuff relevant to type 2 */
  643. X      cursize = SIZ_DIRL;
  644. X      fixsize = SIZ_DIRL;
  645. X      bytes[TZ_I] = direntry->tz;
  646. X      assert(direntry->namlen < 256 && direntry->namlen >= 0);
  647. X      if (direntry->namlen > 0 || direntry->dirlen > 0)
  648. X         cursize += 2;        /* space for namlen and dirlen */
  649. X      if (direntry->namlen > 0) {
  650. X         bytes[NAMLEN_I] = direntry->namlen;
  651. X         for (i = 0; i < direntry->namlen; i++)
  652. X            bytes[LFNAME_I+i] = direntry->lfname[i];
  653. X         cursize += direntry->namlen;
  654. X      } 
  655. X      assert(direntry->dirlen < 256 && direntry->dirlen >= 0);
  656. X      if (direntry->dirlen > 0) {
  657. X         bytes[DIRLEN_I] = direntry->dirlen;
  658. X         for (i = 0; i < direntry->dirlen; i++)
  659. X            bytes[cursize+i] = direntry->dirname[i];
  660. X         cursize += direntry->dirlen;
  661. X      }
  662. X      splitint(&bytes[cursize], direntry->system_id);
  663. X   }
  664. X
  665. X   /* Total length of directory entry is now cursize. */
  666. X   splitint(&bytes[VARDIRLEN_I], cursize - fixsize);
  667. X   assert(cursize == 
  668. X            ((bytes[DIRLEN_I] > 0 || bytes[NAMLEN_I] > 0) ? 2 : 0) +
  669. X            fixsize + bytes[DIRLEN_I] + bytes[NAMLEN_I]
  670. X         );
  671. X
  672. X   /* Do CRC assuming CRC field is zero, and stuff CRC into field. */
  673. X   splitint(&bytes[DCRC_I], 0);           /* fill with zeroes */
  674. X   crccode = 0;
  675. X   addbfcrc(bytes, cursize);              /* update CRC */
  676. X   splitint(&bytes[DCRC_I], crccode);
  677. X
  678. X   /* return total length of directory entry */
  679. X   return (cursize);
  680. X
  681. X
  682. X} /* dir_to_b() */
  683. X#endif /* ifndef FIZ */
  684. X
  685. X/* b_to_dir() converts bytes to directory entry structure.  The CRC of the
  686. Xdirectory bytes, if any, is checked and a zero or nonzero value is returned
  687. Xin direntry->dir_crc according as the check is good or bad */
  688. X
  689. Xvoid b_to_dir(direntry, bytes)
  690. Xstruct direntry *direntry;
  691. XBYTE bytes[];
  692. X{
  693. X   int i;
  694. X   unsigned int savecrc;
  695. X   direntry->zoo_tag = to_long(&bytes[DTAG_I]);
  696. X   direntry->type = bytes[DTYP_I];
  697. X   direntry->packing_method = bytes[PKM_I];
  698. X   direntry->next = to_long(&bytes[NXT_I]);
  699. X   direntry->offset = to_long(&bytes[OFS_I]);
  700. X   direntry->date = to_int(&bytes[DAT_I]);
  701. X   direntry->time = to_int(&bytes[TIM_I]);
  702. X   direntry->file_crc = to_int(&bytes[CRC_I]);
  703. X   direntry->org_size = to_long(&bytes[ORGS_I]);
  704. X   direntry->size_now = to_long(&bytes[SIZNOW_I]);
  705. X   direntry->major_ver = bytes[DMAJ_I];
  706. X   direntry->minor_ver = bytes[DMIN_I];
  707. X   direntry->deleted = bytes[DEL_I];
  708. X   direntry->struc = bytes[STRUC_I];
  709. X   direntry->comment = to_long(&bytes[CMT_I]);
  710. X   direntry->cmt_size = to_int(&bytes[CMTSIZ_I]);
  711. X   for (i = 0; i < FNM_SIZ; i++)
  712. X      direntry->fname[i] = bytes[FNAME_I + i];
  713. X
  714. X   /* start by assuming variable part is zero bytes */
  715. X   direntry->var_dir_len = direntry->dir_crc    = 0;
  716. X   direntry->namlen      = direntry->dirlen     = 0;
  717. X   direntry->lfname[0]   = direntry->dirname[0] = '\0';
  718. X   direntry->tz = NO_TZ;               /* assume unknown */
  719. X   direntry->system_id = SYSID_NIX;    /* default system_id if not present */
  720. X
  721. X   assert (direntry->type <= 2);
  722. X   if (direntry->type == 2) {
  723. X      direntry->var_dir_len = to_int(&bytes[VARDIRLEN_I]);
  724. X      assert(direntry->var_dir_len <= MAXDIRSIZE);
  725. X      if (direntry->var_dir_len > MAXDIRSIZE)
  726. X         direntry->var_dir_len = MAXDIRSIZE;
  727. X      direntry->tz = bytes[TZ_I];   
  728. X      if (direntry->var_dir_len > 0)
  729. X         direntry->namlen = bytes[NAMLEN_I];
  730. X      if (direntry->var_dir_len > 1)
  731. X         direntry->dirlen = bytes[DIRLEN_I];
  732. X      for (i = 0; i < direntry->namlen; i++)
  733. X         direntry->lfname[i] = bytes[LFNAME_I + i];
  734. X      for (i = 0; i < direntry->dirlen; i++)
  735. X         direntry->dirname[i] = bytes[DIRNAME_I + direntry->namlen + i];
  736. X      if (direntry->var_dir_len > direntry->namlen + direntry->dirlen + 2) {
  737. X         direntry->system_id = to_int(&bytes[DIRNAME_I+direntry->namlen+i]);
  738. X      }
  739. X      /* do CRC calculation */
  740. X      savecrc = (unsigned int) to_int(&bytes[DCRC_I]);
  741. X      crccode = 0;
  742. X      splitint(&bytes[DCRC_I], 0);
  743. X      addbfcrc(bytes, SIZ_DIRL + direntry->var_dir_len);
  744. X      direntry->dir_crc = crccode - savecrc;
  745. X   }
  746. X}
  747. X
  748. X#ifdef DEBUG
  749. X/* dump contents of archive header */
  750. Xshow_h (zoo_header)
  751. Xstruct zoo_header *zoo_header;
  752. X{
  753. X   int i;
  754. X   printf ("Header text:\n");
  755. X   for (i = 0; i < SIZ_TEXT-1;  i++)   /* all but trailing ^Z */
  756. X      putchar(zoo_header->text[i]);
  757. X   putchar('\n');
  758. X   printf ("zoo_tag = [%8lx] zoo_start = [%8lx] zoo_minus = [%8lx]\n",
  759. X            zoo_header->zoo_tag, zoo_header->zoo_start, 
  760. X            zoo_header->zoo_minus);
  761. X   printf ("major_ver.minor_ver = [%d.%d]\n",
  762. X            zoo_header->major_ver, zoo_header->minor_ver);
  763. X   printf ("---------\n");
  764. X}
  765. X
  766. X/* dump contents of directory entry */
  767. Xshow_dir (direntry)
  768. Xstruct direntry *direntry;
  769. X{
  770. X   int i;
  771. X   printf ("Directory entry for file [%s][%s]:\n",
  772. X            direntry->fname, direntry->lfname);
  773. X   printf ("tag = [%8lx] type = [%d] PM = [%d] Next = [%8lx] Offset = [%8lx]\n",
  774. X            direntry->zoo_tag, (int) direntry->type, 
  775. X            (int) direntry->packing_method, direntry->next, 
  776. X            direntry->offset);
  777. X   printf ("Orig size = [%ld] Size now = [%ld] dmaj_v.dmin_v = [%d.%d]\n",
  778. X         direntry->org_size, direntry->size_now,
  779. X         (int) direntry->major_ver, (int) direntry->minor_ver);
  780. X   printf ("Struc = [%d] DEL = [%d] comment_offset = [%8lx] cmt_size = [%d]\n",
  781. X         (int) direntry->struc, (int) direntry->deleted, direntry->comment,
  782. X         direntry->cmt_size);
  783. X   printf ("var_dir_len = [%d] TZ = [%d] dir_crc = [%4x]\n",
  784. X            direntry->var_dir_len, (int) direntry->tz, direntry->dir_crc);
  785. X   printf ("system_id = [%d]  dirlen = [%d]  namlen = [%d]\n", 
  786. X            direntry->system_id, direntry->dirlen, direntry->namlen);
  787. X   if (direntry->dirlen > 0)
  788. X      printf ("dirname = [%s]\n", direntry->dirname);
  789. X   printf ("---------\n");
  790. X}
  791. X#endif   /* DEBUG */
  792. X
  793. X#endif   /* PORTABLE */
  794. SHAR_EOF
  795. fi
  796. if test -f 'portable.h'
  797. then
  798.     echo shar: "will not over-write existing file 'portable.h'"
  799. else
  800. sed 's/^X//' << \SHAR_EOF > 'portable.h'
  801. X/* @(#) portable.h 1.3 87/05/03 16:01:22 */
  802. X
  803. X/* Definitions for portable I/O
  804. X
  805. XThe contents of this file are hereby released to the public domain.
  806. X
  807. X                           -- Rahul Dhesi 1986/11/14
  808. X
  809. XDefinitions are:
  810. X
  811. XOPEN        binary open
  812. XCREATE      binary create
  813. XOPEN_T      text open
  814. XCREATE_T    text create
  815. X
  816. XPlus flags for fopen().
  817. X*/
  818. X
  819. X/* 
  820. XMicrosoft C.  The only difference between I/O flags for standard UNIX I/O
  821. Xand Microsoft C is that Microsoft C requires the "O_BINARY" flag in open() 
  822. Xand the "rb" string instead of "r" in fopen().  These are needed to prevent
  823. Xthe library from doing LF <--> CR LF translation.
  824. X*/
  825. X
  826. X#ifdef   MSC
  827. X#define  P_RDWR         S_IWRITE | S_IREAD
  828. X#define  F_WRITE        O_WRONLY
  829. X#define  F_READ         O_RDONLY
  830. X#define  F_RDWR         O_RDWR
  831. X#define  FRDSTR         "rb"     /* readonly string for fopen() */
  832. X#define  FRWSTR         "r+b"    /* read/write string for fopen() */
  833. X#define  CREATE(x,y)    open (x, y|O_CREAT|O_TRUNC|O_BINARY, P_RDWR)
  834. X#define  OPEN(x,y)      open (x, y|O_BINARY)
  835. X#define  CREATE_T(x,y)  open (x, y|O_CREAT|O_TRUNC, P_RDWR)
  836. X#define  OPEN_T(x,y)    open (x, y)
  837. X#define  MKDIR(x)       mkdir(x)
  838. X#endif
  839. X
  840. X#ifdef     DLC
  841. X#define  F_WRITE        O_WRONLY
  842. X#define  F_READ         O_RDONLY
  843. X#define  F_RDWR         O_RDWR
  844. X#define  FRDSTR         "rb"     /* readonly string for fopen() */
  845. X#define  FRWSTR         "r+b"    /* read/write string for fopen() */
  846. X#define  CREATE(x,y)    open (x, 0)
  847. X#define  OPEN(x,y)    open (x, y)
  848. X#define  MKDIR(x)       mkdir(x)
  849. X#endif
  850. X
  851. X
  852. X#ifdef GENERIC
  853. X/* UNIX I/O, but MKDIR() is a no-operation */
  854. X#define  NIX_IO      /* standard UNIX I/O */
  855. X#define  MKDIR(x)
  856. X#endif
  857. X
  858. X/* UNIX System V release 2.1 */
  859. X#ifdef   SYS_V
  860. X#define  NIX_IO      /* standard UNIX I/O */
  861. X#define  MKDIR(x)       mkdir(x) /* define this in sysv.c */
  862. X#endif
  863. X
  864. X/* Xenix  release 3.0 */
  865. X#ifdef   XENIX
  866. X#define  NIX_IO      /* standard UNIX I/O */
  867. X#endif
  868. X
  869. X/* 4.3BSD */
  870. X#ifdef BSD4_3
  871. X#define NIX_IO       /* standard UNIX I/O */
  872. X#define  MKDIR(x)       mkdir(x, 0777)
  873. X#endif
  874. X
  875. X/* Amiga */
  876. X#ifdef MCH_AMIGA
  877. X/* Need to define a macro to make a new directory */
  878. X#define MKDIR(x)        {}
  879. X#define NIX_IO
  880. X#endif
  881. X
  882. X/* Standard UNIX I/O definitions */
  883. X#ifdef   NIX_IO
  884. X/* #define  P_RDWR         S_IWRITE | S_IREAD */
  885. X#define  P_RDWR         0644
  886. X#define  F_WRITE        O_WRONLY
  887. X#define  F_READ         O_RDONLY
  888. X#define  F_RDWR         O_RDWR
  889. X#define  FRDSTR         "r"      /* readonly string for fopen() */
  890. X#define  FRWSTR         "r+"     /* read/write string for fopen() */
  891. X#define  CREATE(x,y)    open (x, y|O_CREAT|O_TRUNC, P_RDWR)
  892. X#define  OPEN(x,y)      open (x, y)
  893. X#define  CREATE_T(x,y)  open (x, y|O_CREAT|O_TRUNC, P_RDWR)
  894. X#define  OPEN_T(x,y)    open (x, y)
  895. X#endif   /* NIX_IO */
  896. X
  897. X/* VAX/VMS version 4.3.  Not yet tested.  */
  898. X#ifdef   VMS
  899. X#define  P_RDWR         0        /* use user's default protection */
  900. X#define  F_WRITE        O_RDWR   /* VAX/VMS random write requires O_RDWR */
  901. X#define  F_READ         O_RDONLY
  902. X#define  F_RDWR         O_RDWR
  903. X#define  FRDSTR         "r"      /* readonly string for fopen() */
  904. X#define  FRWSTR         "r+"     /* read/write string for fopen() */
  905. X#define  CREATE(x,y)    open (x, y|O_CREAT|O_TRUNC, P_RDWR)
  906. X#define  OPEN(x,y)      open (x, y)
  907. X#define  CREATE_T(x,y)  open (x, y|O_CREAT|O_TRUNC, P_RDWR)
  908. X#define  OPEN_T(x,y)    open (x, y)
  909. X#endif
  910. X
  911. X/* MIX C compiler for MS-DOS.  Follows K&R closely. Not yet tested. */
  912. X#ifdef   MIX
  913. X#define  P_RDWR         0
  914. X#define  F_WRITE        1
  915. X#define  F_READ         0
  916. X#define  F_RDWR         2
  917. X#define  FRDSTR         "r"
  918. X#define  FRWSTR         "r+"
  919. X#define  CREATE(x,y)    creat (x,y)
  920. X#define  OPEN(x,y)      open (x,y)
  921. X#define  CREATE_T(x,y)  creat (x,y)
  922. X#define  OPEN_T(x,y)    open (x,y)
  923. X#endif
  924. X
  925. SHAR_EOF
  926. fi
  927. if test -f 'prterror.c'
  928. then
  929.     echo shar: "will not over-write existing file 'prterror.c'"
  930. else
  931. sed 's/^X//' << \SHAR_EOF > 'prterror.c'
  932. X#ifndef LINT
  933. Xstatic char sccsid[]="@(#) prterror.c 1.4 87/05/21 11:37:59";
  934. X#endif /* LINT */
  935. X
  936. X/*
  937. XThe contents of this file are hereby released to the public domain.
  938. X
  939. X                                 -- Rahul Dhesi 1986/11/14
  940. X
  941. X*/
  942. X#include "options.h"
  943. X#include <stdio.h>      /* to make various.h includable */
  944. X#include "various.h"
  945. X/* General error handler.  Input format:
  946. X
  947. X   parameter 1:  'w', 'e', or 'f'.
  948. X
  949. X      'm':  message
  950. X      'M':  message without preceding identification
  951. X      'w':  WARNING
  952. X      'e':  ERROR
  953. X      'f':  FATAL
  954. X      'F':  FATAL but program doesn't exist immediately
  955. X
  956. X   All text printed is preceded by "Zoo:  " or "Ooz:  "  depending
  957. X   upon conditional compilation, except in the case of 'M' messages
  958. X   which are printed without any text being added.
  959. X
  960. X   For messages, the text supplied is printed if and only if the global
  961. X   variable "quiet" is zero.  Control then returns to the caller.
  962. X
  963. X   For warnings, errors, and fatal errors, the variable "quiet" is ignored.
  964. X
  965. X   For warnings and errors, the error message is preceded by the "WARNING:"
  966. X   or "ERROR".  The error message is printed and control returns to the
  967. X   caller.
  968. X
  969. X   For fatal errors, the error message is preceded by "FATAL:" and an
  970. X   error message is printed.  If the option was 'f', the program exits with 
  971. X   a status of 1.  If the option was 'F', control returns to the caller and 
  972. X   it is assumed that the caller will do any cleaning up necessary and then 
  973. X   exit with an error status.
  974. X
  975. X   parameter 2:  The format control string for printf.   
  976. X   parameters 3 and 4 are passed along to printf.
  977. X
  978. X   Note:  printf() is always supplied parameters 3 and 4, even if they were
  979. X   not on the parameter list passed to prterror().  It is assumed that 
  980. X   printf() will only use as many as are specified by the format string.
  981. X   There is a small chance that on some machines, this will cause some
  982. X   kind of stack exception (e.g. if the hardware maintains tag bits in
  983. X   each word on the stack and doesn't allow certain types of data to
  984. X   be arbitrarily accessed).  This is just a theory so far.
  985. X*/
  986. X
  987. Xextern int quiet;
  988. X
  989. X/* These declarations must be equivalent to those in errors.i */
  990. Xchar no_match[] = "No files matched.\n";
  991. Xchar failed_consistency[] = "Archive header failed consistency check.\n";
  992. Xchar invalid_header[] = "Invalid or corrupted archive.\n";
  993. Xchar internal_error[]="Internal error.\n";
  994. Xchar disk_full[]      = "I/O error or disk full.\n";
  995. Xchar bad_directory[]  = "Directory entry in archive is invalid.\n";
  996. Xchar no_memory[] = "Ran out of memory.\n";
  997. Xchar too_many_files[] = "Some filenames ignored -- can only handle %d.\n";
  998. X
  999. X#ifndef OOZ
  1000. Xchar wrong_version[]=
  1001. X   "Zoo %d.%d or later is needed to fully\nmanipulate this archive.\n";
  1002. Xchar cant_process[] = 
  1003. X   "The rest of the archive (%lu bytes) cannot be processed.\n";
  1004. Xchar option_ignored[] = "Ignoring option %c.\n";
  1005. Xchar inv_option[] = "Option %c is invalid.\n";
  1006. Xchar bad_crc[] = "\007Bad CRC, %s probably corrupted\n";
  1007. X#endif
  1008. X
  1009. X#ifdef OOZ
  1010. Xchar could_not_open[] = "Could not open ";
  1011. X#else
  1012. Xchar could_not_open[] = "Could not open %s.\n";
  1013. X#endif
  1014. X
  1015. X/*VARARGS2*/
  1016. Xprterror(level, format, a, b, c)
  1017. Xregister int level;
  1018. Xchar *format, *a, *b, *c;
  1019. X
  1020. X{
  1021. X   char string[120];       /* local format string */
  1022. X   *string = '\0';         /* get a null string to begin with */
  1023. X
  1024. X#ifdef OOZ
  1025. X   strcpy (string, "Ooz:  ");
  1026. X#else
  1027. X   strcpy (string, "Zoo:  ");
  1028. X#endif
  1029. X
  1030. X   switch (level) {
  1031. X      case 'M': *string = '\0';                    /* fall through to 'm' */
  1032. X      case 'm': if (quiet) return; break;
  1033. X      case 'w': strcat (string, "WARNING:  "); break;
  1034. X      case 'e': strcat (string, "ERROR:  ");   break;
  1035. X      case 'F':
  1036. X      case 'f': strcat (string, "FATAL:  ");   break;
  1037. X      default: prterror ('f', internal_error);  /* slick recursive call */
  1038. X   }
  1039. X
  1040. X   strcat (string, format);      /* just append supplied message */
  1041. X
  1042. X#ifdef OOZ
  1043. X   putstr (string);
  1044. X   putstr (a);
  1045. X   putstr (b);
  1046. X#else
  1047. X   printf (string, a, b, c);     /* and print the whole thing */
  1048. X    fflush (stdout);
  1049. X#endif
  1050. X
  1051. X   if (level == 'f')       /* and abort on fatal error 'f' but not 'F' */
  1052. X      exit (1);
  1053. X}
  1054. X
  1055. SHAR_EOF
  1056. fi
  1057. if test -f 'sysv.c'
  1058. then
  1059.     echo shar: "will not over-write existing file 'sysv.c'"
  1060. else
  1061. sed 's/^X//' << \SHAR_EOF > 'sysv.c'
  1062. X#ifndef LINT
  1063. Xstatic char sysvid[]="@(#) sysv.c 1.3 87/06/19 22:21:30";
  1064. X#endif /* LINT */
  1065. X
  1066. X/* machine.c for System V */
  1067. X
  1068. X/*
  1069. XThe contents of this file are hereby released to the public domain.
  1070. X
  1071. X                                    -- Rahul Dhesi  1986/12/31
  1072. X*/
  1073. X
  1074. X/****************
  1075. Xfunction trunc() truncates a file.
  1076. X*/
  1077. X
  1078. Xint trunc (handle)
  1079. Xint handle;
  1080. X{
  1081. X}
  1082. X
  1083. X/****************
  1084. XDate and time functions are standard UNIX-style functions.  "nixtime.i"
  1085. Xwill be included by machine.c.
  1086. X*/
  1087. X
  1088. X#include <sys/types.h>
  1089. X#include <sys/stat.h>
  1090. X#include <time.h>
  1091. X
  1092. X/* Function isadir() returns 1 if the supplied handle is a directory, 
  1093. Xelse it returns 0.  
  1094. X*/
  1095. X
  1096. Xint isadir (handle)
  1097. Xint handle;
  1098. X{
  1099. X   struct stat buf;           /* buffer to hold file information */
  1100. X   if (fstat (handle, &buf) == -1) {
  1101. X      return (0);             /* inaccessible -- assume not dir */
  1102. X   } else {
  1103. X      if (buf.st_mode & S_IFDIR)
  1104. X         return (1);
  1105. X      else
  1106. X         return (0);
  1107. X   }
  1108. X}
  1109. X
  1110. X/****************
  1111. XFunction fixfname() converts the supplied filename to a syntax
  1112. Xlegal for the host system.  It is used during extraction.
  1113. X*/
  1114. X
  1115. Xchar *fixfname(fname)
  1116. Xchar *fname;
  1117. X{
  1118. X   return (fname); /* default is no-op */
  1119. X}
  1120. X
  1121. Xextern long timezone;   /* defined by library routine */
  1122. Xextern int daylight;
  1123. X
  1124. X/* Function gettz(), returns the offset from GMT in seconds of the
  1125. Xlocal time, taking into account daylight savings time */
  1126. Xlong gettz()
  1127. X{
  1128. X   tzset();
  1129. X    /*
  1130. X    Timezone fix thanks to Bill Davidsen <wedu@ge-crd.ARPA>
  1131. X    {uunet | philabs | seismo!rochester}!steinmetz!crdos1!davidsen
  1132. X    */
  1133. X   return (timezone - daylight*3600);
  1134. X}
  1135. X
  1136. X/* Standard UNIX-compatible time functions */
  1137. X#include "nixtime.i"
  1138. X
  1139. X/* 
  1140. XMake a directory.  System V has no system accessible to ordinary
  1141. Xusers to make a new directory.  Hence we spawn a shell and hope
  1142. X/bin/mkdir is there.  Since /bin/mkdir gives a nasty error message
  1143. Xif it fails, we call it only if nothing already exists by the
  1144. Xname of the needed directory.
  1145. X*/
  1146. X
  1147. Xint mkdir(dirname)
  1148. Xchar *dirname;
  1149. X{
  1150. X   char cmd[PATHSIZE+7];
  1151. X   if (!exists(dirname)) {
  1152. X      strcpy(cmd, "/bin/mkdir ");
  1153. X      strcat(cmd, dirname);
  1154. X      return (system(cmd));
  1155. X   }
  1156. X}
  1157. SHAR_EOF
  1158. fi
  1159. if test -f 'various.h'
  1160. then
  1161.     echo shar: "will not over-write existing file 'various.h'"
  1162. else
  1163. sed 's/^X//' << \SHAR_EOF > 'various.h'
  1164. X/* @(#) various.h 1.2 87/05/03 16:01:39 */
  1165. X
  1166. X/*
  1167. XThe contents of this file are hereby released to the public domain.
  1168. X
  1169. X                           -- Rahul Dhesi 1986/11/14
  1170. X*/
  1171. X
  1172. X/*
  1173. XThis files gives definitions for most external functions used by Zoo.
  1174. XIf LINT_ARGS is defined, ANSI-style function prototypes are used, else
  1175. Xnormal K&R function declarations are used.
  1176. X
  1177. XNote:  Always precede this file with an include of stdio.h because it uses
  1178. Xthe predefined type FILE.
  1179. X*/
  1180. X
  1181. X#ifdef LINT_ARGS
  1182. XFILE *fdopen (int, char *);
  1183. XFILE *fopen (char *, char *);
  1184. Xchar *fgets (char *, int, FILE *);
  1185. Xchar *gets (char *);
  1186. Xchar *malloc (unsigned int);
  1187. Xchar *realloc (char *, unsigned int);
  1188. Xchar *strcat (char *, char *);
  1189. Xchar *strchr (char *, int);
  1190. Xchar *strcpy (char *, char *);
  1191. Xchar *strdup (char *);
  1192. Xchar *strlwr (char *);
  1193. Xchar *strncat (char *, char *, unsigned int);
  1194. Xchar *strncpy (char *, char *, unsigned int);
  1195. Xchar *strrchr (char *, int);
  1196. Xint trunc (int);
  1197. Xint close (int);
  1198. Xint creat (char *, int);
  1199. Xint fclose (FILE *);
  1200. Xint fflush (FILE *);
  1201. Xint fgetc (FILE *);
  1202. Xint fgetchar ();
  1203. Xint fprintf (FILE *, char *,);
  1204. Xint fputc (int, FILE *);
  1205. Xint fputchar (int);
  1206. Xint fputs (char *, FILE *);
  1207. Xint fread (char *, int, int, FILE *);
  1208. Xint fseek (FILE *, long, int);
  1209. Xint fwrite (char *, int, int, FILE *);
  1210. Xint open (char *, int,);
  1211. Xint printf (char *,);
  1212. Xint read (int, char *, unsigned int);
  1213. Xint rename (char *, char *);
  1214. Xint setmode (int, int);
  1215. Xint strcmp (char *, char *);
  1216. Xint strncmp (char *, char *, unsigned int);
  1217. Xint unlink (char *);
  1218. Xint write (int, char *, unsigned int);
  1219. Xlong ftell (FILE *);
  1220. Xlong lseek (int, long, int);
  1221. Xlong tell (int);
  1222. Xunsigned int strlen (char *);
  1223. X
  1224. X#else
  1225. X
  1226. XFILE *fdopen ();
  1227. XFILE *fopen ();
  1228. Xchar *fgets ();
  1229. Xchar *gets ();
  1230. Xchar *malloc ();
  1231. Xchar *realloc ();
  1232. Xchar *strcat ();
  1233. Xchar *strchr ();
  1234. Xchar *strcpy ();
  1235. Xchar *strdup ();
  1236. Xchar *strlwr ();
  1237. Xchar *strncat ();
  1238. Xchar *strncpy ();
  1239. Xchar *strrchr ();
  1240. Xint trunc ();
  1241. Xint close ();
  1242. Xint creat ();
  1243. Xint fclose ();
  1244. Xint fflush ();
  1245. Xint fgetc ();
  1246. Xint fgetchar ();
  1247. Xint fprintf ();
  1248. Xint fputc ();
  1249. Xint fputchar ();
  1250. Xint fputs ();
  1251. Xint fread ();
  1252. Xint fseek ();
  1253. Xint fwrite ();
  1254. Xint open ();
  1255. Xint printf ();
  1256. Xint read ();
  1257. Xint rename ();
  1258. Xint setmode ();
  1259. Xint strcmp ();
  1260. Xint strncmp ();
  1261. Xint unlink ();
  1262. Xint write ();
  1263. Xlong ftell ();
  1264. Xlong lseek ();
  1265. Xlong tell ();
  1266. Xunsigned int strlen ();
  1267. X#endif
  1268. SHAR_EOF
  1269. fi
  1270. if test -f 'version.c'
  1271. then
  1272.     echo shar: "will not over-write existing file 'version.c'"
  1273. else
  1274. sed 's/^X//' << \SHAR_EOF > 'version.c'
  1275. X/* @(#) version.c 1.7 1987/07/12 13:04:47  */
  1276. Xchar version[] = "version 1.51 (1987/07/12 13:04:47)";
  1277. SHAR_EOF
  1278. fi
  1279. if test -f 'version.h'
  1280. then
  1281.     echo shar: "will not over-write existing file 'version.h'"
  1282. else
  1283. sed 's/^X//' << \SHAR_EOF > 'version.h'
  1284. X/* @(#) version.h 1.5 Compiled:  1987/07/12 13:04:46  */
  1285. X#define VERSION "INTERNAL VERSION 87/07/12 13:04:46"
  1286. SHAR_EOF
  1287. fi
  1288. if test -f 'zoo.1'
  1289. then
  1290.     echo shar: "will not over-write existing file 'zoo.1'"
  1291. else
  1292. sed 's/^X//' << \SHAR_EOF > 'zoo.1'
  1293. X.\"    @(#) zoo.1 1.17 87/07/12 23:13:15 */
  1294. X.\"
  1295. X.\" For formatting with nroff:
  1296. X.\"   tbl zoo.1 | nroff -man | col
  1297. X.\" It should be possible to use troff instead of nroff but I haven't
  1298. X.\" confirmed this.  R.D.
  1299. X.\"
  1300. X.TH ZOO 1 "Jul 12, 1987"
  1301. X.AT 3
  1302. X.de sh
  1303. X.br
  1304. X.ne 5
  1305. X.PP
  1306. X\fB\\$1\fR
  1307. X.PP
  1308. X..
  1309. X.SH NAME
  1310. Xzoo \- manipulate archives of files in compressed form
  1311. X.SH SYNOPSIS
  1312. X.B zoo 
  1313. X.RB { acDehlLPTuUvx }[ cdEfInMNoOpPquv1:./@ ]
  1314. Xarchive [file] ...
  1315. X.sp 0
  1316. X.B zoo \-command 
  1317. Xarchive [file] ...
  1318. X.sp 0
  1319. X.B zoo h
  1320. X.SH DESCRIPTION
  1321. X.I Zoo
  1322. Xis used to create and maintain collections of files in compressed form.
  1323. XIt uses a Lempel-Ziv compression algorithm that gives space savings
  1324. Xin the range of 20% to 80% depending on the type of file data.  
  1325. X.PP
  1326. XThe command
  1327. X.I zoo 
  1328. X.B h
  1329. Xgives summary of commands.
  1330. X.PP
  1331. X.I Zoo 
  1332. Xwill not add an archive to itself, nor add the
  1333. Xarchive's backup (with 
  1334. X.B .bak 
  1335. Xextension to the filename) to the archive.
  1336. X.PP
  1337. X.I Zoo 
  1338. Xhas two types of commands:  Expert commands, which consist of one command 
  1339. Xletter followed by zero or more modifier characters, and Novice commands, 
  1340. Xwhich consist of a hyphen (`-') followed by a command word that may
  1341. Xbe abbreviated.  Expert commands are case-sensitive but Novice commands
  1342. Xare not.
  1343. X.PP
  1344. XWhen 
  1345. X.I zoo
  1346. Xadds a file to an existing archive, it marks as deleted any
  1347. Xalready-archived file with the same name.  (Directory prefixes are
  1348. Xsignificant in this comparison if and only if directory names are
  1349. Xbeing stored.)
  1350. XDeleted files may be later undeleted.
  1351. XArchives may be packed to recover space occupied by deleted files.
  1352. X.PP
  1353. XAll commands assume that the archive name ends with the characters
  1354. X.B .zoo
  1355. Xunless a different extension is supplied.  
  1356. X.PP
  1357. X.B Novice commands
  1358. X.PP
  1359. XNovice commands may be abbreviated to a hyphen followed by at least
  1360. Xone command character.  Each Novice command works in two stages. 
  1361. XFirst, the command does its intended work.  Then, if the result was
  1362. Xthat one or more files were deleted in the specified archive, the
  1363. Xarchive is packed.  If packing occurs, the original unpacked archive
  1364. Xis always left behind with an extension of
  1365. X.B .bak.
  1366. X.PP
  1367. XNo Novice command ever stores the directory prefix of a file.
  1368. XWhen a Novice command is used to add a file to an archive, any 
  1369. Xalready-archived file with the same name, regardless of the 
  1370. Xdirectory prefix, is marked deleted.
  1371. X.PP
  1372. XThe Novice commands are as follows.
  1373. X.PP
  1374. X.TP 8
  1375. X.B \-add
  1376. XAdds the specified files to the archive.
  1377. X.PP
  1378. X.TP
  1379. X.B \-freshen
  1380. XAdds a specified file to the archive if and only if an older file by
  1381. Xthe same name already exists in the archive.
  1382. X.PP
  1383. X.TP
  1384. X.B \-delete
  1385. XDeletes the specified files from the archive.
  1386. X.PP
  1387. X.TP
  1388. X.B \-update
  1389. XAdds a specified file to the archive either:  if an older file by
  1390. Xthe same name already exists in the archive or:  if a file by the
  1391. Xsame name does not already exist in the archive.
  1392. X.PP
  1393. X.TP
  1394. X.B \-extract
  1395. XExtracts the specified files from the archive.  If no file is specified
  1396. Xall files are extracted.
  1397. X.PP
  1398. X.TP
  1399. X.B \-move
  1400. XEquivalent to 
  1401. X.B \-add
  1402. Xexcept that source files are deleted after addition.
  1403. X.PP
  1404. X.TP
  1405. X.B \-print
  1406. XEquivalent to 
  1407. X.B \-extract
  1408. Xexcept that extracted data are sent to standard output.
  1409. X.PP
  1410. X.TP
  1411. X.B \-list
  1412. XGives information about the specified archived files including any
  1413. Xattached comments.  If no files are
  1414. Xspecified all files are listed.  Deleted files are not listed.
  1415. X.PP
  1416. X.TP
  1417. X.B \-test
  1418. XEquivalent to
  1419. X.B \-extract
  1420. Xexcept that the extracted data are not saved but any errors encountered
  1421. Xare reported.
  1422. X.PP
  1423. X.TP
  1424. X.B \-comment
  1425. XAllows the user to add or update comments attached to archived files.
  1426. XWhen prompted, the user may:  type a carriage return to skip the file,
  1427. Xleaving any
  1428. Xcurrent comment unchanged;  or type a (possibly null) comment of up
  1429. Xto 65,535 characters terminated 
  1430. Xby
  1431. X.B /end
  1432. X(case-insensitive) on
  1433. Xa separate line;  or type the end-of-file character (normally control D)
  1434. Xto skip all remaining files. 
  1435. X.PP
  1436. X.TP
  1437. X.B \-delete
  1438. XDeletes the specified files.
  1439. X.PP
  1440. X.ne 16
  1441. X.nf
  1442. XThe correspondence between Novice and Expert commands is as follows.
  1443. X.PP
  1444. X.\" Table formatting for troff thanks to Bill Davidsen <wedu@ge-crd.ARPA>
  1445. X.sp
  1446. X.in \nW-1
  1447. X.TS H
  1448. Xtab(@);
  1449. Xl l l.
  1450. XNovice@@Equivalent
  1451. XCommand@Description@Expert Command
  1452. X_
  1453. X-add@add files to archive@aP:
  1454. X-extract@extract files from archive@x
  1455. X-move@move files to archive@aMP:
  1456. X-test@test archive integrity@xNd
  1457. X-print@extract files and send to standard output@xp
  1458. X-delete@delete files from archive@DP
  1459. X-list@list information about archived files@v
  1460. X-update@update archive by adding new or newer files@aunP:
  1461. X-freshen@freshen archive by adding newer files@auP:
  1462. X-comment@allows user to attach comments to files@c
  1463. X.TE
  1464. X.in
  1465. X.fi
  1466. X.PD
  1467. X.PP
  1468. X.sh "Expert commands"
  1469. XThe general format of expert commands is:
  1470. X.PP
  1471. X.I zoo
  1472. X.RB { acDehlPTuUvx }[ cdEfInMNoOpPquv1:./@ ]
  1473. Xarchive [file] ...
  1474. X.PP
  1475. XThe characters enclosed within {} are commands.  Choose any one of
  1476. Xthese.  The characters enclosed within [] just to the right of the {}
  1477. Xare modifiers and zero or more of these may immediately follow the
  1478. Xcommand character.  All combinations of command and modifier characters
  1479. Xmay not be valid.
  1480. X.PP
  1481. XFiles are added to an archive with the command:
  1482. X.PP
  1483. X.I zoo 
  1484. X.RB { au }[ cfIMnPqu: ]
  1485. Xarchive [file] ...
  1486. X.PP
  1487. XCommand characters are:
  1488. X.PP
  1489. X.TP
  1490. X.B a
  1491. XAdd each specified file to archive.  Any already-archived file with the
  1492. Xsame name is marked as deleted.
  1493. X.PP
  1494. X.TP 
  1495. X.B u
  1496. XDo an update of the archive.  A specified file is added to the
  1497. Xarchive only if a copy of it is already in the archive and the copy
  1498. Xbeing added is newer than the copy already in the archive.  
  1499. X.PP
  1500. XThe following modifiers are specific to these commands.
  1501. X.PP
  1502. X.TP 
  1503. X.B M
  1504. XMove files to archive.  This makes 
  1505. X.I zoo 
  1506. Xdelete (unlink) the original files after they have been added to the
  1507. Xarchive.  Files are deleted after addition of all files to the archive is
  1508. Xcomplete and after any requested packing of the archive has been done,
  1509. Xand only if 
  1510. X.I zoo 
  1511. Xdetected no errors.
  1512. X.PP
  1513. X.TP 
  1514. X.B n
  1515. XAdd new files only.  A specified file is added only if it isn't
  1516. Xalready in the archive.
  1517. X.PP
  1518. X.TP 
  1519. X.B P
  1520. XPack archive after files have been added.  
  1521. X.PP
  1522. X.TP
  1523. X.B u
  1524. XApplied to the
  1525. X.B a
  1526. Xcommand, this modifier makes it behave identically to the
  1527. X.B u
  1528. Xcommand.
  1529. X.sp 1
  1530. XThe combination of the 
  1531. X.B n
  1532. Xmodifier with the
  1533. X.B u
  1534. Xmodifier or 
  1535. X.B u
  1536. Xcommand causes addition of a file to the archive either 
  1537. Xif the file is not already in the archive, 
  1538. X.I or 
  1539. Xif the file is already in the archive but the archived
  1540. Xcopy is older than the copy being added.
  1541. X.PP
  1542. X.TP
  1543. X.B :
  1544. XDo not store directory names.  In the absence of this modifier
  1545. X.I zoo
  1546. Xstores the full pathname of each archived file.
  1547. X.PP
  1548. X.TP
  1549. X.B I
  1550. XRead filenames to be archived from standard input.  
  1551. X.I Zoo 
  1552. Xwill read
  1553. Xits standard input and assume that each line of text contains a
  1554. Xfilename.  Under the **IX family, the entire line is used.  Under
  1555. XMS-DOS and AmigaDOS, 
  1556. X.I zoo
  1557. Xassumes that the filename is terminated by a blank, tab,
  1558. Xor newline; thus it is permissible for the line of text to
  1559. Xcontain more than one field separated by white space, and only the
  1560. Xfirst field will be used.
  1561. X.sp 1
  1562. XUnder the **IX family of operating systems, 
  1563. X.I zoo
  1564. Xcan be used as follows in a pipeline:
  1565. X.IP "" 10
  1566. Xfind . -print | zoo aI sources
  1567. X.IP "" 5
  1568. X.sp 1
  1569. XIf the
  1570. X.B I
  1571. Xmodifier is specified, no filenames may be supplied on the command
  1572. Xline itself.
  1573. X.PP
  1574. XFiles are extracted from an archive with the command:
  1575. X.sp 1
  1576. X.I zoo 
  1577. X.RB { ex }[ dNoOpq./@ ]
  1578. Xarchive [file] ...
  1579. X.PP
  1580. XThe 
  1581. X.B e 
  1582. Xand 
  1583. X.B x 
  1584. Xcommands are synonymous.  If no file was specified, all files are
  1585. Xextracted from the archive.
  1586. X.PP
  1587. XThe following modifiers are specific to the e and x commands:
  1588. X.PP
  1589. X.TP 
  1590. X.B N
  1591. XDo not save extracted data but report any errors encountered.  
  1592. X.PP
  1593. X.TP
  1594. X.B O
  1595. XOverwrite files.  Normally, if a file being extracted would 
  1596. Xoverwrite an already-existing file of the same name, 
  1597. X.I zoo 
  1598. Xasks you if
  1599. Xyou really want to overwrite it.  You may answer the question with
  1600. X`y', which means yes, overwrite; or `n', which means no, don't
  1601. Xoverwrite; or `a', which means assume the answer is `y' for this
  1602. Xand all subsequent files.  The 
  1603. X.B O 
  1604. Xmodifier makes 
  1605. X.I zoo
  1606. Xassume that files 
  1607. Xmay always be overwritten.  
  1608. X.sp 1
  1609. XThe 
  1610. X.B O, N, 
  1611. Xand 
  1612. X.B p 
  1613. Xmodifiers are mutually exclusive.
  1614. X.PP
  1615. X.TP
  1616. X.B o    
  1617. XThis is equivalent to the 
  1618. X.B O 
  1619. Xmodifier if and only if it
  1620. Xis given at least twice.  It is otherwise ignored.
  1621. X.PP
  1622. X.TP
  1623. X.B p    
  1624. XPipe extracted data to standard output.  Error messages are piped to 
  1625. Xstandard output as well.  However, if a bad CRC is detected, an error
  1626. Xmessage is sent both to standard error and to standard output.
  1627. X.PP
  1628. X.TP
  1629. X.B /
  1630. XExtract to original pathname.  Any needed directories must already
  1631. Xexist.  In the absence of this modifier all files are extracted into
  1632. Xthe current directory.  If this modifier is doubled as
  1633. X.BR // ,
  1634. Xneeded directories need not exist and are created if necessary.
  1635. X.PP
  1636. XArchived files are listed with the command:
  1637. X.sp 1
  1638. X.I zoo
  1639. X.RB { lLv }[ adfv@ ] 
  1640. X.RB archive[ .zoo ]
  1641. X[file] ...
  1642. X.PP
  1643. X.TP
  1644. X.B l
  1645. XInformation presented includes the date and time of each file, its
  1646. Xoriginal and current (compressed) sizes, and the percentage
  1647. Xsize decrease due to compression (labelled CF or compression factor).
  1648. XIf no filename is supplied all files are listed except deleted files.
  1649. X.PP
  1650. X.TP
  1651. X.B L
  1652. XThis is identical to the
  1653. X.B l
  1654. Xcommand except that all supplied arguments must be archives and the contents of each are listed.
  1655. X.PP
  1656. X.TP
  1657. X.B v
  1658. XThis causes a verbose listing, which additionally shows
  1659. Xany comment attached to each file.  Using the 
  1660. X.B v
  1661. Xmodifier with the
  1662. X.B l
  1663. Xcommand has the same effect.
  1664. X.PP
  1665. XThe following modifier is specific to the archive list commands:
  1666. X.PP
  1667. X.TP
  1668. X.B a
  1669. XThis gives a single-line format containing both each filename and the
  1670. Xname of the archive, sorted by archive name.  It is especially useful
  1671. Xwith the
  1672. X.B L
  1673. Xcommand, since the result can be further sorted on any field to give a
  1674. Xmaster listing of the entire contents of a set of archives.
  1675. X.PP
  1676. XFiles may be deleted and undeleted from an archive with the following
  1677. Xcommands:
  1678. X.sp 1
  1679. X.I zoo
  1680. X.RB { DU }[ Pq1 ]
  1681. Xarchive file ...
  1682. X.PP
  1683. XThe 
  1684. X.B D
  1685. Xcommand deletes the specified files and the 
  1686. X.B U
  1687. Xcommand undeletes the specified files.  The
  1688. X.B 1
  1689. Xmodifier (the digit one, not the letter ell) forces deletion or undeletion
  1690. Xof at most one file.  If multiple instances of the same file exist
  1691. Xin an archive, use of the
  1692. X.B 1
  1693. Xmodifier may allow selective extraction of one of these.
  1694. X.PP
  1695. XComments may be added to an archive with the command:
  1696. X.sp 1
  1697. X.I zoo
  1698. X.B c
  1699. Xarchive
  1700. X.PP
  1701. XThis behaves identically to the
  1702. X.B \-comment
  1703. Xcommand.
  1704. X.PP
  1705. XThe timestamp of an archive may be adjusted with the command:
  1706. X.sp 1
  1707. X.I zoo
  1708. X.BR T [ q ]
  1709. Xarchive
  1710. X.PP
  1711. X.I Zoo 
  1712. Xnormally attempts to maintain the timestamp of an archive to reflect
  1713. Xthe age of the newest file stored in it.  Should the timestamp ever be
  1714. Xincorrect it can be fixed with the
  1715. X.B T
  1716. Xcommand.
  1717. X.PP
  1718. XAn archive may be packed with the command:
  1719. X.sp 1
  1720. X.I zoo
  1721. X.BR P [ EPq ]
  1722. Xarchive
  1723. X.PP
  1724. XIf the backup copy of the archive already exists, 
  1725. X.I zoo
  1726. Xwill refuse to
  1727. Xpack the archive unless the
  1728. X.B P
  1729. Xmodifier is also given.  The
  1730. X.B E
  1731. Xmodifier causes 
  1732. X.I zoo
  1733. Xnot to save a backup copy of the original archive
  1734. Xafter packing.  A unique temporary file in the current directory
  1735. Xis used to initially hold the packed archive.  This file will be
  1736. Xleft behind if packing is interrupted or if for some reason this
  1737. Xfile cannot be renamed to the name of the original archive when
  1738. Xpacking is complete.
  1739. X.PP
  1740. XPacking removes any garbage data appended to an archive because of
  1741. XXmodem file transfer and also recovers space used by comments
  1742. Xthat were replaced.
  1743. X.PP
  1744. X.sh "General modifiers"
  1745. X.PP
  1746. XThe following modifiers are applicable to several commands:
  1747. X.PP
  1748. X.TP 
  1749. X.B c
  1750. XApplied to the
  1751. X.B a
  1752. Xand
  1753. X.B u
  1754. Xcommands, this causes the user to be prompted 
  1755. Xfor a comment for each file added to the archive.  If the file
  1756. Xbeing added has replaced a file already in the archive, any comment
  1757. Xattached to the replaced file is shown to the user and becomes
  1758. Xattached to the newly-added file unless the user changes it.
  1759. XPossible user responses are as described for the
  1760. X.B \-comment
  1761. Xcommand.  Applied to the archive list command
  1762. X.B l,
  1763. Xthe 
  1764. X.B c
  1765. Xmodifier causes the listing of any comments attached to archived files.
  1766. X.PP
  1767. X.TP
  1768. X.B \.
  1769. XIn conjunction with
  1770. X.B /
  1771. Xor
  1772. X.B //
  1773. Xthis modifier causes any extracted pathname beginning with `/' to be
  1774. Xinterpreted relative to the current directory, resulting in 
  1775. Xthe possible creation of a subtree rooted at the current directory.
  1776. XIn conjunction with the command
  1777. X.B P
  1778. Xthe
  1779. X.B .
  1780. Xmodifier causes the packed archive to be created in the current
  1781. Xdirectory.  This is intended to allow users with limited disk
  1782. Xspace but multiple disk drives to pack large archives.
  1783. X.PP
  1784. X.TP 
  1785. X.B d
  1786. XMost commands that act on an archive act only on files that are
  1787. Xnot deleted.  The
  1788. X.B d
  1789. Xmodifier makes commands act on both normal and deleted files.  If
  1790. Xdoubled as
  1791. X.B dd,
  1792. Xthis modifier forces selection only of deleted files. 
  1793. X.PP
  1794. X.TP
  1795. X.B f
  1796. XApplied to the
  1797. X.B a
  1798. Xand
  1799. X.B u
  1800. Xcommands, the
  1801. X.B f
  1802. Xmodifier causes fast archiving by adding files without compression.
  1803. XApplied to
  1804. X.B l
  1805. Xit causes a fast listing of files in a multicolumn format.
  1806. X.PP
  1807. X.TP 
  1808. X.B q
  1809. XBe quiet.  Normally 
  1810. X.I zoo
  1811. Xlists the name of each file and what action it is performing.  The
  1812. X.B q
  1813. Xmodifier suppresses this.  When files are being extracted to standard
  1814. Xoutput, the
  1815. X.B q
  1816. Xmodifier suppresses the header preceding each file.  
  1817. X.sp 1
  1818. XError messages are
  1819. Xnever suppressed.
  1820. X.PP
  1821. X.TP
  1822. X.B @
  1823. XExtract or list beginning at position n, where n is a decimal number
  1824. Xfollowing the
  1825. X.B @
  1826. Xsign without any intervening spaces.  This may be used to recover
  1827. Xdata from a damaged archive by skipping the damaged part.  The
  1828. Xnumber specified must be the position within the archive of an
  1829. Xundamaged directory entry.  This position is usually obtained from
  1830. X.I fiz(1).
  1831. X.PP
  1832. X.sh "Wildcard handling"
  1833. XUnder the **IX family of operating systems, 
  1834. Xthe shell normally expands wildcards to a list of matching files.  Wildcards 
  1835. Xthat are meant to match files within an archive must therefore
  1836. Xbe escaped or quoted.  When selecting files to be added to an archive,
  1837. Xwildcard conventions are as defined for the shell.  When selecting
  1838. Xfiles from within an archive, wildcard handling is done by
  1839. X.I zoo
  1840. Xas described below.
  1841. X.PP
  1842. XUnder MS-DOS and AmigaDOS, quoting of wildcards is not needed.
  1843. XAll wildcard expansion of filenames is done by
  1844. X.I zoo,
  1845. Xand wildcards inside directory names are expanded only
  1846. Xwhen listing or extracting files but not when adding them.
  1847. X.PP
  1848. XThe wildcard syntax interpreted by 
  1849. X.I zoo
  1850. Xis limited to the following characters.
  1851. X.PP
  1852. X.TP
  1853. X.B *
  1854. XMatches any sequence of zero or more characters.
  1855. X.PP
  1856. X.TP
  1857. X.B \?
  1858. XMatches any single character.
  1859. X.sp 1
  1860. XArbitrary combinations of 
  1861. X.B *
  1862. Xand 
  1863. X.B ?
  1864. Xare allowed.
  1865. X.PP
  1866. X.TP
  1867. X.B /
  1868. XIf a supplied pattern contains a slash anywhere in it, then the
  1869. Xslash separating any directory prefix from the filename must be
  1870. Xmatched explicitly.  If a supplied pattern contains
  1871. Xno slashes, the match is selective only on the filename.
  1872. X.PP
  1873. X.TP
  1874. X.B c-c
  1875. XTwo characters separated by a hyphen specify a character range.  All
  1876. Xfilenames beginning with those characters will match.  The character
  1877. Xrange is meaningful only by itself or preceded by a directory name.
  1878. XIt is not specially interpreted if it is part of a filename.
  1879. X.PP
  1880. XMS-DOS users should note that 
  1881. X.I zoo 
  1882. Xdoes not treat the dot as
  1883. Xa special character, and it does not ignore characters following
  1884. Xan asterisk.  Thus 
  1885. X.B * 
  1886. Xmatches all filenames;
  1887. X.B *.* 
  1888. Xmatches
  1889. Xfilenames containing a dot;
  1890. X.B *_* 
  1891. Xmatches filenames
  1892. Xcontaining an underscore;  and 
  1893. X.B *z 
  1894. Xmatches all filenames
  1895. Xthat end with the character 
  1896. X.B z,
  1897. Xwhether or not they contain
  1898. Xa dot.
  1899. X.SH FILES
  1900. XxXXXXXX \- temporary file used during packing
  1901. X.sp 0
  1902. X.RB archive_name. bak
  1903. X\- backup of archive
  1904. X.SH "SEE ALSO"
  1905. Xcompress(1), fiz(1)
  1906. X.SH BUGS
  1907. XStandard input cannot be archived nor can a created archive be sent
  1908. Xto standard output.  Spurious error messages may appear if the
  1909. Xfilename of an archive is too long.
  1910. X.PP
  1911. XSince
  1912. X.I zoo
  1913. Xnever archives any file with the same name as the archive or its
  1914. Xbackup (regardless of any path prefixes), care should be taken 
  1915. Xto make sure that a file to be archived does not coincidentally have 
  1916. Xthe same name as the archive it is being added to. It usually suffices 
  1917. Xto make sure that no file being archived is itself a 
  1918. X.I zoo
  1919. Xarchive.
  1920. X.PP
  1921. XOnly regular files are archived; directories and devices are not.
  1922. X.PP
  1923. XEarly versions of MS-DOS have a bug that prevents "." from referring
  1924. Xto the root directory;  this leads to anomalous results if the
  1925. Xextraction of paths beginning with a dot is attempted.
  1926. X.PP
  1927. XIt is not currently possible to create a
  1928. X.I zoo
  1929. Xarchive containing all
  1930. X.I zoo
  1931. Xarchives that do not contain themselves.
  1932. X.SH DIAGNOSTICS
  1933. XError messages are intended to be self-explanatory and are divided into
  1934. Xthree categories.  WARNINGS are intended to inform the user of an
  1935. Xunusual situation, such as a CRC error during extraction, or
  1936. X.BR \-freshen ing
  1937. Xof an archive containing a file newer than one specified on
  1938. Xthe command line.  ERRORS are fatal to one file, but execution
  1939. Xcontinues with the next file if any.  FATAL errors cause execution to
  1940. Xbe aborted.  The occurrence of any of these causes an exit status of
  1941. X1.  Normal termination without any errors gives an exit status of 0.
  1942. X.SH "FUTURE DIRECTIONS"
  1943. XA revised version of 
  1944. X.I zoo
  1945. Xis in the works which will allow numbering of multiple versions of a
  1946. Xfile and automatically perform end-of-line conversion for text files
  1947. Xmoved between dissimilar systems.  It will be upward and downward
  1948. Xcompatible with existing versions of 
  1949. X.I zoo.
  1950. X.SH THANKS
  1951. XThanks are due to:
  1952. X.PP
  1953. XPaul Homchick, who provided numerous detailed reports about some
  1954. Xnasty bugs.
  1955. X.PP
  1956. XBill Davidsen, who fixed
  1957. X.I "zoo's"
  1958. Xhandling of daylight savings time
  1959. Xand also provided changes to make this manual format correctly
  1960. Xwith
  1961. X.I troff.
  1962. X.SH AUTHOR
  1963. XRahul Dhesi
  1964. SHAR_EOF
  1965. fi
  1966. exit 0
  1967. #    End of shell archive
  1968. -- 
  1969. Rahul Dhesi         UUCP:  {ihnp4,seismo}!{iuvax,pur-ee}!bsu-cs!dhesi
  1970.  
  1971. -- 
  1972.  
  1973. Rich $alz
  1974. Cronus Project, BBN Labs            rsalz@bbn.com
  1975. Moderator, comp.sources.unix            sources@uunet.uu.net
  1976.