summaryrefslogtreecommitdiff
path: root/bin/pax/gen_subs.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2003-06-13 17:51:15 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2003-06-13 17:51:15 +0000
commita42016a89f1868417d387d1913b585cc085f838f (patch)
tree18254b99fdacd0fa29113af2a4a37b68887d3ed9 /bin/pax/gen_subs.c
parent2beff53b1604b0bf21610bf30d8b0b92f8a29a53 (diff)
Add a -0 flag to make pax use a NUL instead of a newline as the
pathname separator. Works in list mode as well as read/copy mode. Based on a patch from David Leonard; closes PR 3310
Diffstat (limited to 'bin/pax/gen_subs.c')
-rw-r--r--bin/pax/gen_subs.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/bin/pax/gen_subs.c b/bin/pax/gen_subs.c
index 6d2f47ce1f0..00ae4b674af 100644
--- a/bin/pax/gen_subs.c
+++ b/bin/pax/gen_subs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gen_subs.c,v 1.16 2003/06/02 23:32:08 millert Exp $ */
+/* $OpenBSD: gen_subs.c,v 1.17 2003/06/13 17:51:14 millert Exp $ */
/* $NetBSD: gen_subs.c,v 1.5 1995/03/21 09:07:26 cgd Exp $ */
/*-
@@ -38,7 +38,7 @@
#if 0
static const char sccsid[] = "@(#)gen_subs.c 8.1 (Berkeley) 5/31/93";
#else
-static const char rcsid[] = "$OpenBSD: gen_subs.c,v 1.16 2003/06/02 23:32:08 millert Exp $";
+static const char rcsid[] = "$OpenBSD: gen_subs.c,v 1.17 2003/06/13 17:51:14 millert Exp $";
#endif
#endif /* not lint */
@@ -82,13 +82,19 @@ ls_list(ARCHD *arcn, time_t now, FILE *fp)
char f_mode[MODELEN];
char f_date[DATELEN];
const char *timefrmt;
+ int term;
+
+ term = zeroflag ? '\0' : '\n'; /* path termination character */
/*
* if not verbose, just print the file name
*/
if (!vflag) {
- safe_print(arcn->name, fp);
- (void)putc('\n', fp);
+ if (zeroflag)
+ (void)fputs(arcn->name, fp);
+ else
+ safe_print(arcn->name, fp);
+ (void)putc(term, fp);
(void)fflush(fp);
return;
}
@@ -151,7 +157,7 @@ ls_list(ARCHD *arcn, time_t now, FILE *fp)
fputs(" => ", fp);
safe_print(arcn->ln_name, fp);
}
- (void)putc('\n', fp);
+ (void)putc(term, fp);
(void)fflush(fp);
return;
}