This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Fix slash problem on win32 in libiberty basename()


[ 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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]