On 24 Feb 2017 10:42, Ulf Hermann wrote: > >> and the GNU variant is a whopping two lines of code: > >> > >> char *base = strrchr(path, '/'); > >> return base ? base + 1 : (char *)path; > > > > and we get straight to an example of why your solutions don't scale. > > your replacement is wrong. and ironically, it's wrong on Windows, > > which is the whole point of your work. '/' is not the path sep used > > on every system out there. it also does not properly handle systems > > (such as Windows) that have filesystem prefixes like C:\. > > Both basename variants' documentations only talk about '/'. This is not > the place where we should handle windows directory separators.
umm, sure it is. if dirname/basename don't handle the OS separator, then where do you think it should be handled ? every place that calls basename ? GNU/POSIX not talking about it isn't terribly relevant -- they don't care about systems like Windows that have diff path name semantics. although it's a moot point if you move everything to gnulib as they handle the issue properly. -mike
signature.asc
Description: Digital signature