Prereq: 1 diff -c pax/PATCHLEVEL pax.amiga/PATCHLEVEL *** pax/PATCHLEVEL Sat Feb 18 12:52:01 1989 --- pax.amiga/PATCHLEVEL Fri Oct 6 04:20:44 1989 *************** *** 1,2 ! Patchlevel 1 $Id: PATCHLEVEL,v 1.2 89/02/12 10:09:03 mark Exp $ --- 1,2 ----- ! Patchlevel 1a $Id: PATCHLEVEL,v 1.2 89/02/12 10:09:03 mark Exp $ diff -c pax/Makefile pax.amiga/Makefile *** pax/Makefile Mon Mar 13 11:31:27 1989 --- pax.amiga/Makefile Sun Sep 24 19:15:35 1989 *************** *** 26,34 # Set CFLAGS to whatever makes your C compiler happy. Be sure to include # the definition of $(POSIX) in the flag. # ! CFLAGS = -O $(POSIX) ! CC = cc ! P = & # # Set LIBS to any additional libraries that you need linked in with pax. --- 26,36 ----- # Set CFLAGS to whatever makes your C compiler happy. Be sure to include # the definition of $(POSIX) in the flag. # ! CFLAGS = -O $(POSIX) -i:h/ -cf ! CC = lc ! RM = delete ! #RM = rm -f ! P = # # Set LIBS to any additional libraries that you need linked in with pax. *************** *** 33,39 # # Set LIBS to any additional libraries that you need linked in with pax. # ! LIBS = -lgetopt # # Set LFLAGS to whatever makes your linker happy --- 35,41 ----- # # Set LIBS to any additional libraries that you need linked in with pax. # ! LIBS = -lgetopt # # Set LFLAGS to whatever makes your linker happy *************** *** 44,50 # Set COPY to the name of the command to use to copy pax to cpio and # tar. Usually it is 'ln'. # ! COPY=ln # # Set LINTFLAGS to whatever makes your implementation of lint happy. If --- 46,52 ----- # Set COPY to the name of the command to use to copy pax to cpio and # tar. Usually it is 'ln'. # ! COPY=copy # # Set LINTFLAGS to whatever makes your implementation of lint happy. If *************** *** 57,63 # BINDIR - points to the directory in which you want the final pax, tar and # cpio binaries installed in. # ! BINDIR = /usr/local/bin # # MANDIR - specify the directory in which the man pages will be installed --- 59,65 ----- # BINDIR - points to the directory in which you want the final pax, tar and # cpio binaries installed in. # ! BINDIR = local:bin # # MANDIR - specify the directory in which the man pages will be installed *************** *** 83,89 # to this directory and choose the DIROBJ lines. Please note that this # version of dirent has been modified to work as a stand-alone. # ! DIRENT= #DIRENT= -ldirent #DIROBJ= msd_dir.obj msd_dio.obj getopt.obj --- 85,91 ----- # to this directory and choose the DIROBJ lines. Please note that this # version of dirent has been modified to work as a stand-alone. # ! DIRENT= :lib/local.lib #DIRENT= -ldirent #DIROBJ= msd_dir.obj msd_dio.obj getopt.obj *************** *** 118,124 ln $(BINDIR)/pax $(BINDIR)/tar ln $(BINDIR)/pax $(BINDIR)/cpio cp $(PMAN1) $(MAN1) ! # cp $(PMAN5) $(MAN5) clean: rm -f $(OBJECT) --- 120,126 ----- ln $(BINDIR)/pax $(BINDIR)/tar ln $(BINDIR)/pax $(BINDIR)/cpio cp $(PMAN1) $(MAN1) ! # cp $(PMAN5) $(MAN5) clean: $(RM) $(OBJECT) *************** *** 121,128 # cp $(PMAN5) $(MAN5) clean: ! rm -f $(OBJECT) ! rm -f $(PROGS) a.out *.BAK *.bak lint: lint $(LINTFLAGS) $(SOURCE) --- 123,130 ----- # cp $(PMAN5) $(MAN5) clean: ! $(RM) $(OBJECT) ! $(RM) $(PROGS) a.out *.BAK *.bak lint: lint $(LINTFLAGS) $(SOURCE) *************** *** 128,135 lint $(LINTFLAGS) $(SOURCE) pax :$P $(OBJECT) ! $(CC) $(CFLAGS) $(LDFLAGS) -o pax $(OBJECT) $(DIRENT) $(LIBS) ! : link @linkit tar: pax rm -f tar --- 130,138 ----- lint $(LINTFLAGS) $(SOURCE) pax :$P $(OBJECT) ! blink with pax.lnk ! # $(CC) $(CFLAGS) $(LDFLAGS) -o pax $(OBJECT) $(DIRENT) $(LIBS) ! # : link @linkit tar: pax $(RM) tar *************** *** 132,138 : link @linkit tar: pax ! rm -f tar $(COPY) pax tar cpio: pax --- 135,141 ----- # : link @linkit tar: pax ! $(RM) tar $(COPY) pax tar cpio: pax *************** *** 136,142 $(COPY) pax tar cpio: pax ! rm -f cpio $(COPY) pax cpio $(OBJECT): $(HEADERS) --- 139,145 ----- $(COPY) pax tar cpio: pax ! $(RM) cpio $(COPY) pax cpio $(OBJECT): $(HEADERS) diff -c pax/buffer.c pax.amiga/buffer.c *** pax/buffer.c Sat Feb 18 12:59:39 1989 --- pax.amiga/buffer.c Sun Sep 24 22:15:42 1989 *************** *** 6,16 * * DESCRIPTION * ! * These functions handle buffer manipulations for the archiving ! * formats. Functions are provided to get memory for buffers, ! * flush buffers, read and write buffers and de-allocate buffers. ! * Several housekeeping functions are provided as well to get some ! * information about how full buffers are, etc. * * AUTHOR * --- 6,16 ----- * * DESCRIPTION * ! * These functions handle buffer manipulations for the archiving ! * formats. Functions are provided to get memory for buffers, ! * flush buffers, read and write buffers and de-allocate buffers. ! * Several housekeeping functions are provided as well to get some ! * information about how full buffers are, etc. * * AUTHOR * *************** *** 14,20 * * AUTHOR * ! * Mark H. Colburn, NAPS International (mark@jhereg.mn.org) * * Sponsored by The USENIX Association for public distribution. * --- 14,20 ----- * * AUTHOR * ! * Mark H. Colburn, NAPS International (mark@jhereg.mn.org) * * Sponsored by The USENIX Association for public distribution. * *************** *** 32,38 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * ! * $Log: buffer.c,v $ * Revision 1.2 89/02/12 10:04:02 mark * 1.2 release fixes * --- 32,38 ----- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * ! * $Log: buffer.c,v $ * Revision 1.2 89/02/12 10:04:02 mark * 1.2 release fixes * *************** *** 50,55 /* Headers */ #include "pax.h" /* Function Prototypes */ --- 50,58 ----- /* Headers */ #include "pax.h" + #ifdef AMIGA + # include "local.h" + #endif /* Function Prototypes */ *************** *** 51,57 #include "pax.h" - /* Function Prototypes */ #ifdef __STDC__ --- 54,59 ----- # include "local.h" #endif /* Function Prototypes */ #ifdef __STDC__ *************** *** 81,90 * * DESCRIPTION * ! * Inentry reads an archive entry from the archive file and writes it ! * out the the named file. If we are in PASS mode during archive ! * processing, the pass() function is called, otherwise we will ! * extract from the archive file. * * Inentry actaully calls indata to process the actual data to the * file. --- 83,92 ----- * * DESCRIPTION * ! * Inentry reads an archive entry from the archive file and writes it ! * out the the named file. If we are in PASS mode during archive ! * processing, the pass() function is called, otherwise we will ! * extract from the archive file. * * Inentry actually calls indata to process the data to the * file. *************** *** 86,93 * processing, the pass() function is called, otherwise we will * extract from the archive file. * ! * Inentry actaully calls indata to process the actual data to the ! * file. * * PARAMETERS * --- 88,95 ----- * processing, the pass() function is called, otherwise we will * extract from the archive file. * ! * Inentry actually calls indata to process the data to the ! * file. * * PARAMETERS * *************** *** 91,99 * * PARAMETERS * ! * char *name - name of the file to extract from the archive ! * Stat *asb - stat block of the file to be extracted from the ! * archive. * * RETURNS * --- 93,101 ----- * * PARAMETERS * ! * char *name - name of the file to extract from the archive ! * Stat *asb - stat block of the file to be extracted from the ! * archive. * * RETURNS * *************** *** 97,103 * * RETURNS * ! * Returns zero if successful, -1 otherwise. */ #ifdef __STDC__ --- 99,105 ----- * * RETURNS * ! * Returns zero if successful, -1 otherwise. */ #ifdef __STDC__ *************** *** 119,132 if ((ofd = openout(name, asb, linkp = linkfrom(name, asb), 0)) > 0) { if (asb->sb_size || linkp == (Link *)NULL || linkp->l_size == 0) { ! close(indata(ofd, asb->sb_size, name)); ! } else if ((ifd = open(linkp->l_path->p_name, O_RDONLY)) < 0) { ! warn(linkp->l_path->p_name, strerror()); ! } else { ! passdata(linkp->l_path->p_name, ifd, name, ofd); ! close(ifd); ! close(ofd); ! } } else { return(buf_skip((OFFSET) asb->sb_size) >= 0); } --- 121,134 ----- if ((ofd = openout(name, asb, linkp = linkfrom(name, asb), 0)) > 0) { if (asb->sb_size || linkp == (Link *)NULL || linkp->l_size == 0) { ! close(indata(ofd, asb->sb_size, name)); ! } else if ((ifd = open(linkp->l_path->p_name, O_RDONLY)) < 0) { ! warn(linkp->l_path->p_name, strerror()); ! } else { ! passdata(linkp->l_path->p_name, ifd, name, ofd); ! close(ifd); ! close(ofd); ! } } else { return(buf_skip((OFFSET) asb->sb_size) >= 0); } *************** *** 128,134 close(ofd); } } else { ! return(buf_skip((OFFSET) asb->sb_size) >= 0); } tstamp[0] = (!f_pass && f_access_time) ? asb->sb_atime : time((time_t *) 0); tstamp[1] = f_mtime ? asb->sb_mtime : time((time_t *) 0); --- 130,136 ----- close(ofd); } } else { ! return(buf_skip((OFFSET) asb->sb_size) >= 0); } tstamp[0] = (!f_pass && f_access_time) ? asb->sb_atime : time((time_t *) 0); tstamp[1] = f_mtime ? asb->sb_mtime : time((time_t *) 0); *************** *** 141,151 * * DESCRIPTION * ! * Outdata transfers data from the named file to the archive buffer. ! * It knows about the file padding which is required by tar, but no ! * by cpio. Outdata continues after file read errors, padding with ! * null characters if neccessary. Closes the input file descriptor ! * when finished. * * PARAMETERS * --- 143,153 ----- * * DESCRIPTION * ! * Outdata transfers data from the named file to the archive buffer. ! * It knows about the file padding which is required by tar, but not ! * by cpio. Outdata continues after file read errors, padding with ! * null characters if neccessary. Closes the input file descriptor ! * when finished. * * PARAMETERS * *************** *** 149,157 * * PARAMETERS * ! * int fd - file descriptor of file to read data from ! * char *name - name of file ! * OFFSET size - size of the file * */ --- 151,159 ----- * * PARAMETERS * ! * int fd - file descriptor of file to read data from ! * char *name - name of file ! * OFFSET size - size of the file * */ *************** *** 172,178 int got; int oops; uint avail; ! int pad; char *buf; oops = got = 0; --- 174,180 ----- int got; int oops; uint avail; ! int pad; char *buf; oops = got = 0; *************** *** 177,183 oops = got = 0; if (pad = (size % BLOCKSIZE)) { ! pad = (BLOCKSIZE - pad); } while (size) { avail = buf_out_avail(&buf); --- 179,185 ----- oops = got = 0; if (pad = (size % BLOCKSIZE)) { ! pad = (BLOCKSIZE - pad); } while (size) { avail = buf_out_avail(&buf); *************** *** 180,202 pad = (BLOCKSIZE - pad); } while (size) { ! avail = buf_out_avail(&buf); ! size -= (chunk = size < avail ? (uint) size : avail); ! if (oops == 0 && (got = read(fd, buf, (unsigned int) chunk)) < 0) { ! oops = -1; ! warn(name, strerror()); ! got = 0; ! } ! if (got < chunk) { ! if (oops == 0) { ! oops = -1; ! } ! warn(name, "Early EOF"); ! while (got < chunk) { ! buf[got++] = '\0'; ! } ! } ! buf_use(chunk); } close(fd); if (ar_format == TAR) { --- 182,204 ----- pad = (BLOCKSIZE - pad); } while (size) { ! avail = buf_out_avail(&buf); ! size -= (chunk = size < avail ? (uint) size : avail); ! if (oops == 0 && (got = read(fd, buf, (unsigned int) chunk)) < 0) { ! oops = -1; ! warn(name, strerror()); ! got = 0; ! } ! if (got < chunk) { ! if (oops == 0) { ! oops = -1; ! } ! warn(name, "Early EOF"); ! while (got < chunk) { ! buf[got++] = '\0'; ! } ! } ! buf_use(chunk); } close(fd); if (ar_format == TAR) { *************** *** 200,206 } close(fd); if (ar_format == TAR) { ! buf_pad((OFFSET) pad); } } --- 202,208 ----- } close(fd); if (ar_format == TAR) { ! buf_pad((OFFSET) pad); } } *************** *** 209,217 * * DESCRIPTION * ! * Write out an End-Of-Tape record. We actually zero at least one ! * record, through the end of the block. Old tar writes garbage after ! * two zeroed records -- and PDtar used to. */ #ifdef __STDC__ --- 211,219 ----- * * DESCRIPTION * ! * Write out an End-Of-Tape record. We actually zero at least one ! * record, through the end of the block. Old tar writes garbage after ! * two zeroed records -- and PDtar used to. */ #ifdef __STDC__ *************** *** 228,235 char header[M_STRLEN + H_STRLEN + 1]; if (ar_format == TAR) { ! /* write out two zero blocks for trailer */ ! pad = 2 * BLOCKSIZE; } else { if (pad = (total + M_STRLEN + H_STRLEN + TRAILZ) % BLOCKSIZE) { pad = BLOCKSIZE - pad; --- 230,237 ----- char header[M_STRLEN + H_STRLEN + 1]; if (ar_format == TAR) { ! /* write out two zero blocks for trailer */ ! pad = 2 * BLOCKSIZE; } else { if (pad = (total + M_STRLEN + H_STRLEN + TRAILZ) % BLOCKSIZE) { pad = BLOCKSIZE - pad; *************** *** 231,244 /* write out two zero blocks for trailer */ pad = 2 * BLOCKSIZE; } else { ! if (pad = (total + M_STRLEN + H_STRLEN + TRAILZ) % BLOCKSIZE) { ! pad = BLOCKSIZE - pad; ! } ! strcpy(header, M_ASCII); ! sprintf(header + M_STRLEN, H_PRINT, 0, 0, ! 0, 0, 0, 1, 0, (time_t) 0, TRAILZ, pad); ! outwrite(header, M_STRLEN + H_STRLEN); ! outwrite(TRAILER, TRAILZ); } buf_pad((OFFSET) pad); outflush(); --- 233,246 ----- /* write out two zero blocks for trailer */ pad = 2 * BLOCKSIZE; } else { ! if (pad = (total + M_STRLEN + H_STRLEN + TRAILZ) % BLOCKSIZE) { ! pad = BLOCKSIZE - pad; ! } ! strcpy(header, M_ASCII); ! sprintf(header + M_STRLEN, H_PRINT, 0, 0, ! 0, 0, 0, 1, 0, (time_t) 0, TRAILZ, pad); ! outwrite(header, M_STRLEN + H_STRLEN); ! outwrite(TRAILER, TRAILZ); } buf_pad((OFFSET) pad); outflush(); *************** *** 244,250 outflush(); } ! /* outwrite - write archive data * * DESCRIPTION --- 246,252 ----- outflush(); } ! /* outwrite - write archive data * * DESCRIPTION *************** *** 249,257 * * DESCRIPTION * ! * Writes out data in the archive buffer to the archive file. The ! * buffer index and the total byte count are incremented by the number ! * of data bytes written. * * PARAMETERS * --- 251,259 ----- * * DESCRIPTION * ! * Writes out data in the archive buffer to the archive file. The ! * buffer index and the total byte count are incremented by the number ! * of data bytes written. * * PARAMETERS * *************** *** 254,262 * of data bytes written. * * PARAMETERS ! * ! * char *idx - pointer to data to write ! * uint len - length of the data to write */ #ifdef __STDC__ --- 256,264 ----- * of data bytes written. * * PARAMETERS ! * ! * char *idx - pointer to data to write ! * uint len - length of the data to write */ #ifdef __STDC__ *************** *** 266,273 #else void outwrite(idx, len) ! char *idx; /* pointer to data to write */ ! uint len; /* length of data to write */ #endif { --- 268,275 ----- #else void outwrite(idx, len) ! char *idx; /* pointer to data to write */ ! uint len; /* length of data to write */ #endif { *************** *** 277,295 endx = idx + len; while (want = endx - idx) { ! if (bufend - bufidx < 0) { ! fatal("Buffer overlow in out_write\n"); ! } ! if ((have = bufend - bufidx) == 0) { ! outflush(); ! } ! if (have > want) { ! have = want; ! } ! memcpy(bufidx, idx, (int) have); ! bufidx += have; ! idx += have; ! total += have; } } --- 279,297 ----- endx = idx + len; while (want = endx - idx) { ! if (bufend - bufidx < 0) { ! fatal("Buffer overlow in out_write\n"); ! } ! if ((have = bufend - bufidx) == 0) { ! outflush(); ! } ! if (have > want) { ! have = want; ! } ! memcpy(bufidx, idx, (int) have); ! bufidx += have; ! idx += have; ! total += have; } } *************** *** 298,306 * * DESCRIPTION * ! * Copies a file from one place to another. Doesn't believe in input ! * file descriptor zero (see description of kludge in openin() comments). ! * Closes the provided output file descriptor. * * PARAMETERS * --- 300,308 ----- * * DESCRIPTION * ! * Copies a file from one place to another. Doesn't believe in input ! * file descriptor zero (see description of kludge in openin() comments). ! * Closes the provided output file descriptor. * * PARAMETERS * *************** *** 304,313 * * PARAMETERS * ! * char *from - input file name (old file) ! * int ifd - input file descriptor ! * char *to - output file name (new file) ! * int ofd - output file descriptor */ #ifdef __STDC__ --- 306,315 ----- * * PARAMETERS * ! * char *from - input file name (old file) ! * int ifd - input file descriptor ! * char *to - output file name (new file) ! * int ofd - output file descriptor */ #ifdef __STDC__ *************** *** 329,347 char block[BUFSIZ]; if (ifd) { ! lseek(ifd, (OFFSET) 0, 0); ! sparse = 0; ! while ((got = read(ifd, block, sizeof(block))) > 0 ! && (sparse = ar_write(ofd, block, (uint) got)) >= 0) { ! total += got; ! } ! if (got) { ! warn(got < 0 ? from : to, strerror()); ! } else if (sparse > 0 ! && (lseek(ofd, (OFFSET)(-sparse), 1) < 0 ! || write(ofd, block, (uint) sparse) != sparse)) { ! warn(to, strerror()); ! } } close(ofd); } --- 331,341 ----- char block[BUFSIZ]; if (ifd) { ! lseek(ifd, (OFFSET) 0, 0); ! sparse = 0; ! while ((got = read(ifd, block, sizeof(block))) > 0 ! && (sparse = ar_write(ofd, block, (uint) got)) >= 0) { ! total += got; } if (got) { warn(got < 0 ? from : to, strerror()); *************** *** 343,348 warn(to, strerror()); } } close(ofd); } --- 337,350 ----- && (sparse = ar_write(ofd, block, (uint) got)) >= 0) { total += got; } + if (got) { + warn(got < 0 ? from : to, strerror()); + } else if (sparse > 0 + && (lseek(ofd, (OFFSET)(-sparse), 1) < 0 + || write(ofd, block, (uint) sparse) != sparse)) { + warn(to, strerror()); + } + } close(ofd); } *************** *** 351,360 * * DESCRIPTION * ! * buf_allocate allocates an I/O buffer using malloc. The resulting ! * buffer is used for all data buffering throughout the program. ! * Buf_allocate must be called prior to any use of the buffer or any ! * of the buffering calls. * * PARAMETERS * --- 353,362 ----- * * DESCRIPTION * ! * buf_allocate allocates an I/O buffer using malloc. The resulting ! * buffer is used for all data buffering throughout the program. ! * Buf_allocate must be called prior to any use of the buffer or any ! * of the buffering calls. * * PARAMETERS * *************** *** 358,364 * * PARAMETERS * ! * int size - size of the I/O buffer to request * * ERRORS * --- 360,366 ----- * * PARAMETERS * ! * int size - size of the I/O buffer to request * * ERRORS * *************** *** 362,371 * * ERRORS * ! * If an invalid size is given for a buffer or if a buffer of the ! * required size cannot be allocated, then the function prints out an ! * error message and returns a non-zero exit status to the calling ! * process, terminating the program. * */ --- 364,373 ----- * * ERRORS * ! * If an invalid size is given for a buffer or if a buffer of the ! * required size cannot be allocated, then the function prints out an ! * error message and returns a non-zero exit status to the calling ! * process, terminating the program. * */ *************** *** 381,387 #endif { if (size <= 0) { ! fatal("invalid value for blocksize"); } if ((bufstart = malloc((unsigned) size)) == (char *)NULL) { fatal("Cannot allocate I/O buffer"); --- 383,389 ----- #endif { if (size <= 0) { ! fatal("invalid value for blocksize"); } #ifndef AMIGA if ((bufstart = malloc((unsigned) size)) == (char *)NULL) { *************** *** 383,388 if (size <= 0) { fatal("invalid value for blocksize"); } if ((bufstart = malloc((unsigned) size)) == (char *)NULL) { fatal("Cannot allocate I/O buffer"); } --- 385,391 ----- if (size <= 0) { fatal("invalid value for blocksize"); } + #ifndef AMIGA if ((bufstart = malloc((unsigned) size)) == (char *)NULL) { fatal("Cannot allocate I/O buffer"); } *************** *** 384,390 fatal("invalid value for blocksize"); } if ((bufstart = malloc((unsigned) size)) == (char *)NULL) { ! fatal("Cannot allocate I/O buffer"); } bufend = bufidx = bufstart; bufend += size; --- 387,393 ----- } #ifndef AMIGA if ((bufstart = malloc((unsigned) size)) == (char *)NULL) { ! fatal("Cannot allocate I/O buffer"); } #else /* try to allocate CHIP memory first, to speed o/p to archive device */ *************** *** 386,391 if ((bufstart = malloc((unsigned) size)) == (char *)NULL) { fatal("Cannot allocate I/O buffer"); } bufend = bufidx = bufstart; bufend += size; } --- 389,408 ----- if ((bufstart = malloc((unsigned) size)) == (char *)NULL) { fatal("Cannot allocate I/O buffer"); } + #else + /* try to allocate CHIP memory first, to speed o/p to archive device */ + /* (CHIP memory is accessible to the dma controller: + * a buffer allocated in it will be transferred in one operation + * rather than being split and copied in 512 byte chunks. + */ + if ((bufstart = chipalloc((unsigned) size)) == (char *) NULL) { + /* couldn't get chip: get any */ + if((bufstart = malloc((unsigned)size)) == (char *) NULL) { + fatal("Cannot allocate I/O buffer"); + } + } + #endif /* AMIGA */ + bufend = bufidx = bufstart; bufend += size; } *************** *** 395,402 * * DESCRIPTION * ! * Buf_skip skips past archive data. It is used when the length of ! * the archive data is known, and we do not wish to process the data. * * PARAMETERS * --- 412,419 ----- * * DESCRIPTION * ! * Buf_skip skips past archive data. It is used when the length of ! * the archive data is known, and we do not wish to process the data. * * PARAMETERS * *************** *** 400,406 * * PARAMETERS * ! * OFFSET len - number of bytes to skip * * RETURNS * --- 417,423 ----- * * PARAMETERS * ! * OFFSET len - number of bytes to skip * * RETURNS * *************** *** 404,411 * * RETURNS * ! * Returns zero under normal circumstances, -1 if unreadable data is ! * encountered. */ #ifdef __STDC__ --- 421,428 ----- * * RETURNS * ! * Returns zero under normal circumstances, -1 if unreadable data is ! * encountered. */ #ifdef __STDC__ *************** *** 423,440 int corrupt = 0; while (len) { ! if (bufend - bufidx < 0) { ! fatal("Buffer overlow in buf_skip\n"); ! } ! while ((chunk = bufend - bufidx) == 0) { ! corrupt |= ar_read(); ! } ! if (chunk > len) { ! chunk = len; ! } ! bufidx += chunk; ! len -= chunk; ! total += chunk; } return (corrupt); } --- 440,457 ----- int corrupt = 0; while (len) { ! if (bufend - bufidx < 0) { ! fatal("Buffer overlow in buf_skip\n"); ! } ! while ((chunk = bufend - bufidx) == 0) { ! corrupt |= ar_read(); ! } ! if (chunk > len) { ! chunk = len; ! } ! bufidx += chunk; ! len -= chunk; ! total += chunk; } return (corrupt); } *************** *** 444,451 * * DESCRIPTION * ! * Reads len number of characters from the input archive and ! * stores them in the buffer pointed at by dst. * * PARAMETERS * --- 461,468 ----- * * DESCRIPTION * ! * Reads len number of characters from the input archive and ! * stores them in the buffer pointed at by dst. * * PARAMETERS * *************** *** 449,456 * * PARAMETERS * ! * char *dst - pointer to buffer to store data into ! * uint len - length of data to read * * RETURNS * --- 466,473 ----- * * PARAMETERS * ! * char *dst - pointer to buffer to store data into ! * uint len - length of data to read * * RETURNS * *************** *** 454,461 * * RETURNS * ! * Returns zero with valid data, -1 if unreadable portions were ! * replaced by null characters. */ #ifdef __STDC__ --- 471,478 ----- * * RETURNS * ! * Returns zero with valid data, -1 if unreadable portions were ! * replaced by null characters. */ #ifdef __STDC__ *************** *** 476,495 char *endx = dst + len; while (want = endx - dst) { ! if (bufend - bufidx < 0) { ! fatal("Buffer overlow in buf_read\n"); ! } ! while ((have = bufend - bufidx) == 0) { ! have = 0; ! corrupt |= ar_read(); ! } ! if (have > want) { ! have = want; ! } ! memcpy(dst, bufidx, have); ! bufidx += have; ! dst += have; ! total += have; } return (corrupt); } --- 493,512 ----- char *endx = dst + len; while (want = endx - dst) { ! if (bufend - bufidx < 0) { ! fatal("Buffer overlow in buf_read\n"); ! } ! while ((have = bufend - bufidx) == 0) { ! have = 0; ! corrupt |= ar_read(); ! } ! if (have > want) { ! have = want; ! } ! memcpy(dst, bufidx, have); ! bufidx += have; ! dst += have; ! total += have; } return (corrupt); } *************** *** 499,507 * * DESCRIPTION * ! * Indata writes size bytes of data from the archive buffer to the output ! * file specified by fd. The filename which is being written, pointed ! * to by name is provided only for diagnostics. * * PARAMETERS * --- 516,524 ----- * * DESCRIPTION * ! * Indata writes size bytes of data from the archive buffer to the output ! * file specified by fd. The filename which is being written, pointed ! * to by name is provided only for diagnostics. * * PARAMETERS * *************** *** 505,513 * * PARAMETERS * ! * int fd - output file descriptor ! * OFFSET size - number of bytes to write to output file ! * char *name - name of file which corresponds to fd * * RETURNS * --- 522,530 ----- * * PARAMETERS * ! * int fd - output file descriptor ! * OFFSET size - number of bytes to write to output file ! * char *name - name of file which corresponds to fd * * RETURNS * *************** *** 511,517 * * RETURNS * ! * Returns given file descriptor. */ #ifdef __STDC__ --- 528,534 ----- * * RETURNS * ! * Returns given file descriptor. */ #ifdef __STDC__ *************** *** 537,548 corrupt = sparse = 0; oops = (char *)NULL; while (size) { ! corrupt |= buf_in_avail(&buf, &avail); ! size -= (chunk = size < avail ? (uint) size : avail); ! if (oops == (char *)NULL && (sparse = ar_write(fd, buf, chunk)) < 0) { ! oops = strerror(); ! } ! buf_use(chunk); } if (corrupt) { warn(name, "Corrupt archive data"); --- 554,565 ----- corrupt = sparse = 0; oops = (char *)NULL; while (size) { ! corrupt |= buf_in_avail(&buf, &avail); ! size -= (chunk = size < avail ? (uint) size : avail); ! if (oops == (char *)NULL && (sparse = ar_write(fd, buf, chunk)) < 0) { ! oops = strerror(); ! } ! buf_use(chunk); } if (corrupt) { warn(name, "Corrupt archive data"); *************** *** 545,551 buf_use(chunk); } if (corrupt) { ! warn(name, "Corrupt archive data"); } if (oops) { warn(name, oops); --- 562,568 ----- buf_use(chunk); } if (corrupt) { ! warn(name, "Corrupt archive data"); } if (oops) { warn(name, oops); *************** *** 548,554 warn(name, "Corrupt archive data"); } if (oops) { ! warn(name, oops); } else if (sparse > 0 && (lseek(fd, (OFFSET) - 1, 1) < 0 || write(fd, "", 1) != 1)) { warn(name, strerror()); --- 565,571 ----- warn(name, "Corrupt archive data"); } if (oops) { ! warn(name, oops); } else if (sparse > 0 && (lseek(fd, (OFFSET) - 1, 1) < 0 || write(fd, "", 1) != 1)) { warn(name, strerror()); *************** *** 550,557 if (oops) { warn(name, oops); } else if (sparse > 0 && (lseek(fd, (OFFSET) - 1, 1) < 0 ! || write(fd, "", 1) != 1)) { ! warn(name, strerror()); } return (fd); } --- 567,574 ----- if (oops) { warn(name, oops); } else if (sparse > 0 && (lseek(fd, (OFFSET) - 1, 1) < 0 ! || write(fd, "", 1) != 1)) { ! warn(name, strerror()); } return (fd); } *************** *** 561,568 * * DESCRIPTION * ! * The output buffer is written, if there is anything in it, to the ! * archive file. */ #ifdef __STDC__ --- 578,585 ----- * * DESCRIPTION * ! * The output buffer is written, if there is anything in it, to the ! * archive file. */ #ifdef __STDC__ *************** *** 580,592 uint len; /* if (bufidx - buf > 0) */ ! for (buf = bufstart; len = bufidx - buf;) { ! if ((got = WRITE(archivefd, buf, MIN(len, blocksize))) > 0) { ! buf += got; ! } else if (got < 0) { ! next(AR_WRITE); ! } ! } bufend = (bufidx = bufstart) + blocksize; } --- 597,609 ----- uint len; /* if (bufidx - buf > 0) */ ! for (buf = bufstart; len = bufidx - buf;) { ! if ((got = WRITE(archivefd, buf, MIN(len, blocksize))) > 0) { ! buf += got; ! } else if (got <= 0) { ! next(AR_WRITE); ! } ! } bufend = (bufidx = bufstart) + blocksize; } *************** *** 595,603 * * DESCRIPTION * ! * Remembers mid-buffer read failures and reports them the next time ! * through. Replaces unreadable data with null characters. Resets ! * the buffer pointers as appropriate. * * RETURNS * --- 612,620 ----- * * DESCRIPTION * ! * Remembers mid-buffer read failures and reports them the next time ! * through. Replaces unreadable data with null characters. Resets ! * the buffer pointers as appropriate. * * RETURNS * *************** *** 601,607 * * RETURNS * ! * Returns zero with valid data, -1 otherwise. */ #ifdef __STDC__ --- 618,624 ----- * * RETURNS * ! * Returns zero with valid data, -1 otherwise. */ #ifdef __STDC__ *************** *** 619,641 bufend = bufidx = bufstart; if (!failed) { ! if (areof) { ! if (total == 0) { ! fatal("No input"); ! } else { ! next(AR_READ); ! } ! } ! while (!failed && !areof && bufstart + blocksize - bufend >= blocksize) { ! if ((got = READ(archivefd, bufend, (unsigned int) blocksize)) > 0) { ! bufend += got; ! } else if (got < 0) { ! failed = -1; ! warnarch(strerror(), (OFFSET) 0 - (bufend - bufidx)); ! } else { ! ++areof; ! } ! } } if (failed && bufend == bufstart) { failed = 0; --- 636,647 ----- bufend = bufidx = bufstart; if (!failed) { ! if (areof) { ! if (total == 0) { ! fatal("No input"); ! } else { ! next(AR_READ); ! } } while (!failed && !areof && bufstart + blocksize - bufend >= blocksize) { if ((got = READ(archivefd, bufend, (unsigned int) blocksize)) > 0) { *************** *** 637,642 } } } if (failed && bufend == bufstart) { failed = 0; for (got = 0; got < blocksize; ++got) { --- 643,659 ----- next(AR_READ); } } + while (!failed && !areof && bufstart + blocksize - bufend >= blocksize) { + if ((got = READ(archivefd, bufend, (unsigned int) blocksize)) > 0) { + bufend += got; + } else if (got < 0) { + failed = -1; + warnarch(strerror(), (OFFSET) 0 - (bufend - bufidx)); + } else { + ++areof; + } + } + } if (failed && bufend == bufstart) { failed = 0; for (got = 0; got < blocksize; ++got) { *************** *** 638,648 } } if (failed && bufend == bufstart) { ! failed = 0; ! for (got = 0; got < blocksize; ++got) { ! *bufend++ = '\0'; ! } ! return (-1); } return (0); } --- 655,665 ----- } } if (failed && bufend == bufstart) { ! failed = 0; ! for (got = 0; got < blocksize; ++got) { ! *bufend++ = '\0'; ! } ! return (-1); } return (0); } *************** *** 652,659 * * DESCRIPTION * ! * Writes len bytes of data data from the specified buffer to the ! * specified file. Seeks past sparse blocks. * * PARAMETERS * --- 669,676 ----- * * DESCRIPTION * ! * Writes len bytes of data data from the specified buffer to the ! * specified file. Seeks past sparse blocks. * * PARAMETERS * *************** *** 657,665 * * PARAMETERS * ! * int fd - file to write to ! * char *buf - buffer to get data from ! * uint len - number of bytes to transfer * * RETURNS * --- 674,682 ----- * * PARAMETERS * ! * int fd - file to write to ! * char *buf - buffer to get data from ! * uint len - number of bytes to transfer * * RETURNS * *************** *** 663,670 * * RETURNS * ! * Returns 0 if the block was written, the given length for a sparse ! * block or -1 if unsuccessful. */ #ifdef __STDC__ --- 680,687 ----- * * RETURNS * ! * Returns 0 if the block was written, the given length for a sparse ! * block or -1 if unsuccessful. */ #ifdef __STDC__ *************** *** 673,679 #else ! static int ar_write(fd, buf, len) int fd; char *buf; uint len; --- 690,696 ----- #else ! static int r_write(fd, buf, len) int fd; char *buf; uint len; *************** *** 685,693 bend = (bidx = buf) + len; while (bidx < bend) { ! if (*bidx++) { ! return (WRITE(fd, buf, len) == len ? 0 : -1); ! } } return (LSEEK(fd, (OFFSET) len, 1) < 0 ? -1 : len); } --- 702,710 ----- bend = (bidx = buf) + len; while (bidx < bend) { ! if (*bidx++) { ! return (WRITE(fd, buf, len) == len ? 0 : -1); ! } } return (LSEEK(fd, (OFFSET) len, 1) < 0 ? -1 : (int) len); } *************** *** 689,695 return (WRITE(fd, buf, len) == len ? 0 : -1); } } ! return (LSEEK(fd, (OFFSET) len, 1) < 0 ? -1 : len); } --- 706,712 ----- return (WRITE(fd, buf, len) == len ? 0 : -1); } } ! return (LSEEK(fd, (OFFSET) len, 1) < 0 ? -1 : (int) len); } *************** *** 697,704 * * DESCRIPTION * ! * Buf_pad writes len zero bytes to the archive buffer in order to ! * pad it. * * PARAMETERS * --- 714,721 ----- * * DESCRIPTION * ! * Buf_pad writes len zero bytes to the archive buffer in order to ! * pad it. * * PARAMETERS * *************** *** 702,708 * * PARAMETERS * ! * OFFSET pad - number of zero bytes to pad * */ --- 719,725 ----- * * PARAMETERS * ! * OFFSET pad - number of zero bytes to pad * */ *************** *** 721,737 int have; while (pad) { ! if ((have = bufend - bufidx) > pad) { ! have = pad; ! } ! for (idx = 0; idx < have; ++idx) { ! *bufidx++ = '\0'; ! } ! total += have; ! pad -= have; ! if (bufend - bufidx == 0) { ! outflush(); ! } } } --- 738,754 ----- int have; while (pad) { ! if ((have = bufend - bufidx) > pad) { ! have = pad; ! } ! for (idx = 0; idx < have; ++idx) { ! *bufidx++ = '\0'; ! } ! total += have; ! pad -= have; ! if (bufend - bufidx == 0) { ! outflush(); ! } } } *************** *** 740,747 * * DESCRIPTION * ! * Buf_use marks space in the buffer as being used; advancing both the ! * buffer index (bufidx) and the total byte count (total). * * PARAMETERS * --- 757,764 ----- * * DESCRIPTION * ! * Buf_use marks space in the buffer as being used; advancing both the ! * buffer index (bufidx) and the total byte count (total). * * PARAMETERS * *************** *** 745,751 * * PARAMETERS * ! * uint len - Amount of space to allocate in the buffer */ #ifdef __STDC__ --- 762,768 ----- * * PARAMETERS * ! * uint len - Amount of space to allocate in the buffer */ #ifdef __STDC__ *************** *** 768,776 * * DESCRIPTION * ! * Buf_in_avail fills the archive buffer, and points the bufp ! * parameter at the start of the data. The lenp parameter is ! * modified to contain the number of bytes which were read. * * PARAMETERS * --- 785,793 ----- * * DESCRIPTION * ! * Buf_in_avail fills the archive buffer, and points the bufp ! * parameter at the start of the data. The lenp parameter is ! * modified to contain the number of bytes which were read. * * PARAMETERS * *************** *** 774,782 * * PARAMETERS * ! * char **bufp - pointer to the buffer to read data into ! * uint *lenp - pointer to the number of bytes which were read ! * (returned to the caller) * * RETURNS * --- 791,799 ----- * * PARAMETERS * ! * char **bufp - pointer to the buffer to read data into ! * uint *lenp - pointer to the number of bytes which were read ! * (returned to the caller) * * RETURNS * *************** *** 780,788 * * RETURNS * ! * Stores a pointer to the data and its length in given locations. ! * Returns zero with valid data, -1 if unreadable portions were ! * replaced with nulls. * * ERRORS * --- 797,805 ----- * * RETURNS * ! * Stores a pointer to the data and its length in given locations. ! * Returns zero with valid data, -1 if unreadable portions were ! * replaced with nulls. * * ERRORS * *************** *** 786,793 * * ERRORS * ! * If an error occurs in ar_read, the error code is returned to the ! * calling function. * */ --- 803,810 ----- * * ERRORS * ! * If an error occurs in ar_read, the error code is returned to the ! * calling function. * */ *************** *** 807,813 int corrupt = 0; while ((have = bufend - bufidx) == 0) { ! corrupt |= ar_read(); } *bufp = bufidx; *lenp = have; --- 824,830 ----- int corrupt = 0; while ((have = bufend - bufidx) == 0) { ! corrupt |= ar_read(); } *bufp = bufidx; *lenp = have; *************** *** 819,826 * * DESCRIPTION * ! * Stores a buffer pointer at a given location. Returns the number ! * of bytes available. * * PARAMETERS * --- 836,843 ----- * * DESCRIPTION * ! * Stores a buffer pointer at a given location. Returns the number ! * of bytes available. * * PARAMETERS * *************** *** 824,830 * * PARAMETERS * ! * char **bufp - pointer to the buffer which is to be stored * * RETURNS * --- 841,847 ----- * * PARAMETERS * ! * char **bufp - pointer to the buffer which is to be stored * * RETURNS * *************** *** 828,834 * * RETURNS * ! * The number of bytes which are available in the buffer. * */ --- 845,851 ----- * * RETURNS * ! * The number of bytes which are available in the buffer. * */ *************** *** 843,849 #endif { ! int have; if (bufend - bufidx < 0) { fatal("Buffer overlow in buf_out_avail\n"); --- 860,866 ----- #endif { ! uint have; if (bufend - bufidx < 0) { fatal("Buffer overlow in buf_out_avail\n"); *************** *** 846,852 int have; if (bufend - bufidx < 0) { ! fatal("Buffer overlow in buf_out_avail\n"); } if ((have = bufend - bufidx) == 0) { outflush(); --- 863,869 ----- uint have; if (bufend - bufidx < 0) { ! fatal("Buffer overlow in buf_out_avail\n"); } if ((have = bufend - bufidx) == 0) { outflush(); *************** *** 849,855 fatal("Buffer overlow in buf_out_avail\n"); } if ((have = bufend - bufidx) == 0) { ! outflush(); } *bufp = bufidx; return (have); --- 866,872 ----- fatal("Buffer overlow in buf_out_avail\n"); } if ((have = bufend - bufidx) == 0) { ! outflush(); } *bufp = bufidx; return (have); *************** *** 853,856 } *bufp = bufidx; return (have); - } --- 870,872 ----- } *bufp = bufidx; return (have); diff -c pax/config.h pax.amiga/config.h *** pax/config.h Sat Feb 18 13:26:52 1989 --- pax.amiga/config.h Wed Sep 20 06:38:43 1989 *************** *** 51,56 * USG - USG (Unix System V) specific modifications * * Define USG if you are running Unix System V or some similar variant */ /*#define USG /* Running on a USG System */ --- 51,57 ----- * USG - USG (Unix System V) specific modifications * * Define USG if you are running Unix System V or some similar variant + * */ /*#define USG /* Running on a USG System */ *************** *** 55,61 /*#define USG /* Running on a USG System */ /* ! * BSD - BSD (Berkely) specific modifications * * Define BSD if you are running some version of BSD Unix */ --- 56,62 ----- /*#define USG /* Running on a USG System */ /* ! * BSD - BSD (Berkeley) specific modifications * * Define BSD if you are running some version of BSD Unix */ *************** *** 59,65 * * Define BSD if you are running some version of BSD Unix */ ! #define BSD /* Running on a BSD System */ /* * DEF_AR_FILE - tar only (required) --- 60,66 ----- * * Define BSD if you are running some version of BSD Unix */ ! /*#define BSD /* Running on a BSD System */ /* * DEF_AR_FILE - tar only (required) *************** *** 68,74 * device. Normally this would be a tape drive, but it may be a disk drive * on those systems that don't have tape drives. */ ! #define DEF_AR_FILE "-" /* The default archive on your system */ /* * TTY - device which interactive queries should be directed to (required) --- 69,75 ----- * device. Normally this would be a tape drive, but it may be a disk drive * on those systems that don't have tape drives. */ ! #define DEF_AR_FILE "rdf:" /* The default archive on your system */ /* * TTY - device which interactive queries should be directed to (required) *************** *** 77,83 * received from. On most unix systems, this should be /dev/tty, however, on * some systems, such as MS-DOS, it my need to be different (e.g. "con:"). */ ! #define TTY "/dev/tty" /* for most versions of UNIX */ /*#define TTY "/dev/con" /* For MS-DOS */ /* --- 78,85 ----- * received from. On most unix systems, this should be /dev/tty, however, on * some systems, such as MS-DOS, it my need to be different (e.g. "con:"). */ ! /*#define TTY "/dev/tty" /* for most versions of UNIX */ ! #define TTY "*" /* For Amiga */ /*#define TTY "/dev/con" /* For MS-DOS */ /* *************** *** 107,114 * OFFSET is the type which is returned by lseek(). It is different on * some systems. Most define it to be off_t, but some define it to be long. */ ! #define OFFSET off_t /* for most BSD, USG and other systems */ ! /* #define OFFSET long /* for most of the rest of them... */ /* * VOID - compiler support for VOID types --- 109,116 ----- * OFFSET is the type which is returned by lseek(). It is different on * some systems. Most define it to be off_t, but some define it to be long. */ ! /*#define OFFSET off_t /* for most BSD, USG and other systems */ ! #define OFFSET long /* for most of the rest of them... */ /* * VOID - compiler support for VOID types *************** *** 128,134 * Some systems have signal defines to return an int *, other return a * void *. Please choose the correct value for your system. */ ! /*#define SIG_T void /* signal defined as "void (*signal)()" */ #define SIG_T int /* signal defined as "int (*signal)()" */ /* --- 130,136 ----- * Some systems have signal defines to return an int *, other return a * void *. Please choose the correct value for your system. */ ! /*define SIG_T void /* signal defined as "void (*signal)()" */ #define SIG_T int /* signal defined as "int (*signal)()" */ /* *************** *** 138,144 * For those system define STRCSPN and the one provided in regexp.c will * be used. */ ! #define STRCSPN /* implementation does not have strcspn() */ /* * STRERROR - use the strerror function included with pax --- 140,146 ----- * For those system define STRCSPN and the one provided in regexp.c will * be used. */ ! /*#define STRCSPN /* implementation does not have strcspn() */ /* * STRERROR - use the strerror function included with pax *************** *** 147,153 * For those system define STRERROR and the one provided in misc.c will * be used instead. */ ! #define STRERROR /* implementation does not have strerror() */ /* --- 149,155 ----- * For those system define STRERROR and the one provided in misc.c will * be used instead. */ ! /*#define STRERROR /* implementation does not have strerror() */ /* diff -c pax/cpio.c pax.amiga/cpio.c *** pax/cpio.c Sat Feb 18 12:59:42 1989 --- pax.amiga/cpio.c Thu Sep 14 16:52:13 1989 *************** *** 78,84 #ifdef __STDC__ ! int do_cpio(int argc, char **argv) #else --- 78,84 ----- #ifdef __STDC__ ! void do_cpio(int argc, char **argv) #else *************** *** 82,88 #else ! int do_cpio(argc, argv) int argc; char **argv; --- 82,88 ----- #else ! void do_cpio(argc, argv) int argc; char **argv; diff -c pax/extract.c pax.amiga/extract.c *** pax/extract.c Sat Feb 18 12:49:24 1989 --- pax.amiga/extract.c Mon Sep 25 03:47:33 1989 *************** *** 92,98 #ifdef __STDC__ ! int read_archive(void) #else --- 92,98 ----- #ifdef __STDC__ ! void read_archive(void) #else *************** *** 96,102 #else ! int read_archive() #endif { --- 96,102 ----- #else ! void read_archive() #endif { *************** *** 363,368 } #endif /* S_IFLNK */ /* destroy absolute pathnames for security reasons */ if (name[0] == '/') { if (name[1]) { --- 363,385 ----- } #endif /* S_IFLNK */ + #if AMIGA + /* strip any initial volume name */ + { + static int Vwarned_once = 0; + register char *p = name; + while(*p && *p != ':' && *p != '/') + p++; + if(*p && *p == ':'){ + strcpy(name, p); + if (!Vwarned_once++) { + fprintf(stderr, + "Removing volume specification from absolute path names in archive.\n"); + } + } + } + #else /* AMIGA */ + /* destroy absolute pathnames for security reasons */ if (name[0] == '/') { if (name[1]) { *************** *** 373,378 name[0] = '.'; } } asb->sb_atime = asb->sb_ctime = asb->sb_mtime; if (asb->sb_nlink > 1) { linkto(name, asb); --- 390,396 ----- name[0] = '.'; } } + #endif /* AMIGA */ asb->sb_atime = asb->sb_ctime = asb->sb_mtime; if (asb->sb_nlink > 1) { linkto(name, asb); diff -c pax/func.h pax.amiga/func.h *** pax/func.h Sat Feb 18 12:59:45 1989 --- pax.amiga/func.h Sun Sep 24 20:48:53 1989 *************** *** 48,54 extern int buf_skip(OFFSET); extern int create_archive(void); extern int dirneed(char *); ! extern int read_archive(void); extern int inentry(char *, Stat *); extern int lineget(FILE *, char *); extern int name_match(char *); --- 48,54 ----- extern int buf_skip(OFFSET); extern int create_archive(void); extern int dirneed(char *); ! extern void read_archive(void); extern int inentry(char *, Stat *); extern int lineget(FILE *, char *); extern int name_match(char *); *************** *** 58,64 extern int open_tty(void); extern int openin(char *, Stat *); extern int openout(char *, Stat *, Link *, int); ! extern int pass(char *); extern int passitem(char *, Stat *, int, char *); extern int read_header(char *, Stat *); extern int wildmat(char *, char *); --- 58,64 ----- extern int open_tty(void); extern int openin(char *, Stat *); extern int openout(char *, Stat *, Link *, int); ! extern void pass(char *); extern int passitem(char *, Stat *, int, char *); extern int read_header(char *, Stat *); extern int wildmat(char *, char *); *************** *** 74,80 extern void outwrite(char *, uint); extern void passdata(char *, int, char *, int); extern void print_entry(char *, Stat *); ! extern void warn(); extern void warnarch(char *, OFFSET); extern void write_eot(void); extern void get_archive_type(void); --- 74,80 ----- extern void outwrite(char *, uint); extern void passdata(char *, int, char *, int); extern void print_entry(char *, Stat *); ! extern void warn(char *what, char *why); extern void warnarch(char *, OFFSET); extern void write_eot(void); extern void get_archive_type(void); *************** *** 78,86 extern void warnarch(char *, OFFSET); extern void write_eot(void); extern void get_archive_type(void); ! extern struct group *getgrgid(); ! extern struct group *getgrnam(); ! extern struct passwd *getpwuid(); extern char *getenv(char *); #ifndef MSDOS extern SIG_T (*signal())(); --- 78,84 ----- extern void warnarch(char *, OFFSET); extern void write_eot(void); extern void get_archive_type(void); ! extern int get_header(char *name, Stat *asb); extern char *getenv(char *); #ifndef MSDOS extern SIG_T (*signal())(); *************** *** 89,94 extern char *finduname(int); extern char *findgname(int); extern int findgid(char *gname); extern char *malloc(uint); #else /* !__STDC__ */ --- 87,93 ----- extern char *finduname(int); extern char *findgname(int); extern int findgid(char *gname); + /* extern char *malloc(uint); /**/ extern void *malloc(uint); *************** *** 90,96 extern char *findgname(int); extern int findgid(char *gname); extern char *malloc(uint); ! #else /* !__STDC__ */ extern Link *linkfrom(); --- 89,112 ----- extern int findgid(char *gname); /* extern char *malloc(uint); ! /**/ ! extern void *malloc(uint); ! #ifdef AMIGA ! #include "local.h" ! extern char getopt(int ac, char **av, char *fmt); ! extern void do_pax(int argc, char **argv); ! extern void do_tar(int argc, char **argv); ! extern void do_cpio(int argc, char **argv); ! extern void append_archive(void); ! extern void add_replstr(char * arg); ! extern void append_archive(void); ! extern void rpl_name(char *name); ! extern int get_disposition(char *mode, char *name); ! extern int get_newname(char *name, int size); ! extern int dirmake(char *name, Stat *asb); ! extern int dirneed(char *name); ! extern int finduid(char *uname); ! #endif #else /* !__STDC__ */ extern Link *linkfrom(); *************** *** 104,110 extern int buf_skip(); extern int create_archive(); extern int dirneed(); ! extern int read_archive(); extern int inentry(); extern int lineget(); extern int name_match(); --- 120,126 ----- extern int buf_skip(); extern int create_archive(); extern int dirneed(); ! extern void read_archive(); extern int inentry(); extern int lineget(); extern int name_match(); *************** *** 114,120 extern int open_tty(); extern int openin(); extern int openout(); ! extern int pass(); extern int passitem(); extern int read_header(); extern int wildmat(); --- 130,136 ----- extern int open_tty(); extern int openin(); extern int openout(); ! extern void pass(); extern int passitem(); extern int read_header(); extern int wildmat(); diff -c pax/list.c pax.amiga/list.c *** pax/list.c Sat Feb 18 12:59:47 1989 --- pax.amiga/list.c Sun Sep 24 21:03:46 1989 *************** *** 122,127 int i; long sum; long recsum; Link *link; char *p; char hdrbuf[BLOCKSIZE]; --- 122,128 ----- int i; long sum; long recsum; + #ifdef notdef Link *link; #endif char *p; *************** *** 123,128 long sum; long recsum; Link *link; char *p; char hdrbuf[BLOCKSIZE]; --- 124,130 ----- long recsum; #ifdef notdef Link *link; + #endif char *p; char hdrbuf[BLOCKSIZE]; *************** *** 222,227 break; #endif case CHRTYPE: asb->sb_mode |= S_IFCHR; break; case DIRTYPE: --- 224,230 ----- break; #endif case CHRTYPE: + #ifdef S_IFCHR asb->sb_mode |= S_IFCHR; break; #endif *************** *** 224,229 case CHRTYPE: asb->sb_mode |= S_IFCHR; break; case DIRTYPE: asb->sb_mode |= S_IFDIR; break; --- 227,233 ----- #ifdef S_IFCHR asb->sb_mode |= S_IFCHR; break; + #endif case DIRTYPE: asb->sb_mode |= S_IFDIR; break; *************** *** 320,326 struct tm *atm; Link *from; struct passwd *pwp; - struct group *grp; if (f_list && f_verbose) { fprintf(msgfile, "%-7o", asb->sb_mode); --- 324,329 ----- struct tm *atm; Link *from; struct passwd *pwp; if (f_list && f_verbose) { *************** *** 322,327 struct passwd *pwp; struct group *grp; if (f_list && f_verbose) { fprintf(msgfile, "%-7o", asb->sb_mode); atm = localtime(&asb->sb_mtime); --- 325,331 ----- Link *from; struct passwd *pwp; + if (f_list && f_verbose) { fprintf(msgfile, "%-7o", asb->sb_mode); atm = localtime(&asb->sb_mtime); *************** *** 375,381 #endif { struct tm *atm; - int i; int mode; char *symnam = "NULL"; Link *link; --- 379,384 ----- #endif { struct tm *atm; int mode; #if defined(S_IFLNK) int i; *************** *** 377,382 struct tm *atm; int i; int mode; char *symnam = "NULL"; Link *link; --- 380,387 ----- { struct tm *atm; int mode; + #if defined(S_IFLNK) + int i; char *symnam = "NULL"; #endif Link *link; *************** *** 378,383 int i; int mode; char *symnam = "NULL"; Link *link; if ((mode = asb->sb_mode & S_IFMT) == S_IFDIR) { --- 383,389 ----- #if defined(S_IFLNK) int i; char *symnam = "NULL"; + #endif Link *link; if ((mode = asb->sb_mode & S_IFMT) == S_IFDIR) { *************** *** 515,520 #ifdef S_IFBLK case S_IFBLK: #endif case S_IFCHR: fprintf(msgfile, "\t%3d, %3d", major(asb->sb_rdev), minor(asb->sb_rdev)); --- 521,527 ----- #ifdef S_IFBLK case S_IFBLK: #endif + #ifdef S_IFCHR case S_IFCHR: fprintf(msgfile, "\t%3d, %3d", major(asb->sb_rdev), minor(asb->sb_rdev)); *************** *** 519,524 fprintf(msgfile, "\t%3d, %3d", major(asb->sb_rdev), minor(asb->sb_rdev)); break; case S_IFREG: fprintf(msgfile, "\t%8ld", (long) asb->sb_size); break; --- 526,532 ----- fprintf(msgfile, "\t%3d, %3d", major(asb->sb_rdev), minor(asb->sb_rdev)); break; + #endif case S_IFREG: fprintf(msgfile, "\t%8ld", (long) asb->sb_size); break; *************** *** 584,589 putc('b', msgfile); break; #endif case S_IFCHR: putc('c', msgfile); break; --- 592,598 ----- putc('b', msgfile); break; #endif + #ifdef S_IFCHR case S_IFCHR: putc('c', msgfile); break; *************** *** 587,592 case S_IFCHR: putc('c', msgfile); break; #ifdef S_IFIFO case S_IFIFO: putc('p', msgfile); --- 596,602 ----- case S_IFCHR: putc('c', msgfile); break; + #endif #ifdef S_IFIFO case S_IFIFO: putc('p', msgfile); diff -c pax/namelist.c pax.amiga/namelist.c *** pax/namelist.c Sat Feb 18 12:59:48 1989 --- pax.amiga/namelist.c Sun Sep 24 04:06:30 1989 *************** *** 78,83 struct dirinfo { char dirname[PATH_MAX + 1]; /* name of directory */ OFFSET where; /* current location in directory */ struct dirinfo *next; }; --- 78,84 ----- struct dirinfo { char dirname[PATH_MAX + 1]; /* name of directory */ + #ifndef AMIGA OFFSET where; /* current location in directory */ #else DIR *where; *************** *** 79,84 struct dirinfo { char dirname[PATH_MAX + 1]; /* name of directory */ OFFSET where; /* current location in directory */ struct dirinfo *next; }; --- 80,88 ----- char dirname[PATH_MAX + 1]; /* name of directory */ #ifndef AMIGA OFFSET where; /* current location in directory */ + #else + DIR *where; + #endif struct dirinfo *next; }; *************** *** 137,143 { int i; /* Length of string */ struct nm_list *p; /* Current struct pointer */ - char *malloc(); i = strlen(name); p = (struct nm_list *) malloc((unsigned) (i + sizeof(struct nm_list))); --- 141,146 ----- { int i; /* Length of string */ struct nm_list *p; /* Current struct pointer */ i = strlen(name); p = (struct nm_list *) malloc((unsigned) (i + sizeof(struct nm_list))); *************** *** 365,370 in_subdir--; curr_dir = popdir(); if (in_subdir) { errno = 0; if ((dirp=opendir(curr_dir->dirname)) == (DIR *)NULL) { warn(curr_dir->dirname, "error opening directory (1)"); --- 368,374 ----- in_subdir--; curr_dir = popdir(); if (in_subdir) { + #ifndef AMIGA errno = 0; if ((dirp=opendir(curr_dir->dirname)) == (DIR *)NULL) { warn(curr_dir->dirname, "error opening directory (1)"); *************** *** 371,376 in_subdir--; } seekdir(dirp, curr_dir->where); } continue; } --- 375,383 ----- in_subdir--; } seekdir(dirp, curr_dir->where); + #else + dirp = curr_dir->where; + #endif } continue; } *************** *** 386,391 } if (!names_from_stdin && (statbuf->sb_mode & S_IFMT) == S_IFDIR) { if (in_subdir) { curr_dir->where = telldir(dirp); pushdir(curr_dir); closedir(dirp); --- 393,399 ----- } if (!names_from_stdin && (statbuf->sb_mode & S_IFMT) == S_IFDIR) { if (in_subdir) { + #ifndef AMIGA curr_dir->where = telldir(dirp); #else curr_dir->where = dirp; *************** *** 387,392 if (!names_from_stdin && (statbuf->sb_mode & S_IFMT) == S_IFDIR) { if (in_subdir) { curr_dir->where = telldir(dirp); pushdir(curr_dir); closedir(dirp); } --- 395,403 ----- if (in_subdir) { #ifndef AMIGA curr_dir->where = telldir(dirp); + #else + curr_dir->where = dirp; + #endif pushdir(curr_dir); #ifndef AMIGA closedir(dirp); *************** *** 388,393 if (in_subdir) { curr_dir->where = telldir(dirp); pushdir(curr_dir); closedir(dirp); } in_subdir++; --- 399,405 ----- curr_dir->where = dirp; #endif pushdir(curr_dir); + #ifndef AMIGA closedir(dirp); #endif } *************** *** 389,394 curr_dir->where = telldir(dirp); pushdir(curr_dir); closedir(dirp); } in_subdir++; --- 401,407 ----- pushdir(curr_dir); #ifndef AMIGA closedir(dirp); + #endif } in_subdir++; *************** *** 417,422 err = -1; continue; } else { seekdir(dirp, curr_dir->where); } } while (in_subdir && (! dirp)); --- 430,436 ----- err = -1; continue; } else { + #ifndef AMIGA seekdir(dirp, curr_dir->where); #else if(curr_dir->where) *************** *** 418,423 continue; } else { seekdir(dirp, curr_dir->where); } } while (in_subdir && (! dirp)); } --- 432,441 ----- } else { #ifndef AMIGA seekdir(dirp, curr_dir->where); + #else + if(curr_dir->where) + dirp = curr_dir->where; + #endif } } while (in_subdir && (! dirp)); } diff -c pax/names.c pax.amiga/names.c *** pax/names.c Sat Feb 18 12:59:50 1989 --- pax.amiga/names.c Wed Sep 20 06:07:47 1989 *************** *** 56,62 /* Internal Identifiers */ ! #ifndef MSDOS static int saveuid = -993; static char saveuname[TUNMLEN]; static int my_uid = -993; --- 56,62 ----- /* Internal Identifiers */ ! #if !defined(MSDOS) || !defined(AMIGA) static int saveuid = -993; static char saveuname[TUNMLEN]; static int my_uid = -993; diff -c pax/pass.c pax.amiga/pass.c *** pax/pass.c Sat Feb 18 12:50:51 1989 --- pax.amiga/pass.c Sun Sep 24 20:20:05 1989 *************** *** 67,73 #ifdef __STDC__ ! int pass(char *dirname) #else --- 67,73 ----- #ifdef __STDC__ ! void pass(char *dirname) #else *************** *** 71,77 #else ! int pass(dirname) char *dirname; #endif --- 71,77 ----- #else ! void pass(dirname) char *dirname; #endif diff -c pax/pathname.c pax.amiga/pathname.c *** pax/pathname.c Sat Feb 18 12:50:54 1989 --- pax.amiga/pathname.c Sun Sep 24 20:22:03 1989 *************** *** 74,79 * failed, a -1 will be returned to the calling routine. */ #ifdef __STDC__ int dirneed(char *name) --- 74,85 ----- * failed, a -1 will be returned to the calling routine. */ + #ifdef AMIGA + # define CURDIR "" + #else + # define CURDIR "." + #endif + #ifdef __STDC__ int dirneed(char *name) *************** *** 97,103 } } if (last == (char *)NULL) { ! return (STAT(".", &sb)); } *--last = '\0'; ok = STAT(*name ? name : ".", &sb) == 0 --- 103,109 ----- } } if (last == (char *)NULL) { ! return (STAT(CURDIR, &sb)); } *--last = '\0'; ok = STAT(*name ? name : CURDIR, &sb) == 0 *************** *** 100,106 return (STAT(".", &sb)); } *--last = '\0'; ! ok = STAT(*name ? name : ".", &sb) == 0 ? ((sb.sb_mode & S_IFMT) == S_IFDIR) : (f_dir_create && dirneed(name) == 0 && dirmake(name, &sb) == 0); *last = '/'; --- 106,112 ----- return (STAT(CURDIR, &sb)); } *--last = '\0'; ! ok = STAT(*name ? name : CURDIR, &sb) == 0 ? ((sb.sb_mode & S_IFMT) == S_IFDIR) : (f_dir_create && dirneed(name) == 0 && dirmake(name, &sb) == 0); *last = '/'; *************** *** 136,141 #endif { char *name; char *item; int idx; --- 142,152 ----- #endif { + + #ifdef AMIGA + return begin; + #else + char *name; char *item; int idx; *************** *** 191,196 } *--name = '\0'; return (idx); } --- 202,208 ----- } *--name = '\0'; return (idx); + #endif } *************** *** 198,204 * * DESCRIPTION * ! * Dirmake makes a directory with the appropritate permissions. * * PARAMETERS * --- 210,216 ----- * * DESCRIPTION * ! * Dirmake makes a directory with the appropriate permissions. * * PARAMETERS * *************** *** 223,228 #endif { if (mkdir(name, (int) (asb->sb_mode & S_IPOPN)) < 0) { return (-1); } --- 235,241 ----- #endif { + #ifndef AMIGA if (mkdir(name, (int) (asb->sb_mode & S_IPOPN)) < 0) { return (-1); } *************** *** 226,231 if (mkdir(name, (int) (asb->sb_mode & S_IPOPN)) < 0) { return (-1); } if (asb->sb_mode & S_IPEXE) { chmod(name, (int) (asb->sb_mode & S_IPERM)); } --- 239,249 ----- if (mkdir(name, (int) (asb->sb_mode & S_IPOPN)) < 0) { return (-1); } + #else + if (mkdir(name)) { + return -1; + } + if (asb->sb_mode & S_IPEXE) { chmod(name, (int) (asb->sb_mode & S_IPERM)); } *************** *** 229,234 if (asb->sb_mode & S_IPEXE) { chmod(name, (int) (asb->sb_mode & S_IPERM)); } if (f_owner) { chown(name, (int) asb->sb_uid, (int) asb->sb_gid); } --- 247,253 ----- if (asb->sb_mode & S_IPEXE) { chmod(name, (int) (asb->sb_mode & S_IPERM)); } + #endif if (f_owner) { chown(name, (int) asb->sb_uid, (int) asb->sb_gid); } diff -c pax/pax.c pax.amiga/pax.c *** pax/pax.c Sat Feb 18 12:59:52 1989 --- pax.amiga/pax.c Sun Sep 24 20:29:28 1989 *************** *** 149,154 */ #ifdef __STDC__ int main(int argc, char **argv) --- 149,160 ----- */ #ifdef __STDC__ + #ifdef AMIGA + void + #else + int + #endif + main(int argc, char **argv) #else *************** *** 150,157 #ifdef __STDC__ - int main(int argc, char **argv) - #else int main(argc, argv) --- 156,161 ----- #endif main(int argc, char **argv) #else int main(argc, argv) *************** *** 182,188 *tmp = '\0'; } #else ! /* strip the pathname off of the name of the executable */ if ((myname = strrchr(argv[0], '/')) != (char *)NULL) { myname++; } else { --- 186,192 ----- *tmp = '\0'; } #else ! /* strip the pathname off the name of the executable */ if ((myname = strrchr(argv[0], '/')) != (char *)NULL) { myname++; } else { *************** *** 190,196 } #endif ! /* set upt for collecting other command line arguments */ name_init(argc, argv); /* get all our necessary information */ --- 194,200 ----- } #endif ! /* set up for collecting other command line arguments */ name_init(argc, argv); /* get all our necessary information */ *************** *** 230,237 * * RETURNS * ! * Normally returns 0. If an error occurs, -1 is returned ! * and state is set to reflect the error. * */ --- 234,240 ----- * * RETURNS * ! * Nothing * */ *************** *** 237,243 #ifdef __STDC__ ! int do_pax(int ac, char **av) #else --- 240,246 ----- #ifdef __STDC__ ! void do_pax(int ac, char **av) #else *************** *** 241,247 #else ! int do_pax(ac, av) int ac; /* argument counter */ char **av; /* arguments */ --- 244,250 ----- #else ! void do_pax(ac, av) int ac; /* argument counter */ char **av; /* arguments */ *************** *** 409,415 usage(); } - return (0); } --- 412,417 ----- usage(); } } diff -c pax/pax.h pax.amiga/pax.h *** pax/pax.h Sat Feb 18 12:59:53 1989 --- pax.amiga/pax.h Wed Sep 20 06:38:48 1989 *************** *** 38,43 #include "config.h" #include "limits.h" #include #include #include #include --- 38,48 ----- #include "config.h" #include "limits.h" #include + + #ifndef V7 + # include + #endif + #include #include #include *************** *** 41,46 #include #include #include #include #ifndef MSDOS #include --- 46,52 ----- #include #include #include + #ifndef AMIGA #include #ifndef MSDOS #include *************** *** 46,51 #include #endif #include #include "regexp.h" #if defined(DIRENT) || defined(_POSIX_SOURCE) --- 52,63 ----- #include #endif #include + #else /* AMIGA */ + #include "sys/stat.h" + #include + #include + #endif /* AMIGA */ + #include "regexp.h" #if defined(DIRENT) || defined(_POSIX_SOURCE) *************** *** 55,62 # include # endif #else ! # ifdef hpux ! # include # else # ifdef XENIX_286 # include --- 67,74 ----- # include # endif #else ! # if defined(hpux) || defined(AMIGA) ! # include "ndir.h" # else # ifdef XENIX_286 # include *************** *** 67,73 # define dirent direct #endif ! #ifndef MSDOS #ifndef major # include #endif /* major */ --- 79,85 ----- # define dirent direct #endif ! #if !defined(MSDOS) && !defined(AMIGA) #ifndef major # include #endif /* major */ *************** *** 79,88 # include #endif /* SYSTIME */ - #ifndef V7 - # include - #endif - #ifdef XENIX # include #endif --- 91,96 ----- # include #endif /* SYSTIME */ #ifdef XENIX # include #endif *************** *** 87,93 # include #endif #ifdef XENIX_286 ! #include #endif /* XENIX_286 */ --- 95,101 ----- # include #endif #ifdef XENIX_286 ! # include #endif /* XENIX_286 */ *************** *** 91,98 #endif /* XENIX_286 */ ! #ifndef MSDOS ! #include #include --- 99,105 ----- #endif /* XENIX_286 */ ! #if !defined(MSDOS) && !defined(AMIGA) #include #include *************** *** 97,103 #include #ifndef XENIX_286 ! #include #endif /* XENIX_286 */ #else --- 104,110 ----- #include #ifndef XENIX_286 ! # include #endif /* XENIX_286 */ #else /* MSDOS | AMIGA */ *************** *** 100,107 #include #endif /* XENIX_286 */ ! #else ! #include #define major(x) (0) #define minor(x) (0) #define makedev(x,y) (0) --- 107,116 ----- # include #endif /* XENIX_286 */ ! #else /* MSDOS | AMIGA */ ! # ifndef AMIGA ! # include ! # endif /* AMIGA */ #define major(x) (0) #define minor(x) (0) #define makedev(x,y) (0) *************** *** 339,345 /* * This has to be included here to insure that all of the type ! * delcarations are declared for the prototypes. */ #include "func.h" --- 348,354 ----- /* * This has to be included here to insure that all of the type ! * declarations are declared for the prototypes. */ #include "func.h" *************** *** 399,403 extern int sys_nerr; extern char *sys_errlist[]; extern int errno; - #endif /* _PAX_H */ --- 408,411 ----- extern int sys_nerr; extern char *sys_errlist[]; extern int errno; #endif /* _PAX_H */ diff -c pax/port.c pax.amiga/port.c *** pax/port.c Mon Mar 13 11:28:21 1989 --- pax.amiga/port.c Sun Sep 24 21:51:15 1989 *************** *** 52,57 #include "pax.h" /* * Some computers are not so crass as to align themselves into the BSD or USG * camps. If a system supplies all of the routines we fake here, add it to --- 52,66 ----- #include "pax.h" + #ifdef AMIGA + # include + # include + # include + # include + # include + # include + #endif AMIGA + /* * Some computers are not so crass as to align themselves into the BSD or USG * camps. If a system supplies all of the routines we fake here, add it to *************** *** 59,65 */ #if !defined(mc300) && !defined(mc500) && !defined(mc700) && !defined(BSD) \ ! && !defined(MSDOS) /* mkdir - make a directory * --- 68,74 ----- */ #if !defined(mc300) && !defined(mc500) && !defined(mc700) && !defined(BSD) \ ! && !defined(MSDOS) && !defined(AMIGA) /* mkdir - make a directory * *************** *** 193,199 #endif /* MASSCOMP, BSD */ ! #ifdef MSDOS static struct passwd npwd = {"", "", 0, 0, 0, "", "", "", ""}; static char gmem1[] = ""; --- 202,208 ----- #endif /* MASSCOMP, BSD */ ! #if defined(MSDOS) || defined(AMIGA) static struct passwd npwd = {"", "", 0, 0, 0, "", "", "", ""}; static char gmem1[] = ""; *************** *** 245,247 } #endif --- 254,272 ----- } #endif + #ifdef AMIGA + char * + chipalloc(unsigned size) + { + struct MemList *x = + (struct MemList *)AllocMem((long)size+sizeof(struct MemList), MEMF_CHIP | MEMF_PUBLIC); + struct Task *p = FindTask(0L); + + if(x == (struct MemList *)NULL) + return NULL; + x->ml_NumEntries = 1; + x->ml_ME[0].me_Addr = (APTR)(((long)x) + sizeof(struct MemList)); + x->ml_ME[0].me_Length = size; + AddHead(&p->tc_MemEntry, &x->ml_Node); + return (char *)(x->ml_ME[0].me_Addr); + } diff -c pax/port.h pax.amiga/port.h *** pax/port.h Sat Feb 18 12:51:39 1989 --- pax.amiga/port.h Sun Sep 24 19:15:12 1989 *************** *** 83,89 /* * Map ANSI C compatible functions to V7 functions */ ! # define memcpy(a,b,n) bcopy((b),(a),(n)) # define memset(a,b,n) bzero((a),(n)) # define strrchr(s,c) rindex(s,c) --- 83,89 ----- /* * Map ANSI C compatible functions to V7 functions */ ! #ifndef __STDC__ # define memcpy(a,b,n) bcopy((b),(a),(n)) # define memset(a,b,n) bzero((a),(n)) # define strrchr(s,c) rindex(s,c) *************** *** 88,93 # define memset(a,b,n) bzero((a),(n)) # define strrchr(s,c) rindex(s,c) # define strchr(s,c) index(s,c) ! #endif /* USG */ #endif /* _PAX_PORT_H */ --- 88,96 ----- # define memset(a,b,n) bzero((a),(n)) # define strrchr(s,c) rindex(s,c) # define strchr(s,c) index(s,c) ! #else ! # include ! #endif #endif /* USG */ #ifdef AMIGA typedef long off_t; *************** *** 90,93 # define strchr(s,c) index(s,c) #endif /* USG */ #endif /* _PAX_PORT_H */ --- 92,114 ----- # include #endif #endif /* USG */ + #ifdef AMIGA + typedef long off_t; + #endif + #if defined(MSDOS) || defined(AMIGA) + #ifdef __STDC__ + struct passwd *getpwuid(int x); + struct passwd *getpwnam(char *s); + struct group *getgrgid(int x); + struct group *getgrnam(char *s); + int setgrent(void); + int getuid(void); + int getgid(void); + int link(char *f, char *t); + int chown(char *n, int uid, int gid); + #ifdef AMIGA + char *chipalloc(unsigned size); + #endif /* AMIGA */ + #endif /* __STDC__ */ + #endif /* MSDOS || AMIGA */ #endif /* _PAX_PORT_H */ diff -c pax/regexp.c pax.amiga/regexp.c *** pax/regexp.c Sat Feb 18 12:59:57 1989 --- pax.amiga/regexp.c Sun Sep 24 21:51:59 1989 *************** *** 189,194 #ifndef STATIC #define STATIC static #endif STATIC char *reg(); STATIC char *regbranch(); STATIC char *regpiece(); --- 189,214 ----- #ifndef STATIC #define STATIC static #endif + #ifdef __STDC__ + static char *reg(int paren, + int *flagp); + static char *regbranch(int *flagp); + static char *regpiece(int *flagp); + static char *regatom(int *flagp); + static char *regnode(int op); + static void regc(int b); + static void reginsert(int op, + char *opnd); + static void regtail(char *p, + char *val); + static void regoptail(char *p, + char *val); + static int regtry(struct regexp *prog, + char *string); + static int regmatch(char *prog); + static int regrepeat(char *p); + static char *regnext(register char *p); + #else STATIC char *reg(); STATIC char *regbranch(); STATIC char *regpiece(); *************** *** 199,204 STATIC void reginsert(); STATIC void regtail(); STATIC void regoptail(); #ifdef STRCSPN STATIC int strcspn(); #endif --- 219,225 ----- STATIC void reginsert(); STATIC void regtail(); STATIC void regoptail(); + #endif #ifdef STRCSPN STATIC int strcspn(); #endif *************** *** 226,232 register char *longest; register int len; int flags; - extern char *malloc(); if (exp == (char *)NULL) FAIL("NULL argument"); --- 247,252 ----- register char *longest; register int len; int flags; if (exp == (char *)NULL) FAIL("NULL argument"); *************** *** 416,422 { register char *ret; register char op; ! register char *nxt; int flags; ret = regatom(&flags); --- 436,442 ----- { register char *ret; register char op; ! /* register char *nxt; /* not used: PC */ int flags; ret = regatom(&flags); *************** *** 564,570 - regnode - emit a node */ static char *regnode(op) ! char op; { register char *ret; register char *ptr; --- 584,590 ----- - regnode - emit a node */ static char *regnode(op) ! int op; { register char *ret; register char *ptr; *************** *** 587,593 - regc - emit (if appropriate) a byte of code */ static void regc(b) ! char b; { if (regcode != ®dummy) *regcode++ = b; --- 607,613 ----- - regc - emit (if appropriate) a byte of code */ static void regc(b) ! int b; { if (regcode != ®dummy) *regcode++ = b; *************** *** 601,607 * Means relocating the operand. */ static void reginsert(op, opnd) ! char op; char *opnd; { register char *src; --- 621,627 ----- * Means relocating the operand. */ static void reginsert(op, opnd) ! int op; char *opnd; { register char *src; *************** *** 689,694 #ifdef DEBUG int regnarrate = 0; void regdump(); STATIC char *regprop(); #endif --- 709,718 ----- #ifdef DEBUG int regnarrate = 0; + #ifdef __STDC__ + static char *regprop(char *op); + void regdump(regexp *r); + #else void regdump(); static char *regprop(); #endif *************** *** 690,696 #ifdef DEBUG int regnarrate = 0; void regdump(); ! STATIC char *regprop(); #endif /* --- 714,721 ----- void regdump(regexp *r); #else void regdump(); ! static char *regprop(); ! #endif #endif /* diff -c pax/regexp.h pax.amiga/regexp.h *** pax/regexp.h Mon Feb 6 11:48:59 1989 --- pax.amiga/regexp.h Fri Sep 15 04:58:27 1989 *************** *** 25,30 * number; the start node begins in the second byte. */ #define MAGIC 0234 extern regexp *regcomp(); extern int regexec(); --- 25,40 ----- * number; the start node begins in the second byte. */ #define MAGIC 0234 + #ifdef __STDC__ + /* Prototypes for functions defined in regexp.c */ + extern struct regexp *regcomp(char *exp); + extern int regexec(register struct regexp *prog, + register char *string); + extern void regsub(struct regexp *prog, + char *source, + char *dest); + extern void regerror(char *s); + #else extern regexp *regcomp(); extern int regexec(); *************** *** 30,34 extern int regexec(); extern void regsub(); extern void regerror(); ! #endif /* _PAX_REGEXP_H */ --- 40,44 ----- extern int regexec(); extern void regsub(); extern void regerror(); ! #endif #endif /* _PAX_REGEXP_H */ diff -c pax/tar.c pax.amiga/tar.c *** pax/tar.c Sat Feb 18 12:59:59 1989 --- pax.amiga/tar.c Sun Sep 24 20:27:46 1989 *************** *** 82,88 * * RETURNS * ! * zero */ #ifdef __STDC__ --- 82,88 ----- * * RETURNS * ! * Nothing */ #ifdef __STDC__ *************** *** 87,93 #ifdef __STDC__ ! int do_tar(int argc, char **argv) #else --- 87,93 ----- #ifdef __STDC__ ! void do_tar(int argc, char **argv) #else *************** *** 91,97 #else ! int do_tar(argc, argv) int argc; /* argument count (argc from main) */ char **argv; /* argument list (argv from main) */ --- 91,97 ----- #else ! void do_tar(argc, argv) int argc; /* argument count (argc from main) */ char **argv; /* argument list (argv from main) */ *************** *** 188,193 /* set the blocking factor, if not set by the user */ if (blocking == 0) { #ifdef MSDOS blocking = 20; #else --- 188,196 ----- /* set the blocking factor, if not set by the user */ if (blocking == 0) { + #ifdef AMIGA + blocking = 22; + #else #ifdef MSDOS blocking = 20; #else *************** *** 202,207 blocking = 20; #endif /* USG */ #endif } blocksize = blocking * BLOCKSIZE; buf_allocate((OFFSET) blocksize); --- 205,211 ----- blocking = 20; #endif /* USG */ #endif + #endif; } blocksize = blocking * BLOCKSIZE; buf_allocate((OFFSET) blocksize); *************** *** 224,230 linkleft(); /* report any unresolved links */ } - return (0); } --- 228,233 ----- linkleft(); /* report any unresolved links */ } } diff -c pax/ttyio.c pax.amiga/ttyio.c *** pax/ttyio.c Sat Feb 18 13:00:00 1989 --- pax.amiga/ttyio.c Sun Sep 17 06:35:45 1989 *************** *** 94,99 #ifdef MSDOS setmode(fd, O_TEXT); #endif if (isatty(fd)) { return (fd); } --- 94,100 ----- #ifdef MSDOS setmode(fd, O_TEXT); #endif + if (isatty(fd)) { return (fd); }