{"thread":{"id":"19612","subject":"Re: [PATCH v6 2/3] compat: add a basename() compatibility function","startedAt":"2009-05-31T08:11:02Z","lastAt":"2009-05-31T08:11:02Z","messageCount":1,"participants":["j.sixt@viscovery.net"],"isPatch":true,"patchVersion":6,"patchTotal":3},"messages":[{"id":"115118","messageId":"54809.1243757462@viscovery.net","threadId":"19612","inReplyTo":null,"subject":"Re: [PATCH v6 2/3] compat: add a basename() compatibility function","fromName":"","fromEmail":"j.sixt@viscovery.net","sentAt":"2009-05-31T08:11:02Z","receivedAt":"2009-05-31T08:11:02Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"On Sun 31/05/09 06:42 , David Aguilar davvid@gmail.com sent:\n> On Sat, May 30, 2009 at 09:37:54PM -0700, David Aguilar wrote:\n> > Some systems such as Windows lack libgen.h so provide a\n> > basename() implementation for cross-platform use.\n> > [...]\n> > diff --git a/compat/basename.c b/compat/basename.c\n> > new file mode 100644\n> > index 0000000..c45716a\n> > --- /dev/null\n> > +++ b/compat/basename.c\n> > @@ -0,0 +1,19 @@\n> > +#include \"../git-compat-util.h\"\n> > +\n> > +/* Adapted from libiberty's basename.c.  */\n> > +char *gitbasename (char *path)\n> > +{\n> > +\tconst char *base;\n> > +\n> > +#ifdef USE_WIN32_FS\n> > +\t/* Skip over the disk name in MSDOS pathnames. */\n> > +\tif (isalpha(path[0]) && path[1] == ':')\n> > +\t\tpath += 2;\n> > +#endif\n> \n> Thanks for bearing through this series everyone.. ;)\n> \n> Can someone with better win32 knowledge let me know if the\n> USE_WIN32_FS stuff is needed for msysgit?\n\nNo, you don't need it: use\n\n\tif (has_dos_drive_prefix(path))\n\t\tpath += 2;\n\nwithout any #ifdef.\n\nThank _you_ for going through so many iterations.\n\nUnfortunately, it may take me a day or two until I can test the patches on \nWindows again.\n\n-- Hannes\n"}]}