summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bin/pax/ar_io.c36
-rw-r--r--bin/pax/ar_subs.c23
-rw-r--r--bin/pax/buf_subs.c29
-rw-r--r--bin/pax/cache.c13
-rw-r--r--bin/pax/cpio.c37
-rw-r--r--bin/pax/extern.h2
-rw-r--r--bin/pax/file_subs.c15
-rw-r--r--bin/pax/ftree.c13
-rw-r--r--bin/pax/gen_subs.c5
-rw-r--r--bin/pax/options.c55
-rw-r--r--bin/pax/pat_rep.c31
-rw-r--r--bin/pax/pax.c6
-rw-r--r--bin/pax/sel_subs.c29
-rw-r--r--bin/pax/tables.c37
-rw-r--r--bin/pax/tar.c33
-rw-r--r--bin/pax/tty_subs.c9
16 files changed, 180 insertions, 193 deletions
diff --git a/bin/pax/ar_io.c b/bin/pax/ar_io.c
index 7cef8d2e67a..b3178bcce91 100644
--- a/bin/pax/ar_io.c
+++ b/bin/pax/ar_io.c
@@ -56,9 +56,9 @@ static char rcsid[] = "$NetBSD: ar_io.c,v 1.5 1996/03/26 23:54:13 mrg Exp $";
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
-#include <ctype.h>
#include <errno.h>
#include <stdlib.h>
+#include <err.h>
#include "pax.h"
#include "extern.h"
@@ -174,7 +174,7 @@ ar_open(name)
return(-1);
}
if (S_ISDIR(arsb.st_mode)) {
- warn(0, "Cannot write an archive on top of a directory %s",
+ paxwarn(0, "Cannot write an archive on top of a directory %s",
arcname);
(void)close(arfd);
arfd = -1;
@@ -507,13 +507,13 @@ ar_app_ok()
#endif
{
if (artyp == ISPIPE) {
- warn(1, "Cannot append to an archive obtained from a pipe.");
+ paxwarn(1, "Cannot append to an archive obtained from a pipe.");
return(-1);
}
if (!invld_rec)
return(0);
- warn(1,"Cannot append, device record size %d does not support %s spec",
+ paxwarn(1,"Cannot append, device record size %d does not support %s spec",
rdblksz, argv0);
return(-1);
}
@@ -602,7 +602,7 @@ ar_read(buf, cnt)
if (res < 0)
syswarn(1, errno, "Failed read on archive volume %d", arvol);
else
- warn(0, "End of archive volume %d reached", arvol);
+ paxwarn(0, "End of archive volume %d reached", arvol);
return(res);
}
@@ -681,7 +681,7 @@ ar_write(buf, bsz)
if (res >= 0)
break;
if (errno == EACCES) {
- warn(0, "Write failed, archive is write protected.");
+ paxwarn(0, "Write failed, archive is write protected.");
res = lstrval = 0;
return(0);
}
@@ -719,18 +719,18 @@ ar_write(buf, bsz)
* must quit right away.
*/
if (!wr_trail && (res <= 0)) {
- warn(1,"Unable to append, trailer re-write failed. Quitting.");
+ paxwarn(1,"Unable to append, trailer re-write failed. Quitting.");
return(res);
}
if (res == 0)
- warn(0, "End of archive volume %d reached", arvol);
+ paxwarn(0, "End of archive volume %d reached", arvol);
else if (res < 0)
syswarn(1, errno, "Failed write to archive volume: %d", arvol);
else if (!frmt->blkalgn || ((res % frmt->blkalgn) == 0))
- warn(0,"WARNING: partial archive write. Archive MAY BE FLAWED");
+ paxwarn(0,"WARNING: partial archive write. Archive MAY BE FLAWED");
else
- warn(1,"WARNING: partial archive write. Archive IS FLAWED");
+ paxwarn(1,"WARNING: partial archive write. Archive IS FLAWED");
return(res);
}
@@ -764,7 +764,7 @@ ar_rdsync()
return(-1);
if ((act == APPND) || (act == ARCHIVE)) {
- warn(1, "Cannot allow updates to an archive with flaws.");
+ paxwarn(1, "Cannot allow updates to an archive with flaws.");
return(-1);
}
if (io_ok)
@@ -816,10 +816,10 @@ ar_rdsync()
break;
}
if (lstrval <= 0) {
- warn(1, "Unable to recover from an archive read failure.");
+ paxwarn(1, "Unable to recover from an archive read failure.");
return(-1);
}
- warn(0, "Attempting to recover from an archive read failure.");
+ paxwarn(0, "Attempting to recover from an archive read failure.");
return(0);
}
@@ -925,7 +925,7 @@ ar_rev(sksz)
/*
* cannot go backwards on these critters
*/
- warn(1, "Reverse positioning on pipes is not supported.");
+ paxwarn(1, "Reverse positioning on pipes is not supported.");
lstrval = -1;
return(-1);
case ISREG:
@@ -961,7 +961,7 @@ ar_rev(sksz)
/*
* this should never happen
*/
- warn(1,"Reverse position on previous volume.");
+ paxwarn(1,"Reverse position on previous volume.");
lstrval = -1;
return(-1);
}
@@ -1003,7 +1003,7 @@ ar_rev(sksz)
* ok we have to move. Make sure the tape drive can do it.
*/
if (sksz % phyblk) {
- warn(1,
+ paxwarn(1,
"Tape drive unable to backspace requested amount");
lstrval = -1;
return(-1);
@@ -1127,7 +1127,7 @@ get_phys()
* never fail).
*/
if (padsz % phyblk) {
- warn(1, "Tape drive unable to backspace requested amount");
+ paxwarn(1, "Tape drive unable to backspace requested amount");
return(-1);
}
@@ -1289,7 +1289,7 @@ ar_next()
if ((arcname = strdup(buf)) == NULL) {
done = 1;
lstrval = -1;
- warn(0, "Cannot save archive name.");
+ paxwarn(0, "Cannot save archive name.");
return(-1);
}
freeit = 1;
diff --git a/bin/pax/ar_subs.c b/bin/pax/ar_subs.c
index 4499610dcee..8e955da3c5a 100644
--- a/bin/pax/ar_subs.c
+++ b/bin/pax/ar_subs.c
@@ -52,7 +52,6 @@ static char rcsid[] = "$NetBSD: ar_subs.c,v 1.5 1995/03/21 09:07:06 cgd Exp $";
#include <signal.h>
#include <string.h>
#include <stdio.h>
-#include <ctype.h>
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
@@ -577,7 +576,7 @@ append()
if (get_arc() < 0)
return;
if ((orgfrmt != NULL) && (orgfrmt != frmt)) {
- warn(1, "Cannot mix current archive format %s with %s",
+ paxwarn(1, "Cannot mix current archive format %s with %s",
frmt->name, orgfrmt->name);
return;
}
@@ -763,7 +762,7 @@ copy()
return;
}
if (!S_ISDIR(sb.st_mode)) {
- warn(1, "Destination is not a directory %s", dirptr);
+ paxwarn(1, "Destination is not a directory %s", dirptr);
return;
}
@@ -817,7 +816,7 @@ copy()
else
res = 0;
if ((arcn->nlen - res) > drem) {
- warn(1, "Destination pathname too long %s",
+ paxwarn(1, "Destination pathname too long %s",
arcn->name);
continue;
}
@@ -1014,16 +1013,16 @@ next_head(arcn)
* storage device, better give the user the bad news.
*/
if ((ret == 0) || (rd_sync() < 0)) {
- warn(1,"Premature end of file on archive read");
+ paxwarn(1,"Premature end of file on archive read");
return(-1);
}
if (!in_resync) {
if (act == APPND) {
- warn(1,
+ paxwarn(1,
"Archive I/O error, cannot continue");
return(-1);
}
- warn(1,"Archive I/O error. Trying to recover.");
+ paxwarn(1,"Archive I/O error. Trying to recover.");
++in_resync;
}
@@ -1084,10 +1083,10 @@ next_head(arcn)
*/
if (!in_resync) {
if (act == APPND) {
- warn(1,"Unable to append, archive header flaw");
+ paxwarn(1,"Unable to append, archive header flaw");
return(-1);
}
- warn(1,"Invalid header, starting valid header search.");
+ paxwarn(1,"Invalid header, starting valid header search.");
++in_resync;
}
memmove(hdbuf, hdbuf+1, shftsz);
@@ -1179,7 +1178,7 @@ get_arc()
if (!notice) {
if (act == APPND)
return(-1);
- warn(1,"Cannot identify format. Searching...");
+ paxwarn(1,"Cannot identify format. Searching...");
++notice;
}
}
@@ -1214,7 +1213,7 @@ get_arc()
if (!notice) {
if (act == APPND)
return(-1);
- warn(1, "Cannot identify format. Searching...");
+ paxwarn(1, "Cannot identify format. Searching...");
++notice;
}
@@ -1239,6 +1238,6 @@ get_arc()
/*
* we cannot find a header, bow, apologize and quit
*/
- warn(1, "Sorry, unable to determine archive format.");
+ paxwarn(1, "Sorry, unable to determine archive format.");
return(-1);
}
diff --git a/bin/pax/buf_subs.c b/bin/pax/buf_subs.c
index b627096f2f5..2f8cbc6152c 100644
--- a/bin/pax/buf_subs.c
+++ b/bin/pax/buf_subs.c
@@ -50,7 +50,6 @@ static char rcsid[] = "$NetBSD: buf_subs.c,v 1.5 1995/03/21 09:07:08 cgd Exp $";
#include <sys/stat.h>
#include <sys/param.h>
#include <stdio.h>
-#include <ctype.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
@@ -108,12 +107,12 @@ wr_start()
if (!wrblksz)
wrblksz = frmt->bsz;
if (wrblksz > MAXBLK) {
- warn(1, "Write block size of %d too large, maximium is: %d",
+ paxwarn(1, "Write block size of %d too large, maximium is: %d",
wrblksz, MAXBLK);
return(-1);
}
if (wrblksz % BLKMULT) {
- warn(1, "Write block size of %d is not a %d byte multiple",
+ paxwarn(1, "Write block size of %d is not a %d byte multiple",
wrblksz, BLKMULT);
return(-1);
}
@@ -153,12 +152,12 @@ rd_start()
buf = &(bufmem[BLKMULT]);
if ((act == APPND) && wrblksz) {
if (wrblksz > MAXBLK) {
- warn(1,"Write block size %d too large, maximium is: %d",
+ paxwarn(1,"Write block size %d too large, maximium is: %d",
wrblksz, MAXBLK);
return(-1);
}
if (wrblksz % BLKMULT) {
- warn(1, "Write block size %d is not a %d byte multiple",
+ paxwarn(1, "Write block size %d is not a %d byte multiple",
wrblksz, BLKMULT);
return(-1);
}
@@ -237,7 +236,7 @@ appnd_start(skcnt)
off_t cnt;
if (exit_val != 0) {
- warn(0, "Cannot append to an archive that may have flaws.");
+ paxwarn(0, "Cannot append to an archive that may have flaws.");
return(-1);
}
/*
@@ -314,7 +313,7 @@ appnd_start(skcnt)
return(0);
out:
- warn(1, "Unable to rewrite archive trailer, cannot append.");
+ paxwarn(1, "Unable to rewrite archive trailer, cannot append.");
return(-1);
}
@@ -346,7 +345,7 @@ rd_sync()
if (maxflt == 0)
return(-1);
if (act == APPND) {
- warn(1, "Unable to append when there are archive read errors.");
+ paxwarn(1, "Unable to append when there are archive read errors.");
return(-1);
}
@@ -380,7 +379,7 @@ rd_sync()
* can extract out of the archive.
*/
if ((maxflt > 0) && (++errcnt > maxflt))
- warn(0,"Archive read error limit (%d) reached",maxflt);
+ paxwarn(0,"Archive read error limit (%d) reached",maxflt);
else if (ar_rdsync() == 0)
continue;
if (ar_next() < 0)
@@ -707,11 +706,11 @@ wr_rdfile(arcn, ifd, left)
if (res < 0)
syswarn(1, errno, "Read fault on %s", arcn->org_name);
else if (size != 0L)
- warn(1, "File changed size during read %s", arcn->org_name);
+ paxwarn(1, "File changed size during read %s", arcn->org_name);
else if (fstat(ifd, &sb) < 0)
syswarn(1, errno, "Failed stat on %s", arcn->org_name);
else if (arcn->sb.st_mtime != sb.st_mtime)
- warn(1, "File %s was modified during copy to archive",
+ paxwarn(1, "File %s was modified during copy to archive",
arcn->org_name);
*left = size;
return(0);
@@ -822,7 +821,7 @@ rd_wrfile(arcn, ofd, left)
* calculated crc to the crc stored in the archive
*/
if (docrc && (size == 0L) && (arcn->crc != crc))
- warn(1,"Actual crc does not match expected crc %s",arcn->name);
+ paxwarn(1,"Actual crc does not match expected crc %s",arcn->name);
return(0);
}
@@ -894,12 +893,12 @@ cp_file(arcn, fd1, fd2)
syswarn(1, errno, "Failed write during copy of %s to %s",
arcn->org_name, arcn->name);
else if (cpcnt != arcn->sb.st_size)
- warn(1, "File %s changed size during copy to %s",
+ paxwarn(1, "File %s changed size during copy to %s",
arcn->org_name, arcn->name);
else if (fstat(fd1, &sb) < 0)
syswarn(1, errno, "Failed stat of %s", arcn->org_name);
else if (arcn->sb.st_mtime != sb.st_mtime)
- warn(1, "File %s was modified during copy to %s",
+ paxwarn(1, "File %s was modified during copy to %s",
arcn->org_name, arcn->name);
/*
@@ -992,7 +991,7 @@ buf_flush(bufcnt)
* at least one record. We always round limit UP to next blocksize.
*/
if ((wrlimit > 0) && (wrcnt > wrlimit)) {
- warn(0, "User specified archive volume byte limit reached.");
+ paxwarn(0, "User specified archive volume byte limit reached.");
if (ar_next() < 0) {
wrcnt = 0;
exit_val = 1;
diff --git a/bin/pax/cache.c b/bin/pax/cache.c
index 49b8e93634f..b55af6e38c8 100644
--- a/bin/pax/cache.c
+++ b/bin/pax/cache.c
@@ -51,7 +51,6 @@ static char rcsid[] = "$NetBSD: cache.c,v 1.4 1995/03/21 09:07:10 cgd Exp $";
#include <sys/param.h>
#include <string.h>
#include <stdio.h>
-#include <ctype.h>
#include <pwd.h>
#include <grp.h>
#include <unistd.h>
@@ -97,7 +96,7 @@ uidtb_start()
return(-1);
if ((uidtb = (UIDC **)calloc(UID_SZ, sizeof(UIDC *))) == NULL) {
++fail;
- warn(1, "Unable to allocate memory for user id cache table");
+ paxwarn(1, "Unable to allocate memory for user id cache table");
return(-1);
}
return(0);
@@ -126,7 +125,7 @@ gidtb_start()
return(-1);
if ((gidtb = (GIDC **)calloc(GID_SZ, sizeof(GIDC *))) == NULL) {
++fail;
- warn(1, "Unable to allocate memory for group id cache table");
+ paxwarn(1, "Unable to allocate memory for group id cache table");
return(-1);
}
return(0);
@@ -155,7 +154,7 @@ usrtb_start()
return(-1);
if ((usrtb = (UIDC **)calloc(UNM_SZ, sizeof(UIDC *))) == NULL) {
++fail;
- warn(1, "Unable to allocate memory for user name cache table");
+ paxwarn(1, "Unable to allocate memory for user name cache table");
return(-1);
}
return(0);
@@ -184,7 +183,7 @@ grptb_start()
return(-1);
if ((grptb = (GIDC **)calloc(GNM_SZ, sizeof(GIDC *))) == NULL) {
++fail;
- warn(1,"Unable to allocate memory for group name cache table");
+ paxwarn(1,"Unable to allocate memory for group name cache table");
return(-1);
}
return(0);
@@ -249,7 +248,7 @@ name_uid(uid, frc)
# ifdef NET2_STAT
(void)sprintf(ptr->name, "%u", uid);
# else
- (void)sprintf(ptr->name, "%lu", uid);
+ (void)sprintf(ptr->name, "%lu", (unsigned long)uid);
# endif
if (frc == 0)
return("");
@@ -326,7 +325,7 @@ name_gid(gid, frc)
# ifdef NET2_STAT
(void)sprintf(ptr->name, "%u", gid);
# else
- (void)sprintf(ptr->name, "%lu", gid);
+ (void)sprintf(ptr->name, "%lu", (unsigned long)gid);
# endif
if (frc == 0)
return("");
diff --git a/bin/pax/cpio.c b/bin/pax/cpio.c
index df0885aecd5..44caa1595d0 100644
--- a/bin/pax/cpio.c
+++ b/bin/pax/cpio.c
@@ -50,7 +50,6 @@ static char rcsid[] = "$NetBSD: cpio.c,v 1.5 1995/03/21 09:07:13 cgd Exp $";
#include <sys/stat.h>
#include <sys/param.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
@@ -221,7 +220,7 @@ rd_nm(arcn, nsz)
* do not even try bogus values
*/
if ((nsz == 0) || (nsz > sizeof(arcn->name))) {
- warn(1, "Cpio file name length %d is out of range", nsz);
+ paxwarn(1, "Cpio file name length %d is out of range", nsz);
return(-1);
}
@@ -230,7 +229,7 @@ rd_nm(arcn, nsz)
*/
if ((rd_wrbuf(arcn->name,nsz) != nsz) || (arcn->name[nsz-1] != '\0') ||
(arcn->name[0] == '\0')) {
- warn(1, "Cpio file name in header is corrupted");
+ paxwarn(1, "Cpio file name in header is corrupted");
return(-1);
}
return(0);
@@ -259,10 +258,10 @@ rd_ln_nm(arcn)
if ((arcn->sb.st_size == 0) ||
(arcn->sb.st_size >= sizeof(arcn->ln_name))) {
# ifdef NET2_STAT
- warn(1, "Cpio link name length is invalid: %lu",
+ paxwarn(1, "Cpio link name length is invalid: %lu",
arcn->sb.st_size);
# else
- warn(1, "Cpio link name length is invalid: %qu",
+ paxwarn(1, "Cpio link name length is invalid: %qu",
arcn->sb.st_size);
# endif
return(-1);
@@ -273,7 +272,7 @@ rd_ln_nm(arcn)
*/
if (rd_wrbuf(arcn->ln_name, (int)arcn->sb.st_size) !=
(int)arcn->sb.st_size) {
- warn(1, "Cpio link name read error");
+ paxwarn(1, "Cpio link name read error");
return(-1);
}
arcn->ln_nlen = arcn->sb.st_size;
@@ -283,7 +282,7 @@ rd_ln_nm(arcn)
* watch out for those empty link names
*/
if (arcn->ln_name[0] == '\0') {
- warn(1, "Cpio link name is corrupt");
+ paxwarn(1, "Cpio link name is corrupt");
return(-1);
}
return(0);
@@ -485,7 +484,7 @@ cpio_wr(arcn)
if (uqd_asc((u_quad_t)arcn->sb.st_size, hd->c_filesize,
sizeof(hd->c_filesize), OCT)) {
# endif
- warn(1,"File is too large for cpio format %s",
+ paxwarn(1,"File is too large for cpio format %s",
arcn->org_name);
return(1);
}
@@ -536,7 +535,7 @@ cpio_wr(arcn)
*/
if ((wr_rdbuf(hdblk, (int)sizeof(HD_CPIO)) < 0) ||
(wr_rdbuf(arcn->name, nsz) < 0)) {
- warn(1, "Unable to write cpio header for %s", arcn->org_name);
+ paxwarn(1, "Unable to write cpio header for %s", arcn->org_name);
return(-1);
}
@@ -555,7 +554,7 @@ cpio_wr(arcn)
* next file as we are done.
*/
if (wr_rdbuf(arcn->ln_name, arcn->ln_nlen) < 0) {
- warn(1,"Unable to write cpio link name for %s",arcn->org_name);
+ paxwarn(1,"Unable to write cpio link name for %s",arcn->org_name);
return(-1);
}
return(1);
@@ -564,7 +563,7 @@ cpio_wr(arcn)
/*
* header field is out of range
*/
- warn(1, "Cpio header field is too small to store file %s",
+ paxwarn(1, "Cpio header field is too small to store file %s",
arcn->org_name);
return(1);
}
@@ -852,7 +851,7 @@ vcpio_wr(arcn)
if (uqd_asc((u_quad_t)arcn->sb.st_size, hd->c_filesize,
sizeof(hd->c_filesize), HEX)) {
# endif
- warn(1,"File is too large for sv4cpio format %s",
+ paxwarn(1,"File is too large for sv4cpio format %s",
arcn->org_name);
return(1);
}
@@ -910,7 +909,7 @@ vcpio_wr(arcn)
if ((wr_rdbuf(hdblk, (int)sizeof(HD_VCPIO)) < 0) ||
(wr_rdbuf(arcn->name, (int)nsz) < 0) ||
(wr_skip((off_t)(VCPIO_PAD(sizeof(HD_VCPIO) + nsz))) < 0)) {
- warn(1,"Could not write sv4cpio header for %s",arcn->org_name);
+ paxwarn(1,"Could not write sv4cpio header for %s",arcn->org_name);
return(-1);
}
@@ -932,7 +931,7 @@ vcpio_wr(arcn)
*/
if ((wr_rdbuf(arcn->ln_name, arcn->ln_nlen) < 0) ||
(wr_skip((off_t)(VCPIO_PAD(arcn->ln_nlen))) < 0)) {
- warn(1,"Could not write sv4cpio link name for %s",
+ paxwarn(1,"Could not write sv4cpio link name for %s",
arcn->org_name);
return(-1);
}
@@ -942,7 +941,7 @@ vcpio_wr(arcn)
/*
* header field is out of range
*/
- warn(1,"Sv4cpio header field is too small for file %s",arcn->org_name);
+ paxwarn(1,"Sv4cpio header field is too small for file %s",arcn->org_name);
return(1);
}
@@ -1163,7 +1162,7 @@ bcpio_wr(arcn)
t_offt = (off_t)(SHRT_EXT(hd->h_filesize_1));
t_offt = (t_offt<<16) | ((off_t)(SHRT_EXT(hd->h_filesize_2)));
if (arcn->sb.st_size != t_offt) {
- warn(1,"File is too large for bcpio format %s",
+ paxwarn(1,"File is too large for bcpio format %s",
arcn->org_name);
return(1);
}
@@ -1248,7 +1247,7 @@ bcpio_wr(arcn)
if ((wr_rdbuf(hdblk, (int)sizeof(HD_BCPIO)) < 0) ||
(wr_rdbuf(arcn->name, nsz) < 0) ||
(wr_skip((off_t)(BCPIO_PAD(sizeof(HD_BCPIO) + nsz))) < 0)) {
- warn(1, "Could not write bcpio header for %s", arcn->org_name);
+ paxwarn(1, "Could not write bcpio header for %s", arcn->org_name);
return(-1);
}
@@ -1270,7 +1269,7 @@ bcpio_wr(arcn)
*/
if ((wr_rdbuf(arcn->ln_name, arcn->ln_nlen) < 0) ||
(wr_skip((off_t)(BCPIO_PAD(arcn->ln_nlen))) < 0)) {
- warn(1,"Could not write bcpio link name for %s",arcn->org_name);
+ paxwarn(1,"Could not write bcpio link name for %s",arcn->org_name);
return(-1);
}
return(1);
@@ -1279,6 +1278,6 @@ bcpio_wr(arcn)
/*
* header field is out of range
*/
- warn(1,"Bcpio header field is too small for file %s", arcn->org_name);
+ paxwarn(1,"Bcpio header field is too small for file %s", arcn->org_name);
return(1);
}
diff --git a/bin/pax/extern.h b/bin/pax/extern.h
index fe198b0508f..6c7497daeec 100644
--- a/bin/pax/extern.h
+++ b/bin/pax/extern.h
@@ -290,5 +290,5 @@ int ustar_wr __P((register ARCHD *));
int tty_init __P((void));
void tty_prnt __P((char *, ...));
int tty_read __P((char *, int));
-void warn __P((int, char *, ...));
+void paxwarn __P((int, char *, ...));
void syswarn __P((int, int, char *, ...));
diff --git a/bin/pax/file_subs.c b/bin/pax/file_subs.c
index f37ef0d68ab..3727e0fc1ee 100644
--- a/bin/pax/file_subs.c
+++ b/bin/pax/file_subs.c
@@ -53,7 +53,6 @@ static char rcsid[] = "$NetBSD: file_subs.c,v 1.4 1995/03/21 09:07:18 cgd Exp $"
#include <fcntl.h>
#include <string.h>
#include <stdio.h>
-#include <ctype.h>
#include <errno.h>
#include <sys/uio.h>
#include <stdlib.h>
@@ -211,7 +210,7 @@ lnk_creat(arcn)
}
if (S_ISDIR(sb.st_mode)) {
- warn(1, "A hard link to the directory %s is not allowed",
+ paxwarn(1, "A hard link to the directory %s is not allowed",
arcn->ln_name);
return(-1);
}
@@ -283,7 +282,7 @@ chk_same(arcn)
* better make sure the user does not have src == dest by mistake
*/
if ((arcn->sb.st_dev == sb.st_dev) && (arcn->sb.st_ino == sb.st_ino)) {
- warn(1, "Unable to copy %s, file would overwrite itself",
+ paxwarn(1, "Unable to copy %s, file would overwrite itself",
arcn->name);
return(0);
}
@@ -330,7 +329,7 @@ mk_link(to, to_sb, from, ign)
* make sure it is not the same file, protect the user
*/
if ((to_sb->st_dev==sb.st_dev)&&(to_sb->st_ino == sb.st_ino)) {
- warn(1, "Unable to link file %s to itself", to);
+ paxwarn(1, "Unable to link file %s to itself", to);
return(-1);;
}
@@ -430,7 +429,7 @@ node_creat(arcn)
/*
* Skip sockets, operation has no meaning under BSD
*/
- warn(0,
+ paxwarn(0,
"%s skipped. Sockets cannot be copied or extracted",
arcn->name);
return(-1);
@@ -446,7 +445,7 @@ node_creat(arcn)
/*
* we should never get here
*/
- warn(0, "%s has an unknown file type, skipping",
+ paxwarn(0, "%s has an unknown file type, skipping",
arcn->name);
return(-1);
}
@@ -1046,11 +1045,11 @@ set_crc(arcn, fd)
* they can create inconsistant archive copies.
*/
if (cpcnt != arcn->sb.st_size)
- warn(1, "File changed size %s", arcn->org_name);
+ paxwarn(1, "File changed size %s", arcn->org_name);
else if (fstat(fd, &sb) < 0)
syswarn(1, errno, "Failed stat on %s", arcn->org_name);
else if (arcn->sb.st_mtime != sb.st_mtime)
- warn(1, "File %s was modified during read", arcn->org_name);
+ paxwarn(1, "File %s was modified during read", arcn->org_name);
else if (lseek(fd, (off_t)0L, SEEK_SET) < 0)
syswarn(1, errno, "File rewind failed on: %s", arcn->org_name);
else {
diff --git a/bin/pax/ftree.c b/bin/pax/ftree.c
index 46c2b8729f6..0f320bd03d2 100644
--- a/bin/pax/ftree.c
+++ b/bin/pax/ftree.c
@@ -52,7 +52,6 @@ static char rcsid[] = "$NetBSD: ftree.c,v 1.4 1995/03/21 09:07:21 cgd Exp $";
#include <unistd.h>
#include <string.h>
#include <stdio.h>
-#include <ctype.h>
#include <errno.h>
#include <stdlib.h>
#include <fts.h>
@@ -127,7 +126,7 @@ ftree_start()
ftsopts |= FTS_PHYSICAL;
if (Hflag)
# ifdef NET2_FTS
- warn(0, "The -H flag is not supported on this version");
+ paxwarn(0, "The -H flag is not supported on this version");
# else
ftsopts |= FTS_COMFOLLOW;
# endif
@@ -135,7 +134,7 @@ ftree_start()
ftsopts |= FTS_XDEV;
if ((fthead == NULL) && ((farray[0] = malloc(PAXPATHLEN+2)) == NULL)) {
- warn(1, "Unable to allocate memory for file name buffer");
+ paxwarn(1, "Unable to allocate memory for file name buffer");
return(-1);
}
@@ -170,7 +169,7 @@ ftree_add(str)
* simple check for bad args
*/
if ((str == NULL) || (*str == '\0')) {
- warn(0, "Invalid file name arguement");
+ paxwarn(0, "Invalid file name arguement");
return(-1);
}
@@ -180,7 +179,7 @@ ftree_add(str)
* trailing / the user may pass us. (watch out for / by itself).
*/
if ((ft = (FTREE *)malloc(sizeof(FTREE))) == NULL) {
- warn(0, "Unable to allocate memory for filename");
+ paxwarn(0, "Unable to allocate memory for filename");
return(-1);
}
@@ -268,7 +267,7 @@ ftree_chk()
if (ft->refcnt > 0)
continue;
if (wban == 0) {
- warn(1,"WARNING! These file names were not selected:");
+ paxwarn(1,"WARNING! These file names were not selected:");
++wban;
}
(void)fprintf(stderr, "%s\n", ft->fname);
@@ -428,7 +427,7 @@ next_file(arcn)
/*
* fts claims a file system cycle
*/
- warn(1,"File system cycle found at %s",ftent->fts_path);
+ paxwarn(1,"File system cycle found at %s",ftent->fts_path);
continue;
case FTS_DNR:
# ifdef NET2_FTS
diff --git a/bin/pax/gen_subs.c b/bin/pax/gen_subs.c
index f72dc5460ed..11e4d339b9f 100644
--- a/bin/pax/gen_subs.c
+++ b/bin/pax/gen_subs.c
@@ -50,7 +50,6 @@ static char rcsid[] = "$NetBSD: gen_subs.c,v 1.5 1995/03/21 09:07:26 cgd Exp $";
#include <sys/stat.h>
#include <sys/param.h>
#include <stdio.h>
-#include <ctype.h>
#include <tzfile.h>
#include <utmp.h>
#include <unistd.h>
@@ -139,9 +138,9 @@ ls_list(arcn, now)
# ifdef NET2_STAT
(void)printf("%4u,%4u ", MAJOR(sbp->st_rdev),
# else
- (void)printf("%4lu,%4lu ", MAJOR(sbp->st_rdev),
+ (void)printf("%4lu,%4lu ", (unsigned long)MAJOR(sbp->st_rdev),
# endif
- MINOR(sbp->st_rdev));
+ (unsigned long)MINOR(sbp->st_rdev));
else {
# ifdef NET2_STAT
(void)printf("%9lu ", sbp->st_size);
diff --git a/bin/pax/options.c b/bin/pax/options.c
index 5c916ee8126..411dece0ca4 100644
--- a/bin/pax/options.c
+++ b/bin/pax/options.c
@@ -51,7 +51,6 @@ static char rcsid[] = "$NetBSD: options.c,v 1.6 1996/03/26 23:54:18 mrg Exp $";
#include <sys/mtio.h>
#include <sys/param.h>
#include <stdio.h>
-#include <ctype.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
@@ -97,34 +96,34 @@ static void cpio_usage __P((void));
FSUB fsub[] = {
/* 0: OLD BINARY CPIO */
- "bcpio", 5120, sizeof(HD_BCPIO), 1, 0, 0, 1, bcpio_id, cpio_strd,
+ {"bcpio", 5120, sizeof(HD_BCPIO), 1, 0, 0, 1, bcpio_id, cpio_strd,
bcpio_rd, bcpio_endrd, cpio_stwr, bcpio_wr, cpio_endwr, cpio_trail,
- rd_wrfile, wr_rdfile, bad_opt,
+ rd_wrfile, wr_rdfile, bad_opt},
/* 1: OLD OCTAL CHARACTER CPIO */
- "cpio", 5120, sizeof(HD_CPIO), 1, 0, 0, 1, cpio_id, cpio_strd,
+ {"cpio", 5120, sizeof(HD_CPIO), 1, 0, 0, 1, cpio_id, cpio_strd,
cpio_rd, cpio_endrd, cpio_stwr, cpio_wr, cpio_endwr, cpio_trail,
- rd_wrfile, wr_rdfile, bad_opt,
+ rd_wrfile, wr_rdfile, bad_opt},
/* 2: SVR4 HEX CPIO */
- "sv4cpio", 5120, sizeof(HD_VCPIO), 1, 0, 0, 1, vcpio_id, cpio_strd,
+ {"sv4cpio", 5120, sizeof(HD_VCPIO), 1, 0, 0, 1, vcpio_id, cpio_strd,
vcpio_rd, vcpio_endrd, cpio_stwr, vcpio_wr, cpio_endwr, cpio_trail,
- rd_wrfile, wr_rdfile, bad_opt,
+ rd_wrfile, wr_rdfile, bad_opt},
/* 3: SVR4 HEX CPIO WITH CRC */
- "sv4crc", 5120, sizeof(HD_VCPIO), 1, 0, 0, 1, crc_id, crc_strd,
+ {"sv4crc", 5120, sizeof(HD_VCPIO), 1, 0, 0, 1, crc_id, crc_strd,
vcpio_rd, vcpio_endrd, crc_stwr, vcpio_wr, cpio_endwr, cpio_trail,
- rd_wrfile, wr_rdfile, bad_opt,
+ rd_wrfile, wr_rdfile, bad_opt},
/* 4: OLD TAR */
- "tar", 10240, BLKMULT, 0, 1, BLKMULT, 0, tar_id, no_op,
+ {"tar", 10240, BLKMULT, 0, 1, BLKMULT, 0, tar_id, no_op,
tar_rd, tar_endrd, no_op, tar_wr, tar_endwr, tar_trail,
- rd_wrfile, wr_rdfile, tar_opt,
+ rd_wrfile, wr_rdfile, tar_opt},
/* 5: POSIX USTAR */
- "ustar", 10240, BLKMULT, 0, 1, BLKMULT, 0, ustar_id, ustar_strd,
+ {"ustar", 10240, BLKMULT, 0, 1, BLKMULT, 0, ustar_id, ustar_strd,
ustar_rd, tar_endrd, ustar_stwr, ustar_wr, tar_endwr, tar_trail,
- rd_wrfile, wr_rdfile, bad_opt,
+ rd_wrfile, wr_rdfile, bad_opt},
};
#define F_TAR 4 /* format when called as tar */
#define DEFLT 5 /* default write format from list above */
@@ -217,7 +216,7 @@ pax_options(argc, argv)
*/
flg |= BF;
if ((wrblksz = (int)str_offt(optarg)) <= 0) {
- warn(1, "Invalid block size %s", optarg);
+ paxwarn(1, "Invalid block size %s", optarg);
pax_usage();
}
break;
@@ -319,7 +318,7 @@ pax_options(argc, argv)
pmode = 1;
break;
default:
- warn(1, "Invalid -p string: %c", *pt);
+ paxwarn(1, "Invalid -p string: %c", *pt);
pax_usage();
break;
}
@@ -374,12 +373,12 @@ pax_options(argc, argv)
* specify an archive format on write
*/
tmp.name = optarg;
- if (frmt = (FSUB *)bsearch((void *)&tmp, (void *)fsub,
- sizeof(fsub)/sizeof(FSUB), sizeof(FSUB), c_frmt)) {
+ if ((frmt = (FSUB *)bsearch((void *)&tmp, (void *)fsub,
+ sizeof(fsub)/sizeof(FSUB), sizeof(FSUB), c_frmt)) != NULL) {
flg |= XF;
break;
}
- warn(1, "Unknown -x format: %s", optarg);
+ paxwarn(1, "Unknown -x format: %s", optarg);
(void)fputs("pax: Known -x formats are:", stderr);
for (i = 0; i < (sizeof(fsub)/sizeof(FSUB)); ++i)
(void)fprintf(stderr, " %s", fsub[i].name);
@@ -399,11 +398,11 @@ pax_options(argc, argv)
* single archive volume.
*/
if ((wrlimit = str_offt(optarg)) <= 0) {
- warn(1, "Invalid write limit %s", optarg);
+ paxwarn(1, "Invalid write limit %s", optarg);
pax_usage();
}
if (wrlimit % BLKMULT) {
- warn(1, "Write limit is not a %d byte multiple",
+ paxwarn(1, "Write limit is not a %d byte multiple",
BLKMULT);
pax_usage();
}
@@ -427,7 +426,7 @@ pax_options(argc, argv)
if (strcmp(NONE, optarg) == 0)
maxflt = -1;
else if ((maxflt = atoi(optarg)) < 0) {
- warn(1, "Error count value must be positive");
+ paxwarn(1, "Error count value must be positive");
pax_usage();
}
break;
@@ -562,7 +561,7 @@ pax_options(argc, argv)
break;
case COPY:
if (optind >= argc) {
- warn(0, "Destination directory was not supplied");
+ paxwarn(0, "Destination directory was not supplied");
pax_usage();
}
--argc;
@@ -612,7 +611,7 @@ tar_options(argc, argv)
* specify blocksize
*/
if ((wrblksz = (int)str_offt(optarg)) <= 0) {
- warn(1, "Invalid block size %s", optarg);
+ paxwarn(1, "Invalid block size %s", optarg);
tar_usage();
}
break;
@@ -836,7 +835,7 @@ printflg(flg)
int pos = 0;
(void)fprintf(stderr,"%s: Invalid combination of options:", argv0);
- while (nxt = ffs(flg)) {
+ while ((nxt = ffs(flg)) != 0) {
flg = flg >> nxt;
pos += nxt;
(void)fprintf(stderr, " -%c", flgch[pos-1]);
@@ -907,7 +906,7 @@ bad_opt()
/*
* print all we were given
*/
- warn(1,"These format options are not supported");
+ paxwarn(1,"These format options are not supported");
while ((opt = opt_next()) != NULL)
(void)fprintf(stderr, "\t%s = %s\n", opt->name, opt->value);
pax_usage();
@@ -938,7 +937,7 @@ opt_add(str)
register char *endpt;
if ((str == NULL) || (*str == '\0')) {
- warn(0, "Invalid option name");
+ paxwarn(0, "Invalid option name");
return(-1);
}
frpt = endpt = str;
@@ -952,11 +951,11 @@ opt_add(str)
if ((endpt = strchr(frpt, ',')) != NULL)
*endpt = '\0';
if ((pt = strchr(frpt, '=')) == NULL) {
- warn(0, "Invalid options format");
+ paxwarn(0, "Invalid options format");
return(-1);
}
if ((opt = (OPLIST *)malloc(sizeof(OPLIST))) == NULL) {
- warn(0, "Unable to allocate space for option list");
+ paxwarn(0, "Unable to allocate space for option list");
return(-1);
}
*pt++ = '\0';
diff --git a/bin/pax/pat_rep.c b/bin/pax/pat_rep.c
index 1d2f5b7b5de..631ce50d757 100644
--- a/bin/pax/pat_rep.c
+++ b/bin/pax/pat_rep.c
@@ -50,7 +50,6 @@ static char rcsid[] = "$NetBSD: pat_rep.c,v 1.4 1995/03/21 09:07:33 cgd Exp $";
#include <sys/stat.h>
#include <sys/param.h>
#include <stdio.h>
-#include <ctype.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
@@ -124,7 +123,7 @@ rep_add(str)
* throw out the bad parameters
*/
if ((str == NULL) || (*str == '\0')) {
- warn(1, "Empty replacement string");
+ paxwarn(1, "Empty replacement string");
return(-1);
}
@@ -133,7 +132,7 @@ rep_add(str)
* this expression
*/
if ((pt1 = strchr(str+1, *str)) == NULL) {
- warn(1, "Invalid replacement string %s", str);
+ paxwarn(1, "Invalid replacement string %s", str);
return(-1);
}
@@ -142,7 +141,7 @@ rep_add(str)
* and split out the regular expression and try to compile it
*/
if ((rep = (REPLACE *)malloc(sizeof(REPLACE))) == NULL) {
- warn(1, "Unable to allocate memory for replacement string");
+ paxwarn(1, "Unable to allocate memory for replacement string");
return(-1);
}
@@ -152,7 +151,7 @@ rep_add(str)
# else
if ((res = regcomp(&(rep->rcmp), str+1, 0)) != 0) {
regerror(res, &(rep->rcmp), rebuf, sizeof(rebuf));
- warn(1, "%s while compiling regular expression %s", rebuf, str);
+ paxwarn(1, "%s while compiling regular expression %s", rebuf, str);
# endif
(void)free((char *)rep);
return(-1);
@@ -171,7 +170,7 @@ rep_add(str)
regfree(&(rep->rcmp));
# endif
(void)free((char *)rep);
- warn(1, "Invalid replacement string %s", str);
+ paxwarn(1, "Invalid replacement string %s", str);
return(-1);
}
@@ -201,7 +200,7 @@ rep_add(str)
# endif
(void)free((char *)rep);
*pt1 = *str;
- warn(1, "Invalid replacement string option %s", str);
+ paxwarn(1, "Invalid replacement string option %s", str);
return(-1);
}
++pt2;
@@ -246,7 +245,7 @@ pat_add(str)
* throw out the junk
*/
if ((str == NULL) || (*str == '\0')) {
- warn(1, "Empty pattern string");
+ paxwarn(1, "Empty pattern string");
return(-1);
}
@@ -256,7 +255,7 @@ pat_add(str)
* node to the end of the pattern list
*/
if ((pt = (PATTERN *)malloc(sizeof(PATTERN))) == NULL) {
- warn(1, "Unable to allocate memory for pattern string");
+ paxwarn(1, "Unable to allocate memory for pattern string");
return(-1);
}
@@ -299,7 +298,7 @@ pat_chk()
if (pt->flgs & MTCH)
continue;
if (!wban) {
- warn(1, "WARNING! These patterns were not matched:");
+ paxwarn(1, "WARNING! These patterns were not matched:");
++wban;
}
(void)fprintf(stderr, "%s\n", pt->pstr);
@@ -378,7 +377,7 @@ pat_sel(arcn)
*pt->pend = '\0';
if ((pt->pstr = strdup(arcn->name)) == NULL) {
- warn(1, "Pattern select out of memory");
+ paxwarn(1, "Pattern select out of memory");
if (pt->pend != NULL)
*pt->pend = '/';
pt->pend = NULL;
@@ -426,7 +425,7 @@ pat_sel(arcn)
/*
* should never happen....
*/
- warn(1, "Pattern list inconsistant");
+ paxwarn(1, "Pattern list inconsistant");
return(-1);
}
*ppt = pt->fow;
@@ -621,7 +620,7 @@ range_match(pattern, test)
int negate;
int ok = 0;
- if (negate = (*pattern == '!'))
+ if ((negate = (*pattern == '!')) != 0)
++pattern;
while ((c = *pattern++) != ']') {
@@ -860,7 +859,7 @@ fix_path(or_name, or_len, dir_name, dir_len)
--dest;
}
if ((len = dest - or_name) > PAXPATHLEN) {
- warn(1, "File name %s/%s, too long", dir_name, start);
+ paxwarn(1, "File name %s/%s, too long", dir_name, start);
return(-1);
}
*or_len = len;
@@ -987,7 +986,7 @@ rep_name(name, nlen, prnt)
< 0) {
# endif
if (prnt)
- warn(1, "Replacement name error %s",
+ paxwarn(1, "Replacement name error %s",
name);
return(1);
}
@@ -1038,7 +1037,7 @@ rep_name(name, nlen, prnt)
*outpt = '\0';
if ((outpt == endpt) && (*inpt != '\0')) {
if (prnt)
- warn(1,"Replacement name too long %s >> %s",
+ paxwarn(1,"Replacement name too long %s >> %s",
name, nname);
return(1);
}
diff --git a/bin/pax/pax.c b/bin/pax/pax.c
index 94857a240e7..db593b7911a 100644
--- a/bin/pax/pax.c
+++ b/bin/pax/pax.c
@@ -288,9 +288,9 @@ sig_cleanup(which_sig)
*/
vflag = vfpart = 1;
if (which_sig == SIGXCPU)
- warn(0, "Cpu time limit reached, cleaning up.");
+ paxwarn(0, "Cpu time limit reached, cleaning up.");
else
- warn(0, "Signal caught, cleaning up.");
+ paxwarn(0, "Signal caught, cleaning up.");
ar_close();
proc_dir();
@@ -368,7 +368,7 @@ gen_init()
(sigaddset(&s_mask,SIGINT) < 0)||(sigaddset(&s_mask,SIGHUP) < 0) ||
(sigaddset(&s_mask,SIGPIPE) < 0)||(sigaddset(&s_mask,SIGQUIT)<0) ||
(sigaddset(&s_mask,SIGXCPU) < 0)||(sigaddset(&s_mask,SIGXFSZ)<0)) {
- warn(1, "Unable to set up signal mask");
+ paxwarn(1, "Unable to set up signal mask");
return(-1);
}
n_hand.sa_mask = s_mask;
diff --git a/bin/pax/sel_subs.c b/bin/pax/sel_subs.c
index 234615abd58..7d7a949772a 100644
--- a/bin/pax/sel_subs.c
+++ b/bin/pax/sel_subs.c
@@ -52,7 +52,6 @@ static char rcsid[] = "$NetBSD: sel_subs.c,v 1.5 1995/03/21 09:07:42 cgd Exp $";
#include <pwd.h>
#include <grp.h>
#include <stdio.h>
-#include <ctype.h>
#include <string.h>
#include <strings.h>
#include <unistd.h>
@@ -134,7 +133,7 @@ usr_add(str)
return(-1);
if ((usrtb == NULL) &&
((usrtb = (USRT **)calloc(USR_TB_SZ, sizeof(USRT *))) == NULL)) {
- warn(1, "Unable to allocate memory for user selection table");
+ paxwarn(1, "Unable to allocate memory for user selection table");
return(-1);
}
@@ -148,7 +147,7 @@ usr_add(str)
if ((str[0] == '\\') && (str[1] == '#'))
++str;
if ((pw = getpwnam(str)) == NULL) {
- warn(1, "Unable to find uid for user: %s", str);
+ paxwarn(1, "Unable to find uid for user: %s", str);
return(-1);
}
uid = (uid_t)pw->pw_uid;
@@ -181,7 +180,7 @@ usr_add(str)
usrtb[indx] = pt;
return(0);
}
- warn(1, "User selection table out of memory");
+ paxwarn(1, "User selection table out of memory");
return(-1);
}
@@ -247,7 +246,7 @@ grp_add(str)
return(-1);
if ((grptb == NULL) &&
((grptb = (GRPT **)calloc(GRP_TB_SZ, sizeof(GRPT *))) == NULL)) {
- warn(1, "Unable to allocate memory fo group selection table");
+ paxwarn(1, "Unable to allocate memory fo group selection table");
return(-1);
}
@@ -261,7 +260,7 @@ grp_add(str)
if ((str[0] == '\\') && (str[1] == '#'))
++str;
if ((gr = getgrnam(str)) == NULL) {
- warn(1,"Cannot determine gid for group name: %s", str);
+ paxwarn(1,"Cannot determine gid for group name: %s", str);
return(-1);
}
gid = (gid_t)gr->gr_gid;
@@ -294,7 +293,7 @@ grp_add(str)
grptb[indx] = pt;
return(0);
}
- warn(1, "Group selection table out of memory");
+ paxwarn(1, "Group selection table out of memory");
return(-1);
}
@@ -380,7 +379,7 @@ trng_add(str)
* throw out the badly formed time ranges
*/
if ((str == NULL) || (*str == '\0')) {
- warn(1, "Empty time range string");
+ paxwarn(1, "Empty time range string");
return(-1);
}
@@ -407,7 +406,7 @@ trng_add(str)
++dot;
continue;
}
- warn(1, "Improperly specified time range: %s", str);
+ paxwarn(1, "Improperly specified time range: %s", str);
goto out;
}
@@ -415,7 +414,7 @@ trng_add(str)
* allocate space for the time range and store the limits
*/
if ((pt = (TIME_RNG *)malloc(sizeof(TIME_RNG))) == NULL) {
- warn(1, "Unable to allocate memory for time range");
+ paxwarn(1, "Unable to allocate memory for time range");
return(-1);
}
@@ -438,7 +437,7 @@ trng_add(str)
pt->flgs |= CMPCTME;
break;
default:
- warn(1, "Bad option %c with time range %s",
+ paxwarn(1, "Bad option %c with time range %s",
*flgpt, str);
goto out;
}
@@ -455,7 +454,7 @@ trng_add(str)
* add lower limit
*/
if (str_sec(str, &(pt->low_time)) < 0) {
- warn(1, "Illegal lower time range %s", str);
+ paxwarn(1, "Illegal lower time range %s", str);
(void)free((char *)pt);
goto out;
}
@@ -467,7 +466,7 @@ trng_add(str)
* add upper limit
*/
if (str_sec(up_pt, &(pt->high_time)) < 0) {
- warn(1, "Illegal upper time range %s", up_pt);
+ paxwarn(1, "Illegal upper time range %s", up_pt);
(void)free((char *)pt);
goto out;
}
@@ -478,7 +477,7 @@ trng_add(str)
*/
if (pt->flgs & HASLOW) {
if (pt->low_time > pt->high_time) {
- warn(1, "Upper %s and lower %s time overlap",
+ paxwarn(1, "Upper %s and lower %s time overlap",
up_pt, str);
(void)free((char *)pt);
return(-1);
@@ -496,7 +495,7 @@ trng_add(str)
return(0);
out:
- warn(1, "Time range format is: [yy[mm[dd[hh]]]]mm[.ss][/[c][m]]");
+ paxwarn(1, "Time range format is: [yy[mm[dd[hh]]]]mm[.ss][/[c][m]]");
return(-1);
}
diff --git a/bin/pax/tables.c b/bin/pax/tables.c
index 31ea537d6c7..18008a2bc16 100644
--- a/bin/pax/tables.c
+++ b/bin/pax/tables.c
@@ -51,7 +51,6 @@ static char rcsid[] = "$NetBSD: tables.c,v 1.4 1995/03/21 09:07:45 cgd Exp $";
#include <sys/param.h>
#include <sys/fcntl.h>
#include <stdio.h>
-#include <ctype.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
@@ -120,7 +119,7 @@ lnk_start()
if (ltab != NULL)
return(0);
if ((ltab = (HRDLNK **)calloc(L_TAB_SZ, sizeof(HRDLNK *))) == NULL) {
- warn(1, "Cannot allocate memory for hard link table");
+ paxwarn(1, "Cannot allocate memory for hard link table");
return(-1);
}
return(0);
@@ -219,7 +218,7 @@ chk_lnk(arcn)
(void)free((char *)pt);
}
- warn(1, "Hard link table out of memory");
+ paxwarn(1, "Hard link table out of memory");
return(-1);
}
@@ -368,7 +367,7 @@ ftime_start()
if (ftab != NULL)
return(0);
if ((ftab = (FTM **)calloc(F_TAB_SZ, sizeof(FTM *))) == NULL) {
- warn(1, "Cannot allocate memory for file time table");
+ paxwarn(1, "Cannot allocate memory for file time table");
return(-1);
}
@@ -500,7 +499,7 @@ chk_ftime(arcn)
} else
syswarn(1, errno, "Failed seek on file time table");
} else
- warn(1, "File time table ran out of memory");
+ paxwarn(1, "File time table ran out of memory");
if (pt != NULL)
(void)free((char *)pt);
@@ -537,7 +536,7 @@ name_start()
if (ntab != NULL)
return(0);
if ((ntab = (NAMT **)calloc(N_TAB_SZ, sizeof(NAMT *))) == NULL) {
- warn(1, "Cannot allocate memory for interactive rename table");
+ paxwarn(1, "Cannot allocate memory for interactive rename table");
return(-1);
}
return(0);
@@ -570,7 +569,7 @@ add_name(oname, onamelen, nname)
/*
* should never happen
*/
- warn(0, "No interactive rename table, links may fail\n");
+ paxwarn(0, "No interactive rename table, links may fail\n");
return(0);
}
@@ -596,7 +595,7 @@ add_name(oname, onamelen, nname)
(void)free((char *)pt->nname);
if ((pt->nname = strdup(nname)) == NULL) {
- warn(1, "Cannot update rename table");
+ paxwarn(1, "Cannot update rename table");
return(-1);
}
return(0);
@@ -617,7 +616,7 @@ add_name(oname, onamelen, nname)
}
(void)free((char *)pt);
}
- warn(1, "Interactive rename table out of memory");
+ paxwarn(1, "Interactive rename table out of memory");
return(-1);
}
@@ -729,7 +728,7 @@ dev_start()
if (dtab != NULL)
return(0);
if ((dtab = (DEVT **)calloc(D_TAB_SZ, sizeof(DEVT *))) == NULL) {
- warn(1, "Cannot allocate memory for device mapping table");
+ paxwarn(1, "Cannot allocate memory for device mapping table");
return(-1);
}
return(0);
@@ -815,7 +814,7 @@ chk_dev(dev, add)
* list must be NULL.
*/
if ((pt = (DEVT *)malloc(sizeof(DEVT))) == NULL) {
- warn(1, "Device map table out of memory");
+ paxwarn(1, "Device map table out of memory");
return(NULL);
}
pt->dev = dev;
@@ -957,9 +956,9 @@ map_dev(arcn, dev_mask, ino_mask)
return(0);
bad:
- warn(1, "Unable to fix truncated inode/device field when storing %s",
+ paxwarn(1, "Unable to fix truncated inode/device field when storing %s",
arcn->name);
- warn(0, "Archive may create improper hard links when extracted");
+ paxwarn(0, "Archive may create improper hard links when extracted");
return(0);
}
@@ -998,7 +997,7 @@ atdir_start()
if (atab != NULL)
return(0);
if ((atab = (ATDIR **)calloc(A_TAB_SZ, sizeof(ATDIR *))) == NULL) {
- warn(1,"Cannot allocate space for directory access time table");
+ paxwarn(1,"Cannot allocate space for directory access time table");
return(-1);
}
return(0);
@@ -1105,7 +1104,7 @@ add_atdir(fname, dev, ino, mtime, atime)
(void)free((char *)pt);
}
- warn(1, "Directory access time reset table ran out of memory");
+ paxwarn(1, "Directory access time reset table ran out of memory");
return;
}
@@ -1227,7 +1226,7 @@ dir_start()
(void)unlink(pt);
return(0);
}
- warn(1, "Unable to create temporary file for directory times: %s", pt);
+ paxwarn(1, "Unable to create temporary file for directory times: %s", pt);
return(-1);
}
@@ -1266,7 +1265,7 @@ add_dir(name, nlen, psb, frc_mode)
* in the trailer
*/
if ((dblk.npos = lseek(dirfd, 0L, SEEK_CUR)) < 0) {
- warn(1,"Unable to store mode and times for directory: %s",name);
+ paxwarn(1,"Unable to store mode and times for directory: %s",name);
return;
}
@@ -1284,7 +1283,7 @@ add_dir(name, nlen, psb, frc_mode)
return;
}
- warn(1,"Unable to store mode and times for created directory: %s",name);
+ paxwarn(1,"Unable to store mode and times for created directory: %s",name);
return;
}
@@ -1340,7 +1339,7 @@ proc_dir()
(void)close(dirfd);
dirfd = -1;
if (cnt != dircnt)
- warn(1,"Unable to set mode and times for created directories");
+ paxwarn(1,"Unable to set mode and times for created directories");
return;
}
diff --git a/bin/pax/tar.c b/bin/pax/tar.c
index 3c4597819e4..46a800ae2a9 100644
--- a/bin/pax/tar.c
+++ b/bin/pax/tar.c
@@ -51,7 +51,6 @@ static char rcsid[] = "$NetBSD: tar.c,v 1.5 1995/03/21 09:07:49 cgd Exp $";
#include <sys/param.h>
#include <string.h>
#include <stdio.h>
-#include <ctype.h>
#include <unistd.h>
#include <stdlib.h>
#include "pax.h"
@@ -402,9 +401,9 @@ tar_opt()
while ((opt = opt_next()) != NULL) {
if (strcmp(opt->name, TAR_OPTION) ||
strcmp(opt->value, TAR_NODIR)) {
- warn(1, "Unknown tar format -o option/value pair %s=%s",
+ paxwarn(1, "Unknown tar format -o option/value pair %s=%s",
opt->name, opt->value);
- warn(1,"%s=%s is the only supported tar format option",
+ paxwarn(1,"%s=%s is the only supported tar format option",
TAR_OPTION, TAR_NODIR);
return(-1);
}
@@ -413,7 +412,7 @@ tar_opt()
* we only support one option, and only when writing
*/
if ((act != APPND) && (act != ARCHIVE)) {
- warn(1, "%s=%s is only supported when writing.",
+ paxwarn(1, "%s=%s is only supported when writing.",
opt->name, opt->value);
return(-1);
}
@@ -579,23 +578,23 @@ tar_wr(arcn)
return(1);
break;
case PAX_CHR:
- warn(1, "Tar cannot archive a character device %s",
+ paxwarn(1, "Tar cannot archive a character device %s",
arcn->org_name);
return(1);
case PAX_BLK:
- warn(1, "Tar cannot archive a block device %s", arcn->org_name);
+ paxwarn(1, "Tar cannot archive a block device %s", arcn->org_name);
return(1);
case PAX_SCK:
- warn(1, "Tar cannot archive a socket %s", arcn->org_name);
+ paxwarn(1, "Tar cannot archive a socket %s", arcn->org_name);
return(1);
case PAX_FIF:
- warn(1, "Tar cannot archive a fifo %s", arcn->org_name);
+ paxwarn(1, "Tar cannot archive a fifo %s", arcn->org_name);
return(1);
case PAX_SLK:
case PAX_HLK:
case PAX_HRG:
if (arcn->ln_nlen > sizeof(hd->linkname)) {
- warn(1,"Link name too long for tar %s", arcn->ln_name);
+ paxwarn(1,"Link name too long for tar %s", arcn->ln_name);
return(1);
}
break;
@@ -612,7 +611,7 @@ tar_wr(arcn)
if (arcn->type == PAX_DIR)
++len;
if (len > sizeof(hd->name)) {
- warn(1, "File name too long for tar %s", arcn->name);
+ paxwarn(1, "File name too long for tar %s", arcn->name);
return(1);
}
@@ -668,7 +667,7 @@ tar_wr(arcn)
if (uqd_oct((u_quad_t)arcn->sb.st_size, hd->size,
sizeof(hd->size), 1)) {
# endif
- warn(1,"File is too large for tar %s", arcn->org_name);
+ paxwarn(1,"File is too large for tar %s", arcn->org_name);
return(1);
}
arcn->pad = TAR_PAD(arcn->sb.st_size);
@@ -703,7 +702,7 @@ tar_wr(arcn)
/*
* header field is out of range
*/
- warn(1, "Tar header field is too small for %s", arcn->org_name);
+ paxwarn(1, "Tar header field is too small for %s", arcn->org_name);
return(1);
}
@@ -973,7 +972,7 @@ ustar_wr(arcn)
* check for those file system types ustar cannot store
*/
if (arcn->type == PAX_SCK) {
- warn(1, "Ustar cannot archive a socket %s", arcn->org_name);
+ paxwarn(1, "Ustar cannot archive a socket %s", arcn->org_name);
return(1);
}
@@ -982,7 +981,7 @@ ustar_wr(arcn)
*/
if (((arcn->type == PAX_SLK) || (arcn->type == PAX_HLK) ||
(arcn->type == PAX_HRG)) && (arcn->ln_nlen > sizeof(hd->linkname))){
- warn(1, "Link name too long for ustar %s", arcn->ln_name);
+ paxwarn(1, "Link name too long for ustar %s", arcn->ln_name);
return(1);
}
@@ -991,7 +990,7 @@ ustar_wr(arcn)
* pt != arcn->name, the name has to be split
*/
if ((pt = name_split(arcn->name, arcn->nlen)) == NULL) {
- warn(1, "File name too long for ustar %s", arcn->name);
+ paxwarn(1, "File name too long for ustar %s", arcn->name);
return(1);
}
hd = (HD_USTAR *)hdblk;
@@ -1085,7 +1084,7 @@ ustar_wr(arcn)
if (uqd_oct((u_quad_t)arcn->sb.st_size, hd->size,
sizeof(hd->size), 3)) {
# endif
- warn(1,"File is too long for ustar %s",arcn->org_name);
+ paxwarn(1,"File is too long for ustar %s",arcn->org_name);
return(1);
}
break;
@@ -1126,7 +1125,7 @@ ustar_wr(arcn)
/*
* header field is out of range
*/
- warn(1, "Ustar header field is too small for %s", arcn->org_name);
+ paxwarn(1, "Ustar header field is too small for %s", arcn->org_name);
return(1);
}
diff --git a/bin/pax/tty_subs.c b/bin/pax/tty_subs.c
index e370a56a4df..865558dd11c 100644
--- a/bin/pax/tty_subs.c
+++ b/bin/pax/tty_subs.c
@@ -51,7 +51,6 @@ static char rcsid[] = "$NetBSD: tty_subs.c,v 1.5 1995/03/21 09:07:52 cgd Exp $";
#include <sys/param.h>
#include <fcntl.h>
#include <stdio.h>
-#include <ctype.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
@@ -98,7 +97,7 @@ tty_init()
}
if (iflag) {
- warn(1, "Fatal error, cannot open %s", DEVTTY);
+ paxwarn(1, "Fatal error, cannot open %s", DEVTTY);
return(-1);
}
return(0);
@@ -166,17 +165,17 @@ tty_read(str, len)
}
/*
- * warn()
+ * paxwarn()
* write a warning message to stderr. if "set" the exit value of pax
* will be non-zero.
*/
#if __STDC__
void
-warn(int set, char *fmt, ...)
+paxwarn(int set, char *fmt, ...)
#else
void
-warn(set, fmt, va_alist)
+paxwarn(set, fmt, va_alist)
int set;
char *fmt;
va_dcl