Mail Archives: cygwin/2000/11/03/17:29:22
------_=_NextPart_000_01C045E4.E158FF20
Content-Type: text/plain
> Thanks for the patch but this really needs to be under the
> control of a
> CYGWIN setting. We already have CYGWIN=glob. Maybe something like
> CYGWIN=glob:ignorecase would be appropriate.
Here are patches to dcrt0.cc, environ.cc, and glob.c to do just that.
Note that ignore_case_with_glob is an int, not a BOOL like it should be. I
did that because I'm late getting home.
For future reference, is the way I did it The Right Way?
Brad :)
------_=_NextPart_000_01C045E4.E158FF20
Content-Type: application/octet-stream;
name="dcrt0.cc.patch"
Content-Disposition: attachment;
filename="dcrt0.cc.patch"
--- dcrt0.cc.orig Fri Nov 3 16:51:51 2000
+++ dcrt0.cc Fri Nov 3 16:59:01 2000
@@ -106,6 +106,7 @@
/* resourcelocks */ &_reslock, /* threadinterface */ &_mtinterf,
/* impure_ptr */ &reent_data,
};
+ int ignore_case_with_glob = 0;
};
char *old_title = NULL;
------_=_NextPart_000_01C045E4.E158FF20
Content-Type: application/octet-stream;
name="environ.cc.patch"
Content-Disposition: attachment;
filename="environ.cc.patch"
--- environ.cc.orig Sat Oct 28 01:41:43 2000
+++ environ.cc Fri Nov 3 16:59:44 2000
@@ -26,6 +26,7 @@
#include "environ.h"
extern BOOL allow_glob;
+extern int ignore_case_with_glob;
extern BOOL allow_ntea;
extern BOOL strip_title_path;
extern DWORD chunksize;
@@ -374,6 +375,26 @@
set_process_state,
};
+static void
+glob_init (const char * buf)
+{
+ if (!buf || !*buf)
+ {
+ allow_glob = FALSE;
+ ignore_case_with_glob = 0;
+ }
+ else if (strncasematch (buf, "ignorecase", 10))
+ {
+ allow_glob = TRUE;
+ ignore_case_with_glob = 1;
+ }
+ else
+ {
+ allow_glob = TRUE;
+ ignore_case_with_glob = 0;
+ }
+}
+
/* The structure below is used to set up an array which is used to
* parse the CYGWIN environment variable or, if enabled, options from
* the registry.
@@ -403,7 +424,7 @@
{"error_start", {func: &error_start_init}, isfunc, NULL, {{0}, {0}}},
{"export", {&export_settings}, justset, NULL, {{FALSE}, {TRUE}}},
{"forkchunk", {x: &chunksize}, justset, NULL, {{8192}, {0}}},
- {"glob", {&allow_glob}, justset, NULL, {{FALSE}, {TRUE}}},
+ {"glob", {func: &glob_init}, isfunc, NULL, {{0}, {s: "normal"}}},
{"ntea", {&allow_ntea}, justset, NULL, {{FALSE}, {TRUE}}},
{"ntsec", {&allow_ntsec}, justset, NULL, {{FALSE}, {TRUE}}},
{"reset_com", {&reset_com}, justset, NULL, {{FALSE}, {TRUE}}},
------_=_NextPart_000_01C045E4.E158FF20
Content-Type: application/octet-stream;
name="glob.c.patch"
Content-Disposition: attachment;
filename="glob.c.patch"
--- glob.c.orig Fri Nov 3 09:55:12 2000
+++ glob.c Fri Nov 3 17:12:08 2000
@@ -72,6 +72,7 @@
#include <sys/param.h>
#include <sys/stat.h>
+#include <ctype.h>
#include <dirent.h>
#include <errno.h>
#include <glob.h>
@@ -174,6 +175,8 @@
#undef MAXPATHLEN
#define MAXPATHLEN 16384
+extern int ignore_case_with_glob;
+
int
glob(pattern, flags, errfunc, pglob)
const char *pattern;
@@ -727,19 +730,44 @@
return(0);
if ((negate_range = ((*pat & M_MASK) == M_NOT)) != EOS)
++pat;
- while (((c = *pat++) & M_MASK) != M_END)
- if ((*pat & M_MASK) == M_RNG) {
- if (c <= k && k <= pat[1])
- ok = 1;
- pat += 2;
- } else if (c == k)
- ok = 1;
- if (ok == negate_range)
- return(0);
+
+ if (ignore_case_with_glob)
+ {
+ while (((c = *pat++) & M_MASK) != M_END)
+ if ((*pat & M_MASK) == M_RNG) {
+ if (tolower(c) <= tolower(k) && tolower(k) <= tolower(pat[1]))
+ ok = 1;
+ pat += 2;
+ } else if (tolower(c) == tolower(k))
+ ok = 1;
+ if (ok == negate_range)
+ return(0);
+ }
+ else
+ {
+ while (((c = *pat++) & M_MASK) != M_END)
+ if ((*pat & M_MASK) == M_RNG) {
+ if (c <= k && k <= pat[1])
+ ok = 1;
+ pat += 2;
+ } else if (c == k)
+ ok = 1;
+ if (ok == negate_range)
+ return(0);
+ }
break;
default:
- if (*name++ != c)
- return(0);
+ if (ignore_case_with_glob)
+ {
+ if (tolower(*name) != tolower(c))
+ return(0);
+ ++name;
+ }
+ else
+ {
+ if (*name++ != c)
+ return(0);
+ }
break;
}
}
------_=_NextPart_000_01C045E4.E158FF20
Content-Type: text/plain; charset=us-ascii
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
------_=_NextPart_000_01C045E4.E158FF20--
- Raw text -