OSDN Git Service

Accomodate building under cygwin
authorEric Andersen <andersen@codepoet.org>
Wed, 28 May 2003 07:15:46 +0000 (07:15 -0000)
committerEric Andersen <andersen@codepoet.org>
Wed, 28 May 2003 07:15:46 +0000 (07:15 -0000)
extra/gcc-uClibc/gcc-uClibc.c

index b283ed0..201f0ac 100644 (file)
@@ -75,7 +75,6 @@
 #include <stdarg.h>
 #include <string.h>
 #include <unistd.h>
-#include <libgen.h>
 
 #include "gcc-uClibc.h"
 
@@ -90,6 +89,22 @@ static char nostdlib[] = "-nostdlib";
 static char nostdinc_plus[] = "-nostdinc++";
 #endif
 
+/* Include a local implementation of basename, since this
+ * uses the host system's C lib, and CYGWIN apparently
+ * doesn't provide an implementation of basename(). */
+char *basename(const char *path)
+{
+       register const char *s;
+       register const char *p;
+       p = s = path;
+       while (*s) {
+               if (*s++ == '/') {
+                       p = s;
+               }
+       }
+       return (char *) p;
+}
+
 
 extern void *xmalloc(size_t size)
 {