summaryrefslogtreecommitdiff
path: root/cpio
diff options
context:
space:
mode:
authorTom Ivar Helbekkmo <tih@hamartun.priv.no>2021-03-06 09:28:57 +0100
committerTom Ivar Helbekkmo <tih@hamartun.priv.no>2021-03-06 09:28:57 +0100
commit0d2e5a0502100a83366d7a01e8c9962a19aa22e4 (patch)
tree21d0510b74a2eb84e14307bc3a6b7aa1ec5008e0 /cpio
parent54362e63ce558bd7353370c09cb376b571809af8 (diff)
downloadlibarchive-0d2e5a0502100a83366d7a01e8c9962a19aa22e4.tar.gz
add -7 option to bsdcpio for symmetry
Diffstat (limited to 'cpio')
-rw-r--r--cpio/cmdline.c3
-rw-r--r--cpio/cpio.c8
2 files changed, 7 insertions, 4 deletions
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));