try restructuring rules to ensure reconf always run
[debian/gzip] / unzip.c
diff --git a/unzip.c b/unzip.c
index 349808aee8d0331eeba634893831d3e7da133914..55185a95c8974a81dff4a2e035df030e4d86e51f 100644 (file)
--- a/unzip.c
+++ b/unzip.c
@@ -1,8 +1,23 @@
 /* unzip.c -- decompress files in gzip or pkzip format.
- * Copyright (C) 1992-1993 Jean-loup Gailly
- * This is free software; you can redistribute it and/or modify it under the
- * terms of the GNU General Public License, see the file COPYING.
- *
+
+   Copyright (C) 1997-1999, 2009-2010 Free Software Foundation, Inc.
+   Copyright (C) 1992-1993 Jean-loup Gailly
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+/*
  * The code in this file is derived from the file funzip.c written
  * and put in the public domain by Mark Adler.
  */
    either deflated or stored.
  */
 
-#ifdef RCSID
-static char rcsid[] = "$Id: unzip.c,v 0.13 1993/06/10 13:29:00 jloup Exp $";
-#endif
-
 #include <config.h>
 #include "tailor.h"
 #include "gzip.h"
@@ -28,7 +39,7 @@ static char rcsid[] = "$Id: unzip.c,v 0.13 1993/06/10 13:29:00 jloup Exp $";
 #define  CRPFLG 1               /*  bit for encrypted entry */
 #define  EXTFLG 8               /*  bit for extended local header */
 #define LOCHOW 8                /* offset of compression method */
-#define LOCTIM 10               /* file mod time (for decryption) */
+/* #define LOCTIM 10               UNUSED file mod time (for decryption) */
 #define LOCCRC 14               /* offset of crc */
 #define LOCSIZ 18               /* offset of compressed size */
 #define LOCLEN 22               /* offset of uncompressed length */
@@ -62,7 +73,7 @@ int check_zipfile(in)
 
     if (inptr > insize || LG(h) != LOCSIG) {
        fprintf(stderr, "\n%s: %s: not a valid zip file\n",
-               progname, ifname);
+               program_name, ifname);
        exit_code = ERROR;
        return ERROR;
     }
@@ -70,7 +81,7 @@ int check_zipfile(in)
     if (method != STORED && method != DEFLATED) {
        fprintf(stderr,
                "\n%s: %s: first entry not deflated or stored -- use unzip\n",
-               progname, ifname);
+               program_name, ifname);
        exit_code = ERROR;
        return ERROR;
     }
@@ -78,7 +89,7 @@ int check_zipfile(in)
     /* If entry encrypted, decrypt and validate encryption header */
     if ((decrypt = h[LOCFLG] & CRPFLG) != 0) {
        fprintf(stderr, "\n%s: %s: encrypted file -- use unzip\n",
-               progname, ifname);
+               program_name, ifname);
        exit_code = ERROR;
        return ERROR;
     }
@@ -123,9 +134,9 @@ int unzip(in, out)
        int res = inflate();
 
        if (res == 3) {
-           error("out of memory");
+           xalloc_die ();
        } else if (res != 0) {
-           error("invalid compressed data--format violated");
+           gzip_error ("invalid compressed data--format violated");
        }
 
     } else if (pkzip && method == STORED) {
@@ -135,7 +146,7 @@ int unzip(in, out)
        if (n != LG(inbuf + LOCSIZ) - (decrypt ? RAND_HEAD_LEN : 0)) {
 
            fprintf(stderr, "len %ld, siz %ld\n", n, LG(inbuf + LOCSIZ));
-           error("invalid compressed data--length mismatch");
+           gzip_error ("invalid compressed data--length mismatch");
        }
        while (n--) {
            uch c = (uch)get_byte();
@@ -143,7 +154,7 @@ int unzip(in, out)
        }
        flush_window();
     } else {
-       error("internal error, invalid method");
+       gzip_error ("internal error, invalid method");
     }
 
     /* Get the crc and original length */
@@ -173,12 +184,12 @@ int unzip(in, out)
     /* Validate decompression */
     if (orig_crc != updcrc(outbuf, 0)) {
        fprintf(stderr, "\n%s: %s: invalid compressed data--crc error\n",
-               progname, ifname);
+               program_name, ifname);
        err = ERROR;
     }
     if (orig_len != (ulg)(bytes_out & 0xffffffff)) {
        fprintf(stderr, "\n%s: %s: invalid compressed data--length error\n",
-               progname, ifname);
+               program_name, ifname);
        err = ERROR;
     }
 
@@ -187,12 +198,12 @@ int unzip(in, out)
        if (to_stdout) {
            WARN((stderr,
                  "%s: %s has more than one entry--rest ignored\n",
-                 progname, ifname));
+                 program_name, ifname));
        } else {
            /* Don't destroy the input zip file */
            fprintf(stderr,
                    "%s: %s has more than one entry -- unchanged\n",
-                   progname, ifname);
+                   program_name, ifname);
            err = ERROR;
        }
     }