diff options
author | rillig <rillig@pkgsrc.org> | 2007-03-08 17:18:18 +0000 |
---|---|---|
committer | rillig <rillig@pkgsrc.org> | 2007-03-08 17:18:18 +0000 |
commit | adc5a5668f82b008a520224f12cf333146c98b8c (patch) | |
tree | 0ea276d3776872ac7a982d1304b3929322a50bfd /archivers | |
parent | 2f6b409362d5c9c002de03d415ebbfcd31873ead (diff) | |
download | pkgsrc-adc5a5668f82b008a520224f12cf333146c98b8c.tar.gz |
Removed extra parentheses around simple return statements, to align with
the current NetBSD version.
Diffstat (limited to 'archivers')
-rw-r--r-- | archivers/pax/files/ar_io.c | 94 | ||||
-rw-r--r-- | archivers/pax/files/ar_subs.c | 28 | ||||
-rw-r--r-- | archivers/pax/files/buf_subs.c | 82 | ||||
-rw-r--r-- | archivers/pax/files/cpio.c | 124 | ||||
-rw-r--r-- | archivers/pax/files/file_subs.c | 72 | ||||
-rw-r--r-- | archivers/pax/files/ftree.c | 40 | ||||
-rw-r--r-- | archivers/pax/files/gen_subs.c | 12 | ||||
-rw-r--r-- | archivers/pax/files/options.c | 38 | ||||
-rw-r--r-- | archivers/pax/files/pat_rep.c | 92 | ||||
-rw-r--r-- | archivers/pax/files/pax.c | 14 | ||||
-rw-r--r-- | archivers/pax/files/sel_subs.c | 66 | ||||
-rw-r--r-- | archivers/pax/files/tables.c | 100 | ||||
-rw-r--r-- | archivers/pax/files/tar.c | 102 | ||||
-rw-r--r-- | archivers/pax/files/tty_subs.c | 14 |
14 files changed, 439 insertions, 439 deletions
diff --git a/archivers/pax/files/ar_io.c b/archivers/pax/files/ar_io.c index a2cec3c61b4..127ed2a1a10 100644 --- a/archivers/pax/files/ar_io.c +++ b/archivers/pax/files/ar_io.c @@ -1,4 +1,4 @@ -/* $NetBSD: ar_io.c,v 1.9 2005/12/01 03:00:01 minskim Exp $ */ +/* $NetBSD: ar_io.c,v 1.10 2007/03/08 17:18:18 rillig Exp $ */ /*- * Copyright (c) 1992 Keith Muller. @@ -48,7 +48,7 @@ #if 0 static char sccsid[] = "@(#)ar_io.c 8.2 (Berkeley) 4/18/94"; #else -__RCSID("$NetBSD: ar_io.c,v 1.9 2005/12/01 03:00:01 minskim Exp $"); +__RCSID("$NetBSD: ar_io.c,v 1.10 2007/03/08 17:18:18 rillig Exp $"); #endif #endif /* not lint */ @@ -232,14 +232,14 @@ ar_open(const char *name) */ arcname = NONE; lstrval = 1; - return(0); + return 0; } if (arfd < 0) - return(-1); + return -1; if (chdname != NULL) if (dochdir(chdname) == -1) - return(-1); + return -1; /* * set up is based on device type */ @@ -248,7 +248,7 @@ ar_open(const char *name) (void)close(arfd); arfd = -1; can_unlnk = 0; - return(-1); + return -1; } if (S_ISDIR(arsb.st_mode)) { tty_warn(0, "Cannot write an archive on top of a directory %s", @@ -256,7 +256,7 @@ ar_open(const char *name) (void)close(arfd); arfd = -1; can_unlnk = 0; - return(-1); + return -1; } if (S_ISCHR(arsb.st_mode)) { @@ -302,7 +302,7 @@ ar_open(const char *name) if (act == ARCHIVE) { blksz = rdblksz = wrblksz; lstrval = 1; - return(0); + return 0; } /* @@ -397,7 +397,7 @@ ar_open(const char *name) break; } lstrval = 1; - return(0); + return 0; } /* @@ -582,7 +582,7 @@ ar_set_wr(void) * Add any device dependent code as required here */ if (artyp != ISREG) - return(0); + return 0; /* * Ok we have an archive in a regular file. If we were rewriting a * file, we must get rid of all the stuff after the current offset @@ -591,9 +591,9 @@ ar_set_wr(void) if (((cpos = lseek(arfd, (off_t)0L, SEEK_CUR)) < 0) || (ftruncate(arfd, cpos) < 0)) { syswarn(1, errno, "Unable to truncate archive file"); - return(-1); + return -1; } - return(0); + return 0; } /* @@ -611,15 +611,15 @@ ar_app_ok(void) if (artyp == ISPIPE) { tty_warn(1, "Cannot append to an archive obtained from a pipe."); - return(-1); + return -1; } if (!invld_rec) - return(0); + return 0; tty_warn(1, "Cannot append, device record size %d does not support %s spec", rdblksz, argv0); - return(-1); + return -1; } #ifdef SYS_NO_RESTART @@ -934,7 +934,7 @@ ar_write(char *buf, int bsz) tty_warn(0, "Write failed, archive is write protected."); res = lstrval = 0; - return(0); + return 0; } /* * see if we reached the end of media, if so force a change to @@ -1011,11 +1011,11 @@ ar_rdsync(void) * we need to go to the next volume not try a resync */ if ((done > 0) || (lstrval == 0)) - return(-1); + return -1; if ((act == APPND) || (act == ARCHIVE)) { tty_warn(1, "Cannot allow updates to an archive with flaws."); - return(-1); + return -1; } if (io_ok) did_io = 1; @@ -1083,10 +1083,10 @@ ar_rdsync(void) } if (lstrval <= 0) { tty_warn(1, "Unable to recover from an archive read failure."); - return(-1); + return -1; } tty_warn(0, "Attempting to recover from an archive read failure."); - return(0); + return 0; } /* @@ -1107,7 +1107,7 @@ ar_fow(off_t sksz, off_t *skipped) *skipped = 0; if (sksz <= 0) - return(0); + return 0; /* * we cannot move forward at EOF or error @@ -1129,7 +1129,7 @@ ar_fow(off_t sksz, off_t *skipped) || artyp == ISRMT #endif /* SUPPORT_RMT */ ) - return(0); + return 0; /* * figure out where we are in the archive @@ -1146,15 +1146,15 @@ ar_fow(off_t sksz, off_t *skipped) mpos = arsb.st_size; if ((mpos = lseek(arfd, mpos, SEEK_SET)) >= 0) { *skipped = mpos - cpos; - return(0); + return 0; } } else { if (artyp != ISREG) - return(0); /* non-seekable device */ + return 0; /* non-seekable device */ } syswarn(1, errno, "Forward positioning operation on archive failed"); lstrval = -1; - return(-1); + return -1; } /* @@ -1192,7 +1192,7 @@ ar_rev(off_t sksz) */ tty_warn(1, "Reverse positioning on pipes is not supported."); lstrval = -1; - return(-1); + return -1; case ISREG: case ISBLK: case ISCHR: @@ -1211,7 +1211,7 @@ ar_rev(off_t sksz) syswarn(1, errno, "Unable to obtain current archive byte offset"); lstrval = -1; - return(-1); + return -1; } /* @@ -1229,14 +1229,14 @@ ar_rev(off_t sksz) tty_warn(1, "Reverse position on previous volume."); lstrval = -1; - return(-1); + return -1; } cpos = (off_t)0L; } if (lseek(arfd, cpos, SEEK_SET) < 0) { syswarn(1, errno, "Unable to seek archive backwards"); lstrval = -1; - return(-1); + return -1; } break; case ISTAPE: @@ -1253,7 +1253,7 @@ ar_rev(off_t sksz) */ if ((phyblk = get_phys()) <= 0) { lstrval = -1; - return(-1); + return -1; } /* @@ -1276,7 +1276,7 @@ ar_rev(off_t sksz) tty_warn(1, "Tape drive unable to backspace requested amount"); lstrval = -1; - return(-1); + return -1; } /* @@ -1294,7 +1294,7 @@ ar_rev(off_t sksz) syswarn(1, errno, "Unable to backspace tape %ld blocks.", (long) mb.mt_count); lstrval = -1; - return(-1); + return -1; } #else tty_warn(1, "System does not have tape support"); @@ -1302,7 +1302,7 @@ ar_rev(off_t sksz) break; } lstrval = 1; - return(0); + return 0; } #ifdef SUPPORT_TAPE @@ -1345,7 +1345,7 @@ get_phys(void) padsz += res; if (res < 0) { syswarn(1, errno, "Unable to locate tape filemark."); - return(-1); + return -1; } } @@ -1363,7 +1363,7 @@ get_phys(void) #endif /* SUPPORT_RMT */ < 0) { syswarn(1, errno, "Unable to backspace over tape filemark."); - return(-1); + return -1; } /* @@ -1380,7 +1380,7 @@ get_phys(void) #endif /* SUPPORT_RMT */ < 0) { syswarn(1, errno, "Unable to backspace over last tape block."); - return(-1); + return -1; } if ((phyblk = #ifdef SUPPORT_RMT @@ -1390,7 +1390,7 @@ get_phys(void) #endif /* SUPPORT_RMT */ ) <= 0) { syswarn(1, errno, "Cannot determine archive tape blocksize."); - return(-1); + return -1; } /* @@ -1407,7 +1407,7 @@ get_phys(void) ; if (res < 0) { syswarn(1, errno, "Unable to locate tape filemark."); - return(-1); + return -1; } mb.mt_op = MTBSF; mb.mt_count = 1; @@ -1419,7 +1419,7 @@ get_phys(void) #endif /* SUPPORT_RMT */ < 0) { syswarn(1, errno, "Unable to backspace over tape filemark."); - return(-1); + return -1; } /* @@ -1439,7 +1439,7 @@ get_phys(void) */ if (padsz % phyblk) { tty_warn(1, "Tape drive unable to backspace requested amount"); - return(-1); + return -1; } /* @@ -1458,7 +1458,7 @@ get_phys(void) syswarn(1, errno, "Unable to backspace tape over %ld pad blocks", (long)mb.mt_count); - return(-1); + return -1; } return(phyblk); } @@ -1493,7 +1493,7 @@ ar_next(void) syswarn(0, errno, "Unable to restore signal mask"); if (done || !wr_trail || force_one_volume) - return(-1); + return -1; if (!is_gnutar) tty_prnt("\nATTENTION! %s archive volume change required.\n", @@ -1539,7 +1539,7 @@ ar_next(void) lstrval = -1; tty_prnt("Quitting %s!\n", argv0); vfpart = 0; - return(-1); + return -1; } if ((buf[0] == '\0') || (buf[1] != '\0')) { @@ -1554,7 +1554,7 @@ ar_next(void) * we are to continue with the same device */ if (ar_open(arcname) >= 0) - return(0); + return 0; tty_prnt("Cannot re-open %s, try again\n", arcname); continue; @@ -1591,7 +1591,7 @@ ar_next(void) lstrval = -1; tty_prnt("Quitting %s!\n", argv0); vfpart = 0; - return(-1); + return -1; } if (buf[0] == '\0') { tty_prnt("Empty file name, try again\n"); @@ -1618,7 +1618,7 @@ ar_next(void) done = 1; lstrval = -1; tty_warn(0, "Cannot save archive name."); - return(-1); + return -1; } arcname = arcfree; break; @@ -1626,7 +1626,7 @@ ar_next(void) tty_prnt("Cannot open %s, try again\n", buf); continue; } - return(0); + return 0; } /* diff --git a/archivers/pax/files/ar_subs.c b/archivers/pax/files/ar_subs.c index 8d086311168..504b3049d51 100644 --- a/archivers/pax/files/ar_subs.c +++ b/archivers/pax/files/ar_subs.c @@ -1,4 +1,4 @@ -/* $NetBSD: ar_subs.c,v 1.10 2007/03/08 17:11:46 rillig Exp $ */ +/* $NetBSD: ar_subs.c,v 1.11 2007/03/08 17:18:18 rillig Exp $ */ /*- * Copyright (c) 1992 Keith Muller. @@ -48,7 +48,7 @@ #if 0 static char sccsid[] = "@(#)ar_subs.c 8.2 (Berkeley) 4/18/94"; #else -__RCSID("$NetBSD: ar_subs.c,v 1.10 2007/03/08 17:11:46 rillig Exp $"); +__RCSID("$NetBSD: ar_subs.c,v 1.11 2007/03/08 17:18:18 rillig Exp $"); #endif #endif /* not lint */ @@ -1219,7 +1219,7 @@ next_head(ARCHD *arcn) * them, so exit gracefully. */ if (first && ret == 0) - return(-1); + return -1; first = 0; /* @@ -1229,13 +1229,13 @@ next_head(ARCHD *arcn) if ((ret == 0) || (rd_sync() < 0)) { tty_warn(1, "Premature end of file on archive read"); - return(-1); + return -1; } if (!in_resync) { if (act == APPND) { tty_warn(1, "Archive I/O error, cannot continue"); - return(-1); + return -1; } tty_warn(1, "Archive I/O error. Trying to recover."); @@ -1273,7 +1273,7 @@ next_head(ARCHD *arcn) * valid trailer found, drain input as required */ ar_drain(); - return(-1); + return -1; } if (ret == 1) { @@ -1301,7 +1301,7 @@ next_head(ARCHD *arcn) if (act == APPND) { tty_warn(1, "Unable to append, archive header flaw"); - return(-1); + return -1; } tty_warn(1, "Invalid header, starting valid header search."); @@ -1322,11 +1322,11 @@ next_head(ARCHD *arcn) * valid trailer found, drain input as required */ ar_drain(); - return(-1); + return -1; } ++flcnt; - return(0); + return 0; } /* @@ -1358,7 +1358,7 @@ get_arc(void) minhd = fsub[ford[i]].hsz; } if (rd_start() < 0) - return(-1); + return -1; res = BLKMULT; hdsz = 0; hdend = hdbuf; @@ -1390,7 +1390,7 @@ get_arc(void) hdend = hdbuf; if (!notice) { if (act == APPND) - return(-1); + return -1; tty_warn(1, "Cannot identify format. Searching..."); ++notice; @@ -1417,7 +1417,7 @@ get_arc(void) * adding all the special case code is far worse. */ pback(hdbuf, hdsz); - return(0); + return 0; } /* @@ -1426,7 +1426,7 @@ get_arc(void) */ if (!notice) { if (act == APPND) - return(-1); + return -1; tty_warn(1, "Cannot identify format. Searching..."); ++notice; } @@ -1453,5 +1453,5 @@ get_arc(void) * we cannot find a header, bow, apologize and quit */ tty_warn(1, "Sorry, unable to determine archive format."); - return(-1); + return -1; } diff --git a/archivers/pax/files/buf_subs.c b/archivers/pax/files/buf_subs.c index 5816491d974..49ef3bfc69f 100644 --- a/archivers/pax/files/buf_subs.c +++ b/archivers/pax/files/buf_subs.c @@ -1,4 +1,4 @@ -/* $NetBSD: buf_subs.c,v 1.6 2005/12/01 03:00:01 minskim Exp $ */ +/* $NetBSD: buf_subs.c,v 1.7 2007/03/08 17:18:18 rillig Exp $ */ /*- * Copyright (c) 1992 Keith Muller. @@ -48,7 +48,7 @@ #if 0 static char sccsid[] = "@(#)buf_subs.c 8.2 (Berkeley) 4/18/94"; #else -__RCSID("$NetBSD: buf_subs.c,v 1.6 2005/12/01 03:00:01 minskim Exp $"); +__RCSID("$NetBSD: buf_subs.c,v 1.7 2007/03/08 17:18:18 rillig Exp $"); #endif #endif /* not lint */ @@ -132,12 +132,12 @@ wr_start(void) if (wrblksz > MAXBLK) { tty_warn(1, "Write block size of %d too large, maximum is: %d", wrblksz, MAXBLK); - return(-1); + return -1; } if (wrblksz % BLKMULT) { tty_warn(1, "Write block size of %d is not a %d byte multiple", wrblksz, BLKMULT); - return(-1); + return -1; } /* @@ -145,11 +145,11 @@ wr_start(void) */ blksz = rdblksz = wrblksz; if ((ar_open(arcname) < 0) && (ar_next() < 0)) - return(-1); + return -1; wrcnt = 0; bufend = buf + wrblksz; bufpt = buf; - return(0); + return 0; } /* @@ -173,13 +173,13 @@ rd_start(void) tty_warn(1, "Write block size %d too large, maximum is: %d", wrblksz, MAXBLK); - return(-1); + return -1; } if (wrblksz % BLKMULT) { tty_warn(1, "Write block size %d is not a %d byte multiple", wrblksz, BLKMULT); - return(-1); + return -1; } } @@ -187,11 +187,11 @@ rd_start(void) * open the archive */ if ((ar_open(arcname) < 0) && (ar_next() < 0)) - return(-1); + return -1; bufend = buf + rdblksz; bufpt = bufend; rdcnt = 0; - return(0); + return 0; } /* @@ -246,7 +246,7 @@ appnd_start(off_t skcnt) if (exit_val != 0) { tty_warn(0, "Cannot append to an archive that may have flaws."); - return(-1); + return -1; } /* * if the user did not specify a write blocksize, inherit the size used @@ -262,7 +262,7 @@ appnd_start(off_t skcnt) * make sure that this volume allows appends */ if (ar_app_ok() < 0) - return(-1); + return -1; /* * Calculate bytes to move back and move in front of record where we @@ -317,13 +317,13 @@ appnd_start(off_t skcnt) * ARCHIVE mode (write) conditions */ if (ar_set_wr() < 0) - return(-1); + return -1; act = ARCHIVE; - return(0); + return 0; out: tty_warn(1, "Unable to rewrite archive trailer, cannot append."); - return(-1); + return -1; } /* @@ -347,11 +347,11 @@ rd_sync(void) * if the user says bail out on first fault, we are out of here... */ if (maxflt == 0) - return(-1); + return -1; if (act == APPND) { tty_warn(1, "Unable to append when there are archive read errors."); - return(-1); + return -1; } /* @@ -359,7 +359,7 @@ rd_sync(void) */ if (ar_rdsync() < 0) { if (ar_next() < 0) - return(-1); + return -1; else rdcnt = 0; } @@ -372,7 +372,7 @@ rd_sync(void) bufpt = buf; bufend = buf + res; rdcnt += res; - return(0); + return 0; } /* @@ -393,7 +393,7 @@ rd_sync(void) rdcnt = 0; errcnt = 0; } - return(-1); + return -1; } /* @@ -437,7 +437,7 @@ rd_skip(off_t skcnt) * do not want. */ if (skcnt == 0) - return(0); + return 0; res = MIN((bufend - bufpt), skcnt); bufpt += res; skcnt -= res; @@ -446,7 +446,7 @@ rd_skip(off_t skcnt) * if skcnt is now 0, then no additional i/o is needed */ if (skcnt == 0) - return(0); + return 0; /* * We have to read more, calculate complete and partial record reads @@ -460,7 +460,7 @@ rd_skip(off_t skcnt) * how much it can skip over. We will have to read the rest. */ if (ar_fow(cnt, &skipped) < 0) - return(-1); + return -1; res += cnt - skipped; rdcnt += skipped; @@ -474,14 +474,14 @@ rd_skip(off_t skcnt) * if the read fails, we will have to resync */ if ((cnt <= 0) && ((cnt = buf_fill()) < 0)) - return(-1); + return -1; if (cnt == 0) - return(1); + return 1; cnt = MIN(cnt, res); bufpt += cnt; res -= cnt; } - return(0); + return 0; } /* @@ -525,7 +525,7 @@ wr_rdbuf(char *out, int outcnt) while (outcnt > 0) { cnt = bufend - bufpt; if ((cnt <= 0) && ((cnt = buf_flush(blksz)) < 0)) - return(-1); + return -1; /* * only move what we have space for */ @@ -535,7 +535,7 @@ wr_rdbuf(char *out, int outcnt) out += cnt; outcnt -= cnt; } - return(0); + return 0; } /* @@ -608,13 +608,13 @@ wr_skip(off_t skcnt) while (skcnt > 0L) { cnt = bufend - bufpt; if ((cnt <= 0) && ((cnt = buf_flush(blksz)) < 0)) - return(-1); + return -1; cnt = MIN(cnt, skcnt); memset(bufpt, 0, cnt); bufpt += cnt; skcnt -= cnt; } - return(0); + return 0; } /* @@ -659,7 +659,7 @@ wr_rdfile(ARCHD *arcn, int ifd, off_t *left) cnt = bufend - bufpt; if ((cnt <= 0) && ((cnt = buf_flush(blksz)) < 0)) { *left = size; - return(-1); + return -1; } cnt = MIN(cnt, size); if ((res = read_with_restart(ifd, bufpt, cnt)) <= 0) @@ -682,7 +682,7 @@ wr_rdfile(ARCHD *arcn, int ifd, off_t *left) tty_warn(1, "File %s was modified during copy to archive", arcn->org_name); *left = size; - return(0); + return 0; } /* @@ -778,7 +778,7 @@ rd_wrfile(ARCHD *arcn, int ofd, off_t *left) * if we failed from archive read, we do not want to skip */ if ((size > 0L) && (*left == 0L)) - return(-1); + return -1; /* * some formats record a crc on file data. If so, then we compare the @@ -787,7 +787,7 @@ rd_wrfile(ARCHD *arcn, int ofd, off_t *left) if (docrc && (size == 0L) && (arcn->crc != crc)) tty_warn(1,"Actual crc does not match expected crc %s", arcn->name); - return(0); + return 0; } /* @@ -895,7 +895,7 @@ buf_fill(void) static int fini = 0; if (fini) - return(0); + return 0; for(;;) { /* @@ -919,12 +919,12 @@ buf_fill(void) break; if (frmt == NULL || ar_next() < 0) { fini = 1; - return(0); + return 0; } rdcnt = 0; } exit_val = 1; - return(-1); + return -1; } /* @@ -955,7 +955,7 @@ buf_flush(int bufcnt) if (ar_next() < 0) { wrcnt = 0; exit_val = 1; - return(-1); + return -1; } wrcnt = 0; @@ -970,7 +970,7 @@ buf_flush(int bufcnt) */ bufend = buf + blksz; if (blksz > bufcnt) - return(0); + return 0; if (blksz < bufcnt) push = bufcnt - blksz; } @@ -1035,7 +1035,7 @@ buf_flush(int bufcnt) */ bufend = buf + blksz; if (blksz > bufcnt) - return(0); + return 0; if (blksz < bufcnt) push = bufcnt - blksz; } @@ -1044,5 +1044,5 @@ buf_flush(int bufcnt) * write failed, stop pax. we must not create a bad archive! */ exit_val = 1; - return(-1); + return -1; } diff --git a/archivers/pax/files/cpio.c b/archivers/pax/files/cpio.c index 53c546739fa..0709847bb5d 100644 --- a/archivers/pax/files/cpio.c +++ b/archivers/pax/files/cpio.c @@ -1,4 +1,4 @@ -/* $NetBSD: cpio.c,v 1.5 2005/12/01 03:00:01 minskim Exp $ */ +/* $NetBSD: cpio.c,v 1.6 2007/03/08 17:18:18 rillig Exp $ */ /*- * Copyright (c) 1992 Keith Muller. @@ -48,7 +48,7 @@ #if 0 static char sccsid[] = "@(#)cpio.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: cpio.c,v 1.5 2005/12/01 03:00:01 minskim Exp $"); +__RCSID("$NetBSD: cpio.c,v 1.6 2007/03/08 17:18:18 rillig Exp $"); #endif #endif /* not lint */ @@ -127,8 +127,8 @@ cpio_subtrail(ARCHD *arcn) * look for trailer id in file we are about to process */ if ((strcmp(arcn->name, TRAILER) == 0) && (arcn->sb.st_size == 0)) - return(0); - return(-1); + return 0; + return -1; } /* @@ -176,8 +176,8 @@ com_rd(ARCHD *arcn) break; } if (chk_lnk(arcn) < 0) - return(-1); - return(0); + return -1; + return 0; } /* @@ -218,7 +218,7 @@ rd_nm(ARCHD *arcn, int nsz) */ if ((nsz == 0) || (nsz > sizeof(arcn->name))) { tty_warn(1, "Cpio file name length %d is out of range", nsz); - return(-1); + return -1; } /* @@ -227,9 +227,9 @@ rd_nm(ARCHD *arcn, int nsz) if ((rd_wrbuf(arcn->name,nsz) != nsz) || (arcn->name[nsz-1] != '\0') || (arcn->name[0] == '\0')) { tty_warn(1, "Cpio file name in header is corrupted"); - return(-1); + return -1; } - return(0); + return 0; } /* @@ -250,7 +250,7 @@ rd_ln_nm(ARCHD *arcn) (arcn->sb.st_size >= sizeof(arcn->ln_name))) { tty_warn(1, "Cpio link name length is invalid: " OFFT_F, (OFFT_T) arcn->sb.st_size); - return(-1); + return -1; } /* @@ -259,7 +259,7 @@ rd_ln_nm(ARCHD *arcn) if (rd_wrbuf(arcn->ln_name, (int)arcn->sb.st_size) != (int)arcn->sb.st_size) { tty_warn(1, "Cpio link name read error"); - return(-1); + return -1; } arcn->ln_nlen = arcn->sb.st_size; arcn->ln_name[arcn->ln_nlen] = '\0'; @@ -269,9 +269,9 @@ rd_ln_nm(ARCHD *arcn) */ if (arcn->ln_name[0] == '\0') { tty_warn(1, "Cpio link name is corrupt"); - return(-1); + return -1; } - return(0); + return 0; } /* @@ -291,8 +291,8 @@ cpio_id(char *blk, int size) { if ((size < sizeof(HD_CPIO)) || (strncmp(blk, AMAGIC, sizeof(AMAGIC) - 1) != 0)) - return(-1); - return(0); + return -1; + return 0; } /* @@ -313,7 +313,7 @@ cpio_rd(ARCHD *arcn, char *buf) * check that this is a valid header, if not return -1 */ if (cpio_id(buf, sizeof(HD_CPIO)) < 0) - return(-1); + return -1; hd = (HD_CPIO *)buf; /* @@ -340,10 +340,10 @@ cpio_rd(ARCHD *arcn, char *buf) * follows header in the archive) */ if ((nsz = (int)asc_ul(hd->c_namesize,sizeof(hd->c_namesize),OCT)) < 2) - return(-1); + return -1; arcn->nlen = nsz - 1; if (rd_nm(arcn, nsz) < 0) - return(-1); + return -1; if (((arcn->sb.st_mode&C_IFMT) != C_ISLNK)||(arcn->sb.st_size == 0)) { /* @@ -359,7 +359,7 @@ cpio_rd(ARCHD *arcn, char *buf) * stored like file data. */ if (rd_ln_nm(arcn) < 0) - return(-1); + return -1; /* * we have a valid header (with a link) @@ -413,7 +413,7 @@ cpio_wr(ARCHD *arcn) * check and repair truncated device and inode fields in the header */ if (map_dev(arcn, (u_long)CPIO_MASK, (u_long)CPIO_MASK) < 0) - return(-1); + return -1; arcn->pad = 0L; nsz = arcn->nlen + 1; @@ -432,7 +432,7 @@ cpio_wr(ARCHD *arcn) sizeof(hd->c_filesize), OCT)) { tty_warn(1,"File is too large for cpio format %s", arcn->org_name); - return(1); + return 1; } break; case PAX_SLK: @@ -483,7 +483,7 @@ cpio_wr(ARCHD *arcn) (wr_rdbuf(arcn->name, nsz) < 0)) { tty_warn(1, "Unable to write cpio header for %s", arcn->org_name); - return(-1); + return -1; } /* @@ -491,9 +491,9 @@ cpio_wr(ARCHD *arcn) * data, if we are link tell caller we are done, go to next file */ if ((arcn->type == PAX_CTG) || (arcn->type == PAX_REG)) - return(0); + return 0; if (arcn->type != PAX_SLK) - return(1); + return 1; /* * write the link name to the archive, tell the caller to go to the @@ -502,9 +502,9 @@ cpio_wr(ARCHD *arcn) if (wr_rdbuf(arcn->ln_name, arcn->ln_nlen) < 0) { tty_warn(1,"Unable to write cpio link name for %s", arcn->org_name); - return(-1); + return -1; } - return(1); + return 1; out: /* @@ -512,7 +512,7 @@ cpio_wr(ARCHD *arcn) */ tty_warn(1, "Cpio header field is too small to store file %s", arcn->org_name); - return(1); + return 1; } /* @@ -533,8 +533,8 @@ vcpio_id(char *blk, int size) { if ((size < sizeof(HD_VCPIO)) || (strncmp(blk, AVMAGIC, sizeof(AVMAGIC) - 1) != 0)) - return(-1); - return(0); + return -1; + return 0; } /* @@ -550,8 +550,8 @@ crc_id(char *blk, int size) { if ((size < sizeof(HD_VCPIO)) || (strncmp(blk, AVCMAGIC, sizeof(AVCMAGIC) - 1) != 0)) - return(-1); - return(0); + return -1; + return 0; } /* @@ -590,10 +590,10 @@ vcpio_rd(ARCHD *arcn, char *buf) */ if (docrc) { if (crc_id(buf, sizeof(HD_VCPIO)) < 0) - return(-1); + return -1; } else { if (vcpio_id(buf, sizeof(HD_VCPIO)) < 0) - return(-1); + return -1; } hd = (HD_VCPIO *)buf; @@ -625,16 +625,16 @@ vcpio_rd(ARCHD *arcn, char *buf) * bogus */ if ((nsz = (int)asc_ul(hd->c_namesize,sizeof(hd->c_namesize),HEX)) < 2) - return(-1); + return -1; arcn->nlen = nsz - 1; if (rd_nm(arcn, nsz) < 0) - return(-1); + return -1; /* * skip padding. header + filename is aligned to 4 byte boundaries */ if (rd_skip((off_t)(VCPIO_PAD(sizeof(HD_VCPIO) + nsz))) < 0) - return(-1); + return -1; /* * if not a link (or a file with no data), calculate pad size (for @@ -655,7 +655,7 @@ vcpio_rd(ARCHD *arcn, char *buf) */ if ((rd_ln_nm(arcn) < 0) || (rd_skip((off_t)(VCPIO_PAD(arcn->sb.st_size))) < 0)) - return(-1); + return -1; /* * we have a valid header (with a link) @@ -712,7 +712,7 @@ vcpio_wr(ARCHD *arcn) * header */ if (map_dev(arcn, (u_long)VCPIO_MASK, (u_long)VCPIO_MASK) < 0) - return(-1); + return -1; nsz = arcn->nlen + 1; hd = (HD_VCPIO *)hdblk; if ((arcn->type != PAX_BLK) && (arcn->type != PAX_CHR)) @@ -748,7 +748,7 @@ vcpio_wr(ARCHD *arcn) sizeof(hd->c_filesize), HEX)) { tty_warn(1,"File is too large for sv4cpio format %s", arcn->org_name); - return(1); + return 1; } break; case PAX_SLK: @@ -806,7 +806,7 @@ vcpio_wr(ARCHD *arcn) (wr_skip((off_t)(VCPIO_PAD(sizeof(HD_VCPIO) + nsz))) < 0)) { tty_warn(1,"Could not write sv4cpio header for %s", arcn->org_name); - return(-1); + return -1; } /* @@ -814,13 +814,13 @@ vcpio_wr(ARCHD *arcn) */ if ((arcn->type == PAX_CTG) || (arcn->type == PAX_REG) || (arcn->type == PAX_HRG)) - return(0); + return 0; /* * if we are not a link, tell the caller we are done, go to next file */ if (arcn->type != PAX_SLK) - return(1); + return 1; /* * write the link name, tell the caller we are done. @@ -829,9 +829,9 @@ vcpio_wr(ARCHD *arcn) (wr_skip((off_t)(VCPIO_PAD(arcn->ln_nlen))) < 0)) { tty_warn(1,"Could not write sv4cpio link name for %s", arcn->org_name); - return(-1); + return -1; } - return(1); + return 1; out: /* @@ -839,7 +839,7 @@ vcpio_wr(ARCHD *arcn) */ tty_warn(1,"Sv4cpio header field is too small for file %s", arcn->org_name); - return(1); + return 1; } /* @@ -858,19 +858,19 @@ int bcpio_id(char *blk, int size) { if (size < sizeof(HD_BCPIO)) - return(-1); + return -1; /* * check both normal and byte swapped magic cookies */ if (((u_short)SHRT_EXT(blk)) == MAGIC) - return(0); + return 0; if (((u_short)RSHRT_EXT(blk)) == MAGIC) { if (!cpio_swp_head) ++cpio_swp_head; - return(0); + return 0; } - return(-1); + return -1; } /* @@ -892,7 +892,7 @@ bcpio_rd(ARCHD *arcn, char *buf) * check the header */ if (bcpio_id(buf, sizeof(HD_BCPIO)) < 0) - return(-1); + return -1; arcn->pad = 0L; hd = (HD_BCPIO *)buf; @@ -937,16 +937,16 @@ bcpio_rd(ARCHD *arcn, char *buf) * name */ if (nsz < 2) - return(-1); + return -1; arcn->nlen = nsz - 1; if (rd_nm(arcn, nsz) < 0) - return(-1); + return -1; /* * header + file name are aligned to 2 byte boundaries, skip if needed */ if (rd_skip((off_t)(BCPIO_PAD(sizeof(HD_BCPIO) + nsz))) < 0) - return(-1); + return -1; /* * if not a link (or a file with no data), calculate pad size (for @@ -964,7 +964,7 @@ bcpio_rd(ARCHD *arcn, char *buf) if ((rd_ln_nm(arcn) < 0) || (rd_skip((off_t)(BCPIO_PAD(arcn->sb.st_size))) < 0)) - return(-1); + return -1; /* * we have a valid header (with a link) @@ -1012,7 +1012,7 @@ bcpio_wr(ARCHD *arcn) * header */ if (map_dev(arcn, (u_long)BCPIO_MASK, (u_long)BCPIO_MASK) < 0) - return(-1); + return -1; if ((arcn->type != PAX_BLK) && (arcn->type != PAX_CHR)) arcn->sb.st_rdev = 0; @@ -1036,7 +1036,7 @@ bcpio_wr(ARCHD *arcn) if (arcn->sb.st_size != t_offt) { tty_warn(1,"File is too large for bcpio format %s", arcn->org_name); - return(1); + return 1; } break; case PAX_SLK: @@ -1121,7 +1121,7 @@ bcpio_wr(ARCHD *arcn) (wr_skip((off_t)(BCPIO_PAD(sizeof(HD_BCPIO) + nsz))) < 0)) { tty_warn(1, "Could not write bcpio header for %s", arcn->org_name); - return(-1); + return -1; } /* @@ -1129,13 +1129,13 @@ bcpio_wr(ARCHD *arcn) */ if ((arcn->type == PAX_CTG) || (arcn->type == PAX_REG) || (arcn->type == PAX_HRG)) - return(0); + return 0; /* * if we are not a link, tell the caller we are done, go to next file */ if (arcn->type != PAX_SLK) - return(1); + return 1; /* * write the link name, tell the caller we are done. @@ -1144,9 +1144,9 @@ bcpio_wr(ARCHD *arcn) (wr_skip((off_t)(BCPIO_PAD(arcn->ln_nlen))) < 0)) { tty_warn(1,"Could not write bcpio link name for %s", arcn->org_name); - return(-1); + return -1; } - return(1); + return 1; out: /* @@ -1154,5 +1154,5 @@ bcpio_wr(ARCHD *arcn) */ tty_warn(1,"Bcpio header field is too small for file %s", arcn->org_name); - return(1); + return 1; } diff --git a/archivers/pax/files/file_subs.c b/archivers/pax/files/file_subs.c index 55495e8f94d..7975c2809e1 100644 --- a/archivers/pax/files/file_subs.c +++ b/archivers/pax/files/file_subs.c @@ -1,4 +1,4 @@ -/* $NetBSD: file_subs.c,v 1.11 2005/12/01 03:00:01 minskim Exp $ */ +/* $NetBSD: file_subs.c,v 1.12 2007/03/08 17:18:18 rillig Exp $ */ /*- * Copyright (c) 1992 Keith Muller. @@ -48,7 +48,7 @@ #if 0 static char sccsid[] = "@(#)file_subs.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: file_subs.c,v 1.11 2005/12/01 03:00:01 minskim Exp $"); +__RCSID("$NetBSD: file_subs.c,v 1.12 2007/03/08 17:18:18 rillig Exp $"); #endif #endif /* not lint */ @@ -162,7 +162,7 @@ file_creat(ARCHD *arcn, int write_to_hardlink) arcn->tmp_name = malloc(arcn->nlen + 8); if (arcn->tmp_name == NULL) { syswarn(1, errno, "Cannot malloc %d bytes", arcn->nlen + 8); - return(-1); + return -1; } if (xtmp_name != NULL) abort(); @@ -187,7 +187,7 @@ file_creat(ARCHD *arcn, int write_to_hardlink) xtmp_name = NULL; free(arcn->tmp_name); arcn->tmp_name = NULL; - return(-1); + return -1; } } return(fd); @@ -293,13 +293,13 @@ lnk_creat(ARCHD *arcn, int *payload) if (lstat(arcn->ln_name, &sb) < 0) { syswarn(1, errno, "Cannot link to %s from %s", arcn->ln_name, arcn->name); - return(-1); + return -1; } if (S_ISDIR(sb.st_mode)) { tty_warn(1, "A hard link to the directory %s is not allowed", arcn->ln_name); - return(-1); + return -1; } return(mk_link(arcn->ln_name, &sb, arcn->name, 0)); @@ -324,7 +324,7 @@ cross_lnk(ARCHD *arcn) * root (and it might succeed). */ if (arcn->type == PAX_DIR) - return(1); + return 1; return(mk_link(arcn->org_name, &(arcn->sb), arcn->name, 1)); } @@ -349,9 +349,9 @@ chk_same(ARCHD *arcn) * quietly */ if (lstat(arcn->name, &sb) < 0) - return(1); + return 1; if (kflag) - return(0); + return 0; /* * better make sure the user does not have src == dest by mistake @@ -359,9 +359,9 @@ chk_same(ARCHD *arcn) if ((arcn->sb.st_dev == sb.st_dev) && (arcn->sb.st_ino == sb.st_ino)) { tty_warn(1, "Unable to copy %s, file would overwrite itself", arcn->name); - return(0); + return 0; } - return(1); + return 1; } /* @@ -388,14 +388,14 @@ mk_link(char *to, struct stat *to_sb, char *from, int ign) */ if (lstat(from, &sb) == 0) { if (kflag) - return(0); + return 0; /* * 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)) { tty_warn(1, "Cannot link file %s to itself", to); - return(-1); + return -1; } /* @@ -404,14 +404,14 @@ mk_link(char *to, struct stat *to_sb, char *from, int ign) if (S_ISDIR(sb.st_mode) && strcmp(from, ".") != 0) { if (rmdir(from) < 0) { syswarn(1, errno, "Cannot remove %s", from); - return(-1); + return -1; } } else if (unlink(from) < 0) { if (!ign) { syswarn(1, errno, "Cannot remove %s", from); - return(-1); + return -1; } - return(1); + return 1; } } @@ -429,15 +429,15 @@ mk_link(char *to, struct stat *to_sb, char *from, int ign) if (!ign) { syswarn(1, oerrno, "Cannot link to %s from %s", to, from); - return(-1); + return -1; } - return(1); + return 1; } /* * all right the link was made */ - return(0); + return 0; } /* @@ -636,7 +636,7 @@ badlink: if (pfflags && arcn->type != PAX_SLK) set_chflags(arcn->name, arcn->sb.st_flags); #endif - return(0); + return 0; } /* @@ -660,9 +660,9 @@ unlnk_exist(char *name, int type) * the file does not exist, or -k we are done */ if (lstat(name, &sb) < 0) - return(0); + return 0; if (kflag) - return(-1); + return -1; if (S_ISDIR(sb.st_mode)) { /* @@ -673,14 +673,14 @@ unlnk_exist(char *name, int type) * otherwise later file/directory creation fails. */ if (strcmp(name, ".") == 0) - return(1); + return 1; if (rmdir(name) < 0) { if (type == PAX_DIR) - return(1); + return 1; syswarn(1, errno, "Cannot remove directory %s", name); - return(-1); + return -1; } - return(0); + return 0; } /* @@ -689,9 +689,9 @@ unlnk_exist(char *name, int type) if (unlink(name) < 0) { (void)fflush(listf); syswarn(1, errno, "Cannot unlink %s", name); - return(-1); + return -1; } - return(0); + return 0; } /* @@ -860,9 +860,9 @@ set_ids(char *fnm, uid_t uid, gid_t gid) (void)fflush(listf); syswarn(1, errno, "Cannot set file uid/gid of %s", fnm); - return(-1); + return -1; } - return(0); + return 0; } /* @@ -998,7 +998,7 @@ file_write(int fd, char *str, int cnt, int *rem, int *isempt, int sz, lseek(fd, (off_t)wcnt, SEEK_CUR) < 0) { syswarn(1, errno, "File seek on %s", name); - return(-1); + return -1; } st = pt; continue; @@ -1031,14 +1031,14 @@ file_write(int fd, char *str, int cnt, int *rem, int *isempt, int sz, malloc(wcnt + 1); if (nstr == NULL) { tty_warn(1, "Out of memory"); - return(-1); + return -1; } (void)strlcpy(&nstr[*lenp], st, wcnt + 1); *strp = nstr; *lenp += wcnt; } else if (xwrite(fd, st, wcnt) != wcnt) { syswarn(1, errno, "Failed write to file %s", name); - return(-1); + return -1; } st += wcnt; } @@ -1129,7 +1129,7 @@ set_crc(ARCHD *arcn, int fd) * hmm, no fd, should never happen. well no crc then. */ arcn->crc = 0L; - return(0); + return 0; } if ((size = (u_long)arcn->sb.st_blksize) > (u_long)sizeof(tbuf)) @@ -1161,7 +1161,7 @@ set_crc(ARCHD *arcn, int fd) syswarn(1, errno, "File rewind failed on: %s", arcn->org_name); else { arcn->crc = crc; - return(0); + return 0; } - return(-1); + return -1; } diff --git a/archivers/pax/files/ftree.c b/archivers/pax/files/ftree.c index e402382d615..e23a144ca94 100644 --- a/archivers/pax/files/ftree.c +++ b/archivers/pax/files/ftree.c @@ -1,4 +1,4 @@ -/* $NetBSD: ftree.c,v 1.9 2005/12/01 03:00:01 minskim Exp $ */ +/* $NetBSD: ftree.c,v 1.10 2007/03/08 17:18:18 rillig Exp $ */ /*- * Copyright (c) 1992 Keith Muller. @@ -84,7 +84,7 @@ #if 0 static char sccsid[] = "@(#)ftree.c 8.2 (Berkeley) 4/18/94"; #else -__RCSID("$NetBSD: ftree.c,v 1.9 2005/12/01 03:00:01 minskim Exp $"); +__RCSID("$NetBSD: ftree.c,v 1.10 2007/03/08 17:18:18 rillig Exp $"); #endif #endif /* not lint */ @@ -187,16 +187,16 @@ ftree_start() if (fthead != NULL) { tty_warn(1, "The -M flag is only supported when reading file list from stdin"); - return(-1); + return -1; } ftnode = spec(stdin); if (ftnode != NULL && (ftnode->type != F_DIR || strcmp(ftnode->name, ".") != 0)) { tty_warn(1, "First node of specfile is not `.' directory"); - return(-1); + return -1; } - return(0); + return 0; } #endif /* SMALL */ @@ -233,14 +233,14 @@ ftree_start() if ((fthead == NULL) && ((farray[0] = malloc(PAXPATHLEN+2)) == NULL)) { tty_warn(1, "Unable to allocate memory for file name buffer"); - return(-1); + return -1; } if (ftree_arg() < 0) - return(-1); + return -1; if (tflag && (atdir_start() < 0)) - return(-1); - return(0); + return -1; + return 0; } /* @@ -262,7 +262,7 @@ ftree_add(char *str, int isdir) */ if ((str == NULL) || (*str == '\0')) { tty_warn(0, "Invalid file name argument"); - return(-1); + return -1; } /* @@ -272,7 +272,7 @@ ftree_add(char *str, int isdir) */ if ((ft = (FTREE *)malloc(sizeof(FTREE))) == NULL) { tty_warn(0, "Unable to allocate memory for filename"); - return(-1); + return -1; } if (((len = strlen(str) - 1) > 0) && (str[len] == '/')) @@ -282,11 +282,11 @@ ftree_add(char *str, int isdir) ft->fow = NULL; if (fthead == NULL) { fttail = fthead = ft; - return(0); + return 0; } fttail->fow = ft; fttail = ft; - return(0); + return 0; } /* @@ -409,7 +409,7 @@ ftree_arg(void) if (ftcur == NULL) ftcur = fthead; else if ((ftcur = ftcur->fow) == NULL) - return(-1); + return -1; if (ftcur->refcnt < 0) { /* @@ -435,7 +435,7 @@ ftree_arg(void) if ((ftsp = fts_open(farray, ftsopts, NULL)) != NULL) break; } - return(0); + return 0; } /* @@ -504,7 +504,7 @@ next_file(ARCHD *arcn) tty_warn(1, "line %lu: %s: %s not specified", \ (u_long)ftnode->lineno, \ ftent->fts_path, m); \ - return(-1); \ + return -1; \ } statbuf.st_mode = nodetoino(ftnode->type); NODETEST(ftnode->flags & F_TYPE, "type"); @@ -528,7 +528,7 @@ next_file(ARCHD *arcn) (u_long)ftnode->lineno, ftent->fts_path, inotype(nodetoino(ftnode->type)), inotype(statbuf.st_mode)); - return(-1); + return -1; } if (ftnode->type == F_DIR && (ftnode->flags & F_OPT)) skipoptional = 1; @@ -606,7 +606,7 @@ next_file(ARCHD *arcn) */ ftree_skip = 0; if (ftree_arg() < 0) - return(-1); + return -1; } if (ftsp == NULL) @@ -621,7 +621,7 @@ next_file(ARCHD *arcn) * we are done */ if (ftree_arg() < 0) - return(-1); + return -1; continue; } @@ -787,5 +787,5 @@ next_file(ARCHD *arcn) ftcur->refcnt = 1; (void)ftree_arg(); } - return(0); + return 0; } diff --git a/archivers/pax/files/gen_subs.c b/archivers/pax/files/gen_subs.c index 6d7720f4d9a..b330091c9d7 100644 --- a/archivers/pax/files/gen_subs.c +++ b/archivers/pax/files/gen_subs.c @@ -1,4 +1,4 @@ -/* $NetBSD: gen_subs.c,v 1.7 2004/08/21 03:28:56 jlam Exp $ */ +/* $NetBSD: gen_subs.c,v 1.8 2007/03/08 17:18:18 rillig Exp $ */ /*- * Copyright (c) 1992 Keith Muller. @@ -48,7 +48,7 @@ #if 0 static char sccsid[] = "@(#)gen_subs.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: gen_subs.c,v 1.7 2004/08/21 03:28:56 jlam Exp $"); +__RCSID("$NetBSD: gen_subs.c,v 1.8 2007/03/08 17:18:18 rillig Exp $"); #endif #endif /* not lint */ @@ -325,8 +325,8 @@ ul_asc(u_long val, char *str, int len, int base) while (pt >= str) *pt-- = '0'; if (val != (u_long)0) - return(-1); - return(0); + return -1; + return 0; } #if !defined(NET2_STAT) && !defined(_LP64) @@ -422,8 +422,8 @@ ull_asc(unsigned long long val, char *str, int len, int base) while (pt >= str) *pt-- = '0'; if (val != (unsigned long long)0) - return(-1); - return(0); + return -1; + return 0; } #endif diff --git a/archivers/pax/files/options.c b/archivers/pax/files/options.c index f3293bb0d5b..e16b989fe70 100644 --- a/archivers/pax/files/options.c +++ b/archivers/pax/files/options.c @@ -1,4 +1,4 @@ -/* $NetBSD: options.c,v 1.8 2005/12/01 03:00:01 minskim Exp $ */ +/* $NetBSD: options.c,v 1.9 2007/03/08 17:18:18 rillig Exp $ */ /*- * Copyright (c) 1992 Keith Muller. @@ -48,7 +48,7 @@ #if 0 static char sccsid[] = "@(#)options.c 8.2 (Berkeley) 4/18/94"; #else -__RCSID("$NetBSD: options.c,v 1.8 2005/12/01 03:00:01 minskim Exp $"); +__RCSID("$NetBSD: options.c,v 1.9 2007/03/08 17:18:18 rillig Exp $"); #endif #endif /* not lint */ @@ -1852,7 +1852,7 @@ bad_opt(void) OPLIST *opt; if (ophead == NULL) - return(0); + return 0; /* * print all we were given */ @@ -1868,7 +1868,7 @@ bad_opt(void) #endif else pax_usage(); - return(0); + return 0; } /* @@ -1891,11 +1891,11 @@ opt_add(const char *str) if ((str == NULL) || (*str == '\0')) { tty_warn(0, "Invalid option name"); - return(-1); + return -1; } if ((dstr = strdup(str)) == NULL) { tty_warn(0, "Unable to allocate space for option list"); - return(-1); + return -1; } frpt = endpt = dstr; @@ -1910,12 +1910,12 @@ opt_add(const char *str) if ((pt = strchr(frpt, '=')) == NULL) { tty_warn(0, "Invalid options format"); free(dstr); - return(-1); + return -1; } if ((opt = (OPLIST *)malloc(sizeof(OPLIST))) == NULL) { tty_warn(0, "Unable to allocate space for option list"); free(dstr); - return(-1); + return -1; } *pt++ = '\0'; opt->name = frpt; @@ -1932,7 +1932,7 @@ opt_add(const char *str) optail->fow = opt; optail = opt; } - return(0); + return 0; } /* @@ -1958,35 +1958,35 @@ str_offt(char *val) num = STRTOOFFT(val, &expr, 0); if ((num == OFFT_MAX) || (num <= 0) || (expr == val)) - return(0); + return 0; switch(*expr) { case 'b': t = num; num *= 512; if (t > num) - return(0); + return 0; ++expr; break; case 'k': t = num; num *= 1024; if (t > num) - return(0); + return 0; ++expr; break; case 'm': t = num; num *= 1048576; if (t > num) - return(0); + return 0; ++expr; break; case 'w': t = num; num *= sizeof(int); if (t > num) - return(0); + return 0; ++expr; break; } @@ -1999,10 +1999,10 @@ str_offt(char *val) t = num; num *= str_offt(expr + 1); if (t > num) - return(0); + return 0; break; default: - return(0); + return 0; } return(num); } @@ -2016,14 +2016,14 @@ getline(FILE *f) name = fgetln(f, &len); if (!name) { getline_error = ferror(f) ? GETLINE_FILE_CORRUPT : 0; - return(0); + return 0; } if (name[len-1] != '\n') len++; temp = malloc(len); if (!temp) { getline_error = GETLINE_OUT_OF_MEM; - return(0); + return 0; } memcpy(temp, name, len-1); temp[len-1] = 0; @@ -2040,7 +2040,7 @@ getline(FILE *f) static int no_op(void) { - return(0); + return 0; } /* diff --git a/archivers/pax/files/pat_rep.c b/archivers/pax/files/pat_rep.c index 5e0c3529e71..530bebb7340 100644 --- a/archivers/pax/files/pat_rep.c +++ b/archivers/pax/files/pat_rep.c @@ -1,4 +1,4 @@ -/* $NetBSD: pat_rep.c,v 1.5 2005/12/01 03:00:01 minskim Exp $ */ +/* $NetBSD: pat_rep.c,v 1.6 2007/03/08 17:18:18 rillig Exp $ */ /*- * Copyright (c) 1992 Keith Muller. @@ -48,7 +48,7 @@ #if 0 static char sccsid[] = "@(#)pat_rep.c 8.2 (Berkeley) 4/18/94"; #else -__RCSID("$NetBSD: pat_rep.c,v 1.5 2005/12/01 03:00:01 minskim Exp $"); +__RCSID("$NetBSD: pat_rep.c,v 1.6 2007/03/08 17:18:18 rillig Exp $"); #endif #endif /* not lint */ @@ -151,7 +151,7 @@ rep_add(char *str) */ if ((str == NULL) || (*str == '\0')) { tty_warn(1, "Empty replacement string"); - return(-1); + return -1; } /* @@ -168,7 +168,7 @@ rep_add(char *str) } if (*pt1 == 0) { tty_warn(1, "Invalid replacement string %s", str); - return(-1); + return -1; } /* @@ -177,7 +177,7 @@ rep_add(char *str) */ if ((rep = (REPLACE *)malloc(sizeof(REPLACE))) == NULL) { tty_warn(1, "Unable to allocate memory for replacement string"); - return(-1); + return -1; } *pt1 = '\0'; @@ -190,7 +190,7 @@ rep_add(char *str) tty_warn(1, "%s while compiling regular expression %s", rebuf, str); (void)free((char *)rep); - return(-1); + return -1; } /* @@ -215,7 +215,7 @@ rep_add(char *str) #endif (void)free((char *)rep); tty_warn(1, "Invalid replacement string %s", str); - return(-1); + return -1; } *pt2 = '\0'; @@ -229,7 +229,7 @@ rep_add(char *str) #endif (void)free((char *)rep); tty_warn(1, "Unable to allocate memory for replacement string"); - return(-1); + return -1; } pt1 = pt2++; @@ -258,7 +258,7 @@ rep_add(char *str) *pt1 = *str; tty_warn(1, "Invalid replacement string option %s", str); - return(-1); + return -1; } ++pt2; } @@ -269,11 +269,11 @@ rep_add(char *str) rep->fow = NULL; if (rephead == NULL) { reptail = rephead = rep; - return(0); + return 0; } reptail->fow = rep; reptail = rep; - return(0); + return 0; } /* @@ -298,7 +298,7 @@ pat_add(char *str, char *chdn) */ if ((str == NULL) || (*str == '\0')) { tty_warn(1, "Empty pattern string"); - return(-1); + return -1; } /* @@ -308,7 +308,7 @@ pat_add(char *str, char *chdn) */ if ((pt = (PATTERN *)malloc(sizeof(PATTERN))) == NULL) { tty_warn(1, "Unable to allocate memory for pattern string"); - return(-1); + return -1; } pt->pstr = str; @@ -319,11 +319,11 @@ pat_add(char *str, char *chdn) pt->chdname = chdn; if (pathead == NULL) { pattail = pathead = pt; - return(0); + return 0; } pattail->fow = pt; pattail = pt; - return(0); + return 0; } /* @@ -380,7 +380,7 @@ pat_sel(ARCHD *arcn) * if no patterns just return */ if ((pathead == NULL) || ((pt = arcn->pat) == NULL)) - return(0); + return 0; /* * when we are NOT limited to a single match per pattern mark the @@ -388,7 +388,7 @@ pat_sel(ARCHD *arcn) */ if (!nflag) { pt->flgs |= MTCH; - return(0); + return 0; } /* @@ -399,7 +399,7 @@ pat_sel(ARCHD *arcn) * with -d, this pattern was already selected and we are done */ if (pt->flgs & DIR_MTCH) - return(0); + return 0; if (!dflag && ((pt->pend != NULL) || (arcn->type == PAX_DIR))) { /* @@ -423,7 +423,7 @@ pat_sel(ARCHD *arcn) if (pt->pend != NULL) *pt->pend = '/'; pt->pend = NULL; - return(-1); + return -1; } /* @@ -445,7 +445,7 @@ pat_sel(ARCHD *arcn) } pt->flgs = DIR_MTCH | MTCH; arcn->pat = pt; - return(0); + return 0; } /* @@ -468,12 +468,12 @@ pat_sel(ARCHD *arcn) * should never happen.... */ tty_warn(1, "Pattern list inconsistant"); - return(-1); + return -1; } *ppt = pt->fow; (void)free((char *)pt); arcn->pat = NULL; - return(0); + return 0; } /* @@ -501,8 +501,8 @@ pat_match(ARCHD *arcn) */ if (pathead == NULL) { if (nflag && !cflag) - return(-1); - return(0); + return -1; + return 0; } /* @@ -543,12 +543,12 @@ pat_match(ARCHD *arcn) */ arcn->pat = pt; if (!cflag) - return(0); + return 0; if (pat_sel(arcn) < 0) - return(-1); + return -1; arcn->pat = NULL; - return(1); + return 1; } /* @@ -574,20 +574,20 @@ fn_match(char *pattern, char *string, char **pend) * Ok we found an exact match */ if (*string == '\0') - return(0); + return 0; /* * Check if it is a prefix match */ if ((dflag == 1) || (*string != '/')) - return(-1); + return -1; /* * It is a prefix match, remember where the trailing * / is located */ *pend = string; - return(0); + return 0; case '?': if ((test = *string++) == '\0') return (-1); @@ -807,7 +807,7 @@ tty_rename(ARCHD *arcn) tty_prnt("or a \"return\" to skip this file.\n"); tty_prnt("Input > "); if (tty_read(tmpname, sizeof(tmpname)) < 0) - return(-1); + return -1; if (strcmp(tmpname, "..") == 0) { tty_prnt("Try again, illegal file name: ..\n"); continue; @@ -824,11 +824,11 @@ tty_rename(ARCHD *arcn) */ if (tmpname[0] == '\0') { tty_prnt("Skipping file.\n"); - return(1); + return 1; } if ((tmpname[0] == '.') && (tmpname[1] == '\0')) { tty_prnt("Processing continues, name unchanged.\n"); - return(0); + return 0; } /* @@ -840,8 +840,8 @@ tty_rename(ARCHD *arcn) res = add_name(arcn->name, arcn->nlen, tmpname); arcn->nlen = strlcpy(arcn->name, tmpname, sizeof(arcn->name)); if (res < 0) - return(-1); - return(0); + return -1; + return 0; } /* @@ -856,7 +856,7 @@ int set_dest(ARCHD *arcn, char *dest_dir, int dir_len) { if (fix_path(arcn->name, &(arcn->nlen), dest_dir, dir_len) < 0) - return(-1); + return -1; /* * It is really hard to deal with symlinks here, we cannot be sure @@ -864,11 +864,11 @@ set_dest(ARCHD *arcn, char *dest_dir, int dir_len) * leave them alone. */ if ((arcn->type != PAX_HLK) && (arcn->type != PAX_HRG)) - return(0); + return 0; if (fix_path(arcn->ln_name, &(arcn->ln_nlen), dest_dir, dir_len) < 0) - return(-1); - return(0); + return -1; + return 0; } /* @@ -902,7 +902,7 @@ fix_path( char *or_name, int *or_len, char *dir_name, int dir_len) } if ((len = dest - or_name) > PAXPATHLEN) { tty_warn(1, "File name %s/%s, too long", dir_name, start); - return(-1); + return -1; } *or_len = len; @@ -920,7 +920,7 @@ fix_path( char *or_name, int *or_len, char *dir_name, int dir_len) *dest-- = *src--; *(or_name + len) = '\0'; - return(0); + return 0; } /* @@ -1024,7 +1024,7 @@ rep_name(char *name, size_t namelen, int *nlen, int prnt) if (prnt) tty_warn(1, "Replacement name error %s", name); - return(1); + return 1; } outpt += res; @@ -1075,7 +1075,7 @@ rep_name(char *name, size_t namelen, int *nlen, int prnt) if (prnt) tty_warn(1,"Replacement name too long %s >> %s", name, nname); - return(1); + return 1; } /* @@ -1094,10 +1094,10 @@ rep_name(char *name, size_t namelen, int *nlen, int prnt) * otherwise copy the new name over the orig name and return */ if (*nname == '\0') - return(1); + return 1; *nlen = strlcpy(name, nname, namelen); } - return(0); + return 0; } @@ -1212,7 +1212,7 @@ resub(regex_t *rp, regmatch_t *pm, char *src, char *txt, char *dest, * make sure there is a subexpression as specified */ if ((len = *spt++ - '0') > subexcnt) - return(-1); + return -1; pmpt = pm + len; } else { /* diff --git a/archivers/pax/files/pax.c b/archivers/pax/files/pax.c index b62439abd71..20b98325092 100644 --- a/archivers/pax/files/pax.c +++ b/archivers/pax/files/pax.c @@ -1,4 +1,4 @@ -/* $NetBSD: pax.c,v 1.8 2005/12/01 03:00:01 minskim Exp $ */ +/* $NetBSD: pax.c,v 1.9 2007/03/08 17:18:18 rillig Exp $ */ /*- * Copyright (c) 1992 Keith Muller. @@ -50,7 +50,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993\n\ #if 0 static char sccsid[] = "@(#)pax.c 8.2 (Berkeley) 4/18/94"; #else -__RCSID("$NetBSD: pax.c,v 1.8 2005/12/01 03:00:01 minskim Exp $"); +__RCSID("$NetBSD: pax.c,v 1.9 2007/03/08 17:18:18 rillig Exp $"); #endif #endif /* not lint */ @@ -458,18 +458,18 @@ gen_init(void) (sigaddset(&s_mask,SIGINT) < 0)||(sigaddset(&s_mask,SIGHUP) < 0) || (sigaddset(&s_mask,SIGPIPE) < 0)||(sigaddset(&s_mask,SIGQUIT)<0)){ tty_warn(1, "Unable to set up signal mask"); - return(-1); + return -1; } #ifdef SIGXCPU if (sigaddset(&s_mask,SIGXCPU) < 0) { tty_warn(1, "Unable to set up signal mask"); - return(-1); + return -1; } #endif #ifdef SIGXFSZ if (sigaddset(&s_mask,SIGXFSZ) < 0) { tty_warn(1, "Unable to set up signal mask"); - return(-1); + return -1; } #endif @@ -511,9 +511,9 @@ gen_init(void) if (sigaction(SIGXFSZ, &n_hand, &o_hand) < 0) goto out; #endif - return(0); + return 0; out: syswarn(1, errno, "Unable to set up signal handler"); - return(-1); + return -1; } diff --git a/archivers/pax/files/sel_subs.c b/archivers/pax/files/sel_subs.c index 28070fa103c..c2efa4d1558 100644 --- a/archivers/pax/files/sel_subs.c +++ b/archivers/pax/files/sel_subs.c @@ -1,4 +1,4 @@ -/* $NetBSD: sel_subs.c,v 1.4 2004/08/21 03:28:56 jlam Exp $ */ +/* $NetBSD: sel_subs.c,v 1.5 2007/03/08 17:18:18 rillig Exp $ */ /*- * Copyright (c) 1992 Keith Muller. @@ -48,7 +48,7 @@ #if 0 static char sccsid[] = "@(#)sel_subs.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: sel_subs.c,v 1.4 2004/08/21 03:28:56 jlam Exp $"); +__RCSID("$NetBSD: sel_subs.c,v 1.5 2007/03/08 17:18:18 rillig Exp $"); #endif #endif /* not lint */ @@ -127,8 +127,8 @@ sel_chk(ARCHD *arcn) if (((usrtb != NULL) && usr_match(arcn)) || ((grptb != NULL) && grp_match(arcn)) || ((trhead != NULL) && trng_match(arcn))) - return(1); - return(0); + return 1; + return 0; } /* @@ -158,12 +158,12 @@ usr_add(char *str) * create the table if it doesn't exist */ if ((str == NULL) || (*str == '\0')) - return(-1); + return -1; if ((usrtb == NULL) && ((usrtb = (USRT **)calloc(USR_TB_SZ, sizeof(USRT *))) == NULL)) { tty_warn(1, "Unable to allocate memory for user selection table"); - return(-1); + return -1; } /* @@ -177,7 +177,7 @@ usr_add(char *str) ++str; if ((pw = getpwnam(str)) == NULL) { tty_warn(1, "Unable to find uid for user: %s", str); - return(-1); + return -1; } uid = (uid_t)pw->pw_uid; } else @@ -191,7 +191,7 @@ usr_add(char *str) if ((pt = usrtb[indx]) != NULL) { while (pt != NULL) { if (pt->uid == uid) - return(0); + return 0; pt = pt->fow; } } @@ -203,10 +203,10 @@ usr_add(char *str) pt->uid = uid; pt->fow = usrtb[indx]; usrtb[indx] = pt; - return(0); + return 0; } tty_warn(1, "User selection table out of memory"); - return(-1); + return -1; } /* @@ -227,14 +227,14 @@ usr_match(ARCHD *arcn) pt = usrtb[((unsigned)arcn->sb.st_uid) % USR_TB_SZ]; while (pt != NULL) { if (pt->uid == arcn->sb.st_uid) - return(0); + return 0; pt = pt->fow; } /* * not found */ - return(1); + return 1; } /* @@ -256,12 +256,12 @@ grp_add(char *str) * create the table if it doesn't exist */ if ((str == NULL) || (*str == '\0')) - return(-1); + return -1; if ((grptb == NULL) && ((grptb = (GRPT **)calloc(GRP_TB_SZ, sizeof(GRPT *))) == NULL)) { tty_warn(1, "Unable to allocate memory fo group selection table"); - return(-1); + return -1; } /* @@ -276,7 +276,7 @@ grp_add(char *str) if ((gr = getgrnam(str)) == NULL) { tty_warn(1, "Cannot determine gid for group name: %s", str); - return(-1); + return -1; } gid = (gid_t)gr->gr_gid; } else @@ -290,7 +290,7 @@ grp_add(char *str) if ((pt = grptb[indx]) != NULL) { while (pt != NULL) { if (pt->gid == gid) - return(0); + return 0; pt = pt->fow; } } @@ -302,10 +302,10 @@ grp_add(char *str) pt->gid = gid; pt->fow = grptb[indx]; grptb[indx] = pt; - return(0); + return 0; } tty_warn(1, "Group selection table out of memory"); - return(-1); + return -1; } /* @@ -326,14 +326,14 @@ grp_match(ARCHD *arcn) pt = grptb[((unsigned)arcn->sb.st_gid) % GRP_TB_SZ]; while (pt != NULL) { if (pt->gid == arcn->sb.st_gid) - return(0); + return 0; pt = pt->fow; } /* * not found */ - return(1); + return 1; } /* @@ -379,7 +379,7 @@ trng_add(char *str) */ if ((str == NULL) || (*str == '\0')) { tty_warn(1, "Empty time range string"); - return(-1); + return -1; } /* @@ -414,7 +414,7 @@ trng_add(char *str) */ if ((pt = (TIME_RNG *)malloc(sizeof(TIME_RNG))) == NULL) { tty_warn(1, "Unable to allocate memory for time range"); - return(-1); + return -1; } /* @@ -480,7 +480,7 @@ trng_add(char *str) "Upper %s and lower %s time overlap", up_pt, str); (void)free((char *)pt); - return(-1); + return -1; } } } @@ -488,15 +488,15 @@ trng_add(char *str) pt->fow = NULL; if (trhead == NULL) { trtail = trhead = pt; - return(0); + return 0; } trtail->fow = pt; trtail = pt; - return(0); + return 0; out: tty_warn(1, "Time range format is: [yy[mm[dd[hh]]]]mm[.ss][/[c][m]]"); - return(-1); + return -1; } /* @@ -563,8 +563,8 @@ trng_match(ARCHD *arcn) } if (pt == NULL) - return(1); - return(0); + return 1; + return 0; } /* @@ -591,7 +591,7 @@ str_sec(const char *p, time_t *tval) dot = t; continue; } - return(-1); + return -1; } lt = localtime(tval); @@ -599,7 +599,7 @@ str_sec(const char *p, time_t *tval) if (dot != NULL) { len = strlen(dot); if (len != 3) - return(-1); + return -1; ++dot; lt->tm_sec = ATOI2(dot); } else { @@ -638,13 +638,13 @@ str_sec(const char *p, time_t *tval) lt->tm_min = ATOI2(p); break; default: - return(-1); + return -1; } /* * convert broken-down time to GMT clock time seconds */ if ((*tval = mktime(lt)) == -1) - return(-1); - return(0); + return -1; + return 0; } diff --git a/archivers/pax/files/tables.c b/archivers/pax/files/tables.c index 8b675ca2b00..c117ce9cd7d 100644 --- a/archivers/pax/files/tables.c +++ b/archivers/pax/files/tables.c @@ -1,4 +1,4 @@ -/* $NetBSD: tables.c,v 1.6 2005/12/01 03:00:01 minskim Exp $ */ +/* $NetBSD: tables.c,v 1.7 2007/03/08 17:18:18 rillig Exp $ */ /*- * Copyright (c) 1992 Keith Muller. @@ -48,7 +48,7 @@ #if 0 static char sccsid[] = "@(#)tables.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: tables.c,v 1.6 2005/12/01 03:00:01 minskim Exp $"); +__RCSID("$NetBSD: tables.c,v 1.7 2007/03/08 17:18:18 rillig Exp $"); #endif #endif /* not lint */ @@ -147,12 +147,12 @@ int lnk_start(void) { if (ltab != NULL) - return(0); + return 0; if ((ltab = (HRDLNK **)calloc(L_TAB_SZ, sizeof(HRDLNK *))) == NULL) { tty_warn(1, "Cannot allocate memory for hard link table"); - return(-1); + return -1; } - return(0); + return 0; } /* @@ -175,12 +175,12 @@ chk_lnk(ARCHD *arcn) u_int indx; if (ltab == NULL) - return(-1); + return -1; /* * ignore those nodes that cannot have hard links */ if ((arcn->type == PAX_DIR) || (arcn->sb.st_nlink <= 1)) - return(0); + return 0; /* * hash inode number and look for this file @@ -222,7 +222,7 @@ chk_lnk(ARCHD *arcn) (void)free((char *)pt->name); (void)free((char *)pt); } - return(1); + return 1; } } @@ -237,13 +237,13 @@ chk_lnk(ARCHD *arcn) pt->nlink = arcn->sb.st_nlink; pt->fow = ltab[indx]; ltab[indx] = pt; - return(0); + return 0; } (void)free((char *)pt); } tty_warn(1, "Hard link table out of memory"); - return(-1); + return -1; } /* @@ -371,10 +371,10 @@ int ftime_start(void) { if (ftab != NULL) - return(0); + return 0; if ((ftab = (FTM **)calloc(F_TAB_SZ, sizeof(FTM *))) == NULL) { tty_warn(1, "Cannot allocate memory for file time table"); - return(-1); + return -1; } /* @@ -385,11 +385,11 @@ ftime_start(void) if ((ffd = mkstemp(tempfile)) == -1) { syswarn(1, errno, "Unable to create temporary file: %s", tempfile); - return(-1); + return -1; } (void)unlink(tempfile); - return(0); + return 0; } /* @@ -416,7 +416,7 @@ chk_ftime(ARCHD *arcn) * no info, go ahead and add to archive */ if (ftab == NULL) - return(0); + return 0; /* * hash the pathname and look up in table @@ -438,12 +438,12 @@ chk_ftime(ARCHD *arcn) if (lseek(ffd,pt->seek,SEEK_SET) != pt->seek) { syswarn(1, errno, "Failed ftime table seek"); - return(-1); + return -1; } if (xread(ffd, ckname, namelen) != namelen) { syswarn(1, errno, "Failed ftime table read"); - return(-1); + return -1; } /* @@ -468,12 +468,12 @@ chk_ftime(ARCHD *arcn) * file is newer */ pt->mtime = arcn->sb.st_mtime; - return(0); + return 0; } /* * file is older */ - return(1); + return 1; } } @@ -491,7 +491,7 @@ chk_ftime(ARCHD *arcn) pt->namelen = namelen; pt->fow = ftab[indx]; ftab[indx] = pt; - return(0); + return 0; } syswarn(1, errno, "Failed write to file time table"); } else @@ -501,7 +501,7 @@ chk_ftime(ARCHD *arcn) if (pt != NULL) (void)free((char *)pt); - return(-1); + return -1; } /* @@ -527,13 +527,13 @@ int name_start(void) { if (ntab != NULL) - return(0); + return 0; if ((ntab = (NAMT **)calloc(N_TAB_SZ, sizeof(NAMT *))) == NULL) { tty_warn(1, "Cannot allocate memory for interactive rename table"); - return(-1); + return -1; } - return(0); + return 0; } /* @@ -556,7 +556,7 @@ add_name(char *oname, int onamelen, char *nname) * should never happen */ tty_warn(0, "No interactive rename table, links may fail\n"); - return(0); + return 0; } /* @@ -577,14 +577,14 @@ add_name(char *oname, int onamelen, char *nname) * the user just input (if it is different) */ if (strcmp(nname, pt->nname) == 0) - return(0); + return 0; (void)free((char *)pt->nname); if ((pt->nname = strdup(nname)) == NULL) { tty_warn(1, "Cannot update rename table"); - return(-1); + return -1; } - return(0); + return 0; } } @@ -596,14 +596,14 @@ add_name(char *oname, int onamelen, char *nname) if ((pt->nname = strdup(nname)) != NULL) { pt->fow = ntab[indx]; ntab[indx] = pt; - return(0); + return 0; } (void)free((char *)pt->oname); } (void)free((char *)pt); } tty_warn(1, "Interactive rename table out of memory"); - return(-1); + return -1; } /* @@ -700,12 +700,12 @@ int dev_start(void) { if (dtab != NULL) - return(0); + return 0; if ((dtab = (DEVT **)calloc(D_TAB_SZ, sizeof(DEVT *))) == NULL) { tty_warn(1, "Cannot allocate memory for device mapping table"); - return(-1); + return -1; } - return(0); + return 0; } /* @@ -722,8 +722,8 @@ int add_dev(ARCHD *arcn) { if (chk_dev(arcn->sb.st_dev, 1) == NULL) - return(-1); - return(0); + return -1; + return 0; } /* @@ -809,7 +809,7 @@ map_dev(ARCHD *arcn, u_long dev_mask, u_long ino_mask) ino_t nino; if (dtab == NULL) - return(0); + return 0; /* * check for device and inode truncation, and extract the truncated * bit pattern. @@ -840,7 +840,7 @@ map_dev(ARCHD *arcn, u_long dev_mask, u_long ino_mask) */ arcn->sb.st_dev = dpt->dev; arcn->sb.st_ino = nino; - return(0); + return 0; } } else { /* @@ -848,7 +848,7 @@ map_dev(ARCHD *arcn, u_long dev_mask, u_long ino_mask) * form of truncation, we do not need a remap */ if (!trc_ino && !trc_dev) - return(0); + return 0; /* * we have truncation, have to add this as a device to remap @@ -906,14 +906,14 @@ map_dev(ARCHD *arcn, u_long dev_mask, u_long ino_mask) pt->list = dpt; arcn->sb.st_dev = lastdev; arcn->sb.st_ino = nino; - return(0); + return 0; bad: tty_warn(1, "Unable to fix truncated inode/device field when storing %s", arcn->name); tty_warn(0, "Archive may create improper hard links when extracted"); - return(0); + return 0; } /* @@ -944,13 +944,13 @@ int atdir_start(void) { if (atab != NULL) - return(0); + return 0; if ((atab = (ATDIR **)calloc(A_TAB_SZ, sizeof(ATDIR *))) == NULL) { tty_warn(1, "Cannot allocate space for directory access time table"); - return(-1); + return -1; } - return(0); + return 0; } @@ -1062,13 +1062,13 @@ get_atdir(dev_t dev, ino_t ino, time_t *mtime, time_t *atime) u_int indx; if (atab == NULL) - return(-1); + return -1; /* * hash by inode and search the chain for an inode and device match */ indx = ((unsigned)ino) % A_TAB_SZ; if ((pt = atab[indx]) == NULL) - return(-1); + return -1; ppt = &(atab[indx]); while (pt != NULL) { @@ -1085,7 +1085,7 @@ get_atdir(dev_t dev, ino_t ino, time_t *mtime, time_t *atime) * return if we did not find it. */ if (pt == NULL) - return(-1); + return -1; /* * found it. return the times and remove the entry from the table. @@ -1095,7 +1095,7 @@ get_atdir(dev_t dev, ino_t ino, time_t *mtime, time_t *atime) *atime = pt->atime; (void)free((char *)pt->name); (void)free((char *)pt); - return(0); + return 0; } /* @@ -1138,7 +1138,7 @@ dir_start(void) { #ifdef DIRS_USE_FILE if (dirfd != -1) - return(0); + return 0; /* * unlink the file so it goes away at termination by itself @@ -1146,11 +1146,11 @@ dir_start(void) memcpy(tempbase, _TFILE_BASE, sizeof(_TFILE_BASE)); if ((dirfd = mkstemp(tempfile)) >= 0) { (void)unlink(tempfile); - return(0); + return 0; } tty_warn(1, "Unable to create temporary file for directory times: %s", tempfile); - return(-1); + return -1; #else return (0); #endif /* DIRS_USE_FILE */ diff --git a/archivers/pax/files/tar.c b/archivers/pax/files/tar.c index b02ee64421e..dac0f1d7f8c 100644 --- a/archivers/pax/files/tar.c +++ b/archivers/pax/files/tar.c @@ -1,4 +1,4 @@ -/* $NetBSD: tar.c,v 1.10 2005/12/01 03:00:01 minskim Exp $ */ +/* $NetBSD: tar.c,v 1.11 2007/03/08 17:18:18 rillig Exp $ */ /*- * Copyright (c) 1992 Keith Muller. @@ -48,7 +48,7 @@ #if 0 static char sccsid[] = "@(#)tar.c 8.2 (Berkeley) 4/18/94"; #else -__RCSID("$NetBSD: tar.c,v 1.10 2005/12/01 03:00:01 minskim Exp $"); +__RCSID("$NetBSD: tar.c,v 1.11 2007/03/08 17:18:18 rillig Exp $"); #endif #endif /* not lint */ @@ -150,9 +150,9 @@ check_sum(char *hd, size_t hdlen, char *bl, size_t bllen, int quiet) if (!quiet) tty_warn(0, "Header checksum %lo does not match %lo", hdck, blck); - return(-1); + return -1; } - return(0); + return 0; } @@ -211,7 +211,7 @@ tar_trail(char *buf, int in_resync, int *cnt) * if not all zero it is not a trailer, but MIGHT be a header. */ if (i != BLKMULT) - return(-1); + return -1; /* * When given a zero block, we must be careful! @@ -232,9 +232,9 @@ tar_trail(char *buf, int in_resync, int *cnt) ++*cnt; } if (*cnt >= NULLCNT) - return(0); + return 0; } - return(1); + return 1; } /* @@ -287,8 +287,8 @@ ul_oct(u_long val, char *str, int len, int term) while (pt >= str) *pt-- = '0'; if (val != (u_long)0) - return(-1); - return(0); + return -1; + return 0; } #if !defined(NET2_STAT) && !defined(_LP64) @@ -342,8 +342,8 @@ ull_oct(unsigned long long val, char *str, int len, int term) while (pt >= str) *pt-- = '0'; if (val != (unsigned long long)0) - return(-1); - return(0); + return -1; + return 0; } #endif @@ -406,7 +406,7 @@ tar_id(char *blk, int size) static int is_ustar = -1; if (size < BLKMULT) - return(-1); + return -1; hd = (HD_TAR *)blk; uhd = (HD_USTAR *)blk; @@ -418,11 +418,11 @@ tar_id(char *blk, int size) * checksum. If this is ok we have to assume it is a valid header. */ if (hd->name[0] == '\0') - return(-1); + return -1; if (strncmp(uhd->magic, TMAGIC, TMAGLEN - 1) == 0) { if (is_ustar == -1) { is_ustar = 1; - return(-1); + return -1; } else tty_warn(0, "Busted tar archive: has both ustar and old tar " @@ -453,7 +453,7 @@ tar_opt(void) tty_warn(1, "%s=%s is the only supported tar format option", TAR_OPTION, TAR_NODIR); - return(-1); + return -1; } /* @@ -462,11 +462,11 @@ tar_opt(void) if ((act != APPND) && (act != ARCHIVE)) { tty_warn(1, "%s=%s is only supported when writing.", opt->name, opt->value); - return(-1); + return -1; } tar_nodir = 1; } - return(0); + return 0; } @@ -488,7 +488,7 @@ tar_rd(ARCHD *arcn, char *buf) * we only get proper sized buffers passed to us */ if (tar_id(buf, BLKMULT) < 0) - return(-1); + return -1; memset(arcn, 0, sizeof(*arcn)); arcn->org_name = arcn->name; arcn->pat = NULL; @@ -594,7 +594,7 @@ tar_rd(ARCHD *arcn, char *buf) *pt = '\0'; --arcn->nlen; } - return(0); + return 0; } /* @@ -625,29 +625,29 @@ tar_wr(ARCHD *arcn) * user asked that dirs not be written to the archive */ if (tar_nodir) - return(1); + return 1; break; case PAX_CHR: tty_warn(1, "Tar cannot archive a character device %s", arcn->org_name); - return(1); + return 1; case PAX_BLK: tty_warn(1, "Tar cannot archive a block device %s", arcn->org_name); - return(1); + return 1; case PAX_SCK: tty_warn(1, "Tar cannot archive a socket %s", arcn->org_name); - return(1); + return 1; case PAX_FIF: tty_warn(1, "Tar cannot archive a fifo %s", arcn->org_name); - return(1); + return 1; case PAX_SLK: case PAX_HLK: case PAX_HRG: if (arcn->ln_nlen > sizeof(hd->linkname)) { tty_warn(1,"Link name too long for tar %s", arcn->ln_name); - return(1); + return 1; } break; case PAX_REG: @@ -664,7 +664,7 @@ tar_wr(ARCHD *arcn) ++len; if (len >= sizeof(hd->name)) { tty_warn(1, "File name too long for tar %s", arcn->name); - return(1); + return 1; } /* @@ -714,7 +714,7 @@ tar_wr(ARCHD *arcn) if (OFFT_OCT(arcn->sb.st_size, hd->size, sizeof(hd->size), 1)) { tty_warn(1,"File is too large for tar %s", arcn->org_name); - return(1); + return 1; } arcn->pad = TAR_PAD(arcn->sb.st_size); } @@ -742,19 +742,19 @@ tar_wr(ARCHD *arcn) * seems incorrect */ if (wr_rdbuf(hdblk, sizeof(HD_TAR)) < 0) - return(-1); + return -1; if (wr_skip((off_t)(BLKMULT - sizeof(HD_TAR))) < 0) - return(-1); + return -1; if ((arcn->type == PAX_CTG) || (arcn->type == PAX_REG)) - return(0); - return(1); + return 0; + return 1; out: /* * header field is out of range */ tty_warn(1, "Tar header field is too small for %s", arcn->org_name); - return(1); + return 1; } /* @@ -771,7 +771,7 @@ tar_wr(ARCHD *arcn) int ustar_strd(void) { - return(0); + return 0; } /* @@ -784,7 +784,7 @@ ustar_strd(void) int ustar_stwr(void) { - return(0); + return 0; } /* @@ -801,7 +801,7 @@ ustar_id(char *blk, int size) HD_USTAR *hd; if (size < BLKMULT) - return(-1); + return -1; hd = (HD_USTAR *)blk; /* @@ -811,9 +811,9 @@ ustar_id(char *blk, int size) * check the checksum. If ok we have to assume it is a valid header. */ if (hd->name[0] == '\0') - return(-1); + return -1; if (strncmp(hd->magic, TMAGIC, TMAGLEN - 1) != 0) - return(-1); + return -1; /* This is GNU tar */ if (strncmp(hd->magic, "ustar ", 8) == 0 && !is_gnutar && !seen_gnu_warning) { @@ -845,7 +845,7 @@ ustar_rd(ARCHD *arcn, char *buf) * we only get proper sized buffers */ if (ustar_id(buf, BLKMULT) < 0) - return(-1); + return -1; memset(arcn, 0, sizeof(*arcn)); arcn->org_name = arcn->name; @@ -989,7 +989,7 @@ ustar_rd(ARCHD *arcn, char *buf) arcn->sb.st_mode |= S_IFREG; break; } - return(0); + return 0; } static int @@ -1077,7 +1077,7 @@ ustar_wr(ARCHD *arcn) if (!is_gnutar) tty_warn(1, "Ustar cannot archive a socket %s", arcn->org_name); - return(1); + return 1; case PAX_SLK: case PAX_HLK: @@ -1091,7 +1091,7 @@ ustar_wr(ARCHD *arcn) } else { tty_warn(1, "Link name too long for ustar %s", arcn->ln_name); - return(1); + return 1; } } break; @@ -1110,7 +1110,7 @@ ustar_wr(ARCHD *arcn) } else { tty_warn(1, "File name too long for ustar %s", arcn->name); - return(1); + return 1; } } @@ -1196,7 +1196,7 @@ ustar_wr(ARCHD *arcn) sizeof(hd->size), 3)) { tty_warn(1,"File is too long for ustar %s", arcn->org_name); - return(1); + return 1; } } else { if (arcn->type == PAX_CTG) @@ -1208,7 +1208,7 @@ ustar_wr(ARCHD *arcn) sizeof(hd->size), 3)) { tty_warn(1,"File is too long for ustar %s", arcn->org_name); - return(1); + return 1; } } break; @@ -1246,22 +1246,22 @@ ustar_wr(ARCHD *arcn) sizeof(hd->chksum), 3)) return size_err("CHKSUM", arcn); if (wr_rdbuf(hdblk, sizeof(HD_USTAR)) < 0) - return(-1); + return -1; if (wr_skip((off_t)(BLKMULT - sizeof(HD_USTAR))) < 0) - return(-1); + return -1; if (gnu_hack_string) { int res = wr_rdbuf(gnu_hack_string, gnu_hack_len); int pad = gnu_hack_len; gnu_hack_string = NULL; gnu_hack_len = 0; if (res < 0) - return(-1); + return -1; if (wr_skip((off_t)(BLKMULT - (pad % BLKMULT))) < 0) - return(-1); + return -1; } if ((arcn->type == PAX_CTG) || (arcn->type == PAX_REG)) - return(0); - return(1); + return 0; + return 1; } /* @@ -1419,7 +1419,7 @@ tar_gnutar_X_compat(path) if (fp == NULL) { tty_warn(1, "cannot open %s: %s", path, strerror(errno)); - return(-1); + return -1; } while ((line = fgetln(fp, &len))) { diff --git a/archivers/pax/files/tty_subs.c b/archivers/pax/files/tty_subs.c index d33dccba7ba..0bfec193913 100644 --- a/archivers/pax/files/tty_subs.c +++ b/archivers/pax/files/tty_subs.c @@ -1,4 +1,4 @@ -/* $NetBSD: tty_subs.c,v 1.5 2005/12/01 03:00:01 minskim Exp $ */ +/* $NetBSD: tty_subs.c,v 1.6 2007/03/08 17:18:19 rillig Exp $ */ /*- * Copyright (c) 1992 Keith Muller. @@ -48,7 +48,7 @@ #if 0 static char sccsid[] = "@(#)tty_subs.c 8.2 (Berkeley) 4/18/94"; #else -__RCSID("$NetBSD: tty_subs.c,v 1.5 2005/12/01 03:00:01 minskim Exp $"); +__RCSID("$NetBSD: tty_subs.c,v 1.6 2007/03/08 17:18:19 rillig Exp $"); #endif #endif /* not lint */ @@ -113,7 +113,7 @@ tty_init(void) if ((ttyfd = open(DEVTTY, O_RDWR)) >= 0) { if ((ttyoutf = fdopen(ttyfd, "w")) != NULL) { if ((ttyinf = fdopen(ttyfd, "r")) != NULL) - return(0); + return 0; (void)fclose(ttyoutf); } (void)close(ttyfd); @@ -121,9 +121,9 @@ tty_init(void) if (iflag) { tty_warn(1, "Fatal error, cannot open %s", DEVTTY); - return(-1); + return -1; } - return(0); + return 0; } /* @@ -158,7 +158,7 @@ tty_read(char *str, int len) char *pt; if ((--len <= 0) || (ttyinf == NULL) || (fgets(str,len,ttyinf) == NULL)) - return(-1); + return -1; *(str + len) = '\0'; /* @@ -166,7 +166,7 @@ tty_read(char *str, int len) */ if ((pt = strchr(str, '\n')) != NULL) *pt = '\0'; - return(0); + return 0; } /* |