Am Montag, 22. Dezember 2014, 18:09:06 schrieb Eli Zaretskii: > > From: Tim Rühsen <[email protected]> > > Date: Sun, 21 Dec 2014 18:24:19 +0100 > > > > > > + 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. > > I'm sorry, but it looks like I'm still missing something. AFAICS, > gnulib doesn't offer 'basename', it only offers 'base_name'. I > verified this by running "nm -A" on libgnu.a. > > The node you cite from the Gnulib manual says: > > Gnulib module: — > > Portability problems fixed by Gnulib: > > Portability problems not fixed by Gnulib: > > This function is missing on some platforms: IRIX 6.5, Solaris 2.5.1, > mingw, MSVC 9, BeOS. glibc has two different functions basename: the POSIX > version and the GNU version. basename assumes file names in POSIX syntax; > it does not work with file names in Windows syntax. > > The Gnulib module dirname provides similar API, with function base_name, > that also works with Windows file names. > > My interpretation of this is: > > . Gnulib doesn't provide a substitute for this function (that's the > "Gnulib module: —" part above, which is explained in the parent > node). It is also consistent with "Portability problems not fixed > by Gnulib:" ^^^^^^^^^ > > . 'basename' as defined by Posix doesn't support Windows file names. > > . Gnulib provides a similar function called 'base_name' that does > work on Posix and Windows platforms alike. > > So it looks to me that my original comment was correct, and we should > call base_name. What am I missing?
I guess you are right. My problem is that I can't find any documentation for base_name(). I can look at the source to find out how it works (e.g. the returned pointer must be freed later). But without documentation, this function may change at any time. I have to ask on the the gnulib list for a statement. Tim
signature.asc
Description: This is a digitally signed message part.
