compat: add a basename() compatibility function
On Sun 31/05/09 06:42 , David Aguilar [email protected] sent:
Quoted 25 lines · David Aguilar
Quoted 11 lines
Some systems such as Windows lack
libgen.hso provide abasename()implementation for cross-platform use. [...]compat/basename.c new file +2
-0@@ -0,0 +1,19 @@ +#include "../git-compat-util.h" +compat/basename.c line 12
Quoted 10 lines
compat/basename.c new file +10
-0+/* Adapted from libiberty's basename.c. */ +char *gitbasename (char *path) +{ +const char *base; + +#ifdef USE_WIN32_FS +/* Skip over the disk name in MSDOS pathnames. */ +if (isalpha (path[0 ]) && path[1 ] ==':' ) + path +=2 ; +#endif Thanks for bearing through this series everyone.. ;)
Quoted 2 lines
Can someone with better win32 knowledge let me know if the
USE_WIN32_FSstuff is needed for msysgit?
No, you don't need it: use
if (has_dos_drive_prefix(path)) path += 2;
without any #ifdef.
Thank _you_ for going through so many iterations.
Unfortunately, it may take me a day or two until I can test the patches on Windows again.
-- Hannes