diff options
-rw-r--r-- | bin/pax/ar_io.c | 34 | ||||
-rw-r--r-- | bin/pax/ar_subs.c | 32 | ||||
-rw-r--r-- | bin/pax/extern.h | 4 | ||||
-rw-r--r-- | bin/pax/options.c | 12 | ||||
-rw-r--r-- | bin/pax/pax.c | 5 |
5 files changed, 46 insertions, 41 deletions
diff --git a/bin/pax/ar_io.c b/bin/pax/ar_io.c index ffda2463aab..6afe997e246 100644 --- a/bin/pax/ar_io.c +++ b/bin/pax/ar_io.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ar_io.c,v 1.17 1997/09/01 18:29:42 deraadt Exp $ */ +/* $OpenBSD: ar_io.c,v 1.18 1998/09/20 02:22:21 millert Exp $ */ /* $NetBSD: ar_io.c,v 1.5 1996/03/26 23:54:13 mrg Exp $ */ /*- @@ -42,7 +42,7 @@ #if 0 static char sccsid[] = "@(#)ar_io.c 8.2 (Berkeley) 4/18/94"; #else -static char rcsid[] = "$OpenBSD: ar_io.c,v 1.17 1997/09/01 18:29:42 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: ar_io.c,v 1.18 1998/09/20 02:22:21 millert Exp $"; #endif #endif /* not lint */ @@ -316,18 +316,12 @@ void ar_close() #endif { - FILE *outf; if (arfd < 0) { did_io = io_ok = flcnt = 0; return; } - if (act == LIST) - outf = stdout; - else - outf = stderr; - /* * Close archive file. This may take a LONG while on tapes (we may be * forced to wait for the rewind to complete) so tell the user what is @@ -336,11 +330,11 @@ ar_close() */ if (vflag && (artyp == ISTAPE)) { if (vfpart) - (void)putc('\n', outf); - (void)fprintf(outf, + (void)putc('\n', listf); + (void)fprintf(listf, "%s: Waiting for tape drive close to complete...", argv0); - (void)fflush(outf); + (void)fflush(listf); } /* @@ -356,9 +350,9 @@ ar_close() (void)close(arfd); if (vflag && (artyp == ISTAPE)) { - (void)fputs("done.\n", outf); + (void)fputs("done.\n", listf); vfpart = 0; - (void)fflush(outf); + (void)fflush(listf); } arfd = -1; @@ -384,7 +378,7 @@ ar_close() * Print out a summary of I/O for this archive volume. */ if (vfpart) { - (void)putc('\n', outf); + (void)putc('\n', listf); vfpart = 0; } @@ -395,27 +389,27 @@ ar_close() */ if (frmt == NULL) { # ifdef NET2_STAT - (void)fprintf(outf, "%s: unknown format, %lu bytes skipped.\n", + (void)fprintf(listf, "%s: unknown format, %lu bytes skipped.\n", # else - (void)fprintf(outf, "%s: unknown format, %qu bytes skipped.\n", + (void)fprintf(listf, "%s: unknown format, %qu bytes skipped.\n", # endif argv0, rdcnt); - (void)fflush(outf); + (void)fflush(listf); flcnt = 0; return; } if (strcmp(NM_CPIO, argv0) == 0) - (void)fprintf(outf, "%qu blocks\n", (rdcnt ? rdcnt : wrcnt) / 5120); + (void)fprintf(listf, "%qu blocks\n", (rdcnt ? rdcnt : wrcnt) / 5120); else if (strcmp(NM_TAR, argv0) != 0) - (void)fprintf(outf, + (void)fprintf(listf, # ifdef NET2_STAT "%s: %s vol %d, %lu files, %lu bytes read, %lu bytes written.\n", # else "%s: %s vol %d, %lu files, %qu bytes read, %qu bytes written.\n", # endif argv0, frmt->name, arvol-1, flcnt, rdcnt, wrcnt); - (void)fflush(outf); + (void)fflush(listf); flcnt = 0; } diff --git a/bin/pax/ar_subs.c b/bin/pax/ar_subs.c index c3887ea6d73..46868823185 100644 --- a/bin/pax/ar_subs.c +++ b/bin/pax/ar_subs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ar_subs.c,v 1.13 1997/09/16 21:20:35 niklas Exp $ */ +/* $OpenBSD: ar_subs.c,v 1.14 1998/09/20 02:22:21 millert Exp $ */ /* $NetBSD: ar_subs.c,v 1.5 1995/03/21 09:07:06 cgd Exp $ */ /*- @@ -42,7 +42,7 @@ #if 0 static char sccsid[] = "@(#)ar_subs.c 8.2 (Berkeley) 4/18/94"; #else -static char rcsid[] = "$OpenBSD: ar_subs.c,v 1.13 1997/09/16 21:20:35 niklas Exp $"; +static char rcsid[] = "$OpenBSD: ar_subs.c,v 1.14 1998/09/20 02:22:21 millert Exp $"; #endif #endif /* not lint */ @@ -284,9 +284,9 @@ extract() if (vflag) { if (vflag > 1) - ls_list(arcn, now, stderr); + ls_list(arcn, now, listf); else { - (void)fputs(arcn->name, stderr); + (void)fputs(arcn->name, listf); vfpart = 1; } } @@ -318,7 +318,7 @@ extract() purg_lnk(arcn); if (vflag && vfpart) { - (void)putc('\n', stderr); + (void)putc('\n', listf); vfpart = 0; } continue; @@ -339,7 +339,7 @@ extract() res = (*frmt->rd_data)(arcn, fd, &cnt); file_close(arcn, fd); if (vflag && vfpart) { - (void)putc('\n', stderr); + (void)putc('\n', listf); vfpart = 0; } if (!res) @@ -488,9 +488,9 @@ wr_archive(arcn, is_app) if (vflag) { if (vflag > 1) - ls_list(arcn, now, stderr); + ls_list(arcn, now, listf); else { - (void)fputs(arcn->name, stderr); + (void)fputs(arcn->name, listf); vfpart = 1; } } @@ -511,7 +511,7 @@ wr_archive(arcn, is_app) * so we are done messing with this file */ if (vflag && vfpart) { - (void)putc('\n', stderr); + (void)putc('\n', listf); vfpart = 0; } rdfile_close(arcn, &fd); @@ -529,7 +529,7 @@ wr_archive(arcn, is_app) res = (*frmt->wr_data)(arcn, fd, &cnt); rdfile_close(arcn, &fd); if (vflag && vfpart) { - (void)putc('\n', stderr); + (void)putc('\n', listf); vfpart = 0; } if (res < 0) @@ -646,7 +646,7 @@ append() * reading the archive may take a long time. If verbose tell the user */ if (vflag) { - (void)fprintf(stderr, + (void)fprintf(listf, "%s: Reading archive to position at the end...", argv0); vfpart = 1; } @@ -708,7 +708,7 @@ append() * tell the user we are done reading. */ if (vflag && vfpart) { - (void)fputs("done.\n", stderr); + (void)fputs("done.\n", listf); vfpart = 0; } @@ -906,7 +906,7 @@ copy() } if (vflag) { - (void)fputs(arcn->name, stderr); + (void)fputs(arcn->name, listf); vfpart = 1; } ++flcnt; @@ -921,7 +921,7 @@ copy() res = chk_same(arcn); if (res <= 0) { if (vflag && vfpart) { - (void)putc('\n', stderr); + (void)putc('\n', listf); vfpart = 0; } continue; @@ -941,7 +941,7 @@ copy() if (res < 0) purg_lnk(arcn); if (vflag && vfpart) { - (void)putc('\n', stderr); + (void)putc('\n', listf); vfpart = 0; } continue; @@ -971,7 +971,7 @@ copy() rdfile_close(arcn, &fdsrc); if (vflag && vfpart) { - (void)putc('\n', stderr); + (void)putc('\n', listf); vfpart = 0; } } diff --git a/bin/pax/extern.h b/bin/pax/extern.h index 6fbf7b88a32..df441731d48 100644 --- a/bin/pax/extern.h +++ b/bin/pax/extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.14 1997/07/24 23:19:18 millert Exp $ */ +/* $OpenBSD: extern.h,v 1.15 1998/09/20 02:22:21 millert Exp $ */ /* $NetBSD: extern.h,v 1.5 1996/03/26 23:54:16 mrg Exp $ */ /*- @@ -238,6 +238,8 @@ extern int docrc; extern char *dirptr; extern char *ltmfrmt; extern char *argv0; +extern FILE *listf; + int main __P((int, char **)); void sig_cleanup __P((int)); diff --git a/bin/pax/options.c b/bin/pax/options.c index 42bb211bcd8..4aea6004423 100644 --- a/bin/pax/options.c +++ b/bin/pax/options.c @@ -1,4 +1,4 @@ -/* $OpenBSD: options.c,v 1.33 1998/03/31 17:14:21 millert Exp $ */ +/* $OpenBSD: options.c,v 1.34 1998/09/20 02:22:22 millert Exp $ */ /* $NetBSD: options.c,v 1.6 1996/03/26 23:54:18 mrg Exp $ */ /*- @@ -42,7 +42,7 @@ #if 0 static char sccsid[] = "@(#)options.c 8.2 (Berkeley) 4/18/94"; #else -static char rcsid[] = "$OpenBSD: options.c,v 1.33 1998/03/31 17:14:21 millert Exp $"; +static char rcsid[] = "$OpenBSD: options.c,v 1.34 1998/09/20 02:22:22 millert Exp $"; #endif #endif /* not lint */ @@ -523,6 +523,7 @@ pax_options(argc, argv) */ if (ISLIST(flg)) { act = LIST; + listf = stdout; bflg = flg & BDLIST; } else if (ISEXTRACT(flg)) { act = EXTRACT; @@ -791,6 +792,12 @@ tar_options(argc, argv) argc -= optind; argv += optind; + /* Traditional tar behaviour (pax uses stderr unless in list mode) */ + if (fstdin == 1 && act == ARCHIVE) + listf = stderr; + else + listf = stdout; + /* Traditional tar behaviour (pax wants to read filelist from stdin) */ if ((act == ARCHIVE || act == APPND) && argc == 0) exit(0); @@ -1011,6 +1018,7 @@ cpio_options(argc, argv) * list contents of archive */ act = LIST; + listf = stdout; break; case 'u': /* diff --git a/bin/pax/pax.c b/bin/pax/pax.c index b77f9b5c195..637e2f3ecbb 100644 --- a/bin/pax/pax.c +++ b/bin/pax/pax.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pax.c,v 1.13 1998/07/27 05:18:29 millert Exp $ */ +/* $OpenBSD: pax.c,v 1.14 1998/09/20 02:22:22 millert Exp $ */ /* $NetBSD: pax.c,v 1.5 1996/03/26 23:54:20 mrg Exp $ */ /*- @@ -48,7 +48,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)pax.c 8.2 (Berkeley) 4/18/94"; #else -static char rcsid[] = "$OpenBSD: pax.c,v 1.13 1998/07/27 05:18:29 millert Exp $"; +static char rcsid[] = "$OpenBSD: pax.c,v 1.14 1998/09/20 02:22:22 millert Exp $"; #endif #endif /* not lint */ @@ -107,6 +107,7 @@ char *dirptr; /* destination dir in a copy */ char *ltmfrmt; /* -v locale time format (if any) */ char *argv0; /* root of argv[0] */ sigset_t s_mask; /* signal mask for cleanup critical sect */ +FILE *listf = stderr; /* file pointer to print file list to */ /* * PAX - Portable Archive Interchange |