Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/pax PR/19490: Julio Merino: Teach tar about --sparse, -S...



details:   https://anonhg.NetBSD.org/src/rev/957ceb1641a3
branches:  trunk
changeset: 570170:957ceb1641a3
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Sep 26 23:46:00 2004 +0000

description:
PR/19490: Julio Merino: Teach tar about --sparse, -S option.
Do it for cpio too.

diffstat:

 bin/pax/options.c |  20 ++++++++++++++------
 bin/pax/tar.1     |   8 ++++++--
 2 files changed, 20 insertions(+), 8 deletions(-)

diffs (119 lines):

diff -r f61728990b43 -r 957ceb1641a3 bin/pax/options.c
--- a/bin/pax/options.c Sun Sep 26 22:49:05 2004 +0000
+++ b/bin/pax/options.c Sun Sep 26 23:46:00 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: options.c,v 1.77 2004/09/22 14:52:00 christos Exp $    */
+/*     $NetBSD: options.c,v 1.78 2004/09/26 23:46:00 christos Exp $    */
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)options.c  8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: options.c,v 1.77 2004/09/22 14:52:00 christos Exp $");
+__RCSID("$NetBSD: options.c,v 1.78 2004/09/26 23:46:00 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -122,6 +122,7 @@
 #define        OPT_FORCE_LOCAL                 13
 #define        OPT_INSECURE                    14
 #define        OPT_STRICT                      15
+#define        OPT_SPARSE                      16
 
 /*
  *     Format specific routine table - MUST BE IN SORTED ORDER BY NAME
@@ -741,6 +742,7 @@
                                                OPT_INSECURE },
        { "exclude",            required_argument,      0,
                                                OPT_EXCLUDE },
+       { "sparse",             no_argument,            0,      'S' },
 #if 0 /* Not implemented */
        { "catenate",           no_argument,            0,      'A' },  /* F */
        { "concatenate",        no_argument,            0,      'A' },  /* F */
@@ -767,7 +769,6 @@
                                                OPT_REMOVE_FILES },
        { "same-order",         no_argument,            0,      's' },
        { "preserve-order",     no_argument,            0,      's' },
-       { "sparse",             no_argument,            0,      'S' },
        { "null",               no_argument,            0,
                                                OPT_NULL },
        { "totals",             no_argument,            0,
@@ -809,7 +810,7 @@
         * process option flags
         */
        while ((c = getoldopt(argc, argv,
-           "+b:cef:hjklmopqrs:tuvwxzBC:HI:OPT:X:Z014578",
+           "+b:cef:hjklmopqrs:tuvwxzBC:HI:OPST:X:Z014578",
            tar_longopts, NULL))
            != -1)  {
                switch(c) {
@@ -1004,6 +1005,9 @@
                        rmleadslash = 0;
                        Aflag = 1;
                        break;
+               case 'S':
+                       /* do nothing; we already generate sparse files */
+                       break;
                case 'X':
                        /*
                         * GNU tar compat: exclude the files listed in optarg
@@ -1328,6 +1332,8 @@
        { "swap-halfwords",     no_argument,            0,      'S' },
        { "insecure",           no_argument,            0,
                                                OPT_INSECURE },
+       { "sparse",             no_argument,            0,
+                                               OPT_SPARSE },
 
 #ifdef notyet
 /* Not implemented */
@@ -1348,8 +1354,6 @@
                                                OPT_ONLY_VERIFY_CRC },
        { "rsh-command",        required_argument,      0,
                                                OPT_RSH_COMMAND },
-       { "sparce",             no_argument,            0,
-                                               OPT_SPARSE },
        { "version",            no_argument,            0,
                                                OPT_VERSION },
 #endif
@@ -1617,6 +1621,10 @@
                case OPT_INSECURE:
                        secure = 0;
                        break;
+
+               case OPT_SPARSE:
+                       /* do nothing; we already generate sparse files */
+                       break;
                default:
                        cpio_usage();
                        break;
diff -r f61728990b43 -r 957ceb1641a3 bin/pax/tar.1
--- a/bin/pax/tar.1     Sun Sep 26 22:49:05 2004 +0000
+++ b/bin/pax/tar.1     Sun Sep 26 23:46:00 2004 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: tar.1,v 1.15 2004/09/15 19:45:17 hubertf Exp $
+.\" $NetBSD: tar.1,v 1.16 2004/09/26 23:46:00 christos Exp $
 .\"
 .\" Copyright (c) 1996 SigmaSoft, Th. Lockert
 .\" All rights reserved.
@@ -34,7 +34,7 @@
 .Sh SYNOPSIS
 .Nm tar
 .Sm off
-.Oo \&- Oc {crtux} Op Fl befhjklmopqvwzHLOPXZ014578
+.Oo \&- Oc {crtux} Op Fl befhjklmopqvwzHLOPSXZ014578
 .Sm on
 .Op Ar archive
 .Op Ar blocksize
@@ -145,6 +145,10 @@
 .Ar pattern .
 When members of type directory are matched, the file hierarchy rooted at that
 directory is also matched.
+.It Fl S , -sparse
+This flag has no effect as
+.Nm
+always generates sparse files.
 .It Fl s Ar replstr
 Modify the file or archive member names specified by the
 .Ar pattern



Home | Main Index | Thread Index | Old Index