bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-wget] Building and testing wget 1.16.1 on MinGW


From: Tim Rühsen
Subject: Re: [Bug-wget] Building and testing wget 1.16.1 on MinGW
Date: Sun, 21 Dec 2014 18:24:19 +0100
User-agent: KMail/4.14.2 (Linux/3.16.0-4-amd64; KDE/4.14.2; x86_64; ; )

Am Sonntag, 21. Dezember 2014, 18:33:06 schrieb Eli Zaretskii:
> > From: Tim Ruehsen <address@hidden>
> > Date: Fri, 19 Dec 2014 16:32:29 +0100
> > 
> > From: =?UTF-8?q?Tim=20R=C3=BChsen?= <address@hidden>
> > 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.

base_name() is a similar function (but I couldn't find a documentation).
https://www.gnu.org/software/gnulib/manual/html_node/basename.html

The most important part seems to leave libgen.h away. To avoid the POSIX 
basename function.

> 
> > @@ -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.

I pushed the patch today amended to include fcntl.h if WINDOWS has been 
defined.

Thanks for testing.

Tim

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]