From 0d2e5a0502100a83366d7a01e8c9962a19aa22e4 Mon Sep 17 00:00:00 2001 From: Tom Ivar Helbekkmo Date: Sat, 6 Mar 2021 09:28:57 +0100 Subject: add -7 option to bsdcpio for symmetry --- cpio/cmdline.c | 3 ++- cpio/cpio.c | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'cpio') diff --git a/cpio/cmdline.c b/cpio/cmdline.c index 0ca9b4de..2683524e 100644 --- a/cpio/cmdline.c +++ b/cpio/cmdline.c @@ -51,7 +51,7 @@ __FBSDID("$FreeBSD: src/usr.bin/cpio/cmdline.c,v 1.5 2008/12/06 07:30:40 kientzl /* * Short options for cpio. Please keep this sorted. */ -static const char *short_options = "06AaBC:cdE:F:f:H:hI:iJjLlmnO:opR:rtuVvW:yZz"; +static const char *short_options = "067AaBC:cdE:F:f:H:hI:iJjLlmnO:opR:rtuVvW:yZz"; /* * Long options for cpio. Please keep this sorted. @@ -62,6 +62,7 @@ static const struct option { int equivalent; /* Equivalent short option. */ } cpio_longopts[] = { { "b64encode", 0, OPTION_B64ENCODE }, + { "binary", 0, '7' }, { "create", 0, 'o' }, { "dereference", 0, 'L' }, { "dot", 0, 'V' }, diff --git a/cpio/cpio.c b/cpio/cpio.c index 678d2419..d80c7621 100644 --- a/cpio/cpio.c +++ b/cpio/cpio.c @@ -192,8 +192,12 @@ main(int argc, char *argv[]) case '0': /* GNU convention: --null, -0 */ cpio->option_null = 1; break; - case '6': /* 6th edition (PWB) interpretation of file mode bits */ + case '6': /* in/out: assume/create 6th edition (PWB) format */ cpio->option_pwb = 1; + cpio->format = "pwb"; + break; + case '7': /* out: create archive using 7th Edition binary format */ + cpio->format = "bin"; break; case 'A': /* NetBSD/OpenBSD */ cpio->option_append = 1; @@ -586,8 +590,6 @@ mode_out(struct cpio *cpio) } if (r < ARCHIVE_WARN) lafe_errc(1, 0, "Requested filter not available"); - if (cpio->option_pwb) - cpio->format = "pwb"; r = archive_write_set_format_by_name(cpio->archive, cpio->format); if (r != ARCHIVE_OK) lafe_errc(1, 0, "%s", archive_error_string(cpio->archive)); -- cgit v1.2.1