From f3e2c552d3cd5cfe8bd9100db93ef7c09e52b442 Mon Sep 17 00:00:00 2001 From: deraadt Date: Sat, 11 Jan 2014 05:36:26 +0000 Subject: [PATCH] Add -DNOCPIO option for use by distrib/special ok guenther tedu --- bin/pax/ar_io.c | 10 ++++++---- bin/pax/options.c | 24 +++++++++++++++++++++--- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/bin/pax/ar_io.c b/bin/pax/ar_io.c index bc789b2cc1b..2b237eb1470 100644 --- a/bin/pax/ar_io.c +++ b/bin/pax/ar_io.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ar_io.c,v 1.43 2014/01/08 05:52:47 guenther Exp $ */ +/* $OpenBSD: ar_io.c,v 1.44 2014/01/11 05:36:26 deraadt Exp $ */ /* $NetBSD: ar_io.c,v 1.5 1996/03/26 23:54:13 mrg Exp $ */ /*- @@ -386,12 +386,14 @@ ar_close(void) return; } - if (strcmp(NM_CPIO, argv0) == 0) - (void)fprintf(listf, "%llu blocks\n", (rdcnt ? rdcnt : wrcnt) / 5120); - else if (strcmp(NM_TAR, argv0) != 0) + if (strcmp(NM_TAR, argv0) != 0) (void)fprintf(listf, "%s: %s vol %d, %lu files, %llu bytes read, %llu bytes written.\n", argv0, frmt->name, arvol-1, flcnt, rdcnt, wrcnt); +#ifndef NOCPIO + else if (strcmp(NM_CPIO, argv0) == 0) + (void)fprintf(listf, "%llu blocks\n", (rdcnt ? rdcnt : wrcnt) / 5120); +#endif /* !NOCPIO */ (void)fflush(listf); flcnt = 0; } diff --git a/bin/pax/options.c b/bin/pax/options.c index 994ce5d8a7e..1366ee598c5 100644 --- a/bin/pax/options.c +++ b/bin/pax/options.c @@ -1,4 +1,4 @@ -/* $OpenBSD: options.c,v 1.80 2014/01/08 06:43:34 deraadt Exp $ */ +/* $OpenBSD: options.c,v 1.81 2014/01/11 05:36:26 deraadt Exp $ */ /* $NetBSD: options.c,v 1.6 1996/03/26 23:54:18 mrg Exp $ */ /*- @@ -91,6 +91,16 @@ static int getline_error; */ FSUB fsub[] = { +#ifdef NOCPIO +/* 0: OLD BINARY CPIO */ + { }, +/* 1: OLD OCTAL CHARACTER CPIO */ + { }, +/* 2: SVR4 HEX CPIO */ + { }, +/* 3: SVR4 HEX CPIO WITH CRC */ + { }, +#else /* 0: OLD BINARY CPIO */ {"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, @@ -110,7 +120,7 @@ FSUB fsub[] = { {"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}, - +#endif /* 4: OLD TAR */ {"tar", 10240, BLKMULT, 0, 1, BLKMULT, 0, tar_id, no_op, tar_rd, tar_endrd, no_op, tar_wr, tar_endwr, tar_trail, @@ -161,10 +171,13 @@ options(int argc, char **argv) if (strcmp(NM_TAR, argv0) == 0) { tar_options(argc, argv); return; - } else if (strcmp(NM_CPIO, argv0) == 0) { + } +#ifndef NOCPIO + else if (strcmp(NM_CPIO, argv0) == 0) { cpio_options(argc, argv); return; } +#endif /* !NOCPIO */ /* * assume pax as the default */ @@ -1030,6 +1043,8 @@ mkpath(path) return (0); } + +#ifndef NOCPIO /* * cpio_options() * look at the user specified flags. set globals as required and check if @@ -1296,6 +1311,7 @@ cpio_options(int argc, char **argv) break; } } +#endif /* !NOCPIO */ /* * printflg() @@ -1584,6 +1600,7 @@ tar_usage(void) exit(1); } +#ifndef NOCPIO /* * cpio_usage() * print the usage summary to the user @@ -1601,3 +1618,4 @@ cpio_usage(void) stderr); exit(1); } +#endif /* !NOCPIO */ -- 2.20.1