Imported Debian patch 1.5-16
[debian/pax] / options.c
index 4aea6004423b0375fbcbb5898d2b52759cce786e..49592e662eb0fa78ca31b517db8d9e9dd02c94a7 100644 (file)
--- a/options.c
+++ b/options.c
@@ -64,6 +64,8 @@ static char rcsid[] = "$OpenBSD: options.c,v 1.34 1998/09/20 02:22:22 millert Ex
 #include "tar.h"
 #include "extern.h"
 
+#include "fgetln.h"    /* added, David */
+
 /*
  * Routines which handle command line options
  */
@@ -85,6 +87,7 @@ static void cpio_usage __P((void));
 
 #define GZIP_CMD       "gzip"          /* command to run as gzip */
 #define COMPRESS_CMD   "compress"      /* command to run as compress */
+#define BZIP2_CMD      "bzip2"         /* command to run as bzip2 */
 
 /*
  *     Format specific routine table - MUST BE IN SORTED ORDER BY NAME
@@ -204,7 +207,7 @@ pax_options(argc, argv)
        /*
         * process option flags
         */
-       while ((c=getopt(argc,argv,"ab:cdf:iklno:p:rs:tuvwx:zB:DE:G:HLPT:U:XYZ"))
+       while ((c=getopt(argc,argv,"ab:cdf:ijklno:p:rs:tuvwx:zB:DE:G:HLPT:U:XYZ"))
            != EOF) {
                switch (c) {
                case 'a':
@@ -251,6 +254,13 @@ pax_options(argc, argv)
                        iflag = 1;
                        flg |= IF;
                        break;
+               case 'j':
+                       /*
+                        * use bzip2.  Non standard option.
+                        */
+                       zflag = 1;
+                       gzip_program = BZIP2_CMD;
+                       break;
                case 'k':
                        /*
                         * do not clobber files that exist
@@ -613,7 +623,7 @@ tar_options(argc, argv)
         * process option flags
         */
        while ((c = getoldopt(argc, argv,
-           "b:cef:hmopruts:vwxzBC:HLOPXZ014578"))
+           "b:cef:hjmopruts:vwxzBC:HLOPXZ014578"))
            != EOF) {
                switch(c) {
                case 'b':
@@ -659,6 +669,13 @@ tar_options(argc, argv)
                         */
                        Lflag = 1;
                        break;
+               case 'j':
+                       /*
+                        * use bzip2.  Non standard option.
+                        */
+                       zflag = 1;
+                       gzip_program = BZIP2_CMD;
+                       break;
                case 'm':
                        /*
                         * do not preserve modification time
@@ -938,7 +955,7 @@ cpio_options(argc, argv)
        dflag = 1;
        act = -1;
        nodirs = 1;
-       while ((c=getopt(argc,argv,"abcdfiklmoprstuvzABC:E:F:H:I:LO:SZ6")) != EOF)
+       while ((c=getopt(argc,argv,"abcdfijklmoprstuvzABC:E:F:H:I:LO:SZ6")) != EOF)
                switch (c) {
                        case 'a':
                                /*
@@ -975,6 +992,13 @@ cpio_options(argc, argv)
                                 */
                                act = EXTRACT;
                                break;
+                       case 'j':
+                               /*
+                                * use bzip2.  Non standard option.
+                                */
+                               zflag = 1;
+                               gzip_program = BZIP2_CMD;
+                               break;
                        case 'k':
                                break;
                        case 'l':
@@ -1452,18 +1476,18 @@ void
 pax_usage()
 #endif
 {
-       (void)fputs("usage: pax [-cdnv] [-E limit] [-f archive] ", stderr);
+       (void)fputs("usage: pax [-cdjnvz] [-E limit] [-f archive] ", stderr);
        (void)fputs("[-s replstr] ... [-U user] ...", stderr);
        (void)fputs("\n           [-G group] ... ", stderr);
        (void)fputs("[-T [from_date][,to_date]] ... ", stderr);
        (void)fputs("[pattern ...]\n", stderr);
-       (void)fputs("       pax -r [-cdiknuvDYZ] [-E limit] ", stderr);
+       (void)fputs("       pax -r [-cdijknuvzDYZ] [-E limit] ", stderr);
        (void)fputs("[-f archive] [-o options] ... \n", stderr);
        (void)fputs("           [-p string] ... [-s replstr] ... ", stderr);
        (void)fputs("[-U user] ... [-G group] ...\n           ", stderr);
        (void)fputs("[-T [from_date][,to_date]] ... ", stderr);
        (void)fputs(" [pattern ...]\n", stderr);
-       (void)fputs("       pax -w [-dituvHLPX] [-b blocksize] ", stderr);
+       (void)fputs("       pax -w [-dijtuvzHLPX] [-b blocksize] ", stderr);
        (void)fputs("[ [-a] [-f archive] ] [-x format] \n", stderr);
        (void)fputs("           [-B bytes] [-s replstr] ... ", stderr);
        (void)fputs("[-o options] ... [-U user] ...", stderr);
@@ -1491,7 +1515,7 @@ void
 tar_usage()
 #endif
 {
-       (void)fputs("usage: tar -{txru}[cevfbmopswzBHLPXZ014578] [tapefile] ",
+       (void)fputs("usage: tar -{txru}[cevfbjmopswzBHLPXZ014578] [tapefile] ",
                 stderr);
        (void)fputs("[blocksize] [replstr] [-C directory] file1 file2...\n",
            stderr);
@@ -1511,9 +1535,9 @@ void
 cpio_usage()
 #endif
 {
-       (void)fputs("usage: cpio -o [-aABcLvVzZ] [-C bytes] [-H format] [-O archive]\n", stderr);
+       (void)fputs("usage: cpio -o [-aABcjLvVzZ] [-C bytes] [-H format] [-O archive]\n", stderr);
        (void)fputs("               [-F archive] < name-list [> archive]\n", stderr);
-       (void)fputs("       cpio -i [-bBcdfmnrsStuvVzZ6] [-C bytes] [-E file] [-H format]\n", stderr);
+       (void)fputs("       cpio -i [-bBcdfjmnrsStuvVzZ6] [-C bytes] [-E file] [-H format]\n", stderr);
        (void)fputs("               [-I archive] [-F archive] [pattern...] [< archive]\n", stderr);
        (void)fputs("       cpio -p [-adlLmuvV] destination-directory < name-list\n", stderr);
        exit(1);