From 851b8b9332ede0d780b3ba483b637e7c903646bc Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 2 Jul 2008 12:40:22 -0400 Subject: [PATCH] zgz: Remove support for a GZIP env variable. We don't need this in pristine-tar, and if could screw things up if a user set it. Closes: #488986 --- debian/changelog | 3 +++ zgz.c | 68 -------------------------------------------------------- 2 files changed, 3 insertions(+), 68 deletions(-) diff --git a/debian/changelog b/debian/changelog index 84cb31e..d91abc5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,9 @@ pristine-tar (0.15) UNRELEASED; urgency=low * Fix POD issues. Closes: #484165 + * zgz: Remove support for a GZIP env variable. We don't need this in + pristine-tar, and if could screw things up if a user set it. + Closes: #488986 -- Joey Hess Mon, 02 Jun 2008 15:37:47 -0400 diff --git a/zgz.c b/zgz.c index e6ace02..738c2f0 100644 --- a/zgz.c +++ b/zgz.c @@ -189,7 +189,6 @@ static void display_version(void); static void display_license(void); static const suffixes_t *check_suffix(char *, int); -static void prepend_gzip(char *, int *, char ***); static void print_verbage(const char *, const char *, off_t, off_t); static void copymodes(int fd, const struct stat *, const char *file); static int check_outfile(const char *outfile); @@ -235,9 +234,6 @@ main(int argc, char **argv) int len; int ch; - if ((gzip = getenv("GZIP")) != NULL) - prepend_gzip(gzip, &argc, &argv); - if (strcmp(progname, "gunzip") == 0 || strcmp(progname, "zcat") == 0 || strcmp(progname, "gzcat") == 0) { @@ -425,70 +421,6 @@ maybe_err(const char *fmt, ...) exit(2); } -/* split up $GZIP and prepend it to the argument list */ -static void -prepend_gzip(char *gzip, int *argc, char ***argv) -{ - char *s, **nargv, **ac; - int nenvarg = 0, i; - - /* scan how many arguments there are */ - for (s = gzip;;) { - while (*s == ' ' || *s == '\t') - s++; - if (*s == 0) - goto count_done; - nenvarg++; - while (*s != ' ' && *s != '\t') - if (*s++ == 0) - goto count_done; - } -count_done: - /* punt early */ - if (nenvarg == 0) - return; - - *argc += nenvarg; - ac = *argv; - - nargv = (char **)malloc((*argc + 1) * sizeof(char *)); - if (nargv == NULL) - maybe_err("malloc"); - - /* stash this away */ - *argv = nargv; - - /* copy the program name first */ - i = 0; - nargv[i++] = *(ac++); - - /* take a copy of $GZIP and add it to the array */ - s = strdup(gzip); - if (s == NULL) - maybe_err("strdup"); - for (;;) { - /* Skip whitespaces. */ - while (*s == ' ' || *s == '\t') - s++; - if (*s == 0) - goto copy_done; - nargv[i++] = s; - /* Find the end of this argument. */ - while (*s != ' ' && *s != '\t') - if (*s++ == 0) - /* Argument followed by NUL. */ - goto copy_done; - /* Terminate by overwriting ' ' or '\t' with NUL. */ - *s++ = 0; - } -copy_done: - - /* copy the original arguments and a NULL */ - while (*ac) - nargv[i++] = *(ac++); - nargv[i] = NULL; -} - /* compress input to output. Return bytes read, -1 on error */ static off_t gz_compress(int in, int out, off_t *gsizep, const char *origname, uint32_t mtime) -- 2.7.4