summaryrefslogtreecommitdiffstats
path: root/bin/pax/cpio.c
diff options
context:
space:
mode:
authorkris <kris@FreeBSD.org>2001-04-26 08:37:00 +0000
committerkris <kris@FreeBSD.org>2001-04-26 08:37:00 +0000
commitb146fa78f3320e3f8c5e0b0b79af2c4379535ddf (patch)
tree96b72fbcb458a825fab88ea86f82db96ce1ddd6a /bin/pax/cpio.c
parentb4108a06977f82330a90556ab13b966e612c07bd (diff)
downloadFreeBSD-src-b146fa78f3320e3f8c5e0b0b79af2c4379535ddf.zip
FreeBSD-src-b146fa78f3320e3f8c5e0b0b79af2c4379535ddf.tar.gz
Reduce diffs with OpenBSD:
#if __STDC__ -> #ifdef __STDC__ pax_warn() -> paxwarn() sys_warn() -> syswarn() (foo *)NULL -> NULL bcopy -> memmove()/memcpy() bzero -> memset() Typo fixes sprintf() -> snprintf() rindex() -> strrchr() index() -> strchr() sys_errlist[] -> strerror() Obtained from: OpenBSD
Diffstat (limited to 'bin/pax/cpio.c')
-rw-r--r--bin/pax/cpio.c82
1 files changed, 41 insertions, 41 deletions
diff --git a/bin/pax/cpio.c b/bin/pax/cpio.c
index 626a77d..d6ad17d 100644
--- a/bin/pax/cpio.c
+++ b/bin/pax/cpio.c
@@ -75,7 +75,7 @@ static int swp_head; /* binary cpio header byte swap */
* 0 if ok -1 otherwise (the return values of lnk_start())
*/
-#if __STDC__
+#ifdef __STDC__
int
cpio_strd(void)
#else
@@ -96,7 +96,7 @@ cpio_strd()
* 0 if a valid trailer, -1 if not a valid trailer,
*/
-#if __STDC__
+#ifdef __STDC__
int
cpio_trail(register ARCHD *arcn)
#else
@@ -120,7 +120,7 @@ cpio_trail(arcn)
* 0
*/
-#if __STDC__
+#ifdef __STDC__
static int
com_rd(register ARCHD *arcn)
#else
@@ -175,7 +175,7 @@ com_rd(arcn)
* result of the write of the trailer from the cpio specific write func
*/
-#if __STDC__
+#ifdef __STDC__
int
cpio_endwr(void)
#else
@@ -188,7 +188,7 @@ cpio_endwr()
/*
* create a trailer request and call the proper format write function
*/
- bzero((char *)&last, sizeof(last));
+ memset(&last, 0, sizeof(last));
last.nlen = sizeof(TRAILER) - 1;
last.type = PAX_REG;
last.sb.st_nlink = 1;
@@ -203,7 +203,7 @@ cpio_endwr()
* 0 if ok, -1 otherwise
*/
-#if __STDC__
+#ifdef __STDC__
static int
rd_nm(register ARCHD *arcn, int nsz)
#else
@@ -217,7 +217,7 @@ rd_nm(arcn, nsz)
* do not even try bogus values
*/
if ((nsz == 0) || (nsz > sizeof(arcn->name))) {
- pax_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);
}
@@ -226,7 +226,7 @@ rd_nm(arcn, nsz)
*/
if ((rd_wrbuf(arcn->name,nsz) != nsz) || (arcn->name[nsz-1] != '\0') ||
(arcn->name[0] == '\0')) {
- pax_warn(1, "Cpio file name in header is corrupted");
+ paxwarn(1, "Cpio file name in header is corrupted");
return(-1);
}
return(0);
@@ -240,7 +240,7 @@ rd_nm(arcn, nsz)
* 0 if ok, -1 otherwise
*/
-#if __STDC__
+#ifdef __STDC__
static int
rd_ln_nm(register ARCHD *arcn)
#else
@@ -255,10 +255,10 @@ rd_ln_nm(arcn)
if ((arcn->sb.st_size == 0) ||
(arcn->sb.st_size >= sizeof(arcn->ln_name))) {
# ifdef NET2_STAT
- pax_warn(1, "Cpio link name length is invalid: %lu",
+ paxwarn(1, "Cpio link name length is invalid: %lu",
arcn->sb.st_size);
# else
- pax_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);
@@ -269,7 +269,7 @@ rd_ln_nm(arcn)
*/
if (rd_wrbuf(arcn->ln_name, (int)arcn->sb.st_size) !=
(int)arcn->sb.st_size) {
- pax_warn(1, "Cpio link name read error");
+ paxwarn(1, "Cpio link name read error");
return(-1);
}
arcn->ln_nlen = arcn->sb.st_size;
@@ -279,7 +279,7 @@ rd_ln_nm(arcn)
* watch out for those empty link names
*/
if (arcn->ln_name[0] == '\0') {
- pax_warn(1, "Cpio link name is corrupt");
+ paxwarn(1, "Cpio link name is corrupt");
return(-1);
}
return(0);
@@ -297,7 +297,7 @@ rd_ln_nm(arcn)
* 0 if a valid header, -1 otherwise
*/
-#if __STDC__
+#ifdef __STDC__
int
cpio_id(char *blk, int size)
#else
@@ -321,7 +321,7 @@ cpio_id(blk, size)
* 0 if a valid header, -1 otherwise.
*/
-#if __STDC__
+#ifdef __STDC__
int
cpio_rd(register ARCHD *arcn, register char *buf)
#else
@@ -404,7 +404,7 @@ cpio_rd(arcn, buf)
* size of trailer header in this format
*/
-#if __STDC__
+#ifdef __STDC__
off_t
cpio_endrd(void)
#else
@@ -422,7 +422,7 @@ cpio_endrd()
* 0 if ok, -1 otherwise (what dev_start() returns)
*/
-#if __STDC__
+#ifdef __STDC__
int
cpio_stwr(void)
#else
@@ -442,7 +442,7 @@ cpio_stwr()
* data to write after the header, -1 if archive write failed
*/
-#if __STDC__
+#ifdef __STDC__
int
cpio_wr(register ARCHD *arcn)
#else
@@ -481,7 +481,7 @@ cpio_wr(arcn)
if (uqd_asc((u_quad_t)arcn->sb.st_size, hd->c_filesize,
sizeof(hd->c_filesize), OCT)) {
# endif
- pax_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);
}
@@ -532,7 +532,7 @@ cpio_wr(arcn)
*/
if ((wr_rdbuf(hdblk, (int)sizeof(HD_CPIO)) < 0) ||
(wr_rdbuf(arcn->name, nsz) < 0)) {
- pax_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);
}
@@ -551,7 +551,7 @@ cpio_wr(arcn)
* next file as we are done.
*/
if (wr_rdbuf(arcn->ln_name, arcn->ln_nlen) < 0) {
- pax_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);
@@ -560,7 +560,7 @@ cpio_wr(arcn)
/*
* header field is out of range
*/
- pax_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);
}
@@ -578,7 +578,7 @@ cpio_wr(arcn)
* 0 if a valid header, -1 otherwise
*/
-#if __STDC__
+#ifdef __STDC__
int
vcpio_id(char *blk, int size)
#else
@@ -602,7 +602,7 @@ vcpio_id(blk, size)
* 0 if a valid header, -1 otherwise
*/
-#if __STDC__
+#ifdef __STDC__
int
crc_id(char *blk, int size)
#else
@@ -625,7 +625,7 @@ crc_id(blk, size)
* 0 if ok -1 otherwise (the return values of lnk_start())
*/
-#if __STDC__
+#ifdef __STDC__
int
crc_strd(void)
#else
@@ -645,7 +645,7 @@ crc_strd()
* 0 if a valid header, -1 otherwise.
*/
-#if __STDC__
+#ifdef __STDC__
int
vcpio_rd(register ARCHD *arcn, register char *buf)
#else
@@ -751,7 +751,7 @@ vcpio_rd(arcn, buf)
* size of trailer header in this format
*/
-#if __STDC__
+#ifdef __STDC__
off_t
vcpio_endrd(void)
#else
@@ -770,7 +770,7 @@ vcpio_endrd()
* 0 if ok, -1 otherwise (what dev_start() returns)
*/
-#if __STDC__
+#ifdef __STDC__
int
crc_stwr(void)
#else
@@ -791,7 +791,7 @@ crc_stwr()
* NO data to write after the header, -1 if archive write failed
*/
-#if __STDC__
+#ifdef __STDC__
int
vcpio_wr(register ARCHD *arcn)
#else
@@ -848,7 +848,7 @@ vcpio_wr(arcn)
if (uqd_asc((u_quad_t)arcn->sb.st_size, hd->c_filesize,
sizeof(hd->c_filesize), HEX)) {
# endif
- pax_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);
}
@@ -906,7 +906,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)) {
- pax_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);
}
@@ -928,7 +928,7 @@ vcpio_wr(arcn)
*/
if ((wr_rdbuf(arcn->ln_name, arcn->ln_nlen) < 0) ||
(wr_skip((off_t)(VCPIO_PAD(arcn->ln_nlen))) < 0)) {
- pax_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);
}
@@ -938,7 +938,7 @@ vcpio_wr(arcn)
/*
* header field is out of range
*/
- pax_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);
}
@@ -954,7 +954,7 @@ vcpio_wr(arcn)
* 0 if a valid header, -1 otherwise
*/
-#if __STDC__
+#ifdef __STDC__
int
bcpio_id(char *blk, int size)
#else
@@ -989,7 +989,7 @@ bcpio_id(blk, size)
* 0 if a valid header, -1 otherwise.
*/
-#if __STDC__
+#ifdef __STDC__
int
bcpio_rd(register ARCHD *arcn, register char *buf)
#else
@@ -1093,7 +1093,7 @@ bcpio_rd(arcn, buf)
* size of trailer header in this format
*/
-#if __STDC__
+#ifdef __STDC__
off_t
bcpio_endrd(void)
#else
@@ -1116,7 +1116,7 @@ bcpio_endrd()
* data to write after the header, -1 if archive write failed
*/
-#if __STDC__
+#ifdef __STDC__
int
bcpio_wr(register ARCHD *arcn)
#else
@@ -1159,7 +1159,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) {
- pax_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);
}
@@ -1244,7 +1244,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)) {
- pax_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);
}
@@ -1266,7 +1266,7 @@ bcpio_wr(arcn)
*/
if ((wr_rdbuf(arcn->ln_name, arcn->ln_nlen) < 0) ||
(wr_skip((off_t)(BCPIO_PAD(arcn->ln_nlen))) < 0)) {
- pax_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);
@@ -1275,6 +1275,6 @@ bcpio_wr(arcn)
/*
* header field is out of range
*/
- pax_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);
}
OpenPOWER on IntegriCloud