This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
Fix slash problem on win32 in libiberty basename()
- To: gdb-patches@sourceware.cygnus.com (GDB Patches)
- Subject: Fix slash problem on win32 in libiberty basename()
- From: toddpw@wrs.com (Todd Whitesel)
- Date: Tue, 11 May 1999 20:26:33 -0700 (PDT)
[ just who the heck do we send libiberty patches to anyway? ]
This patch allows libiberty basename() to grok both slash directions on win32.
Admittedly I am grafting in the machinery that would have been used in the gdb
directory, because that was the easiest way to get the bug report off my desk.
Tue May 11 20:22:48 PDT 1999 Todd Whitesel (toddpw@wrs.com)
* basename.c (basename): Accept both slash flavors on WIN32.
#!/bin/sh
patch -b -c -p 0 <<':END:PATCH:HUNKS:'
Index: basename.c
diff -c basename.c.orig basename.c
*** basename.c.orig Tue May 11 20:18:32 1999
--- basename.c Tue May 11 20:20:07 1999
***************
*** 20,25 ****
--- 20,31 ----
#include "ansidecl.h"
#include "libiberty.h"
+ #if defined(WIN32) || defined(_WIN32)
+ #define SLASH_P(x) ((x)=='/' || (x)=='\\')
+ #else
+ #define SLASH_P(x) ((x)=='/')
+ #endif
+
char *
basename (name)
const char *name;
***************
*** 28,34 ****
while (*name)
{
! if (*name++ == '/')
{
base = name;
}
--- 34,41 ----
while (*name)
{
! const char c = *name++;
! if (SLASH_P(c))
{
base = name;
}
:END:PATCH:HUNKS:
# eof
--
Todd Whitesel
toddpw @ wrs.com