New upstream version 1.9
[debian/gzip] / util.c
diff --git a/util.c b/util.c
index c06bcc42ec7dc7233b0d6402f75997d0ccbc840c..bb5e9f3a49cefaa3004e4e72c6d4a618b2173f87 100644 (file)
--- a/util.c
+++ b/util.c
@@ -1,6 +1,6 @@
 /* util.c -- utility functions for gzip support
 
-   Copyright (C) 1997-1999, 2001-2002, 2006, 2009-2016 Free Software
+   Copyright (C) 1997-1999, 2001-2002, 2006, 2009-2018 Free Software
    Foundation, Inc.
    Copyright (C) 1992-1993 Jean-loup Gailly
 
@@ -29,6 +29,7 @@
 
 #include "tailor.h"
 #include "gzip.h"
+#include <dirname.h>
 #include <xalloc.h>
 
 #ifndef CHAR_BIT
@@ -299,18 +300,7 @@ char *
 gzip_base_name (fname)
     char *fname;
 {
-    char *p;
-
-    if ((p = strrchr(fname, PATH_SEP))  != NULL) fname = p+1;
-#ifdef PATH_SEP2
-    if ((p = strrchr(fname, PATH_SEP2)) != NULL) fname = p+1;
-#endif
-#ifdef PATH_SEP3
-    if ((p = strrchr(fname, PATH_SEP3)) != NULL) fname = p+1;
-#endif
-#ifdef SUFFIX_SEP
-    if ((p = strrchr(fname, SUFFIX_SEP)) != NULL) *p = '\0';
-#endif
+    fname = last_component (fname);
     if (casemap('A') == 'a') strlwr(fname);
     return fname;
 }