home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 419b.lha / pax_v1.1 / pax.diff < prev    next >
Text File  |  1990-09-27  |  86KB  |  4,049 lines

  1. Prereq: 1
  2. diff -c pax/PATCHLEVEL pax.amiga/PATCHLEVEL
  3. *** pax/PATCHLEVEL    Sat Feb 18 12:52:01 1989
  4. --- pax.amiga/PATCHLEVEL    Fri Oct  6 04:20:44 1989
  5. ***************
  6. *** 1,2
  7. ! Patchlevel 1
  8.   $Id: PATCHLEVEL,v 1.2 89/02/12 10:09:03 mark Exp $
  9.  
  10. --- 1,2 -----
  11. ! Patchlevel 1a
  12.   $Id: PATCHLEVEL,v 1.2 89/02/12 10:09:03 mark Exp $
  13. diff -c pax/Makefile pax.amiga/Makefile
  14. *** pax/Makefile    Mon Mar 13 11:31:27 1989
  15. --- pax.amiga/Makefile    Sun Sep 24 19:15:35 1989
  16. ***************
  17. *** 26,34
  18.   # Set CFLAGS to whatever makes your C compiler happy.  Be sure to include 
  19.   # the definition of $(POSIX) in the flag.
  20.   #
  21. ! CFLAGS = -O $(POSIX)
  22. ! CC = cc
  23. ! P    = &
  24.   
  25.   #
  26.   # Set LIBS to any additional libraries that you need linked in with pax.
  27.  
  28. --- 26,36 -----
  29.   # Set CFLAGS to whatever makes your C compiler happy.  Be sure to include 
  30.   # the definition of $(POSIX) in the flag.
  31.   #
  32. ! CFLAGS = -O $(POSIX) -i:h/ -cf
  33. ! CC = lc
  34. ! RM = delete
  35. ! #RM = rm -f
  36. ! P   = 
  37.   
  38.   #
  39.   # Set LIBS to any additional libraries that you need linked in with pax.
  40. ***************
  41. *** 33,39
  42.   #
  43.   # Set LIBS to any additional libraries that you need linked in with pax.
  44.   #
  45. ! LIBS =    -lgetopt
  46.   
  47.   #
  48.   # Set LFLAGS to whatever makes your linker happy
  49.  
  50. --- 35,41 -----
  51.   #
  52.   # Set LIBS to any additional libraries that you need linked in with pax.
  53.   #
  54. ! LIBS =  -lgetopt
  55.   
  56.   #
  57.   # Set LFLAGS to whatever makes your linker happy
  58. ***************
  59. *** 44,50
  60.   # Set COPY to the name of the command to use to copy pax to cpio and
  61.   # tar.  Usually it is 'ln'.
  62.   #
  63. ! COPY=ln
  64.   
  65.   #
  66.   # Set LINTFLAGS to whatever makes your implementation of lint happy.  If
  67.  
  68. --- 46,52 -----
  69.   # Set COPY to the name of the command to use to copy pax to cpio and
  70.   # tar.  Usually it is 'ln'.
  71.   #
  72. ! COPY=copy
  73.   
  74.   #
  75.   # Set LINTFLAGS to whatever makes your implementation of lint happy.  If
  76. ***************
  77. *** 57,63
  78.   # BINDIR - points to the directory in which you want the final pax, tar and
  79.   # cpio binaries installed in.
  80.   #
  81. ! BINDIR = /usr/local/bin
  82.   
  83.   #
  84.   # MANDIR - specify the directory in which the man pages will be installed
  85.  
  86. --- 59,65 -----
  87.   # BINDIR - points to the directory in which you want the final pax, tar and
  88.   # cpio binaries installed in.
  89.   #
  90. ! BINDIR = local:bin
  91.   
  92.   #
  93.   # MANDIR - specify the directory in which the man pages will be installed
  94. ***************
  95. *** 83,89
  96.   #    to this directory and choose the DIROBJ lines.  Please note that this 
  97.   #    version of dirent has been modified to work as a stand-alone. 
  98.   #
  99. ! DIRENT=
  100.   #DIRENT= -ldirent
  101.   #DIROBJ= msd_dir.obj msd_dio.obj getopt.obj
  102.   
  103.  
  104. --- 85,91 -----
  105.   #    to this directory and choose the DIROBJ lines.  Please note that this 
  106.   #    version of dirent has been modified to work as a stand-alone. 
  107.   #
  108. ! DIRENT= :lib/local.lib
  109.   #DIRENT= -ldirent
  110.   #DIROBJ= msd_dir.obj msd_dio.obj getopt.obj
  111.   
  112. ***************
  113. *** 118,124
  114.       ln $(BINDIR)/pax $(BINDIR)/tar
  115.       ln $(BINDIR)/pax $(BINDIR)/cpio
  116.       cp $(PMAN1) $(MAN1)
  117. ! #    cp $(PMAN5) $(MAN5)
  118.   
  119.   clean:
  120.       rm -f $(OBJECT)
  121.  
  122. --- 120,126 -----
  123.       ln $(BINDIR)/pax $(BINDIR)/tar
  124.       ln $(BINDIR)/pax $(BINDIR)/cpio
  125.       cp $(PMAN1) $(MAN1)
  126. ! #   cp $(PMAN5) $(MAN5)
  127.   
  128.   clean:
  129.       $(RM) $(OBJECT)
  130. ***************
  131. *** 121,128
  132.   #    cp $(PMAN5) $(MAN5)
  133.   
  134.   clean:
  135. !     rm -f $(OBJECT)
  136. !     rm -f $(PROGS) a.out *.BAK *.bak 
  137.   
  138.   lint:
  139.       lint $(LINTFLAGS) $(SOURCE)
  140.  
  141. --- 123,130 -----
  142.   #   cp $(PMAN5) $(MAN5)
  143.   
  144.   clean:
  145. !     $(RM) $(OBJECT)
  146. !     $(RM) $(PROGS) a.out *.BAK *.bak 
  147.   
  148.   lint:
  149.       lint $(LINTFLAGS) $(SOURCE)
  150. ***************
  151. *** 128,135
  152.       lint $(LINTFLAGS) $(SOURCE)
  153.   
  154.   pax :$P $(OBJECT)
  155. !     $(CC) $(CFLAGS) $(LDFLAGS) -o pax $(OBJECT) $(DIRENT) $(LIBS)
  156. !     : link @linkit
  157.   
  158.   tar: pax
  159.       rm -f tar
  160.  
  161. --- 130,138 -----
  162.       lint $(LINTFLAGS) $(SOURCE)
  163.   
  164.   pax :$P $(OBJECT)
  165. !     blink with pax.lnk
  166. ! #    $(CC) $(CFLAGS) $(LDFLAGS) -o pax $(OBJECT) $(DIRENT) $(LIBS)
  167. ! #    : link @linkit
  168.   
  169.   tar: pax
  170.       $(RM) tar
  171. ***************
  172. *** 132,138
  173.       : link @linkit
  174.   
  175.   tar: pax
  176. !     rm -f tar
  177.       $(COPY) pax tar
  178.   
  179.   cpio: pax
  180.  
  181. --- 135,141 -----
  182.   #    : link @linkit
  183.   
  184.   tar: pax
  185. !     $(RM) tar
  186.       $(COPY) pax tar
  187.   
  188.   cpio: pax
  189. ***************
  190. *** 136,142
  191.       $(COPY) pax tar
  192.   
  193.   cpio: pax
  194. !     rm -f cpio
  195.       $(COPY) pax cpio
  196.   
  197.   $(OBJECT): $(HEADERS)
  198.  
  199. --- 139,145 -----
  200.       $(COPY) pax tar
  201.   
  202.   cpio: pax
  203. !     $(RM) cpio
  204.       $(COPY) pax cpio
  205.   
  206.   $(OBJECT): $(HEADERS)
  207. diff -c pax/buffer.c pax.amiga/buffer.c
  208. *** pax/buffer.c    Sat Feb 18 12:59:39 1989
  209. --- pax.amiga/buffer.c    Sun Sep 24 22:15:42 1989
  210. ***************
  211. *** 6,16
  212.    *
  213.    * DESCRIPTION
  214.    *
  215. !  *    These functions handle buffer manipulations for the archiving
  216. !  *    formats.  Functions are provided to get memory for buffers, 
  217. !  *    flush buffers, read and write buffers and de-allocate buffers.  
  218. !  *    Several housekeeping functions are provided as well to get some 
  219. !  *    information about how full buffers are, etc.
  220.    *
  221.    * AUTHOR
  222.    *
  223.  
  224. --- 6,16 -----
  225.    *
  226.    * DESCRIPTION
  227.    *
  228. !  *  These functions handle buffer manipulations for the archiving
  229. !  *  formats.  Functions are provided to get memory for buffers, 
  230. !  *  flush buffers, read and write buffers and de-allocate buffers.  
  231. !  *  Several housekeeping functions are provided as well to get some 
  232. !  *  information about how full buffers are, etc.
  233.    *
  234.    * AUTHOR
  235.    *
  236. ***************
  237. *** 14,20
  238.    *
  239.    * AUTHOR
  240.    *
  241. !  *    Mark H. Colburn, NAPS International (mark@jhereg.mn.org)
  242.    *
  243.    * Sponsored by The USENIX Association for public distribution. 
  244.    *
  245.  
  246. --- 14,20 -----
  247.    *
  248.    * AUTHOR
  249.    *
  250. !  *  Mark H. Colburn, NAPS International (mark@jhereg.mn.org)
  251.    *
  252.    * Sponsored by The USENIX Association for public distribution. 
  253.    *
  254. ***************
  255. *** 32,38
  256.    * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  257.    * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  258.    *
  259. !  * $Log:    buffer.c,v $
  260.    * Revision 1.2  89/02/12  10:04:02  mark
  261.    * 1.2 release fixes
  262.    * 
  263.  
  264. --- 32,38 -----
  265.    * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  266.    * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  267.    *
  268. !  * $Log:    buffer.c,v $
  269.    * Revision 1.2  89/02/12  10:04:02  mark
  270.    * 1.2 release fixes
  271.    * 
  272. ***************
  273. *** 50,55
  274.   /* Headers */
  275.   
  276.   #include "pax.h"
  277.   
  278.   
  279.   /* Function Prototypes */
  280.  
  281. --- 50,58 -----
  282.   /* Headers */
  283.   
  284.   #include "pax.h"
  285. + #ifdef AMIGA
  286. + #  include "local.h"
  287. + #endif
  288.   
  289.   /* Function Prototypes */
  290.   
  291. ***************
  292. *** 51,57
  293.   
  294.   #include "pax.h"
  295.   
  296.   /* Function Prototypes */
  297.   
  298.   #ifdef __STDC__
  299.  
  300. --- 54,59 -----
  301.   #  include "local.h"
  302.   #endif
  303.   
  304.   /* Function Prototypes */
  305.   
  306.   #ifdef __STDC__
  307. ***************
  308. *** 81,90
  309.    *
  310.    * DESCRIPTION
  311.    *
  312. !  *    Inentry reads an archive entry from the archive file and writes it
  313. !  *    out the the named file.  If we are in PASS mode during archive
  314. !  *    processing, the pass() function is called, otherwise we will
  315. !  *    extract from the archive file.
  316.    *
  317.    *    Inentry actaully calls indata to process the actual data to the
  318.    *    file.
  319.  
  320. --- 83,92 -----
  321.    *
  322.    * DESCRIPTION
  323.    *
  324. !  *  Inentry reads an archive entry from the archive file and writes it
  325. !  *  out the the named file.  If we are in PASS mode during archive
  326. !  *  processing, the pass() function is called, otherwise we will
  327. !  *  extract from the archive file.
  328.    *
  329.    *  Inentry actually calls indata to process the data to the
  330.    *  file.
  331. ***************
  332. *** 86,93
  333.    *    processing, the pass() function is called, otherwise we will
  334.    *    extract from the archive file.
  335.    *
  336. !  *    Inentry actaully calls indata to process the actual data to the
  337. !  *    file.
  338.    *
  339.    * PARAMETERS
  340.    *
  341.  
  342. --- 88,95 -----
  343.    *  processing, the pass() function is called, otherwise we will
  344.    *  extract from the archive file.
  345.    *
  346. !  *  Inentry actually calls indata to process the data to the
  347. !  *  file.
  348.    *
  349.    * PARAMETERS
  350.    *
  351. ***************
  352. *** 91,99
  353.    *
  354.    * PARAMETERS
  355.    *
  356. !  *    char    *name    - name of the file to extract from the archive
  357. !  *    Stat    *asb    - stat block of the file to be extracted from the
  358. !  *              archive.
  359.    *
  360.    * RETURNS
  361.    *
  362.  
  363. --- 93,101 -----
  364.    *
  365.    * PARAMETERS
  366.    *
  367. !  *  char    *name   - name of the file to extract from the archive
  368. !  *  Stat    *asb    - stat block of the file to be extracted from the
  369. !  *            archive.
  370.    *
  371.    * RETURNS
  372.    *
  373. ***************
  374. *** 97,103
  375.    *
  376.    * RETURNS
  377.    *
  378. !  *     Returns zero if successful, -1 otherwise. 
  379.    */
  380.   
  381.   #ifdef __STDC__
  382.  
  383. --- 99,105 -----
  384.    *
  385.    * RETURNS
  386.    *
  387. !  *  Returns zero if successful, -1 otherwise. 
  388.    */
  389.   
  390.   #ifdef __STDC__
  391. ***************
  392. *** 119,132
  393.   
  394.       if ((ofd = openout(name, asb, linkp = linkfrom(name, asb), 0)) > 0) {
  395.       if (asb->sb_size || linkp == (Link *)NULL || linkp->l_size == 0) {
  396. !         close(indata(ofd, asb->sb_size, name));
  397. !     } else if ((ifd = open(linkp->l_path->p_name, O_RDONLY)) < 0) {
  398. !         warn(linkp->l_path->p_name, strerror());
  399. !     } else {
  400. !         passdata(linkp->l_path->p_name, ifd, name, ofd);
  401. !         close(ifd);
  402. !         close(ofd);
  403. !     }
  404.       } else {
  405.       return(buf_skip((OFFSET) asb->sb_size) >= 0);
  406.       }
  407.  
  408. --- 121,134 -----
  409.   
  410.       if ((ofd = openout(name, asb, linkp = linkfrom(name, asb), 0)) > 0) {
  411.       if (asb->sb_size || linkp == (Link *)NULL || linkp->l_size == 0) {
  412. !            close(indata(ofd, asb->sb_size, name));
  413. !         } else if ((ifd = open(linkp->l_path->p_name, O_RDONLY)) < 0) {
  414. !             warn(linkp->l_path->p_name, strerror());
  415. !         } else {
  416. !             passdata(linkp->l_path->p_name, ifd, name, ofd);
  417. !             close(ifd);
  418. !             close(ofd);
  419. !         }
  420.       } else {
  421.           return(buf_skip((OFFSET) asb->sb_size) >= 0);
  422.       }
  423. ***************
  424. *** 128,134
  425.           close(ofd);
  426.       }
  427.       } else {
  428. !     return(buf_skip((OFFSET) asb->sb_size) >= 0);
  429.       }
  430.       tstamp[0] = (!f_pass && f_access_time) ? asb->sb_atime : time((time_t *) 0);
  431.       tstamp[1] = f_mtime ? asb->sb_mtime : time((time_t *) 0);
  432.  
  433. --- 130,136 -----
  434.               close(ofd);
  435.           }
  436.       } else {
  437. !         return(buf_skip((OFFSET) asb->sb_size) >= 0);
  438.       }
  439.       tstamp[0] = (!f_pass && f_access_time) ? asb->sb_atime : time((time_t *) 0);
  440.       tstamp[1] = f_mtime ? asb->sb_mtime : time((time_t *) 0);
  441. ***************
  442. *** 141,151
  443.    *
  444.    * DESCRIPTION
  445.    *
  446. !  *    Outdata transfers data from the named file to the archive buffer.
  447. !  *    It knows about the file padding which is required by tar, but no
  448. !  *    by cpio.  Outdata continues after file read errors, padding with 
  449. !  *    null characters if neccessary.   Closes the input file descriptor 
  450. !  *    when finished.
  451.    *
  452.    * PARAMETERS
  453.    *
  454.  
  455. --- 143,153 -----
  456.    *
  457.    * DESCRIPTION
  458.    *
  459. !  *  Outdata transfers data from the named file to the archive buffer.
  460. !  *  It knows about the file padding which is required by tar, but not
  461. !  *  by cpio.  Outdata continues after file read errors, padding with 
  462. !  *  null characters if neccessary.   Closes the input file descriptor 
  463. !  *  when finished.
  464.    *
  465.    * PARAMETERS
  466.    *
  467. ***************
  468. *** 149,157
  469.    *
  470.    * PARAMETERS
  471.    *
  472. !  *    int    fd    - file descriptor of file to read data from
  473. !  *    char   *name    - name of file
  474. !  *    OFFSET    size    - size of the file
  475.    *
  476.    */
  477.   
  478.  
  479. --- 151,159 -----
  480.    *
  481.    * PARAMETERS
  482.    *
  483. !  *  int fd  - file descriptor of file to read data from
  484. !  *  char   *name    - name of file
  485. !  *  OFFSET  size    - size of the file
  486.    *
  487.    */
  488.   
  489. ***************
  490. *** 172,178
  491.       int             got;
  492.       int             oops;
  493.       uint            avail;
  494. !     int            pad;
  495.       char           *buf;
  496.   
  497.       oops = got = 0;
  498.  
  499. --- 174,180 -----
  500.       int             got;
  501.       int             oops;
  502.       uint            avail;
  503. !     int         pad;
  504.       char           *buf;
  505.   
  506.       oops = got = 0;
  507. ***************
  508. *** 177,183
  509.   
  510.       oops = got = 0;
  511.       if (pad = (size % BLOCKSIZE)) {
  512. !     pad = (BLOCKSIZE - pad);
  513.       }
  514.       while (size) {
  515.       avail = buf_out_avail(&buf);
  516.  
  517. --- 179,185 -----
  518.   
  519.       oops = got = 0;
  520.       if (pad = (size % BLOCKSIZE)) {
  521. !         pad = (BLOCKSIZE - pad);
  522.       }
  523.       while (size) {
  524.           avail = buf_out_avail(&buf);
  525. ***************
  526. *** 180,202
  527.       pad = (BLOCKSIZE - pad);
  528.       }
  529.       while (size) {
  530. !     avail = buf_out_avail(&buf);
  531. !     size -= (chunk = size < avail ? (uint) size : avail);
  532. !     if (oops == 0 && (got = read(fd, buf, (unsigned int) chunk)) < 0) {
  533. !         oops = -1;
  534. !         warn(name, strerror());
  535. !         got = 0;
  536. !     }
  537. !     if (got < chunk) {
  538. !         if (oops == 0) {
  539. !         oops = -1;
  540. !         }
  541. !         warn(name, "Early EOF");
  542. !         while (got < chunk) {
  543. !         buf[got++] = '\0';
  544. !         }
  545. !     }
  546. !     buf_use(chunk);
  547.       }
  548.       close(fd);
  549.       if (ar_format == TAR) {
  550.  
  551. --- 182,204 -----
  552.           pad = (BLOCKSIZE - pad);
  553.       }
  554.       while (size) {
  555. !         avail = buf_out_avail(&buf);
  556. !         size -= (chunk = size < avail ? (uint) size : avail);
  557. !         if (oops == 0 && (got = read(fd, buf, (unsigned int) chunk)) < 0) {
  558. !             oops = -1;
  559. !             warn(name, strerror());
  560. !             got = 0;
  561. !         }
  562. !         if (got < chunk) {
  563. !             if (oops == 0) {
  564. !                 oops = -1;
  565. !             }
  566. !             warn(name, "Early EOF");
  567. !             while (got < chunk) {
  568. !                 buf[got++] = '\0';
  569. !             }
  570. !         }
  571. !         buf_use(chunk);
  572.       }
  573.       close(fd);
  574.       if (ar_format == TAR) {
  575. ***************
  576. *** 200,206
  577.       }
  578.       close(fd);
  579.       if (ar_format == TAR) {
  580. !     buf_pad((OFFSET) pad);
  581.       }
  582.   }
  583.   
  584.  
  585. --- 202,208 -----
  586.       }
  587.       close(fd);
  588.       if (ar_format == TAR) {
  589. !         buf_pad((OFFSET) pad);
  590.       }
  591.   }
  592.   
  593. ***************
  594. *** 209,217
  595.    *
  596.    * DESCRIPTION
  597.    *
  598. !  *    Write out an End-Of-Tape record.  We actually zero at least one 
  599. !  *    record, through the end of the block.  Old tar writes garbage after 
  600. !  *    two zeroed records -- and PDtar used to.
  601.    */
  602.   
  603.   #ifdef __STDC__
  604.  
  605. --- 211,219 -----
  606.    *
  607.    * DESCRIPTION
  608.    *
  609. !  *  Write out an End-Of-Tape record.  We actually zero at least one
  610. !  *  record, through the end of the block.  Old tar writes garbage after
  611. !  *  two zeroed records -- and PDtar used to.
  612.    */
  613.   
  614.   #ifdef __STDC__
  615. ***************
  616. *** 228,235
  617.       char            header[M_STRLEN + H_STRLEN + 1];
  618.   
  619.       if (ar_format == TAR) {
  620. !     /* write out two zero blocks for trailer */
  621. !     pad = 2 * BLOCKSIZE;
  622.       } else {
  623.       if (pad = (total + M_STRLEN + H_STRLEN + TRAILZ) % BLOCKSIZE) {
  624.           pad = BLOCKSIZE - pad;
  625.  
  626. --- 230,237 -----
  627.       char            header[M_STRLEN + H_STRLEN + 1];
  628.   
  629.       if (ar_format == TAR) {
  630. !         /* write out two zero blocks for trailer */
  631. !         pad = 2 * BLOCKSIZE;
  632.       } else {
  633.           if (pad = (total + M_STRLEN + H_STRLEN + TRAILZ) % BLOCKSIZE) {
  634.               pad = BLOCKSIZE - pad;
  635. ***************
  636. *** 231,244
  637.       /* write out two zero blocks for trailer */
  638.       pad = 2 * BLOCKSIZE;
  639.       } else {
  640. !     if (pad = (total + M_STRLEN + H_STRLEN + TRAILZ) % BLOCKSIZE) {
  641. !         pad = BLOCKSIZE - pad;
  642. !     }
  643. !     strcpy(header, M_ASCII);
  644. !     sprintf(header + M_STRLEN, H_PRINT, 0, 0,
  645. !                0, 0, 0, 1, 0, (time_t) 0, TRAILZ, pad);
  646. !     outwrite(header, M_STRLEN + H_STRLEN);
  647. !     outwrite(TRAILER, TRAILZ);
  648.       }
  649.       buf_pad((OFFSET) pad);
  650.       outflush();
  651.  
  652. --- 233,246 -----
  653.           /* write out two zero blocks for trailer */
  654.           pad = 2 * BLOCKSIZE;
  655.       } else {
  656. !         if (pad = (total + M_STRLEN + H_STRLEN + TRAILZ) % BLOCKSIZE) {
  657. !             pad = BLOCKSIZE - pad;
  658. !         }
  659. !         strcpy(header, M_ASCII);
  660. !         sprintf(header + M_STRLEN, H_PRINT, 0, 0,
  661. !                0, 0, 0, 1, 0, (time_t) 0, TRAILZ, pad);
  662. !         outwrite(header, M_STRLEN + H_STRLEN);
  663. !         outwrite(TRAILER, TRAILZ);
  664.       }
  665.       buf_pad((OFFSET) pad);
  666.       outflush();
  667. ***************
  668. *** 244,250
  669.       outflush();
  670.   }
  671.   
  672. !  
  673.   /* outwrite -  write archive data
  674.    *
  675.    * DESCRIPTION
  676.  
  677. --- 246,252 -----
  678.       outflush();
  679.   }
  680.   
  681.   /* outwrite -  write archive data
  682.    *
  683.    * DESCRIPTION
  684. ***************
  685. *** 249,257
  686.    *
  687.    * DESCRIPTION
  688.    *
  689. !  *    Writes out data in the archive buffer to the archive file.  The
  690. !  *    buffer index and the total byte count are incremented by the number
  691. !  *    of data bytes written.
  692.    *
  693.    * PARAMETERS
  694.    *    
  695.  
  696. --- 251,259 -----
  697.    *
  698.    * DESCRIPTION
  699.    *
  700. !  *  Writes out data in the archive buffer to the archive file.  The
  701. !  *  buffer index and the total byte count are incremented by the number
  702. !  *  of data bytes written.
  703.    *
  704.    * PARAMETERS
  705.    *  
  706. ***************
  707. *** 254,262
  708.    *    of data bytes written.
  709.    *
  710.    * PARAMETERS
  711. !  *    
  712. !  *    char   *idx    - pointer to data to write
  713. !  *    uint    len    - length of the data to write
  714.    */
  715.   
  716.   #ifdef __STDC__
  717.  
  718. --- 256,264 -----
  719.    *  of data bytes written.
  720.    *
  721.    * PARAMETERS
  722. !  *  
  723. !  *  char   *idx - pointer to data to write
  724. !  *  uint    len - length of the data to write
  725.    */
  726.   
  727.   #ifdef __STDC__
  728. ***************
  729. *** 266,273
  730.   #else
  731.   
  732.   void outwrite(idx, len)
  733. ! char           *idx;    /* pointer to data to write */
  734. ! uint            len;    /* length of data to write */
  735.   
  736.   #endif
  737.   {
  738.  
  739. --- 268,275 -----
  740.   #else
  741.   
  742.   void outwrite(idx, len)
  743. ! char           *idx;    /* pointer to data to write */
  744. ! uint            len;    /* length of data to write */
  745.   
  746.   #endif
  747.   {
  748. ***************
  749. *** 277,295
  750.   
  751.       endx = idx + len;
  752.       while (want = endx - idx) {
  753. !     if (bufend - bufidx < 0) {
  754. !         fatal("Buffer overlow in out_write\n");
  755. !     }
  756. !     if ((have = bufend - bufidx) == 0) {
  757. !         outflush();
  758. !     }
  759. !     if (have > want) {
  760. !         have = want;
  761. !     }
  762. !     memcpy(bufidx, idx, (int) have);
  763. !     bufidx += have;
  764. !     idx += have;
  765. !     total += have;
  766.       }
  767.   }
  768.   
  769.  
  770. --- 279,297 -----
  771.   
  772.       endx = idx + len;
  773.       while (want = endx - idx) {
  774. !         if (bufend - bufidx < 0) {
  775. !             fatal("Buffer overlow in out_write\n");
  776. !         }
  777. !         if ((have = bufend - bufidx) == 0) {
  778. !             outflush();
  779. !         }
  780. !         if (have > want) {
  781. !             have = want;
  782. !         }
  783. !         memcpy(bufidx, idx, (int) have);
  784. !         bufidx += have;
  785. !         idx += have;
  786. !         total += have;
  787.       }
  788.   }
  789.   
  790. ***************
  791. *** 298,306
  792.    *
  793.    * DESCRIPTION
  794.    *
  795. !  *    Copies a file from one place to another.  Doesn't believe in input 
  796. !  *    file descriptor zero (see description of kludge in openin() comments). 
  797. !  *    Closes the provided output file descriptor. 
  798.    *
  799.    * PARAMETERS
  800.    *
  801.  
  802. --- 300,308 -----
  803.    *
  804.    * DESCRIPTION
  805.    *
  806. !  *  Copies a file from one place to another.  Doesn't believe in input 
  807. !  *  file descriptor zero (see description of kludge in openin() comments). 
  808. !  *  Closes the provided output file descriptor. 
  809.    *
  810.    * PARAMETERS
  811.    *
  812. ***************
  813. *** 304,313
  814.    *
  815.    * PARAMETERS
  816.    *
  817. !  *    char    *from    - input file name (old file)
  818. !  *    int    ifd    - input file descriptor
  819. !  *    char    *to    - output file name (new file)
  820. !  *    int    ofd    - output file descriptor
  821.    */
  822.   
  823.   #ifdef __STDC__
  824.  
  825. --- 306,315 -----
  826.    *
  827.    * PARAMETERS
  828.    *
  829. !  *  char    *from   - input file name (old file)
  830. !  *  int ifd - input file descriptor
  831. !  *  char    *to - output file name (new file)
  832. !  *  int ofd - output file descriptor
  833.    */
  834.   
  835.   #ifdef __STDC__
  836. ***************
  837. *** 329,347
  838.       char            block[BUFSIZ];
  839.   
  840.       if (ifd) {
  841. !     lseek(ifd, (OFFSET) 0, 0);
  842. !     sparse = 0;
  843. !     while ((got = read(ifd, block, sizeof(block))) > 0
  844. !            && (sparse = ar_write(ofd, block, (uint) got)) >= 0) {
  845. !         total += got;
  846. !     }
  847. !     if (got) {
  848. !         warn(got < 0 ? from : to, strerror());
  849. !     } else if (sparse > 0
  850. !          && (lseek(ofd, (OFFSET)(-sparse), 1) < 0
  851. !              || write(ofd, block, (uint) sparse) != sparse)) {
  852. !         warn(to, strerror());
  853. !     }
  854.       }
  855.       close(ofd);
  856.   }
  857.  
  858. --- 331,341 -----
  859.       char            block[BUFSIZ];
  860.   
  861.       if (ifd) {
  862. !     lseek(ifd, (OFFSET) 0, 0);
  863. !     sparse = 0;
  864. !     while ((got = read(ifd, block, sizeof(block))) > 0
  865. !            && (sparse = ar_write(ofd, block, (uint) got)) >= 0) {
  866. !         total += got;
  867.       }
  868.       if (got) {
  869.           warn(got < 0 ? from : to, strerror());
  870. ***************
  871. *** 343,348
  872.           warn(to, strerror());
  873.       }
  874.       }
  875.       close(ofd);
  876.   }
  877.   
  878.  
  879. --- 337,350 -----
  880.              && (sparse = ar_write(ofd, block, (uint) got)) >= 0) {
  881.           total += got;
  882.       }
  883. +     if (got) {
  884. +         warn(got < 0 ? from : to, strerror());
  885. +     } else if (sparse > 0
  886. +          && (lseek(ofd, (OFFSET)(-sparse), 1) < 0
  887. +              || write(ofd, block, (uint) sparse) != sparse)) {
  888. +         warn(to, strerror());
  889. +     }
  890. +     }
  891.       close(ofd);
  892.   }
  893.   
  894. ***************
  895. *** 351,360
  896.    *
  897.    * DESCRIPTION
  898.    *
  899. !  *    buf_allocate allocates an I/O buffer using malloc.  The resulting
  900. !  *    buffer is used for all data buffering throughout the program.
  901. !  *    Buf_allocate must be called prior to any use of the buffer or any
  902. !  *    of the buffering calls.
  903.    *
  904.    * PARAMETERS
  905.    *
  906.  
  907. --- 353,362 -----
  908.    *
  909.    * DESCRIPTION
  910.    *
  911. !  *  buf_allocate allocates an I/O buffer using malloc.  The resulting
  912. !  *  buffer is used for all data buffering throughout the program.
  913. !  *  Buf_allocate must be called prior to any use of the buffer or any
  914. !  *  of the buffering calls.
  915.    *
  916.    * PARAMETERS
  917.    *
  918. ***************
  919. *** 358,364
  920.    *
  921.    * PARAMETERS
  922.    *
  923. !  *    int    size    - size of the I/O buffer to request
  924.    *
  925.    * ERRORS
  926.    *
  927.  
  928. --- 360,366 -----
  929.    *
  930.    * PARAMETERS
  931.    *
  932. !  *  int size    - size of the I/O buffer to request
  933.    *
  934.    * ERRORS
  935.    *
  936. ***************
  937. *** 362,371
  938.    *
  939.    * ERRORS
  940.    *
  941. !  *    If an invalid size is given for a buffer or if a buffer of the 
  942. !  *    required size cannot be allocated, then the function prints out an 
  943. !  *    error message and returns a non-zero exit status to the calling 
  944. !  *    process, terminating the program.
  945.    *
  946.    */
  947.   
  948.  
  949. --- 364,373 -----
  950.    *
  951.    * ERRORS
  952.    *
  953. !  *  If an invalid size is given for a buffer or if a buffer of the 
  954. !  *  required size cannot be allocated, then the function prints out an 
  955. !  *  error message and returns a non-zero exit status to the calling 
  956. !  *  process, terminating the program.
  957.    *
  958.    */
  959.   
  960. ***************
  961. *** 381,387
  962.   #endif
  963.   {
  964.       if (size <= 0) {
  965. !     fatal("invalid value for blocksize");
  966.       }
  967.       if ((bufstart = malloc((unsigned) size)) == (char *)NULL) {
  968.       fatal("Cannot allocate I/O buffer");
  969.  
  970. --- 383,389 -----
  971.   #endif
  972.   {
  973.       if (size <= 0) {
  974. !         fatal("invalid value for blocksize");
  975.       }
  976.   #ifndef AMIGA
  977.       if ((bufstart = malloc((unsigned) size)) == (char *)NULL) {
  978. ***************
  979. *** 383,388
  980.       if (size <= 0) {
  981.       fatal("invalid value for blocksize");
  982.       }
  983.       if ((bufstart = malloc((unsigned) size)) == (char *)NULL) {
  984.       fatal("Cannot allocate I/O buffer");
  985.       }
  986.  
  987. --- 385,391 -----
  988.       if (size <= 0) {
  989.           fatal("invalid value for blocksize");
  990.       }
  991. + #ifndef AMIGA
  992.       if ((bufstart = malloc((unsigned) size)) == (char *)NULL) {
  993.          fatal("Cannot allocate I/O buffer");
  994.       }
  995. ***************
  996. *** 384,390
  997.       fatal("invalid value for blocksize");
  998.       }
  999.       if ((bufstart = malloc((unsigned) size)) == (char *)NULL) {
  1000. !     fatal("Cannot allocate I/O buffer");
  1001.       }
  1002.       bufend = bufidx = bufstart;
  1003.       bufend += size;
  1004.  
  1005. --- 387,393 -----
  1006.       }
  1007.   #ifndef AMIGA
  1008.       if ((bufstart = malloc((unsigned) size)) == (char *)NULL) {
  1009. !        fatal("Cannot allocate I/O buffer");
  1010.       }
  1011.   #else
  1012.       /* try to allocate CHIP memory first, to speed o/p to archive device */
  1013. ***************
  1014. *** 386,391
  1015.       if ((bufstart = malloc((unsigned) size)) == (char *)NULL) {
  1016.       fatal("Cannot allocate I/O buffer");
  1017.       }
  1018.       bufend = bufidx = bufstart;
  1019.       bufend += size;
  1020.   }
  1021.  
  1022. --- 389,408 -----
  1023.       if ((bufstart = malloc((unsigned) size)) == (char *)NULL) {
  1024.          fatal("Cannot allocate I/O buffer");
  1025.       }
  1026. + #else
  1027. +     /* try to allocate CHIP memory first, to speed o/p to archive device */
  1028. +     /* (CHIP memory is accessible to the dma controller:
  1029. +         *  a buffer allocated in it will be transferred in one operation
  1030. +      *  rather than being split and copied in 512 byte chunks.
  1031. +      */
  1032. +     if ((bufstart = chipalloc((unsigned) size)) == (char *) NULL) {
  1033. +     /* couldn't get chip: get any */
  1034. +     if((bufstart = malloc((unsigned)size)) == (char *) NULL) {
  1035. +         fatal("Cannot allocate I/O buffer");
  1036. +     }
  1037. +     }
  1038. + #endif /* AMIGA */
  1039.       bufend = bufidx = bufstart;
  1040.       bufend += size;
  1041.   }
  1042. ***************
  1043. *** 395,402
  1044.    *
  1045.    * DESCRIPTION
  1046.    *
  1047. !  *    Buf_skip skips past archive data.  It is used when the length of
  1048. !  *    the archive data is known, and we do not wish to process the data.
  1049.    *
  1050.    * PARAMETERS
  1051.    *
  1052.  
  1053. --- 412,419 -----
  1054.    *
  1055.    * DESCRIPTION
  1056.    *
  1057. !  *  Buf_skip skips past archive data.  It is used when the length of
  1058. !  *  the archive data is known, and we do not wish to process the data.
  1059.    *
  1060.    * PARAMETERS
  1061.    *
  1062. ***************
  1063. *** 400,406
  1064.    *
  1065.    * PARAMETERS
  1066.    *
  1067. !  *    OFFSET    len    - number of bytes to skip
  1068.    *
  1069.    * RETURNS
  1070.    *
  1071.  
  1072. --- 417,423 -----
  1073.    *
  1074.    * PARAMETERS
  1075.    *
  1076. !  *  OFFSET  len - number of bytes to skip
  1077.    *
  1078.    * RETURNS
  1079.    *
  1080. ***************
  1081. *** 404,411
  1082.    *
  1083.    * RETURNS
  1084.    *
  1085. !  *     Returns zero under normal circumstances, -1 if unreadable data is 
  1086. !  *     encountered. 
  1087.    */
  1088.   
  1089.   #ifdef __STDC__
  1090.  
  1091. --- 421,428 -----
  1092.    *
  1093.    * RETURNS
  1094.    *
  1095. !  *  Returns zero under normal circumstances, -1 if unreadable data is 
  1096. !  *  encountered. 
  1097.    */
  1098.   
  1099.   #ifdef __STDC__
  1100. ***************
  1101. *** 423,440
  1102.       int             corrupt = 0;
  1103.   
  1104.       while (len) {
  1105. !     if (bufend - bufidx < 0) {
  1106. !         fatal("Buffer overlow in buf_skip\n");
  1107. !     }
  1108. !     while ((chunk = bufend - bufidx) == 0) {
  1109. !         corrupt |= ar_read();
  1110. !     }
  1111. !     if (chunk > len) {
  1112. !         chunk = len;
  1113. !     }
  1114. !     bufidx += chunk;
  1115. !     len -= chunk;
  1116. !     total += chunk;
  1117.       }
  1118.       return (corrupt);
  1119.   }
  1120.  
  1121. --- 440,457 -----
  1122.       int             corrupt = 0;
  1123.   
  1124.       while (len) {
  1125. !         if (bufend - bufidx < 0) {
  1126. !             fatal("Buffer overlow in buf_skip\n");
  1127. !         }
  1128. !         while ((chunk = bufend - bufidx) == 0) {
  1129. !             corrupt |= ar_read();
  1130. !         }
  1131. !         if (chunk > len) {
  1132. !             chunk = len;
  1133. !         }
  1134. !         bufidx += chunk;
  1135. !         len -= chunk;
  1136. !         total += chunk;
  1137.       }
  1138.       return (corrupt);
  1139.   }
  1140. ***************
  1141. *** 444,451
  1142.    *
  1143.    * DESCRIPTION
  1144.    *
  1145. !  *    Reads len number of characters from the input archive and
  1146. !  *    stores them in the buffer pointed at by dst.
  1147.    *
  1148.    * PARAMETERS
  1149.    *
  1150.  
  1151. --- 461,468 -----
  1152.    *
  1153.    * DESCRIPTION
  1154.    *
  1155. !  *  Reads len number of characters from the input archive and
  1156. !  *  stores them in the buffer pointed at by dst.
  1157.    *
  1158.    * PARAMETERS
  1159.    *
  1160. ***************
  1161. *** 449,456
  1162.    *
  1163.    * PARAMETERS
  1164.    *
  1165. !  *    char   *dst    - pointer to buffer to store data into
  1166. !  *    uint    len    - length of data to read
  1167.    *
  1168.    * RETURNS
  1169.    *
  1170.  
  1171. --- 466,473 -----
  1172.    *
  1173.    * PARAMETERS
  1174.    *
  1175. !  *  char   *dst - pointer to buffer to store data into
  1176. !  *  uint    len - length of data to read
  1177.    *
  1178.    * RETURNS
  1179.    *
  1180. ***************
  1181. *** 454,461
  1182.    *
  1183.    * RETURNS
  1184.    *
  1185. !  *     Returns zero with valid data, -1 if unreadable portions were 
  1186. !  *    replaced by null characters. 
  1187.    */
  1188.   
  1189.   #ifdef __STDC__
  1190.  
  1191. --- 471,478 -----
  1192.    *
  1193.    * RETURNS
  1194.    *
  1195. !  *  Returns zero with valid data, -1 if unreadable portions were 
  1196. !  *  replaced by null characters. 
  1197.    */
  1198.   
  1199.   #ifdef __STDC__
  1200. ***************
  1201. *** 476,495
  1202.       char           *endx = dst + len;
  1203.   
  1204.       while (want = endx - dst) {
  1205. !     if (bufend - bufidx < 0) {
  1206. !         fatal("Buffer overlow in buf_read\n");
  1207. !     }
  1208. !     while ((have = bufend - bufidx) == 0) {
  1209. !         have = 0;
  1210. !         corrupt |= ar_read();
  1211. !     }
  1212. !     if (have > want) {
  1213. !         have = want;
  1214. !     }
  1215. !     memcpy(dst, bufidx, have);
  1216. !     bufidx += have;
  1217. !     dst += have;
  1218. !     total += have;
  1219.       }
  1220.       return (corrupt);
  1221.   }
  1222.  
  1223. --- 493,512 -----
  1224.       char           *endx = dst + len;
  1225.   
  1226.       while (want = endx - dst) {
  1227. !         if (bufend - bufidx < 0) {
  1228. !             fatal("Buffer overlow in buf_read\n");
  1229. !         }
  1230. !         while ((have = bufend - bufidx) == 0) {
  1231. !             have = 0;
  1232. !             corrupt |= ar_read();
  1233. !         }
  1234. !         if (have > want) {
  1235. !             have = want;
  1236. !         }
  1237. !         memcpy(dst, bufidx, have);
  1238. !         bufidx += have;
  1239. !         dst += have;
  1240. !         total += have;
  1241.       }
  1242.       return (corrupt);
  1243.   }
  1244. ***************
  1245. *** 499,507
  1246.    *
  1247.    * DESCRIPTION
  1248.    *
  1249. !  *    Indata writes size bytes of data from the archive buffer to the output 
  1250. !  *    file specified by fd.  The filename which is being written, pointed
  1251. !  *    to by name is provided only for diagnostics.
  1252.    *
  1253.    * PARAMETERS
  1254.    *
  1255.  
  1256. --- 516,524 -----
  1257.    *
  1258.    * DESCRIPTION
  1259.    *
  1260. !  *  Indata writes size bytes of data from the archive buffer to the output 
  1261. !  *  file specified by fd.  The filename which is being written, pointed
  1262. !  *  to by name is provided only for diagnostics.
  1263.    *
  1264.    * PARAMETERS
  1265.    *
  1266. ***************
  1267. *** 505,513
  1268.    *
  1269.    * PARAMETERS
  1270.    *
  1271. !  *    int    fd    - output file descriptor
  1272. !  *    OFFSET    size    - number of bytes to write to output file
  1273. !  *    char    *name    - name of file which corresponds to fd
  1274.    *
  1275.    * RETURNS
  1276.    *
  1277.  
  1278. --- 522,530 -----
  1279.    *
  1280.    * PARAMETERS
  1281.    *
  1282. !  *  int fd  - output file descriptor
  1283. !  *  OFFSET  size    - number of bytes to write to output file
  1284. !  *  char    *name   - name of file which corresponds to fd
  1285.    *
  1286.    * RETURNS
  1287.    *
  1288. ***************
  1289. *** 511,517
  1290.    *
  1291.    * RETURNS
  1292.    *
  1293. !  *     Returns given file descriptor. 
  1294.    */
  1295.   
  1296.   #ifdef __STDC__
  1297.  
  1298. --- 528,534 -----
  1299.    *
  1300.    * RETURNS
  1301.    *
  1302. !  *  Returns given file descriptor. 
  1303.    */
  1304.   
  1305.   #ifdef __STDC__
  1306. ***************
  1307. *** 537,548
  1308.       corrupt = sparse = 0;
  1309.       oops = (char *)NULL;
  1310.       while (size) {
  1311. !     corrupt |= buf_in_avail(&buf, &avail);
  1312. !     size -= (chunk = size < avail ? (uint) size : avail);
  1313. !     if (oops == (char *)NULL && (sparse = ar_write(fd, buf, chunk)) < 0) {
  1314. !         oops = strerror();
  1315. !     }
  1316. !     buf_use(chunk);
  1317.       }
  1318.       if (corrupt) {
  1319.       warn(name, "Corrupt archive data");
  1320.  
  1321. --- 554,565 -----
  1322.       corrupt = sparse = 0;
  1323.       oops = (char *)NULL;
  1324.       while (size) {
  1325. !         corrupt |= buf_in_avail(&buf, &avail);
  1326. !         size -= (chunk = size < avail ? (uint) size : avail);
  1327. !         if (oops == (char *)NULL && (sparse = ar_write(fd, buf, chunk)) < 0) {
  1328. !             oops = strerror();
  1329. !         }
  1330. !         buf_use(chunk);
  1331.       }
  1332.       if (corrupt) {
  1333.           warn(name, "Corrupt archive data");
  1334. ***************
  1335. *** 545,551
  1336.       buf_use(chunk);
  1337.       }
  1338.       if (corrupt) {
  1339. !     warn(name, "Corrupt archive data");
  1340.       }
  1341.       if (oops) {
  1342.       warn(name, oops);
  1343.  
  1344. --- 562,568 -----
  1345.           buf_use(chunk);
  1346.       }
  1347.       if (corrupt) {
  1348. !         warn(name, "Corrupt archive data");
  1349.       }
  1350.       if (oops) {
  1351.           warn(name, oops);
  1352. ***************
  1353. *** 548,554
  1354.       warn(name, "Corrupt archive data");
  1355.       }
  1356.       if (oops) {
  1357. !     warn(name, oops);
  1358.       } else if (sparse > 0 && (lseek(fd, (OFFSET) - 1, 1) < 0
  1359.                     || write(fd, "", 1) != 1)) {
  1360.       warn(name, strerror());
  1361.  
  1362. --- 565,571 -----
  1363.           warn(name, "Corrupt archive data");
  1364.       }
  1365.       if (oops) {
  1366. !         warn(name, oops);
  1367.       } else if (sparse > 0 && (lseek(fd, (OFFSET) - 1, 1) < 0
  1368.                     || write(fd, "", 1) != 1)) {
  1369.           warn(name, strerror());
  1370. ***************
  1371. *** 550,557
  1372.       if (oops) {
  1373.       warn(name, oops);
  1374.       } else if (sparse > 0 && (lseek(fd, (OFFSET) - 1, 1) < 0
  1375. !                   || write(fd, "", 1) != 1)) {
  1376. !     warn(name, strerror());
  1377.       }
  1378.       return (fd);
  1379.   }
  1380.  
  1381. --- 567,574 -----
  1382.       if (oops) {
  1383.           warn(name, oops);
  1384.       } else if (sparse > 0 && (lseek(fd, (OFFSET) - 1, 1) < 0
  1385. !                   || write(fd, "", 1) != 1)) {
  1386. !         warn(name, strerror());
  1387.       }
  1388.       return (fd);
  1389.   }
  1390. ***************
  1391. *** 561,568
  1392.    *
  1393.    * DESCRIPTION
  1394.    *
  1395. !  *    The output buffer is written, if there is anything in it, to the
  1396. !  *    archive file.
  1397.    */
  1398.   
  1399.   #ifdef __STDC__
  1400.  
  1401. --- 578,585 -----
  1402.    *
  1403.    * DESCRIPTION
  1404.    *
  1405. !  *  The output buffer is written, if there is anything in it, to the
  1406. !  *  archive file.
  1407.    */
  1408.   
  1409.   #ifdef __STDC__
  1410. ***************
  1411. *** 580,592
  1412.       uint            len;
  1413.   
  1414.       /* if (bufidx - buf > 0) */
  1415. !     for (buf = bufstart; len = bufidx - buf;) {
  1416. !         if ((got = WRITE(archivefd, buf, MIN(len, blocksize))) > 0) {
  1417. !         buf += got;
  1418. !         } else if (got < 0) {
  1419. !         next(AR_WRITE);
  1420. !         }
  1421. !     }
  1422.       bufend = (bufidx = bufstart) + blocksize;
  1423.   }
  1424.   
  1425.  
  1426. --- 597,609 -----
  1427.       uint            len;
  1428.   
  1429.       /* if (bufidx - buf > 0) */
  1430. !     for (buf = bufstart; len = bufidx - buf;) {
  1431. !         if ((got = WRITE(archivefd, buf, MIN(len, blocksize))) > 0) {
  1432. !             buf += got;
  1433. !         } else if (got <= 0) {
  1434. !             next(AR_WRITE);
  1435. !         }
  1436. !     }
  1437.       bufend = (bufidx = bufstart) + blocksize;
  1438.   }
  1439.   
  1440. ***************
  1441. *** 595,603
  1442.    *
  1443.    * DESCRIPTION
  1444.    *
  1445. !  *     Remembers mid-buffer read failures and reports them the next time 
  1446. !  *    through.  Replaces unreadable data with null characters.   Resets
  1447. !  *    the buffer pointers as appropriate.
  1448.    *
  1449.    * RETURNS
  1450.    *
  1451.  
  1452. --- 612,620 -----
  1453.    *
  1454.    * DESCRIPTION
  1455.    *
  1456. !  *  Remembers mid-buffer read failures and reports them the next time 
  1457. !  *  through.  Replaces unreadable data with null characters.   Resets
  1458. !  *  the buffer pointers as appropriate.
  1459.    *
  1460.    * RETURNS
  1461.    *
  1462. ***************
  1463. *** 601,607
  1464.    *
  1465.    * RETURNS
  1466.    *
  1467. !  *    Returns zero with valid data, -1 otherwise. 
  1468.    */
  1469.   
  1470.   #ifdef __STDC__
  1471.  
  1472. --- 618,624 -----
  1473.    *
  1474.    * RETURNS
  1475.    *
  1476. !  *  Returns zero with valid data, -1 otherwise. 
  1477.    */
  1478.   
  1479.   #ifdef __STDC__
  1480. ***************
  1481. *** 619,641
  1482.   
  1483.       bufend = bufidx = bufstart;
  1484.       if (!failed) {
  1485. !     if (areof) {
  1486. !         if (total == 0) {
  1487. !         fatal("No input");
  1488. !         } else {
  1489. !         next(AR_READ);
  1490. !         }
  1491. !     }
  1492. !     while (!failed && !areof && bufstart + blocksize - bufend >= blocksize) {
  1493. !         if ((got = READ(archivefd, bufend, (unsigned int) blocksize)) > 0) {
  1494. !         bufend += got;
  1495. !         } else if (got < 0) {
  1496. !         failed = -1;
  1497. !         warnarch(strerror(), (OFFSET) 0 - (bufend - bufidx));
  1498. !         } else {
  1499. !         ++areof;
  1500. !         }
  1501. !     }
  1502.       }
  1503.       if (failed && bufend == bufstart) {
  1504.       failed = 0;
  1505.  
  1506. --- 636,647 -----
  1507.   
  1508.       bufend = bufidx = bufstart;
  1509.       if (!failed) {
  1510. !     if (areof) {
  1511. !         if (total == 0) {
  1512. !             fatal("No input");
  1513. !         } else {
  1514. !             next(AR_READ);
  1515. !         }
  1516.       }
  1517.       while (!failed && !areof && bufstart + blocksize - bufend >= blocksize) {
  1518.           if ((got = READ(archivefd, bufend, (unsigned int) blocksize)) > 0) {
  1519. ***************
  1520. *** 637,642
  1521.           }
  1522.       }
  1523.       }
  1524.       if (failed && bufend == bufstart) {
  1525.       failed = 0;
  1526.       for (got = 0; got < blocksize; ++got) {
  1527.  
  1528. --- 643,659 -----
  1529.               next(AR_READ);
  1530.           }
  1531.       }
  1532. +     while (!failed && !areof && bufstart + blocksize - bufend >= blocksize) {
  1533. +         if ((got = READ(archivefd, bufend, (unsigned int) blocksize)) > 0) {
  1534. +             bufend += got;
  1535. +         } else if (got < 0) {
  1536. +             failed = -1;
  1537. +             warnarch(strerror(), (OFFSET) 0 - (bufend - bufidx));
  1538. +         } else {
  1539. +             ++areof;
  1540. +         }
  1541. +     }
  1542. +     }
  1543.       if (failed && bufend == bufstart) {
  1544.           failed = 0;
  1545.           for (got = 0; got < blocksize; ++got) {
  1546. ***************
  1547. *** 638,648
  1548.       }
  1549.       }
  1550.       if (failed && bufend == bufstart) {
  1551. !     failed = 0;
  1552. !     for (got = 0; got < blocksize; ++got) {
  1553. !         *bufend++ = '\0';
  1554. !     }
  1555. !     return (-1);
  1556.       }
  1557.       return (0);
  1558.   }
  1559.  
  1560. --- 655,665 -----
  1561.       }
  1562.       }
  1563.       if (failed && bufend == bufstart) {
  1564. !         failed = 0;
  1565. !         for (got = 0; got < blocksize; ++got) {
  1566. !             *bufend++ = '\0';
  1567. !         }
  1568. !         return (-1);
  1569.       }
  1570.       return (0);
  1571.   }
  1572. ***************
  1573. *** 652,659
  1574.    *
  1575.    * DESCRIPTION
  1576.    *
  1577. !  *     Writes len bytes of data data from the specified buffer to the 
  1578. !  *    specified file.   Seeks past sparse blocks. 
  1579.    *
  1580.    * PARAMETERS
  1581.    *
  1582.  
  1583. --- 669,676 -----
  1584.    *
  1585.    * DESCRIPTION
  1586.    *
  1587. !  *  Writes len bytes of data data from the specified buffer to the 
  1588. !  *  specified file.   Seeks past sparse blocks. 
  1589.    *
  1590.    * PARAMETERS
  1591.    *
  1592. ***************
  1593. *** 657,665
  1594.    *
  1595.    * PARAMETERS
  1596.    *
  1597. !  *    int     fd    - file to write to
  1598. !  *    char   *buf    - buffer to get data from
  1599. !  *    uint    len    - number of bytes to transfer
  1600.    *
  1601.    * RETURNS
  1602.    *
  1603.  
  1604. --- 674,682 -----
  1605.    *
  1606.    * PARAMETERS
  1607.    *
  1608. !  *  int     fd  - file to write to
  1609. !  *  char   *buf - buffer to get data from
  1610. !  *  uint    len - number of bytes to transfer
  1611.    *
  1612.    * RETURNS
  1613.    *
  1614. ***************
  1615. *** 663,670
  1616.    *
  1617.    * RETURNS
  1618.    *
  1619. !  *    Returns 0 if the block was written, the given length for a sparse 
  1620. !  *    block or -1 if unsuccessful. 
  1621.    */
  1622.   
  1623.   #ifdef __STDC__
  1624.  
  1625. --- 680,687 -----
  1626.    *
  1627.    * RETURNS
  1628.    *
  1629. !  *  Returns 0 if the block was written, the given length for a sparse 
  1630. !  *  block or -1 if unsuccessful. 
  1631.    */
  1632.   
  1633.   #ifdef __STDC__
  1634. ***************
  1635. *** 673,679
  1636.   
  1637.   #else
  1638.   
  1639. ! static int ar_write(fd, buf, len)
  1640.   int             fd;
  1641.   char           *buf;
  1642.   uint            len;
  1643.  
  1644. --- 690,696 -----
  1645.   
  1646.   #else
  1647.   
  1648. ! static int r_write(fd, buf, len)
  1649.   int             fd;
  1650.   char           *buf;
  1651.   uint            len;
  1652. ***************
  1653. *** 685,693
  1654.   
  1655.       bend = (bidx = buf) + len;
  1656.       while (bidx < bend) {
  1657. !     if (*bidx++) {
  1658. !         return (WRITE(fd, buf, len) == len ? 0 : -1);
  1659. !     }
  1660.       }
  1661.       return (LSEEK(fd, (OFFSET) len, 1) < 0 ? -1 : len);
  1662.   }
  1663.  
  1664. --- 702,710 -----
  1665.   
  1666.       bend = (bidx = buf) + len;
  1667.       while (bidx < bend) {
  1668. !         if (*bidx++) {
  1669. !             return (WRITE(fd, buf, len) == len ? 0 : -1);
  1670. !         }
  1671.       }
  1672.       return (LSEEK(fd, (OFFSET) len, 1) < 0 ? -1 : (int) len);
  1673.   }
  1674. ***************
  1675. *** 689,695
  1676.           return (WRITE(fd, buf, len) == len ? 0 : -1);
  1677.       }
  1678.       }
  1679. !     return (LSEEK(fd, (OFFSET) len, 1) < 0 ? -1 : len);
  1680.   }
  1681.   
  1682.   
  1683.  
  1684. --- 706,712 -----
  1685.               return (WRITE(fd, buf, len) == len ? 0 : -1);
  1686.           }
  1687.       }
  1688. !     return (LSEEK(fd, (OFFSET) len, 1) < 0 ? -1 : (int) len);
  1689.   }
  1690.   
  1691.   
  1692. ***************
  1693. *** 697,704
  1694.    *
  1695.    * DESCRIPTION
  1696.    *
  1697. !  *    Buf_pad writes len zero bytes to the archive buffer in order to 
  1698. !  *    pad it.
  1699.    *
  1700.    * PARAMETERS
  1701.    *
  1702.  
  1703. --- 714,721 -----
  1704.    *
  1705.    * DESCRIPTION
  1706.    *
  1707. !  *  Buf_pad writes len zero bytes to the archive buffer in order to 
  1708. !  *  pad it.
  1709.    *
  1710.    * PARAMETERS
  1711.    *
  1712. ***************
  1713. *** 702,708
  1714.    *
  1715.    * PARAMETERS
  1716.    *
  1717. !  *    OFFSET    pad    - number of zero bytes to pad
  1718.    *
  1719.    */
  1720.   
  1721.  
  1722. --- 719,725 -----
  1723.    *
  1724.    * PARAMETERS
  1725.    *
  1726. !  *  OFFSET  pad - number of zero bytes to pad
  1727.    *
  1728.    */
  1729.   
  1730. ***************
  1731. *** 721,737
  1732.       int             have;
  1733.   
  1734.       while (pad) {
  1735. !     if ((have = bufend - bufidx) > pad) {
  1736. !         have = pad;
  1737. !     }
  1738. !     for (idx = 0; idx < have; ++idx) {
  1739. !         *bufidx++ = '\0';
  1740. !     }
  1741. !     total += have;
  1742. !     pad -= have;
  1743. !     if (bufend - bufidx == 0) {
  1744. !         outflush();
  1745. !     }
  1746.       }
  1747.   }
  1748.   
  1749.  
  1750. --- 738,754 -----
  1751.       int             have;
  1752.   
  1753.       while (pad) {
  1754. !         if ((have = bufend - bufidx) > pad) {
  1755. !             have = pad;
  1756. !         }
  1757. !         for (idx = 0; idx < have; ++idx) {
  1758. !             *bufidx++ = '\0';
  1759. !         }
  1760. !         total += have;
  1761. !         pad -= have;
  1762. !         if (bufend - bufidx == 0) {
  1763. !             outflush();
  1764. !         }
  1765.       }
  1766.   }
  1767.   
  1768. ***************
  1769. *** 740,747
  1770.    *
  1771.    * DESCRIPTION
  1772.    *
  1773. !  *    Buf_use marks space in the buffer as being used; advancing both the
  1774. !  *    buffer index (bufidx) and the total byte count (total).
  1775.    *
  1776.    * PARAMETERS
  1777.    *
  1778.  
  1779. --- 757,764 -----
  1780.    *
  1781.    * DESCRIPTION
  1782.    *
  1783. !  *  Buf_use marks space in the buffer as being used; advancing both the
  1784. !  *  buffer index (bufidx) and the total byte count (total).
  1785.    *
  1786.    * PARAMETERS
  1787.    *
  1788. ***************
  1789. *** 745,751
  1790.    *
  1791.    * PARAMETERS
  1792.    *
  1793. !  *    uint    len    - Amount of space to allocate in the buffer
  1794.    */
  1795.   
  1796.   #ifdef __STDC__
  1797.  
  1798. --- 762,768 -----
  1799.    *
  1800.    * PARAMETERS
  1801.    *
  1802. !  *  uint    len - Amount of space to allocate in the buffer
  1803.    */
  1804.   
  1805.   #ifdef __STDC__
  1806. ***************
  1807. *** 768,776
  1808.    *
  1809.    * DESCRIPTION
  1810.    *
  1811. !  *    Buf_in_avail fills the archive buffer, and points the bufp
  1812. !  *    parameter at the start of the data.  The lenp parameter is
  1813. !  *    modified to contain the number of bytes which were read.
  1814.    *
  1815.    * PARAMETERS
  1816.    *
  1817.  
  1818. --- 785,793 -----
  1819.    *
  1820.    * DESCRIPTION
  1821.    *
  1822. !  *  Buf_in_avail fills the archive buffer, and points the bufp
  1823. !  *  parameter at the start of the data.  The lenp parameter is
  1824. !  *  modified to contain the number of bytes which were read.
  1825.    *
  1826.    * PARAMETERS
  1827.    *
  1828. ***************
  1829. *** 774,782
  1830.    *
  1831.    * PARAMETERS
  1832.    *
  1833. !  *    char   **bufp    - pointer to the buffer to read data into
  1834. !  *    uint    *lenp    - pointer to the number of bytes which were read
  1835. !  *              (returned to the caller)
  1836.    *
  1837.    * RETURNS
  1838.    *
  1839.  
  1840. --- 791,799 -----
  1841.    *
  1842.    * PARAMETERS
  1843.    *
  1844. !  *  char   **bufp   - pointer to the buffer to read data into
  1845. !  *  uint    *lenp   - pointer to the number of bytes which were read
  1846. !  *            (returned to the caller)
  1847.    *
  1848.    * RETURNS
  1849.    *
  1850. ***************
  1851. *** 780,788
  1852.    *
  1853.    * RETURNS
  1854.    *
  1855. !  *     Stores a pointer to the data and its length in given locations. 
  1856. !  *    Returns zero with valid data, -1 if unreadable portions were 
  1857. !  *    replaced with nulls. 
  1858.    *
  1859.    * ERRORS
  1860.    *
  1861.  
  1862. --- 797,805 -----
  1863.    *
  1864.    * RETURNS
  1865.    *
  1866. !  *  Stores a pointer to the data and its length in given locations. 
  1867. !  *  Returns zero with valid data, -1 if unreadable portions were 
  1868. !  *  replaced with nulls. 
  1869.    *
  1870.    * ERRORS
  1871.    *
  1872. ***************
  1873. *** 786,793
  1874.    *
  1875.    * ERRORS
  1876.    *
  1877. !  *    If an error occurs in ar_read, the error code is returned to the
  1878. !  *    calling function.
  1879.    *
  1880.    */
  1881.   
  1882.  
  1883. --- 803,810 -----
  1884.    *
  1885.    * ERRORS
  1886.    *
  1887. !  *  If an error occurs in ar_read, the error code is returned to the
  1888. !  *  calling function.
  1889.    *
  1890.    */
  1891.   
  1892. ***************
  1893. *** 807,813
  1894.       int             corrupt = 0;
  1895.   
  1896.       while ((have = bufend - bufidx) == 0) {
  1897. !     corrupt |= ar_read();
  1898.       }
  1899.       *bufp = bufidx;
  1900.       *lenp = have;
  1901.  
  1902. --- 824,830 -----
  1903.       int             corrupt = 0;
  1904.   
  1905.       while ((have = bufend - bufidx) == 0) {
  1906. !         corrupt |= ar_read();
  1907.       }
  1908.       *bufp = bufidx;
  1909.       *lenp = have;
  1910. ***************
  1911. *** 819,826
  1912.    *
  1913.    * DESCRIPTION
  1914.    *
  1915. !  *     Stores a buffer pointer at a given location. Returns the number 
  1916. !  *    of bytes available. 
  1917.    *
  1918.    * PARAMETERS
  1919.    *
  1920.  
  1921. --- 836,843 -----
  1922.    *
  1923.    * DESCRIPTION
  1924.    *
  1925. !  *  Stores a buffer pointer at a given location. Returns the number 
  1926. !  *  of bytes available. 
  1927.    *
  1928.    * PARAMETERS
  1929.    *
  1930. ***************
  1931. *** 824,830
  1932.    *
  1933.    * PARAMETERS
  1934.    *
  1935. !  *    char    **bufp    - pointer to the buffer which is to be stored
  1936.    *
  1937.    * RETURNS
  1938.    *
  1939.  
  1940. --- 841,847 -----
  1941.    *
  1942.    * PARAMETERS
  1943.    *
  1944. !  *  char    **bufp  - pointer to the buffer which is to be stored
  1945.    *
  1946.    * RETURNS
  1947.    *
  1948. ***************
  1949. *** 828,834
  1950.    *
  1951.    * RETURNS
  1952.    *
  1953. !  *     The number of bytes which are available in the buffer.
  1954.    *
  1955.    */
  1956.   
  1957.  
  1958. --- 845,851 -----
  1959.    *
  1960.    * RETURNS
  1961.    *
  1962. !  *  The number of bytes which are available in the buffer.
  1963.    *
  1964.    */
  1965.   
  1966. ***************
  1967. *** 843,849
  1968.   
  1969.   #endif
  1970.   {
  1971. !     int             have;
  1972.   
  1973.       if (bufend - bufidx < 0) {
  1974.       fatal("Buffer overlow in buf_out_avail\n");
  1975.  
  1976. --- 860,866 -----
  1977.   
  1978.   #endif
  1979.   {
  1980. !     uint             have;
  1981.   
  1982.       if (bufend - bufidx < 0) {
  1983.           fatal("Buffer overlow in buf_out_avail\n");
  1984. ***************
  1985. *** 846,852
  1986.       int             have;
  1987.   
  1988.       if (bufend - bufidx < 0) {
  1989. !     fatal("Buffer overlow in buf_out_avail\n");
  1990.       }
  1991.       if ((have = bufend - bufidx) == 0) {
  1992.       outflush();
  1993.  
  1994. --- 863,869 -----
  1995.       uint             have;
  1996.   
  1997.       if (bufend - bufidx < 0) {
  1998. !         fatal("Buffer overlow in buf_out_avail\n");
  1999.       }
  2000.       if ((have = bufend - bufidx) == 0) {
  2001.           outflush();
  2002. ***************
  2003. *** 849,855
  2004.       fatal("Buffer overlow in buf_out_avail\n");
  2005.       }
  2006.       if ((have = bufend - bufidx) == 0) {
  2007. !     outflush();
  2008.       }
  2009.       *bufp = bufidx;
  2010.       return (have);
  2011.  
  2012. --- 866,872 -----
  2013.           fatal("Buffer overlow in buf_out_avail\n");
  2014.       }
  2015.       if ((have = bufend - bufidx) == 0) {
  2016. !         outflush();
  2017.       }
  2018.       *bufp = bufidx;
  2019.       return (have);
  2020. ***************
  2021. *** 853,856
  2022.       }
  2023.       *bufp = bufidx;
  2024.       return (have);
  2025. - }
  2026.  
  2027. --- 870,872 -----
  2028.       }
  2029.       *bufp = bufidx;
  2030.       return (have);
  2031. diff -c pax/config.h pax.amiga/config.h
  2032. *** pax/config.h    Sat Feb 18 13:26:52 1989
  2033. --- pax.amiga/config.h    Wed Sep 20 06:38:43 1989
  2034. ***************
  2035. *** 51,56
  2036.    * USG - USG (Unix System V) specific modifications
  2037.    *
  2038.    * Define USG if you are running Unix System V or some similar variant
  2039.    */
  2040.   /*#define USG     /* Running on a USG System */
  2041.   
  2042.  
  2043. --- 51,57 -----
  2044.    * USG - USG (Unix System V) specific modifications
  2045.    *
  2046.    * Define USG if you are running Unix System V or some similar variant
  2047. +  *
  2048.    */
  2049.   /*#define USG     /* Running on a USG System */
  2050.   
  2051. ***************
  2052. *** 55,61
  2053.   /*#define USG     /* Running on a USG System */
  2054.   
  2055.   /*
  2056. !  * BSD - BSD (Berkely) specific modifications
  2057.    *
  2058.    * Define BSD if you are running some version of BSD Unix
  2059.    */
  2060.  
  2061. --- 56,62 -----
  2062.   /*#define USG     /* Running on a USG System */
  2063.   
  2064.   /*
  2065. !  * BSD - BSD (Berkeley) specific modifications
  2066.    *
  2067.    * Define BSD if you are running some version of BSD Unix
  2068.    */
  2069. ***************
  2070. *** 59,65
  2071.    *
  2072.    * Define BSD if you are running some version of BSD Unix
  2073.    */
  2074. ! #define BSD     /* Running on a BSD System */
  2075.   
  2076.   /*
  2077.    * DEF_AR_FILE - tar only (required)
  2078.  
  2079. --- 60,66 -----
  2080.    *
  2081.    * Define BSD if you are running some version of BSD Unix
  2082.    */
  2083. ! /*#define BSD     /* Running on a BSD System */
  2084.   
  2085.   /*
  2086.    * DEF_AR_FILE - tar only (required)
  2087. ***************
  2088. *** 68,74
  2089.    * device.  Normally this would be a tape drive, but it may be a disk drive
  2090.    * on those systems that don't have tape drives.
  2091.    */
  2092. ! #define DEF_AR_FILE    "-"    /* The default archive on your system */
  2093.   
  2094.   /*
  2095.    * TTY - device which interactive queries should be directed to (required)
  2096.  
  2097. --- 69,75 -----
  2098.    * device.  Normally this would be a tape drive, but it may be a disk drive
  2099.    * on those systems that don't have tape drives.
  2100.    */
  2101. ! #define DEF_AR_FILE    "rdf:"    /* The default archive on your system */
  2102.   
  2103.   /*
  2104.    * TTY - device which interactive queries should be directed to (required)
  2105. ***************
  2106. *** 77,83
  2107.    * received from.  On most unix systems, this should be /dev/tty, however, on
  2108.    * some systems, such as MS-DOS, it my need to be different (e.g. "con:").
  2109.    */
  2110. ! #define    TTY    "/dev/tty"    /* for most versions of UNIX */
  2111.   /*#define    TTY    "/dev/con"        /* For MS-DOS */
  2112.   
  2113.   /*
  2114.  
  2115. --- 78,85 -----
  2116.    * received from.  On most unix systems, this should be /dev/tty, however, on
  2117.    * some systems, such as MS-DOS, it my need to be different (e.g. "con:").
  2118.    */
  2119. ! /*#define    TTY    "/dev/tty"    /* for most versions of UNIX */
  2120. ! #define        TTY    "*"        /* For Amiga */
  2121.   /*#define    TTY    "/dev/con"        /* For MS-DOS */
  2122.   
  2123.   /*
  2124. ***************
  2125. *** 107,114
  2126.    * OFFSET is the type which is returned by lseek().  It is different on
  2127.    * some systems.  Most define it to be off_t, but some define it to be long.
  2128.    */
  2129. ! #define OFFSET    off_t    /* for most BSD, USG and other systems */
  2130. ! /* #define OFFSET    long    /* for most of the rest of them... */
  2131.   
  2132.   /*
  2133.    * VOID - compiler support for VOID types
  2134.  
  2135. --- 109,116 -----
  2136.    * OFFSET is the type which is returned by lseek().  It is different on
  2137.    * some systems.  Most define it to be off_t, but some define it to be long.
  2138.    */
  2139. ! /*#define OFFSET    off_t    /* for most BSD, USG and other systems */
  2140. ! #define OFFSET    long    /* for most of the rest of them... */
  2141.   
  2142.   /*
  2143.    * VOID - compiler support for VOID types
  2144. ***************
  2145. *** 128,134
  2146.    * Some systems have signal defines to return an int *, other return a
  2147.    * void *.  Please choose the correct value for your system.
  2148.    */
  2149. ! /*#define SIG_T    void    /* signal defined as "void (*signal)()" */
  2150.   #define SIG_T    int    /* signal defined as "int (*signal)()" */
  2151.   
  2152.   /*
  2153.  
  2154. --- 130,136 -----
  2155.    * Some systems have signal defines to return an int *, other return a
  2156.    * void *.  Please choose the correct value for your system.
  2157.    */
  2158. ! /*define SIG_T    void    /* signal defined as "void (*signal)()" */
  2159.   #define SIG_T    int    /* signal defined as "int (*signal)()" */
  2160.   
  2161.   /*
  2162. ***************
  2163. *** 138,144
  2164.    * For those system define STRCSPN and the one provided in regexp.c will 
  2165.    * be used.
  2166.    */
  2167. ! #define STRCSPN    /* implementation does not have strcspn() */
  2168.   
  2169.   /*
  2170.    * STRERROR - use the strerror function included with pax
  2171.  
  2172. --- 140,146 -----
  2173.    * For those system define STRCSPN and the one provided in regexp.c will 
  2174.    * be used.
  2175.    */
  2176. ! /*#define STRCSPN    /* implementation does not have strcspn() */
  2177.   
  2178.   /*
  2179.    * STRERROR - use the strerror function included with pax
  2180. ***************
  2181. *** 147,153
  2182.    * For those system define STRERROR and the one provided in misc.c will 
  2183.    * be used instead.
  2184.    */
  2185. ! #define STRERROR    /* implementation does not have strerror() */
  2186.   
  2187.   /*
  2188.   
  2189.  
  2190. --- 149,155 -----
  2191.    * For those system define STRERROR and the one provided in misc.c will 
  2192.    * be used instead.
  2193.    */
  2194. ! /*#define STRERROR    /* implementation does not have strerror() */
  2195.   
  2196.   /*
  2197.   
  2198. diff -c pax/cpio.c pax.amiga/cpio.c
  2199. *** pax/cpio.c    Sat Feb 18 12:59:42 1989
  2200. --- pax.amiga/cpio.c    Thu Sep 14 16:52:13 1989
  2201. ***************
  2202. *** 78,84
  2203.   
  2204.   #ifdef __STDC__
  2205.   
  2206. ! int do_cpio(int argc, char **argv)
  2207.   
  2208.   #else
  2209.   
  2210.  
  2211. --- 78,84 -----
  2212.   
  2213.   #ifdef __STDC__
  2214.   
  2215. ! void do_cpio(int argc, char **argv)
  2216.   
  2217.   #else
  2218.   
  2219. ***************
  2220. *** 82,88
  2221.   
  2222.   #else
  2223.   
  2224. ! int do_cpio(argc, argv)
  2225.   int             argc;
  2226.   char          **argv;
  2227.   
  2228.  
  2229. --- 82,88 -----
  2230.   
  2231.   #else
  2232.   
  2233. ! void do_cpio(argc, argv)
  2234.   int             argc;
  2235.   char          **argv;
  2236.   
  2237. diff -c pax/extract.c pax.amiga/extract.c
  2238. *** pax/extract.c    Sat Feb 18 12:49:24 1989
  2239. --- pax.amiga/extract.c    Mon Sep 25 03:47:33 1989
  2240. ***************
  2241. *** 92,98
  2242.   
  2243.   #ifdef __STDC__
  2244.   
  2245. ! int read_archive(void)
  2246.   
  2247.   #else
  2248.       
  2249.  
  2250. --- 92,98 -----
  2251.   
  2252.   #ifdef __STDC__
  2253.   
  2254. ! void read_archive(void)
  2255.   
  2256.   #else
  2257.       
  2258. ***************
  2259. *** 96,102
  2260.   
  2261.   #else
  2262.       
  2263. ! int read_archive()
  2264.   
  2265.   #endif
  2266.   {
  2267.  
  2268. --- 96,102 -----
  2269.   
  2270.   #else
  2271.       
  2272. ! void read_archive()
  2273.   
  2274.   #endif
  2275.   {
  2276. ***************
  2277. *** 363,368
  2278.       }
  2279.   #endif                /* S_IFLNK */
  2280.   
  2281.       /* destroy absolute pathnames for security reasons */
  2282.       if (name[0] == '/') {
  2283.       if (name[1]) {
  2284.  
  2285. --- 363,385 -----
  2286.       }
  2287.   #endif                /* S_IFLNK */
  2288.   
  2289. + #if AMIGA
  2290. +     /* strip any initial volume name */
  2291. +     {
  2292. +        static int Vwarned_once = 0;
  2293. +        register char *p = name;
  2294. +        while(*p && *p != ':' && *p != '/')
  2295. +         p++;
  2296. +        if(*p && *p == ':'){
  2297. +         strcpy(name, p);
  2298. +         if (!Vwarned_once++) {
  2299. +                 fprintf(stderr, 
  2300. +      "Removing volume specification from absolute path names in archive.\n");
  2301. +         }
  2302. +         }
  2303. +     }
  2304. + #else /* AMIGA */
  2305.       /* destroy absolute pathnames for security reasons */
  2306.       if (name[0] == '/') {
  2307.       if (name[1]) {
  2308. ***************
  2309. *** 373,378
  2310.           name[0] = '.';
  2311.       }
  2312.       }
  2313.       asb->sb_atime = asb->sb_ctime = asb->sb_mtime;
  2314.       if (asb->sb_nlink > 1) {
  2315.       linkto(name, asb);
  2316.  
  2317. --- 390,396 -----
  2318.           name[0] = '.';
  2319.       }
  2320.       }
  2321. + #endif /* AMIGA */
  2322.       asb->sb_atime = asb->sb_ctime = asb->sb_mtime;
  2323.       if (asb->sb_nlink > 1) {
  2324.       linkto(name, asb);
  2325. diff -c pax/func.h pax.amiga/func.h
  2326. *** pax/func.h    Sat Feb 18 12:59:45 1989
  2327. --- pax.amiga/func.h    Sun Sep 24 20:48:53 1989
  2328. ***************
  2329. *** 48,54
  2330.   extern int          buf_skip(OFFSET);
  2331.   extern int          create_archive(void);
  2332.   extern int          dirneed(char *);
  2333. ! extern int          read_archive(void);
  2334.   extern int          inentry(char *, Stat *);
  2335.   extern int          lineget(FILE *, char *);
  2336.   extern int          name_match(char *);
  2337.  
  2338. --- 48,54 -----
  2339.   extern int          buf_skip(OFFSET);
  2340.   extern int          create_archive(void);
  2341.   extern int          dirneed(char *);
  2342. ! extern void          read_archive(void);
  2343.   extern int          inentry(char *, Stat *);
  2344.   extern int          lineget(FILE *, char *);
  2345.   extern int          name_match(char *);
  2346. ***************
  2347. *** 58,64
  2348.   extern int          open_tty(void);
  2349.   extern int          openin(char *, Stat *);
  2350.   extern int          openout(char *, Stat *, Link *, int);
  2351. ! extern int          pass(char *);
  2352.   extern int          passitem(char *, Stat *, int, char *);
  2353.   extern int          read_header(char *, Stat *);
  2354.   extern int          wildmat(char *, char *);
  2355.  
  2356. --- 58,64 -----
  2357.   extern int          open_tty(void);
  2358.   extern int          openin(char *, Stat *);
  2359.   extern int          openout(char *, Stat *, Link *, int);
  2360. ! extern void          pass(char *);
  2361.   extern int          passitem(char *, Stat *, int, char *);
  2362.   extern int          read_header(char *, Stat *);
  2363.   extern int          wildmat(char *, char *);
  2364. ***************
  2365. *** 74,80
  2366.   extern void         outwrite(char *, uint);
  2367.   extern void         passdata(char *, int, char *, int);
  2368.   extern void         print_entry(char *, Stat *);
  2369. ! extern void         warn();
  2370.   extern void        warnarch(char *, OFFSET);
  2371.   extern void         write_eot(void);
  2372.   extern void        get_archive_type(void);
  2373.  
  2374. --- 74,80 -----
  2375.   extern void         outwrite(char *, uint);
  2376.   extern void         passdata(char *, int, char *, int);
  2377.   extern void         print_entry(char *, Stat *);
  2378. ! extern void         warn(char *what, char *why);
  2379.   extern void        warnarch(char *, OFFSET);
  2380.   extern void         write_eot(void);
  2381.   extern void        get_archive_type(void);
  2382. ***************
  2383. *** 78,86
  2384.   extern void        warnarch(char *, OFFSET);
  2385.   extern void         write_eot(void);
  2386.   extern void        get_archive_type(void);
  2387. ! extern struct group    *getgrgid();
  2388. ! extern struct group    *getgrnam();
  2389. ! extern struct passwd   *getpwuid();
  2390.   extern char               *getenv(char *);
  2391.   #ifndef MSDOS
  2392.   extern SIG_T             (*signal())();
  2393.  
  2394. --- 78,84 -----
  2395.   extern void        warnarch(char *, OFFSET);
  2396.   extern void         write_eot(void);
  2397.   extern void        get_archive_type(void);
  2398. ! extern int        get_header(char *name, Stat *asb);
  2399.   extern char               *getenv(char *);
  2400.   #ifndef MSDOS
  2401.   extern SIG_T             (*signal())();
  2402. ***************
  2403. *** 89,94
  2404.   extern char            *finduname(int);
  2405.   extern char            *findgname(int);
  2406.   extern int        findgid(char *gname);
  2407.   extern char               *malloc(uint);
  2408.   
  2409.   #else /* !__STDC__ */
  2410.  
  2411. --- 87,93 -----
  2412.   extern char            *finduname(int);
  2413.   extern char            *findgname(int);
  2414.   extern int        findgid(char *gname);
  2415. + /*
  2416.   extern char               *malloc(uint);
  2417.   /**/
  2418.   extern void           *malloc(uint);
  2419. ***************
  2420. *** 90,96
  2421.   extern char            *findgname(int);
  2422.   extern int        findgid(char *gname);
  2423.   extern char               *malloc(uint);
  2424.   #else /* !__STDC__ */
  2425.   
  2426.   extern Link               *linkfrom();
  2427.  
  2428. --- 89,112 -----
  2429.   extern int        findgid(char *gname);
  2430.   /*
  2431.   extern char               *malloc(uint);
  2432. ! /**/
  2433. ! extern void           *malloc(uint);
  2434. ! #ifdef AMIGA
  2435. ! #include        "local.h"
  2436. ! extern char         getopt(int ac, char **av, char *fmt);
  2437. ! extern void        do_pax(int argc, char **argv);
  2438. ! extern void        do_tar(int argc, char **argv);
  2439. ! extern void        do_cpio(int argc, char **argv);
  2440. ! extern void        append_archive(void);
  2441. ! extern void        add_replstr(char * arg);
  2442. ! extern void        append_archive(void);
  2443. ! extern void        rpl_name(char *name);
  2444. ! extern int        get_disposition(char *mode, char *name);
  2445. ! extern int        get_newname(char *name, int size);
  2446. ! extern int        dirmake(char *name, Stat *asb);
  2447. ! extern int        dirneed(char *name);
  2448. ! extern int        finduid(char *uname);
  2449. ! #endif
  2450.   #else /* !__STDC__ */
  2451.   
  2452.   extern Link               *linkfrom();
  2453. ***************
  2454. *** 104,110
  2455.   extern int          buf_skip();
  2456.   extern int          create_archive();
  2457.   extern int          dirneed();
  2458. ! extern int          read_archive();
  2459.   extern int          inentry();
  2460.   extern int          lineget();
  2461.   extern int          name_match();
  2462.  
  2463. --- 120,126 -----
  2464.   extern int          buf_skip();
  2465.   extern int          create_archive();
  2466.   extern int          dirneed();
  2467. ! extern void          read_archive();
  2468.   extern int          inentry();
  2469.   extern int          lineget();
  2470.   extern int          name_match();
  2471. ***************
  2472. *** 114,120
  2473.   extern int          open_tty();
  2474.   extern int          openin();
  2475.   extern int          openout();
  2476. ! extern int          pass();
  2477.   extern int          passitem();
  2478.   extern int              read_header();
  2479.   extern int          wildmat();
  2480.  
  2481. --- 130,136 -----
  2482.   extern int          open_tty();
  2483.   extern int          openin();
  2484.   extern int          openout();
  2485. ! extern void          pass();
  2486.   extern int          passitem();
  2487.   extern int              read_header();
  2488.   extern int          wildmat();
  2489. diff -c pax/list.c pax.amiga/list.c
  2490. *** pax/list.c    Sat Feb 18 12:59:47 1989
  2491. --- pax.amiga/list.c    Sun Sep 24 21:03:46 1989
  2492. ***************
  2493. *** 122,127
  2494.       int             i;
  2495.       long            sum;
  2496.       long        recsum;
  2497.       Link           *link;
  2498.       char           *p;
  2499.       char            hdrbuf[BLOCKSIZE];
  2500.  
  2501. --- 122,128 -----
  2502.       int             i;
  2503.       long            sum;
  2504.       long        recsum;
  2505. + #ifdef    notdef
  2506.       Link           *link;
  2507.   #endif
  2508.       char           *p;
  2509. ***************
  2510. *** 123,128
  2511.       long            sum;
  2512.       long        recsum;
  2513.       Link           *link;
  2514.       char           *p;
  2515.       char            hdrbuf[BLOCKSIZE];
  2516.   
  2517.  
  2518. --- 124,130 -----
  2519.       long        recsum;
  2520.   #ifdef    notdef
  2521.       Link           *link;
  2522. + #endif
  2523.       char           *p;
  2524.       char            hdrbuf[BLOCKSIZE];
  2525.   
  2526. ***************
  2527. *** 222,227
  2528.           break;
  2529.   #endif
  2530.       case CHRTYPE:
  2531.           asb->sb_mode |= S_IFCHR;
  2532.           break;
  2533.       case DIRTYPE:
  2534.  
  2535. --- 224,230 -----
  2536.           break;
  2537.   #endif
  2538.       case CHRTYPE:
  2539. + #ifdef S_IFCHR
  2540.           asb->sb_mode |= S_IFCHR;
  2541.           break;
  2542.   #endif
  2543. ***************
  2544. *** 224,229
  2545.       case CHRTYPE:
  2546.           asb->sb_mode |= S_IFCHR;
  2547.           break;
  2548.       case DIRTYPE:
  2549.           asb->sb_mode |= S_IFDIR;
  2550.           break;
  2551.  
  2552. --- 227,233 -----
  2553.   #ifdef S_IFCHR
  2554.           asb->sb_mode |= S_IFCHR;
  2555.           break;
  2556. + #endif
  2557.       case DIRTYPE:
  2558.           asb->sb_mode |= S_IFDIR;
  2559.           break;
  2560. ***************
  2561. *** 320,326
  2562.       struct tm           *atm;
  2563.       Link           *from;
  2564.       struct passwd      *pwp;
  2565. -     struct group       *grp;
  2566.   
  2567.       if (f_list && f_verbose) {
  2568.       fprintf(msgfile, "%-7o", asb->sb_mode);
  2569.  
  2570. --- 324,329 -----
  2571.       struct tm           *atm;
  2572.       Link           *from;
  2573.       struct passwd      *pwp;
  2574.   
  2575.   
  2576.       if (f_list && f_verbose) {
  2577. ***************
  2578. *** 322,327
  2579.       struct passwd      *pwp;
  2580.       struct group       *grp;
  2581.   
  2582.       if (f_list && f_verbose) {
  2583.       fprintf(msgfile, "%-7o", asb->sb_mode);
  2584.       atm = localtime(&asb->sb_mtime);
  2585.  
  2586. --- 325,331 -----
  2587.       Link           *from;
  2588.       struct passwd      *pwp;
  2589.   
  2590.       if (f_list && f_verbose) {
  2591.       fprintf(msgfile, "%-7o", asb->sb_mode);
  2592.       atm = localtime(&asb->sb_mtime);
  2593. ***************
  2594. *** 375,381
  2595.   #endif
  2596.   {
  2597.       struct tm             *atm;
  2598. -     int            i;
  2599.       int            mode;
  2600.       char               *symnam = "NULL";
  2601.       Link               *link;
  2602.  
  2603. --- 379,384 -----
  2604.   #endif
  2605.   {
  2606.       struct tm             *atm;
  2607.       int            mode;
  2608.   #if defined(S_IFLNK)
  2609.       int            i;
  2610. ***************
  2611. *** 377,382
  2612.       struct tm             *atm;
  2613.       int            i;
  2614.       int            mode;
  2615.       char               *symnam = "NULL";
  2616.       Link               *link;
  2617.   
  2618.  
  2619. --- 380,387 -----
  2620.   {
  2621.       struct tm             *atm;
  2622.       int            mode;
  2623. + #if defined(S_IFLNK)
  2624. +     int            i;
  2625.       char               *symnam = "NULL";
  2626.   #endif
  2627.       Link               *link;
  2628. ***************
  2629. *** 378,383
  2630.       int            i;
  2631.       int            mode;
  2632.       char               *symnam = "NULL";
  2633.       Link               *link;
  2634.   
  2635.       if ((mode = asb->sb_mode & S_IFMT) == S_IFDIR) {
  2636.  
  2637. --- 383,389 -----
  2638.   #if defined(S_IFLNK)
  2639.       int            i;
  2640.       char               *symnam = "NULL";
  2641. + #endif
  2642.       Link               *link;
  2643.   
  2644.       if ((mode = asb->sb_mode & S_IFMT) == S_IFDIR) {
  2645. ***************
  2646. *** 515,520
  2647.   #ifdef S_IFBLK
  2648.       case S_IFBLK:
  2649.   #endif
  2650.       case S_IFCHR:
  2651.           fprintf(msgfile, "\t%3d, %3d",
  2652.                      major(asb->sb_rdev), minor(asb->sb_rdev));
  2653.  
  2654. --- 521,527 -----
  2655.   #ifdef S_IFBLK
  2656.       case S_IFBLK:
  2657.   #endif
  2658. + #ifdef S_IFCHR
  2659.       case S_IFCHR:
  2660.           fprintf(msgfile, "\t%3d, %3d",
  2661.                      major(asb->sb_rdev), minor(asb->sb_rdev));
  2662. ***************
  2663. *** 519,524
  2664.           fprintf(msgfile, "\t%3d, %3d",
  2665.                      major(asb->sb_rdev), minor(asb->sb_rdev));
  2666.           break;
  2667.       case S_IFREG:
  2668.           fprintf(msgfile, "\t%8ld", (long) asb->sb_size);
  2669.           break;
  2670.  
  2671. --- 526,532 -----
  2672.           fprintf(msgfile, "\t%3d, %3d",
  2673.                      major(asb->sb_rdev), minor(asb->sb_rdev));
  2674.           break;
  2675. + #endif
  2676.       case S_IFREG:
  2677.           fprintf(msgfile, "\t%8ld", (long) asb->sb_size);
  2678.           break;
  2679. ***************
  2680. *** 584,589
  2681.           putc('b', msgfile); 
  2682.           break;
  2683.   #endif
  2684.       case S_IFCHR: 
  2685.           putc('c', msgfile); 
  2686.           break;
  2687.  
  2688. --- 592,598 -----
  2689.           putc('b', msgfile); 
  2690.           break;
  2691.   #endif
  2692. + #ifdef S_IFCHR
  2693.       case S_IFCHR: 
  2694.           putc('c', msgfile); 
  2695.           break;
  2696. ***************
  2697. *** 587,592
  2698.       case S_IFCHR: 
  2699.           putc('c', msgfile); 
  2700.           break;
  2701.   #ifdef    S_IFIFO
  2702.       case S_IFIFO: 
  2703.           putc('p', msgfile); 
  2704.  
  2705. --- 596,602 -----
  2706.       case S_IFCHR: 
  2707.           putc('c', msgfile); 
  2708.           break;
  2709. + #endif
  2710.   #ifdef    S_IFIFO
  2711.       case S_IFIFO: 
  2712.           putc('p', msgfile); 
  2713. diff -c pax/namelist.c pax.amiga/namelist.c
  2714. *** pax/namelist.c    Sat Feb 18 12:59:48 1989
  2715. --- pax.amiga/namelist.c    Sun Sep 24 04:06:30 1989
  2716. ***************
  2717. *** 78,83
  2718.   
  2719.   struct dirinfo {
  2720.       char            dirname[PATH_MAX + 1];    /* name of directory */
  2721.       OFFSET        where;    /* current location in directory */
  2722.       struct dirinfo *next;
  2723.   };
  2724.  
  2725. --- 78,84 -----
  2726.   
  2727.   struct dirinfo {
  2728.       char            dirname[PATH_MAX + 1];    /* name of directory */
  2729. + #ifndef AMIGA
  2730.       OFFSET        where;    /* current location in directory */
  2731.   #else
  2732.       DIR           *where;
  2733. ***************
  2734. *** 79,84
  2735.   struct dirinfo {
  2736.       char            dirname[PATH_MAX + 1];    /* name of directory */
  2737.       OFFSET        where;    /* current location in directory */
  2738.       struct dirinfo *next;
  2739.   };
  2740.   
  2741.  
  2742. --- 80,88 -----
  2743.       char            dirname[PATH_MAX + 1];    /* name of directory */
  2744.   #ifndef AMIGA
  2745.       OFFSET        where;    /* current location in directory */
  2746. + #else
  2747. +     DIR           *where;
  2748. + #endif
  2749.       struct dirinfo *next;
  2750.   };
  2751.   
  2752. ***************
  2753. *** 137,143
  2754.   {
  2755.       int             i;        /* Length of string */
  2756.       struct nm_list *p;        /* Current struct pointer */
  2757. -     char *malloc();
  2758.   
  2759.       i = strlen(name);
  2760.       p = (struct nm_list *) malloc((unsigned) (i + sizeof(struct nm_list)));
  2761.  
  2762. --- 141,146 -----
  2763.   {
  2764.       int             i;        /* Length of string */
  2765.       struct nm_list *p;        /* Current struct pointer */
  2766.   
  2767.       i = strlen(name);
  2768.       p = (struct nm_list *) malloc((unsigned) (i + sizeof(struct nm_list)));
  2769. ***************
  2770. *** 365,370
  2771.               in_subdir--;
  2772.               curr_dir = popdir();
  2773.               if (in_subdir) {
  2774.               errno = 0;
  2775.               if ((dirp=opendir(curr_dir->dirname)) == (DIR *)NULL) {
  2776.                   warn(curr_dir->dirname, "error opening directory (1)");
  2777.  
  2778. --- 368,374 -----
  2779.               in_subdir--;
  2780.               curr_dir = popdir();
  2781.               if (in_subdir) {
  2782. + #ifndef AMIGA
  2783.               errno = 0;
  2784.               if ((dirp=opendir(curr_dir->dirname)) == (DIR *)NULL) {
  2785.                   warn(curr_dir->dirname, "error opening directory (1)");
  2786. ***************
  2787. *** 371,376
  2788.                   in_subdir--;
  2789.               }
  2790.               seekdir(dirp, curr_dir->where);
  2791.               }
  2792.               continue;
  2793.           }
  2794.  
  2795. --- 375,383 -----
  2796.                   in_subdir--;
  2797.               }
  2798.               seekdir(dirp, curr_dir->where);
  2799. + #else
  2800. +                 dirp = curr_dir->where;
  2801. + #endif
  2802.               }
  2803.               continue;
  2804.           }
  2805. ***************
  2806. *** 386,391
  2807.       }
  2808.       if (!names_from_stdin && (statbuf->sb_mode & S_IFMT) == S_IFDIR) {
  2809.           if (in_subdir) {
  2810.           curr_dir->where = telldir(dirp);
  2811.           pushdir(curr_dir);
  2812.           closedir(dirp);
  2813.  
  2814. --- 393,399 -----
  2815.       }
  2816.       if (!names_from_stdin && (statbuf->sb_mode & S_IFMT) == S_IFDIR) {
  2817.           if (in_subdir) {
  2818. + #ifndef AMIGA
  2819.           curr_dir->where = telldir(dirp);
  2820.   #else
  2821.           curr_dir->where = dirp;
  2822. ***************
  2823. *** 387,392
  2824.       if (!names_from_stdin && (statbuf->sb_mode & S_IFMT) == S_IFDIR) {
  2825.           if (in_subdir) {
  2826.           curr_dir->where = telldir(dirp);
  2827.           pushdir(curr_dir);
  2828.           closedir(dirp);
  2829.           } 
  2830.  
  2831. --- 395,403 -----
  2832.           if (in_subdir) {
  2833.   #ifndef AMIGA
  2834.           curr_dir->where = telldir(dirp);
  2835. + #else
  2836. +         curr_dir->where = dirp;
  2837. + #endif
  2838.           pushdir(curr_dir);
  2839.   #ifndef AMIGA
  2840.           closedir(dirp);
  2841. ***************
  2842. *** 388,393
  2843.           if (in_subdir) {
  2844.           curr_dir->where = telldir(dirp);
  2845.           pushdir(curr_dir);
  2846.           closedir(dirp);
  2847.           } 
  2848.           in_subdir++;
  2849.  
  2850. --- 399,405 -----
  2851.           curr_dir->where = dirp;
  2852.   #endif
  2853.           pushdir(curr_dir);
  2854. + #ifndef AMIGA
  2855.           closedir(dirp);
  2856.   #endif
  2857.           } 
  2858. ***************
  2859. *** 389,394
  2860.           curr_dir->where = telldir(dirp);
  2861.           pushdir(curr_dir);
  2862.           closedir(dirp);
  2863.           } 
  2864.           in_subdir++;
  2865.   
  2866.  
  2867. --- 401,407 -----
  2868.           pushdir(curr_dir);
  2869.   #ifndef AMIGA
  2870.           closedir(dirp);
  2871. + #endif
  2872.           } 
  2873.           in_subdir++;
  2874.   
  2875. ***************
  2876. *** 417,422
  2877.                        err = -1;
  2878.                        continue;
  2879.                   } else {
  2880.                        seekdir(dirp, curr_dir->where);
  2881.           }
  2882.           } while (in_subdir && (! dirp));
  2883.  
  2884. --- 430,436 -----
  2885.                        err = -1;
  2886.                        continue;
  2887.                   } else {
  2888. + #ifndef AMIGA
  2889.                        seekdir(dirp, curr_dir->where);
  2890.   #else
  2891.                if(curr_dir->where)
  2892. ***************
  2893. *** 418,423
  2894.                        continue;
  2895.                   } else {
  2896.                        seekdir(dirp, curr_dir->where);
  2897.           }
  2898.           } while (in_subdir && (! dirp));
  2899.       }
  2900.  
  2901. --- 432,441 -----
  2902.                   } else {
  2903.   #ifndef AMIGA
  2904.                        seekdir(dirp, curr_dir->where);
  2905. + #else
  2906. +              if(curr_dir->where)
  2907. +              dirp = curr_dir->where;
  2908. + #endif
  2909.           }
  2910.           } while (in_subdir && (! dirp));
  2911.       }
  2912. diff -c pax/names.c pax.amiga/names.c
  2913. *** pax/names.c    Sat Feb 18 12:59:50 1989
  2914. --- pax.amiga/names.c    Wed Sep 20 06:07:47 1989
  2915. ***************
  2916. *** 56,62
  2917.   
  2918.   
  2919.   /* Internal Identifiers */
  2920. ! #ifndef MSDOS
  2921.   static int      saveuid = -993;
  2922.   static char     saveuname[TUNMLEN];
  2923.   static int      my_uid = -993;
  2924.  
  2925. --- 56,62 -----
  2926.   
  2927.   
  2928.   /* Internal Identifiers */
  2929. ! #if !defined(MSDOS) || !defined(AMIGA)
  2930.   static int      saveuid = -993;
  2931.   static char     saveuname[TUNMLEN];
  2932.   static int      my_uid = -993;
  2933. diff -c pax/pass.c pax.amiga/pass.c
  2934. *** pax/pass.c    Sat Feb 18 12:50:51 1989
  2935. --- pax.amiga/pass.c    Sun Sep 24 20:20:05 1989
  2936. ***************
  2937. *** 67,73
  2938.   
  2939.   #ifdef __STDC__
  2940.       
  2941. ! int pass(char *dirname)
  2942.   
  2943.   #else
  2944.       
  2945.  
  2946. --- 67,73 -----
  2947.   
  2948.   #ifdef __STDC__
  2949.       
  2950. ! void pass(char *dirname)
  2951.   
  2952.   #else
  2953.       
  2954. ***************
  2955. *** 71,77
  2956.   
  2957.   #else
  2958.       
  2959. ! int pass(dirname)
  2960.   char    *dirname;
  2961.   
  2962.   #endif
  2963.  
  2964. --- 71,77 -----
  2965.   
  2966.   #else
  2967.       
  2968. ! void pass(dirname)
  2969.   char    *dirname;
  2970.   
  2971.   #endif
  2972. diff -c pax/pathname.c pax.amiga/pathname.c
  2973. *** pax/pathname.c    Sat Feb 18 12:50:54 1989
  2974. --- pax.amiga/pathname.c    Sun Sep 24 20:22:03 1989
  2975. ***************
  2976. *** 74,79
  2977.    *    failed, a -1 will be returned to the calling routine.
  2978.    */
  2979.   
  2980.   #ifdef __STDC__
  2981.   
  2982.   int dirneed(char *name)
  2983.  
  2984. --- 74,85 -----
  2985.    *    failed, a -1 will be returned to the calling routine.
  2986.    */
  2987.   
  2988. + #ifdef AMIGA
  2989. + #  define CURDIR ""
  2990. + #else
  2991. + #  define CURDIR "."
  2992. + #endif
  2993.   #ifdef __STDC__
  2994.   
  2995.   int dirneed(char *name)
  2996. ***************
  2997. *** 97,103
  2998.       }
  2999.       }
  3000.       if (last == (char *)NULL) {
  3001. !     return (STAT(".", &sb));
  3002.       }
  3003.       *--last = '\0';
  3004.       ok = STAT(*name ? name : ".", &sb) == 0
  3005.  
  3006. --- 103,109 -----
  3007.       }
  3008.       }
  3009.       if (last == (char *)NULL) {
  3010. !     return (STAT(CURDIR, &sb));
  3011.       }
  3012.       *--last = '\0';
  3013.       ok = STAT(*name ? name : CURDIR, &sb) == 0
  3014. ***************
  3015. *** 100,106
  3016.       return (STAT(".", &sb));
  3017.       }
  3018.       *--last = '\0';
  3019. !     ok = STAT(*name ? name : ".", &sb) == 0
  3020.       ? ((sb.sb_mode & S_IFMT) == S_IFDIR)
  3021.       : (f_dir_create && dirneed(name) == 0 && dirmake(name, &sb) == 0);
  3022.       *last = '/';
  3023.  
  3024. --- 106,112 -----
  3025.       return (STAT(CURDIR, &sb));
  3026.       }
  3027.       *--last = '\0';
  3028. !     ok = STAT(*name ? name : CURDIR, &sb) == 0
  3029.       ? ((sb.sb_mode & S_IFMT) == S_IFDIR)
  3030.       : (f_dir_create && dirneed(name) == 0 && dirmake(name, &sb) == 0);
  3031.       *last = '/';
  3032. ***************
  3033. *** 136,141
  3034.   
  3035.   #endif
  3036.   {
  3037.       char           *name;
  3038.       char           *item;
  3039.       int             idx;
  3040.  
  3041. --- 142,152 -----
  3042.   
  3043.   #endif
  3044.   {
  3045. + #ifdef AMIGA
  3046. +     return begin;
  3047. + #else
  3048.       char           *name;
  3049.       char           *item;
  3050.       int             idx;
  3051. ***************
  3052. *** 191,196
  3053.       }
  3054.       *--name = '\0';
  3055.       return (idx);
  3056.   }
  3057.   
  3058.   
  3059.  
  3060. --- 202,208 -----
  3061.       }
  3062.       *--name = '\0';
  3063.       return (idx);
  3064. + #endif
  3065.   }
  3066.   
  3067.   
  3068. ***************
  3069. *** 198,204
  3070.    *
  3071.    * DESCRIPTION
  3072.    *
  3073. !  *    Dirmake makes a directory with the appropritate permissions.
  3074.    *
  3075.    * PARAMETERS
  3076.    *
  3077.  
  3078. --- 210,216 -----
  3079.    *
  3080.    * DESCRIPTION
  3081.    *
  3082. !  *    Dirmake makes a directory with the appropriate permissions.
  3083.    *
  3084.    * PARAMETERS
  3085.    *
  3086. ***************
  3087. *** 223,228
  3088.   
  3089.   #endif
  3090.   {
  3091.       if (mkdir(name, (int) (asb->sb_mode & S_IPOPN)) < 0) {
  3092.       return (-1);
  3093.       }
  3094.  
  3095. --- 235,241 -----
  3096.   
  3097.   #endif
  3098.   {
  3099. + #ifndef AMIGA
  3100.       if (mkdir(name, (int) (asb->sb_mode & S_IPOPN)) < 0) {
  3101.       return (-1);
  3102.       }
  3103. ***************
  3104. *** 226,231
  3105.       if (mkdir(name, (int) (asb->sb_mode & S_IPOPN)) < 0) {
  3106.       return (-1);
  3107.       }
  3108.       if (asb->sb_mode & S_IPEXE) {
  3109.       chmod(name, (int) (asb->sb_mode & S_IPERM));
  3110.       }
  3111.  
  3112. --- 239,249 -----
  3113.       if (mkdir(name, (int) (asb->sb_mode & S_IPOPN)) < 0) {
  3114.       return (-1);
  3115.       }
  3116. + #else
  3117. +     if (mkdir(name)) {
  3118. +     return -1;
  3119. +     }
  3120.       if (asb->sb_mode & S_IPEXE) {
  3121.       chmod(name, (int) (asb->sb_mode & S_IPERM));
  3122.       }
  3123. ***************
  3124. *** 229,234
  3125.       if (asb->sb_mode & S_IPEXE) {
  3126.       chmod(name, (int) (asb->sb_mode & S_IPERM));
  3127.       }
  3128.       if (f_owner) {
  3129.       chown(name, (int) asb->sb_uid, (int) asb->sb_gid);
  3130.       }
  3131.  
  3132. --- 247,253 -----
  3133.       if (asb->sb_mode & S_IPEXE) {
  3134.       chmod(name, (int) (asb->sb_mode & S_IPERM));
  3135.       }
  3136. + #endif
  3137.       if (f_owner) {
  3138.       chown(name, (int) asb->sb_uid, (int) asb->sb_gid);
  3139.       }
  3140. diff -c pax/pax.c pax.amiga/pax.c
  3141. *** pax/pax.c    Sat Feb 18 12:59:52 1989
  3142. --- pax.amiga/pax.c    Sun Sep 24 20:29:28 1989
  3143. ***************
  3144. *** 149,154
  3145.    */
  3146.   
  3147.   #ifdef __STDC__
  3148.   
  3149.   int main(int argc, char **argv)
  3150.   
  3151.  
  3152. --- 149,160 -----
  3153.    */
  3154.   
  3155.   #ifdef __STDC__
  3156. + #ifdef AMIGA
  3157. + void
  3158. + #else
  3159. + int
  3160. + #endif
  3161. + main(int argc, char **argv)
  3162.   
  3163.   #else
  3164.   
  3165. ***************
  3166. *** 150,157
  3167.   
  3168.   #ifdef __STDC__
  3169.   
  3170. - int main(int argc, char **argv)
  3171.   #else
  3172.   
  3173.   int main(argc, argv)
  3174.  
  3175. --- 156,161 -----
  3176.   #endif
  3177.   main(int argc, char **argv)
  3178.   
  3179.   #else
  3180.   
  3181.   int main(argc, argv)
  3182. ***************
  3183. *** 182,188
  3184.               *tmp = '\0';
  3185.       }
  3186.   #else
  3187. !     /* strip the pathname off of the name of the executable */
  3188.       if ((myname = strrchr(argv[0], '/')) != (char *)NULL) {
  3189.       myname++;
  3190.       } else {
  3191.  
  3192. --- 186,192 -----
  3193.               *tmp = '\0';
  3194.       }
  3195.   #else
  3196. !     /* strip the pathname off the name of the executable */
  3197.       if ((myname = strrchr(argv[0], '/')) != (char *)NULL) {
  3198.       myname++;
  3199.       } else {
  3200. ***************
  3201. *** 190,196
  3202.       }
  3203.   #endif
  3204.   
  3205. !     /* set upt for collecting other command line arguments */
  3206.       name_init(argc, argv);
  3207.   
  3208.       /* get all our necessary information */
  3209.  
  3210. --- 194,200 -----
  3211.       }
  3212.   #endif
  3213.   
  3214. !     /* set up for collecting other command line arguments */
  3215.       name_init(argc, argv);
  3216.   
  3217.       /* get all our necessary information */
  3218. ***************
  3219. *** 230,237
  3220.    *
  3221.    * RETURNS
  3222.    *
  3223. !  *    Normally returns 0.  If an error occurs, -1 is returned 
  3224. !  *    and state is set to reflect the error.
  3225.    *
  3226.    */
  3227.   
  3228.  
  3229. --- 234,240 -----
  3230.    *
  3231.    * RETURNS
  3232.    *
  3233. !  *    Nothing
  3234.    *
  3235.    */
  3236.   
  3237. ***************
  3238. *** 237,243
  3239.   
  3240.   #ifdef __STDC__
  3241.   
  3242. ! int do_pax(int ac, char **av)
  3243.   
  3244.   #else
  3245.   
  3246.  
  3247. --- 240,246 -----
  3248.   
  3249.   #ifdef __STDC__
  3250.   
  3251. ! void do_pax(int ac, char **av)
  3252.   
  3253.   #else
  3254.   
  3255. ***************
  3256. *** 241,247
  3257.   
  3258.   #else
  3259.   
  3260. ! int do_pax(ac, av)
  3261.   int             ac;        /* argument counter */
  3262.   char          **av;        /* arguments */
  3263.   
  3264.  
  3265. --- 244,250 -----
  3266.   
  3267.   #else
  3268.   
  3269. ! void do_pax(ac, av)
  3270.   int             ac;        /* argument counter */
  3271.   char          **av;        /* arguments */
  3272.   
  3273. ***************
  3274. *** 409,415
  3275.       usage();
  3276.       }
  3277.   
  3278. -     return (0);
  3279.   }
  3280.   
  3281.   
  3282.  
  3283. --- 412,417 -----
  3284.       usage();
  3285.       }
  3286.   
  3287.   }
  3288.   
  3289.   
  3290. diff -c pax/pax.h pax.amiga/pax.h
  3291. *** pax/pax.h    Sat Feb 18 12:59:53 1989
  3292. --- pax.amiga/pax.h    Wed Sep 20 06:38:48 1989
  3293. ***************
  3294. *** 38,43
  3295.   #include "config.h"
  3296.   #include "limits.h"
  3297.   #include <stdio.h>
  3298.   #include <errno.h>
  3299.   #include <signal.h>
  3300.   #include <ctype.h>
  3301.  
  3302. --- 38,48 -----
  3303.   #include "config.h"
  3304.   #include "limits.h"
  3305.   #include <stdio.h>
  3306. + #ifndef V7
  3307. + #   include <fcntl.h>
  3308. + #endif
  3309.   #include <errno.h>
  3310.   #include <signal.h>
  3311.   #include <ctype.h>
  3312. ***************
  3313. *** 41,46
  3314.   #include <errno.h>
  3315.   #include <signal.h>
  3316.   #include <ctype.h>
  3317.   #include <sys/types.h>
  3318.   #ifndef MSDOS
  3319.   #include <sys/ioctl.h>
  3320.  
  3321. --- 46,52 -----
  3322.   #include <errno.h>
  3323.   #include <signal.h>
  3324.   #include <ctype.h>
  3325. + #ifndef AMIGA
  3326.   #include <sys/types.h>
  3327.   #ifndef MSDOS
  3328.   #include <sys/ioctl.h>
  3329. ***************
  3330. *** 46,51
  3331.   #include <sys/ioctl.h>
  3332.   #endif
  3333.   #include <sys/stat.h>
  3334.   #include "regexp.h"
  3335.   
  3336.   #if defined(DIRENT) || defined(_POSIX_SOURCE)
  3337.  
  3338. --- 52,63 -----
  3339.   #include <sys/ioctl.h>
  3340.   #endif
  3341.   #include <sys/stat.h>
  3342. + #else /* AMIGA */
  3343. + #include "sys/stat.h"
  3344. + #include <stdlib.h>
  3345. + #include <stddef.h>
  3346. + #endif /* AMIGA */
  3347.   #include "regexp.h"
  3348.   
  3349.   #if defined(DIRENT) || defined(_POSIX_SOURCE)
  3350. ***************
  3351. *** 55,62
  3352.   #  include <dirent.h>
  3353.   # endif
  3354.   #else
  3355. ! # ifdef hpux
  3356. ! #  include <ndir.h>
  3357.   # else
  3358.   #  ifdef XENIX_286
  3359.   #   include <sys/ndir.h>
  3360.  
  3361. --- 67,74 -----
  3362.   #  include <dirent.h>
  3363.   # endif
  3364.   #else
  3365. ! # if defined(hpux) || defined(AMIGA)
  3366. ! #  include "ndir.h"
  3367.   # else
  3368.   #  ifdef XENIX_286
  3369.   #   include <sys/ndir.h>
  3370. ***************
  3371. *** 67,73
  3372.   # define dirent direct
  3373.   #endif
  3374.   
  3375. ! #ifndef MSDOS
  3376.   #ifndef    major
  3377.   #   include <sys/sysmacros.h>
  3378.   #endif            /* major */    
  3379.  
  3380. --- 79,85 -----
  3381.   # define dirent direct
  3382.   #endif
  3383.   
  3384. ! #if !defined(MSDOS) && !defined(AMIGA)
  3385.   #ifndef    major
  3386.   #   include <sys/sysmacros.h>
  3387.   #endif            /* major */    
  3388. ***************
  3389. *** 79,88
  3390.   #   include <time.h>
  3391.   #endif                /* SYSTIME */
  3392.   
  3393. - #ifndef V7
  3394. - #   include <fcntl.h>
  3395. - #endif
  3396.   #ifdef XENIX
  3397.   #   include <sys/inode.h>
  3398.   #endif
  3399.  
  3400. --- 91,96 -----
  3401.   #   include <time.h>
  3402.   #endif                /* SYSTIME */
  3403.   
  3404.   #ifdef XENIX
  3405.   #   include <sys/inode.h>
  3406.   #endif
  3407. ***************
  3408. *** 87,93
  3409.   #   include <sys/inode.h>
  3410.   #endif
  3411.   #ifdef XENIX_286
  3412. ! #include <sys/param.h>
  3413.   #endif /* XENIX_286 */
  3414.   
  3415.   
  3416.  
  3417. --- 95,101 -----
  3418.   #   include <sys/inode.h>
  3419.   #endif
  3420.   #ifdef XENIX_286
  3421. ! #   include <sys/param.h>
  3422.   #endif /* XENIX_286 */
  3423.   
  3424.   
  3425. ***************
  3426. *** 91,98
  3427.   #endif /* XENIX_286 */
  3428.   
  3429.   
  3430. ! #ifndef MSDOS
  3431.   #include <pwd.h>
  3432.   #include <grp.h>
  3433.   
  3434.  
  3435. --- 99,105 -----
  3436.   #endif /* XENIX_286 */
  3437.   
  3438.   
  3439. ! #if  !defined(MSDOS) && !defined(AMIGA)
  3440.   #include <pwd.h>
  3441.   #include <grp.h>
  3442.   
  3443. ***************
  3444. *** 97,103
  3445.   #include <grp.h>
  3446.   
  3447.   #ifndef XENIX_286
  3448. ! #include <sys/file.h>
  3449.   #endif /* XENIX_286 */
  3450.   
  3451.   #else
  3452.  
  3453. --- 104,110 -----
  3454.   #include <grp.h>
  3455.   
  3456.   #ifndef XENIX_286
  3457. ! #   include <sys/file.h>
  3458.   #endif /* XENIX_286 */
  3459.   
  3460.   #else /* MSDOS | AMIGA */
  3461. ***************
  3462. *** 100,107
  3463.   #include <sys/file.h>
  3464.   #endif /* XENIX_286 */
  3465.   
  3466. ! #else
  3467. ! #include <io.h>
  3468.   #define    major(x)    (0)
  3469.   #define    minor(x)    (0)
  3470.   #define    makedev(x,y)    (0)
  3471.  
  3472. --- 107,116 -----
  3473.   #   include <sys/file.h>
  3474.   #endif /* XENIX_286 */
  3475.   
  3476. ! #else /* MSDOS | AMIGA */
  3477. ! #  ifndef AMIGA
  3478. ! #    include <io.h>
  3479. ! #  endif /* AMIGA */
  3480.   #define    major(x)    (0)
  3481.   #define    minor(x)    (0)
  3482.   #define    makedev(x,y)    (0)
  3483. ***************
  3484. *** 339,345
  3485.   
  3486.   /*
  3487.    * This has to be included here to insure that all of the type 
  3488. !  * delcarations are declared for the prototypes.
  3489.    */
  3490.   #include "func.h"
  3491.   
  3492.  
  3493. --- 348,354 -----
  3494.   
  3495.   /*
  3496.    * This has to be included here to insure that all of the type 
  3497. !  * declarations are declared for the prototypes.
  3498.    */
  3499.   #include "func.h"
  3500.   
  3501. ***************
  3502. *** 399,403
  3503.   extern int      sys_nerr;
  3504.   extern char    *sys_errlist[];
  3505.   extern int      errno;
  3506.   #endif /* _PAX_H */
  3507.  
  3508. --- 408,411 -----
  3509.   extern int      sys_nerr;
  3510.   extern char    *sys_errlist[];
  3511.   extern int      errno;
  3512.   #endif /* _PAX_H */
  3513. diff -c pax/port.c pax.amiga/port.c
  3514. *** pax/port.c    Mon Mar 13 11:28:21 1989
  3515. --- pax.amiga/port.c    Sun Sep 24 21:51:15 1989
  3516. ***************
  3517. *** 52,57
  3518.   #include "pax.h"
  3519.   
  3520.   
  3521.   /*
  3522.    * Some computers are not so crass as to align themselves into the BSD or USG
  3523.    * camps.  If a system supplies all of the routines we fake here, add it to
  3524.  
  3525. --- 52,66 -----
  3526.   #include "pax.h"
  3527.   
  3528.   
  3529. + #ifdef AMIGA
  3530. + #  include <exec/types.h>
  3531. + #  include <exec/memory.h>
  3532. + #  include <libraries/dos.h>
  3533. + #  include <libraries/dosextens.h>
  3534. + #  include <proto/exec.h>
  3535. + #  include <proto/dos.h>
  3536. + #endif AMIGA
  3537.   /*
  3538.    * Some computers are not so crass as to align themselves into the BSD or USG
  3539.    * camps.  If a system supplies all of the routines we fake here, add it to
  3540. ***************
  3541. *** 59,65
  3542.    */
  3543.   
  3544.   #if !defined(mc300) && !defined(mc500) && !defined(mc700) && !defined(BSD) \
  3545. ! && !defined(MSDOS)
  3546.   
  3547.   /* mkdir - make a directory
  3548.    *
  3549.  
  3550. --- 68,74 -----
  3551.    */
  3552.   
  3553.   #if !defined(mc300) && !defined(mc500) && !defined(mc700) && !defined(BSD) \
  3554. ! && !defined(MSDOS) && !defined(AMIGA)
  3555.   
  3556.   /* mkdir - make a directory
  3557.    *
  3558. ***************
  3559. *** 193,199
  3560.   
  3561.   #endif /* MASSCOMP, BSD */
  3562.   
  3563. ! #ifdef MSDOS
  3564.   
  3565.   static struct passwd npwd = {"", "", 0, 0, 0, "", "", "", ""};
  3566.   static char gmem1[] = "";
  3567.  
  3568. --- 202,208 -----
  3569.   
  3570.   #endif /* MASSCOMP, BSD */
  3571.   
  3572. ! #if defined(MSDOS) || defined(AMIGA)
  3573.   
  3574.   static struct passwd npwd = {"", "", 0, 0, 0, "", "", "", ""};
  3575.   static char gmem1[] = "";
  3576. ***************
  3577. *** 245,247
  3578.   }
  3579.   #endif
  3580.   
  3581.  
  3582. --- 254,272 -----
  3583.   }
  3584.   #endif
  3585.   
  3586. + #ifdef AMIGA
  3587. + char *
  3588. + chipalloc(unsigned size)
  3589. + {
  3590. +     struct MemList *x =  
  3591. +     (struct MemList *)AllocMem((long)size+sizeof(struct MemList), MEMF_CHIP | MEMF_PUBLIC);
  3592. +     struct Task *p = FindTask(0L);
  3593. +     if(x == (struct MemList *)NULL)
  3594. +     return NULL;
  3595. +     x->ml_NumEntries = 1;
  3596. +     x->ml_ME[0].me_Addr = (APTR)(((long)x) + sizeof(struct MemList));
  3597. +     x->ml_ME[0].me_Length = size;
  3598. +     AddHead(&p->tc_MemEntry, &x->ml_Node);
  3599. +     return (char *)(x->ml_ME[0].me_Addr);
  3600. + }
  3601. diff -c pax/port.h pax.amiga/port.h
  3602. *** pax/port.h    Sat Feb 18 12:51:39 1989
  3603. --- pax.amiga/port.h    Sun Sep 24 19:15:12 1989
  3604. ***************
  3605. *** 83,89
  3606.   /*
  3607.    * Map ANSI C compatible functions to V7 functions
  3608.    */
  3609.   #   define memcpy(a,b,n)    bcopy((b),(a),(n))
  3610.   #   define memset(a,b,n)    bzero((a),(n))
  3611.   #   define strrchr(s,c)        rindex(s,c)
  3612.  
  3613. --- 83,89 -----
  3614.   /*
  3615.    * Map ANSI C compatible functions to V7 functions
  3616.    */
  3617. ! #ifndef __STDC__
  3618.   #   define memcpy(a,b,n)    bcopy((b),(a),(n))
  3619.   #   define memset(a,b,n)    bzero((a),(n))
  3620.   #   define strrchr(s,c)        rindex(s,c)
  3621. ***************
  3622. *** 88,93
  3623.   #   define memset(a,b,n)    bzero((a),(n))
  3624.   #   define strrchr(s,c)        rindex(s,c)
  3625.   #   define strchr(s,c)        index(s,c)
  3626.   #endif /* USG */
  3627.   #endif /* _PAX_PORT_H */
  3628.  
  3629. --- 88,96 -----
  3630.   #   define memset(a,b,n)    bzero((a),(n))
  3631.   #   define strrchr(s,c)        rindex(s,c)
  3632.   #   define strchr(s,c)        index(s,c)
  3633. ! #else
  3634. ! #   include <string.h>
  3635. ! #endif
  3636.   #endif /* USG */
  3637.   #ifdef AMIGA
  3638.   typedef long     off_t;
  3639. ***************
  3640. *** 90,93
  3641.   #   define strchr(s,c)        index(s,c)
  3642.   
  3643.   #endif /* USG */
  3644.   #endif /* _PAX_PORT_H */
  3645.  
  3646. --- 92,114 -----
  3647.   #   include <string.h>
  3648.   #endif
  3649.   #endif /* USG */
  3650. + #ifdef AMIGA
  3651. + typedef long     off_t;
  3652. + #endif
  3653. + #if defined(MSDOS) || defined(AMIGA)
  3654. + #ifdef __STDC__
  3655. + struct passwd *getpwuid(int x);
  3656. + struct passwd *getpwnam(char *s);
  3657. + struct group *getgrgid(int x);
  3658. + struct group *getgrnam(char *s);
  3659. + int          setgrent(void);
  3660. + int          getuid(void);
  3661. + int           getgid(void);
  3662. + int              link(char *f, char *t);
  3663. + int          chown(char *n, int uid, int gid);
  3664. + #ifdef AMIGA
  3665. + char          *chipalloc(unsigned size);
  3666. + #endif /* AMIGA */
  3667. + #endif /* __STDC__ */
  3668. + #endif /* MSDOS || AMIGA */
  3669.   #endif /* _PAX_PORT_H */
  3670. diff -c pax/regexp.c pax.amiga/regexp.c
  3671. *** pax/regexp.c    Sat Feb 18 12:59:57 1989
  3672. --- pax.amiga/regexp.c    Sun Sep 24 21:51:59 1989
  3673. ***************
  3674. *** 189,194
  3675.   #ifndef STATIC
  3676.   #define    STATIC    static
  3677.   #endif
  3678.   STATIC char    *reg();
  3679.   STATIC char    *regbranch();
  3680.   STATIC char    *regpiece();
  3681.  
  3682. --- 189,214 -----
  3683.   #ifndef STATIC
  3684.   #define    STATIC    static
  3685.   #endif
  3686. + #ifdef __STDC__
  3687. + static char *reg(int paren,
  3688. +                  int *flagp);
  3689. + static char *regbranch(int *flagp);
  3690. + static char *regpiece(int *flagp);
  3691. + static char *regatom(int *flagp);
  3692. + static char *regnode(int op);
  3693. + static void regc(int b);
  3694. + static void reginsert(int op,
  3695. +                       char *opnd);
  3696. + static void regtail(char *p,
  3697. +                     char *val);
  3698. + static void regoptail(char *p,
  3699. +                       char *val);
  3700. + static int regtry(struct regexp *prog,
  3701. +                   char *string);
  3702. + static int regmatch(char *prog);
  3703. + static int regrepeat(char *p);
  3704. + static char *regnext(register char *p);
  3705. + #else
  3706.   STATIC char    *reg();
  3707.   STATIC char    *regbranch();
  3708.   STATIC char    *regpiece();
  3709. ***************
  3710. *** 199,204
  3711.   STATIC void     reginsert();
  3712.   STATIC void     regtail();
  3713.   STATIC void     regoptail();
  3714.   #ifdef STRCSPN
  3715.   STATIC int      strcspn();
  3716.   #endif
  3717.  
  3718. --- 219,225 -----
  3719.   STATIC void     reginsert();
  3720.   STATIC void     regtail();
  3721.   STATIC void     regoptail();
  3722. + #endif
  3723.   #ifdef STRCSPN
  3724.   STATIC int      strcspn();
  3725.   #endif
  3726. ***************
  3727. *** 226,232
  3728.       register char  *longest;
  3729.       register int    len;
  3730.       int             flags;
  3731. -     extern char    *malloc();
  3732.   
  3733.       if (exp == (char *)NULL)
  3734.       FAIL("NULL argument");
  3735.  
  3736. --- 247,252 -----
  3737.       register char  *longest;
  3738.       register int    len;
  3739.       int             flags;
  3740.   
  3741.       if (exp == (char *)NULL)
  3742.       FAIL("NULL argument");
  3743. ***************
  3744. *** 416,422
  3745.   {
  3746.       register char  *ret;
  3747.       register char   op;
  3748. !     register char  *nxt;
  3749.       int             flags;
  3750.   
  3751.       ret = regatom(&flags);
  3752.  
  3753. --- 436,442 -----
  3754.   {
  3755.       register char  *ret;
  3756.       register char   op;
  3757. ! /*    register char  *nxt; /* not used: PC */
  3758.       int             flags;
  3759.   
  3760.       ret = regatom(&flags);
  3761. ***************
  3762. *** 564,570
  3763.    - regnode - emit a node
  3764.    */
  3765.   static char *regnode(op)
  3766. ! char            op;
  3767.   {
  3768.       register char  *ret;
  3769.       register char  *ptr;
  3770.  
  3771. --- 584,590 -----
  3772.    - regnode - emit a node
  3773.    */
  3774.   static char *regnode(op)
  3775. ! int          op;
  3776.   {
  3777.       register char  *ret;
  3778.       register char  *ptr;
  3779. ***************
  3780. *** 587,593
  3781.    - regc - emit (if appropriate) a byte of code
  3782.    */
  3783.   static void regc(b)
  3784. ! char            b;
  3785.   {
  3786.       if (regcode != ®dummy)
  3787.       *regcode++ = b;
  3788.  
  3789. --- 607,613 -----
  3790.    - regc - emit (if appropriate) a byte of code
  3791.    */
  3792.   static void regc(b)
  3793. ! int            b;
  3794.   {
  3795.       if (regcode != ®dummy)
  3796.       *regcode++ = b;
  3797. ***************
  3798. *** 601,607
  3799.    * Means relocating the operand.
  3800.    */
  3801.   static void reginsert(op, opnd)
  3802. ! char            op;
  3803.   char           *opnd;
  3804.   {
  3805.       register char  *src;
  3806.  
  3807. --- 621,627 -----
  3808.    * Means relocating the operand.
  3809.    */
  3810.   static void reginsert(op, opnd)
  3811. ! int             op;
  3812.   char           *opnd;
  3813.   {
  3814.       register char  *src;
  3815. ***************
  3816. *** 689,694
  3817.   
  3818.   #ifdef DEBUG
  3819.   int             regnarrate = 0;
  3820.   void            regdump();
  3821.   STATIC char    *regprop();
  3822.   #endif
  3823.  
  3824. --- 709,718 -----
  3825.   
  3826.   #ifdef DEBUG
  3827.   int             regnarrate = 0;
  3828. + #ifdef __STDC__
  3829. + static char *regprop(char *op);
  3830. + void         regdump(regexp *r);
  3831. + #else
  3832.   void            regdump();
  3833.   static char    *regprop();
  3834.   #endif
  3835. ***************
  3836. *** 690,696
  3837.   #ifdef DEBUG
  3838.   int             regnarrate = 0;
  3839.   void            regdump();
  3840. ! STATIC char    *regprop();
  3841.   #endif
  3842.   
  3843.   /*
  3844.  
  3845. --- 714,721 -----
  3846.   void         regdump(regexp *r);
  3847.   #else
  3848.   void            regdump();
  3849. ! static char    *regprop();
  3850. ! #endif
  3851.   #endif
  3852.   
  3853.   /*
  3854. diff -c pax/regexp.h pax.amiga/regexp.h
  3855. *** pax/regexp.h    Mon Feb  6 11:48:59 1989
  3856. --- pax.amiga/regexp.h    Fri Sep 15 04:58:27 1989
  3857. ***************
  3858. *** 25,30
  3859.    * number; the start node begins in the second byte.
  3860.    */
  3861.   #define    MAGIC    0234
  3862.   
  3863.   extern regexp *regcomp();
  3864.   extern int regexec();
  3865.  
  3866. --- 25,40 -----
  3867.    * number; the start node begins in the second byte.
  3868.    */
  3869.   #define    MAGIC    0234
  3870. + #ifdef __STDC__
  3871. + /* Prototypes for functions defined in regexp.c */
  3872. + extern struct regexp *regcomp(char *exp);
  3873. + extern int regexec(register struct regexp *prog,
  3874. +              register char *string);
  3875. + extern void regsub(struct regexp *prog,
  3876. +              char *source,
  3877. +              char *dest);
  3878. + extern void regerror(char *s);
  3879. + #else
  3880.   
  3881.   extern regexp *regcomp();
  3882.   extern int regexec();
  3883. ***************
  3884. *** 30,34
  3885.   extern int regexec();
  3886.   extern void regsub();
  3887.   extern void regerror();
  3888.   #endif /* _PAX_REGEXP_H */
  3889.  
  3890. --- 40,44 -----
  3891.   extern int regexec();
  3892.   extern void regsub();
  3893.   extern void regerror();
  3894. ! #endif
  3895.   #endif /* _PAX_REGEXP_H */
  3896. diff -c pax/tar.c pax.amiga/tar.c
  3897. *** pax/tar.c    Sat Feb 18 12:59:59 1989
  3898. --- pax.amiga/tar.c    Sun Sep 24 20:27:46 1989
  3899. ***************
  3900. *** 82,88
  3901.    *
  3902.    * RETURNS
  3903.    *
  3904. !  *    zero
  3905.    */
  3906.   
  3907.   #ifdef __STDC__
  3908.  
  3909. --- 82,88 -----
  3910.    *
  3911.    * RETURNS
  3912.    *
  3913. !  *    Nothing
  3914.    */
  3915.   
  3916.   #ifdef __STDC__
  3917. ***************
  3918. *** 87,93
  3919.   
  3920.   #ifdef __STDC__
  3921.   
  3922. ! int do_tar(int argc, char **argv)
  3923.   
  3924.   #else
  3925.   
  3926.  
  3927. --- 87,93 -----
  3928.   
  3929.   #ifdef __STDC__
  3930.   
  3931. ! void do_tar(int argc, char **argv)
  3932.   
  3933.   #else
  3934.   
  3935. ***************
  3936. *** 91,97
  3937.   
  3938.   #else
  3939.   
  3940. ! int do_tar(argc, argv)
  3941.   int             argc;        /* argument count (argc from main) */
  3942.   char          **argv;        /* argument list (argv from main) */
  3943.   
  3944.  
  3945. --- 91,97 -----
  3946.   
  3947.   #else
  3948.   
  3949. ! void do_tar(argc, argv)
  3950.   int             argc;        /* argument count (argc from main) */
  3951.   char          **argv;        /* argument list (argv from main) */
  3952.   
  3953. ***************
  3954. *** 188,193
  3955.   
  3956.       /* set the blocking factor, if not set by the user */
  3957.       if (blocking == 0) {
  3958.   #ifdef MSDOS
  3959.           blocking = 20;
  3960.   #else
  3961.  
  3962. --- 188,196 -----
  3963.   
  3964.       /* set the blocking factor, if not set by the user */
  3965.       if (blocking == 0) {
  3966. + #ifdef AMIGA
  3967. +     blocking = 22;
  3968. + #else
  3969.   #ifdef MSDOS
  3970.           blocking = 20;
  3971.   #else
  3972. ***************
  3973. *** 202,207
  3974.       blocking = 20;
  3975.   #endif /* USG */
  3976.   #endif
  3977.       }
  3978.       blocksize = blocking * BLOCKSIZE;
  3979.       buf_allocate((OFFSET) blocksize);
  3980.  
  3981. --- 205,211 -----
  3982.       blocking = 20;
  3983.   #endif /* USG */
  3984.   #endif
  3985. + #endif;
  3986.       }
  3987.       blocksize = blocking * BLOCKSIZE;
  3988.       buf_allocate((OFFSET) blocksize);
  3989. ***************
  3990. *** 224,230
  3991.       linkleft();         /* report any unresolved links */ 
  3992.       }
  3993.       
  3994. -     return (0);
  3995.   }
  3996.   
  3997.   
  3998.  
  3999. --- 228,233 -----
  4000.       linkleft();         /* report any unresolved links */ 
  4001.       }
  4002.       
  4003.   }
  4004.   
  4005.   
  4006. diff -c pax/ttyio.c pax.amiga/ttyio.c
  4007. *** pax/ttyio.c    Sat Feb 18 13:00:00 1989
  4008. --- pax.amiga/ttyio.c    Sun Sep 17 06:35:45 1989
  4009. ***************
  4010. *** 94,99
  4011.   #ifdef MSDOS
  4012.       setmode(fd, O_TEXT);
  4013.   #endif
  4014.       if (isatty(fd)) {
  4015.       return (fd);
  4016.       }
  4017.  
  4018. --- 94,100 -----
  4019.   #ifdef MSDOS
  4020.       setmode(fd, O_TEXT);
  4021.   #endif
  4022.       if (isatty(fd)) {
  4023.       return (fd);
  4024.       }
  4025.  
  4026.