Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/gzip pull across a few changes from the freebsd folks:



details:   https://anonhg.NetBSD.org/src/rev/73288a21a535
branches:  trunk
changeset: 758521:73288a21a535
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sat Nov 06 21:42:32 2010 +0000

description:
pull across a few changes from the freebsd folks:

http://svn.freebsd.org/changeset/base/213044
        - fixes gunzip issues
http://svn.freebsd.org/changeset/base/213927
        - fixes various typos and comments

and also an older change to add support for bzip2's "-k" option:
        don't delete the input file


thanks!

diffstat:

 usr.bin/gzip/gzip.c        |  21 ++++++++++++++++-----
 usr.bin/gzip/unpack.c      |  16 ++++++++--------
 usr.bin/gzip/zuncompress.c |   4 ++--
 3 files changed, 26 insertions(+), 15 deletions(-)

diffs (183 lines):

diff -r d0028bae7569 -r 73288a21a535 usr.bin/gzip/gzip.c
--- a/usr.bin/gzip/gzip.c       Sat Nov 06 21:34:24 2010 +0000
+++ b/usr.bin/gzip/gzip.c       Sat Nov 06 21:42:32 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gzip.c,v 1.97 2009/10/11 09:17:21 mrg Exp $    */
+/*     $NetBSD: gzip.c,v 1.98 2010/11/06 21:42:32 mrg Exp $    */
 
 /*
  * Copyright (c) 1997, 1998, 2003, 2004, 2006 Matthew R. Green
@@ -30,7 +30,7 @@
 #ifndef lint
 __COPYRIGHT("@(#) Copyright (c) 1997, 1998, 2003, 2004, 2006\
  Matthew R. Green.  All rights reserved.");
-__RCSID("$NetBSD: gzip.c,v 1.97 2009/10/11 09:17:21 mrg Exp $");
+__RCSID("$NetBSD: gzip.c,v 1.98 2010/11/06 21:42:32 mrg Exp $");
 #endif /* not lint */
 
 /*
@@ -148,7 +148,7 @@
 #define NUM_SUFFIXES (sizeof suffixes / sizeof suffixes[0])
 #define SUFFIX_MAXLEN  30
 
-static const char      gzip_version[] = "NetBSD gzip 20091011";
+static const char      gzip_version[] = "NetBSD gzip 20101018";
 
 static int     cflag;                  /* stdout mode */
 static int     dflag;                  /* decompress mode */
@@ -157,6 +157,7 @@
 
 #ifndef SMALL
 static int     fflag;                  /* force mode */
+static int     kflag;                  /* don't delete input files */
 static int     nflag;                  /* don't save name/timestamp */
 static int     Nflag;                  /* don't restore name/timestamp */
 static int     qflag;                  /* quiet mode */
@@ -238,6 +239,7 @@
        { "uncompress",         no_argument,            0,      'd' },
        { "force",              no_argument,            0,      'f' },
        { "help",               no_argument,            0,      'h' },
+       { "keep",               no_argument,            0,      'k' },
        { "list",               no_argument,            0,      'l' },
        { "no-name",            no_argument,            0,      'n' },
        { "name",               no_argument,            0,      'N' },
@@ -291,7 +293,7 @@
 #ifdef SMALL
 #define OPT_LIST "123456789cdhltV"
 #else
-#define OPT_LIST "123456789cdfhlNnqrS:tVv"
+#define OPT_LIST "123456789cdfhklNnqrS:tVv"
 #endif
 
        while ((ch = getopt_long(argc, argv, OPT_LIST, longopts, NULL)) != -1) {
@@ -318,6 +320,9 @@
                case 'f':
                        fflag = 1;
                        break;
+               case 'k':
+                       kflag = 1;
+                       break;
                case 'N':
                        nflag = 0;
                        Nflag = 1;
@@ -886,6 +891,9 @@
                        switch (error) {
                        /* Z_BUF_ERROR goes with Z_FINISH... */
                        case Z_BUF_ERROR:
+                               if (z.avail_out > 0 && !done_reading)
+                                       continue;
+
                        case Z_STREAM_END:
                        case Z_OK:
                                break;
@@ -1127,8 +1135,10 @@
 {
        struct stat nsb;
 
+       if (kflag)
+               return;
        if (stat(file, &nsb) != 0)
-               /* Must be gone alrady */
+               /* Must be gone already */
                return;
        if (nsb.st_dev != sb->st_dev || nsb.st_ino != sb->st_ino)
                /* Definitely a different file */
@@ -1991,6 +2001,7 @@
     "    --uncompress\n"
     " -f --force           force overwriting & compress links\n"
     " -h --help            display this help\n"
+    " -k --keep            don't delete input files during operation\n"
     " -l --list            list compressed file contents\n"
     " -N --name            save or restore original file name and time stamp\n"
     " -n --no-name         don't save original file name or time stamp\n"
diff -r d0028bae7569 -r 73288a21a535 usr.bin/gzip/unpack.c
--- a/usr.bin/gzip/unpack.c     Sat Nov 06 21:34:24 2010 +0000
+++ b/usr.bin/gzip/unpack.c     Sat Nov 06 21:42:32 2010 +0000
@@ -1,5 +1,5 @@
 /*     $FreeBSD: head/usr.bin/gzip/unpack.c 194579 2009-06-21 09:39:43Z delphij $      */
-/*     $NetBSD: unpack.c,v 1.1 2009/10/11 07:07:54 mrg Exp $   */
+/*     $NetBSD: unpack.c,v 1.2 2010/11/06 21:42:32 mrg Exp $   */
 
 /*-
  * Copyright (c) 2009 Xin LI <delphij%FreeBSD.org@localhost>
@@ -41,7 +41,7 @@
  * tree levels, each level would consume 1 byte (See [1]).
  *
  * After the symbol count table, there is the symbol table, storing
- * symbols represented by coresponding leaf node.  EOB is not being
+ * symbols represented by corresponding leaf node.  EOB is not being
  * explicitly transmitted (not necessary anyway) in the symbol table.
  *
  * Compressed data goes after the symbol table.
@@ -62,7 +62,7 @@
 /*
  * unpack descriptor
  *
- * Represent the huffman tree in a similiar way that pack(1) would
+ * Represent the huffman tree in a similar way that pack(1) would
  * store in a packed file.  We store all symbols in a linear table,
  * and store pointers to each level's first symbol.  In addition to
  * that, maintain two counts for each level: inner nodes count and
@@ -93,7 +93,7 @@
  * Caller is responsible to make sure that all of these pointers are
  * initialized (in our case, they all point to valid memory block).
  * We don't zero out pointers here because nobody else would ever
- * reference the memory block without scrubing them.
+ * reference the memory block without scrubbing them.
  */
 static void
 unpack_descriptor_fini(unpack_descriptor_t *unpackd)
@@ -118,7 +118,7 @@
        /*
         * The internal nodes would be 1/2 of total internal nodes and
         * leaf nodes in the next level.  For the last level there
-        * would be no internal node by defination.
+        * would be no internal node by definition.
         */
        if (level < unpackd->treelevels) {
                unpackd_fill_inodesin(unpackd, level + 1);
@@ -141,7 +141,7 @@
 
 /*
  * Read file header and construct the tree.  Also, prepare the buffered I/O
- * for decode rountine.
+ * for decode routine.
  *
  * Return value is uncompressed size.
  */
@@ -196,7 +196,7 @@
        /* We count from 0 so adjust to match array upper bound */
        unpackd->treelevels--;
 
-       /* Read the levels symbol count table and caculate total */
+       /* Read the levels symbol count table and calculate total */
        unpackd->symbol_size = 1;               /* EOB */
        for (i = 0; i <= unpackd->treelevels; i++) {
                if ((thisbyte = fgetc(unpackd->fpIn)) == EOF)
@@ -238,7 +238,7 @@
 
        /*
         * The symbolsin table has been constructed now.
-        * Caculate the internal nodes count table based on it.
+        * Calculate the internal nodes count table based on it.
         */
        unpackd_fill_inodesin(unpackd, 0);
 }
diff -r d0028bae7569 -r 73288a21a535 usr.bin/gzip/zuncompress.c
--- a/usr.bin/gzip/zuncompress.c        Sat Nov 06 21:34:24 2010 +0000
+++ b/usr.bin/gzip/zuncompress.c        Sat Nov 06 21:42:32 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: zuncompress.c,v 1.7 2009/04/12 10:31:14 lukem Exp $ */
+/*     $NetBSD: zuncompress.c,v 1.8 2010/11/06 21:42:32 mrg Exp $ */
 
 /*-
  * Copyright (c) 1985, 1986, 1992, 1993
@@ -114,7 +114,7 @@
                        code_int zs_ent;
                        code_int zs_hsize_reg;
                        int zs_hshift;
-               } w;                    /* Write paramenters */
+               } w;                    /* Write parameters */
                struct {
                        char_type *zs_stackp;
                        int zs_finchar;



Home | Main Index | Thread Index | Old Index