/* 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-2017 Free Software
Foundation, Inc.
Copyright (C) 1992-1993 Jean-loup Gailly
#include <config.h>
#include <ctype.h>
#include <errno.h>
-
-#include "tailor.h"
-
#include <limits.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
#include <errno.h>
+#include "tailor.h"
#include "gzip.h"
+#include <dirname.h>
#include <xalloc.h>
#ifndef CHAR_BIT
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;
}