0011-pax-Support-xz-compression-with-J-flag.patch (2485B)
1 From 86ce82bfd12c6db2468e3db4afd843cf081f71b2 Mon Sep 17 00:00:00 2001 2 From: Michael Forney <mforney@mforney.org> 3 Date: Sat, 3 Dec 2016 23:50:27 -0800 4 Subject: [PATCH] pax: Support xz compression with -J flag 5 6 --- 7 bin/pax/options.c | 25 ++++++++++++++++++++++--- 8 1 file changed, 22 insertions(+), 3 deletions(-) 9 10 diff --git a/bin/pax/options.c b/bin/pax/options.c 11 index 560478f2681..27de25d655b 100644 12 --- a/bin/pax/options.c 13 +++ b/bin/pax/options.c 14 @@ -154,6 +154,7 @@ static int xz_id(char *_blk, int _size); 15 #define GZIP_CMD "gzip" /* command to run as gzip */ 16 #define COMPRESS_CMD "compress" /* command to run as compress */ 17 #define BZIP2_CMD "bzip2" /* command to run as bzip2 */ 18 +#define XZ_CMD "xz" /* command to run as xz */ 19 20 /* 21 * Format specific routine table 22 @@ -300,7 +301,7 @@ pax_options(int argc, char **argv) 23 /* 24 * process option flags 25 */ 26 - while ((c=getopt(argc,argv,"ab:cdf:ijklno:p:rs:tuvwx:zB:DE:G:HLOPT:U:XYZ0")) 27 + while ((c=getopt(argc,argv,"ab:cdf:ijklno:p:rs:tuvwx:zB:DE:G:HJLOPT:U:XYZ0")) 28 != -1) { 29 switch (c) { 30 case 'a': 31 @@ -556,6 +557,12 @@ pax_options(int argc, char **argv) 32 Hflag = 1; 33 flg |= CHF; 34 break; 35 + case 'J': 36 + /* 37 + * use xz. Non standard option. 38 + */ 39 + gzip_program = XZ_CMD; 40 + break; 41 case 'L': 42 /* 43 * follow symlinks 44 @@ -731,7 +738,7 @@ tar_options(int argc, char **argv) 45 * process option flags 46 */ 47 while ((c = getoldopt(argc, argv, 48 - "b:cef:hjmopqruts:vwxzBC:HI:LNOPXZ014578")) != -1) { 49 + "b:cef:hjmopqruts:vwxzBC:HI:JLNOPXZ014578")) != -1) { 50 switch (c) { 51 case 'b': 52 /* 53 @@ -880,6 +887,12 @@ tar_options(int argc, char **argv) 54 incfiles[nincfiles - 1].file = optarg; 55 incfiles[nincfiles - 1].dir = chdname; 56 break; 57 + case 'J': 58 + /* 59 + * use xz. Non standard option. 60 + */ 61 + gzip_program = XZ_CMD; 62 + break; 63 case 'L': 64 /* 65 * follow symlinks 66 @@ -1163,7 +1176,7 @@ cpio_options(int argc, char **argv) 67 dflag = 1; 68 act = -1; 69 nodirs = 1; 70 - while ((c=getopt(argc,argv,"abcdfijklmoprstuvzABC:E:F:H:I:LO:SZ6")) != -1) 71 + while ((c=getopt(argc,argv,"abcdfijklmoprstuvzABC:E:F:H:I:JLO:SZ6")) != -1) 72 switch (c) { 73 case 'a': 74 /* 75 @@ -1347,6 +1360,12 @@ cpio_options(int argc, char **argv) 76 (void)fputs("\n\n", stderr); 77 cpio_usage(); 78 break; 79 + case 'J': 80 + /* 81 + * use xz. Non standard option. 82 + */ 83 + gzip_program = XZ_CMD; 84 + break; 85 case 'L': 86 /* 87 * follow symbolic links 88 -- 89 2.37.3 90