> From: Tim Ruehsen <[email protected]> > Date: Fri, 19 Dec 2014 16:32:29 +0100 > > From: =?UTF-8?q?Tim=20R=C3=BChsen?= <[email protected]> > Date: Fri, 19 Dec 2014 16:07:38 +0100 > Subject: [PATCH] gnulib: Use basename() from gnulib module 'dirname' > > Avoid basename incompatibilities between POSIX and GNU implementations. > Also, libgen.h isn't needed any more which increases compatibility. > --- > bootstrap.conf | 1 + > src/main.c | 7 ++----- > src/warc.c | 16 +++------------- > 3 files changed, 6 insertions(+), 18 deletions(-) > > diff --git a/bootstrap.conf b/bootstrap.conf > index 211f0ad..8d45475 100644 > --- a/bootstrap.conf > +++ b/bootstrap.conf > @@ -36,6 +36,7 @@ c-strcasestr > clock-time > close > connect > +dirname > fcntl > fnmatch > futimens > diff --git a/src/main.c b/src/main.c > index f511258..608a20c 100644 > --- a/src/main.c > +++ b/src/main.c > @@ -56,6 +56,7 @@ as that of the covered work. */ > #include "warc.h" > #include "version.h" > #include "c-strcase.h" > +#include "dirname.h" > #include <getopt.h> > #include <getpass.h> > #include <quote.h> > @@ -1033,11 +1034,7 @@ main (int argc, char **argv) > /* On VMS, lose the "dev:[dir]" prefix and the ".EXE;nnn" suffix. */ > exec_name = vms_basename (argv[0]); > #else /* def __VMS */ > - exec_name = strrchr (argv[0], PATH_SEPARATOR); > - if (!exec_name) > - exec_name = argv[0]; > - else > - ++exec_name; > + exec_name = basename (argv[0]);
Shouldn't this use base_name? AFAICS, this is what gnulib provides. > @@ -681,8 +676,7 @@ warc_write_warcinfo_record (char *filename) > > warc_timestamp (timestamp, sizeof(timestamp)); > > - filename_copy = strdup (filename); > - filename_basename = strdup (basename (filename_copy)); > + filename_basename = basename (filename); And likewise here. Otherwise, looks good, except that you need to leave fcntl.h there, as I wrote earlier. Thanks!
