X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=gzip.c;h=cfc4fe3a2a7ff70ea28662cd52aef87c4b9257d7;hb=621b71dc5a3e523d4663d9021a9bbcc29c19690d;hp=32a229c4e044a28a1b36e6e61fea47521b6c59b9;hpb=6a692a8db14d2ce1f9ad166e6e426e723385b74d;p=debian%2Fgzip diff --git a/gzip.c b/gzip.c index 32a229c..cfc4fe3 100644 --- a/gzip.c +++ b/gzip.c @@ -29,10 +29,10 @@ */ static char const *const license_msg[] = { -"Copyright (C) 2016 Free Software Foundation, Inc.", +"Copyright (C) 2017 Free Software Foundation, Inc.", "Copyright (C) 1993 Jean-loup Gailly.", "This is free software. You may redistribute copies of it under the terms of", -"the GNU General Public License .", +"the GNU General Public License .", "There is NO WARRANTY, to the extent permitted by law.", 0}; @@ -77,6 +77,7 @@ static char const *const license_msg[] = { #include "ignore-value.h" #include "stat-time.h" #include "version.h" +#include "xalloc.h" #include "yesno.h" /* configuration */ @@ -1180,9 +1181,12 @@ local char *get_suffix(name) break; } } + + char *z_lower = xstrdup(z_suffix); + strlwr(z_lower); known_suffixes[suffix_of_builtin ? sizeof known_suffixes / sizeof *known_suffixes - 2 - : 0] = z_suffix; + : 0] = z_lower; suf = known_suffixes + suffix_of_builtin; nlen = strlen(name); @@ -1193,15 +1197,18 @@ local char *get_suffix(name) } strlwr(suffix); slen = strlen(suffix); + char *match = NULL; do { int s = strlen(*suf); if (slen > s && ! ISSLASH (suffix[slen - s - 1]) && strequ(suffix + slen - s, *suf)) { - return name+nlen-s; + match = name+nlen-s; + break; } } while (*++suf != NULL); + free(z_lower); - return NULL; + return match; }