]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
add -7 option to bsdcpio for symmetry
authorTom Ivar Helbekkmo <tih@hamartun.priv.no>
Sat, 6 Mar 2021 08:28:57 +0000 (09:28 +0100)
committerTom Ivar Helbekkmo <tih@hamartun.priv.no>
Sat, 6 Mar 2021 08:28:57 +0000 (09:28 +0100)
cpio/cmdline.c
cpio/cpio.c

index 0ca9b4dec00442490621155ab0d1cc105b675a6f..2683524e4ed055e223517fa1253e9ca0ba48b6e1 100644 (file)
@@ -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' },
index 678d2419b71358806c3ff2d9bd0636b408663dec..d80c762175a2943a39af6abf8e3fb1be21e31f8c 100644 (file)
@@ -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));