[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
glob() problem with double '//' in path
From: |
Kris Warkentin |
Subject: |
glob() problem with double '//' in path |
Date: |
Mon, 02 Feb 2004 14:23:09 -0500 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5) Gecko/20031007 |
I notice that when you build make with msdev studio, any paths that come
into glob() looking like, for example ../../rom//*.c, do not get
expanded properly.
This doesn't seem to be a problem with a cygwin or other unix built
make. I hacked a really stupid and ugly fix (we were supposed to go
beta today...) but I'm sure that there is probably a better way to do
it. Ideally, our makefile structure wouldn't be passing // in but it's
not a perfect world and this hack was easier to do in the short term.
Any ideas of a better way?
cheers,
Kris
Index: glob.c
===================================================================
RCS file: /product/tools/make/glob/glob.c,v
retrieving revision 1.4
diff -u -r1.4 glob.c
--- glob.c 24 Jul 2003 18:44:53 -0000 1.4
+++ glob.c 2 Feb 2004 19:18:41 -0000
@@ -371,6 +371,20 @@
size_t dirlen;
int status;
int oldcount;
+ char *blah = pattern, *bar = alloca(strlen(pattern)), *barptr;
+
+ barptr = bar;
+ while(*blah){
+ if(*blah == '/' && *(blah + 1) == '/'){
+ blah++;
+ continue;
+ }
+ *barptr = *blah;
+ barptr++;
+ blah++;
+ }
+ *barptr = '\0';
+ strcpy(pattern, bar);
if (pattern == NULL || pglob == NULL || (flags & ~__GLOB_FLAGS) != 0)
{
- glob() problem with double '//' in path,
Kris Warkentin <=