Mail Archives: cygwin/2000/11/10/14:23:54
------_=_NextPart_000_01C04B4A.60741FA0
Content-Type: text/plain
Okay, let's try this again. :)
Attached are patches making yet another attempt to provide case-insensitive
yada yada yada.
Legal stuff:
--- cut here ---
All of the work I perform for the Cygwin project is mine. My employer has
no claim to it.
I hereby assign copyright for the work to Red Hat.
--- cut here ---
Is that enough?
Brad Town
------_=_NextPart_000_01C04B4A.60741FA0
Content-Type: application/octet-stream;
name="dcrt0.cc.patch"
Content-Disposition: attachment;
filename="dcrt0.cc.patch"
--- dcrt0.cc.orig Wed Nov 8 10:15:22 2000
+++ dcrt0.cc Fri Nov 10 13:51:11 2000
@@ -106,6 +106,7 @@ extern "C"
/* resourcelocks */ &_reslock, /* threadinterface */ &_mtinterf,
/* impure_ptr */ &reent_data,
};
+ BOOL ignore_case_with_glob = FALSE;
};
char *old_title = NULL;
@@ -834,6 +835,9 @@ dll_crt0_1 ()
set_errno (0);
return;
}
+
+ /* Disable case-insensitive globbing */
+ ignore_case_with_glob = FALSE;
/* Flush signals and ensure that signal thread is up and running. Can't
do this for noncygwin case since the signal thread is blocked due to
------_=_NextPart_000_01C04B4A.60741FA0
Content-Type: application/octet-stream;
name="environ.cc.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="environ.cc.patch"
--- environ.cc.orig Thu Nov 9 09:04:53 2000=0A=
+++ environ.cc Thu Nov 9 10:16:41 2000=0A=
@@ -27,6 +27,7 @@ details. */=0A=
#include "perprocess.h"=0A=
=0A=
extern BOOL allow_glob;=0A=
+extern BOOL ignore_case_with_glob;=0A=
extern BOOL allow_ntea;=0A=
extern BOOL strip_title_path;=0A=
extern DWORD chunksize;=0A=
@@ -380,6 +381,31 @@ enum settings=0A=
set_process_state,=0A=
};=0A=
=0A=
+/* When BUF is:=0A=
+ * null or empty: disables globbing=0A=
+ * "ignorecase": enables case-insensitive globbing=0A=
+ * anything else: enables case-sensitive globbing=0A=
+ */=0A=
+static void=0A=
+glob_init (const char *buf)=0A=
+{=0A=
+ if (!buf || !*buf)=0A=
+ {=0A=
+ allow_glob =3D FALSE;=0A=
+ ignore_case_with_glob =3D FALSE;=0A=
+ }=0A=
+ else if (strncasematch (buf, "ignorecase", 10))=0A=
+ {=0A=
+ allow_glob =3D TRUE;=0A=
+ ignore_case_with_glob =3D TRUE;=0A=
+ }=0A=
+ else=0A=
+ {=0A=
+ allow_glob =3D TRUE;=0A=
+ ignore_case_with_glob =3D FALSE;=0A=
+ }=0A=
+}=0A=
+=0A=
/* The structure below is used to set up an array which is used to=0A=
* parse the CYGWIN environment variable or, if enabled, options =
from=0A=
* the registry.=0A=
@@ -409,7 +435,7 @@ struct parse_thing=0A=
{"error_start", {func: &error_start_init}, isfunc, NULL, {{0}, =
{0}}},=0A=
{"export", {&export_settings}, justset, NULL, {{FALSE}, {TRUE}}},=0A=
{"forkchunk", {x: &chunksize}, justset, NULL, {{8192}, {0}}},=0A=
- {"glob", {&allow_glob}, justset, NULL, {{FALSE}, {TRUE}}},=0A=
+ {"glob", {func: &glob_init}, isfunc, NULL, {{0}, {s: "normal"}}},=0A=
{"ntea", {&allow_ntea}, justset, NULL, {{FALSE}, {TRUE}}},=0A=
{"ntsec", {&allow_ntsec}, justset, NULL, {{FALSE}, {TRUE}}},=0A=
{"reset_com", {&reset_com}, justset, NULL, {{FALSE}, {TRUE}}},=0A=
------_=_NextPart_000_01C04B4A.60741FA0
Content-Type: application/octet-stream;
name="glob.c.patch"
Content-Disposition: attachment;
filename="glob.c.patch"
--- glob.c.orig Mon Nov 6 10:02:50 2000
+++ glob.c Thu Nov 9 10:03:56 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>
@@ -81,6 +82,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <windows.h>
#ifdef __weak_alias
#ifdef __LIBC12_SOURCE__
@@ -174,6 +176,8 @@ static void qprintf __P((const char *,
#undef MAXPATHLEN
#define MAXPATHLEN 16384
+extern BOOL ignore_case_with_glob;
+
int
glob(pattern, flags, errfunc, pglob)
const char *pattern;
@@ -727,19 +731,41 @@ match(name, pat, patend)
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 (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;
+ }
+ 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_01C04B4A.60741FA0
Content-Type: application/octet-stream;
name="ChangeLog.mine"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="ChangeLog.mine"
Fri Nov 10 13:48:44 2000 Bradley A. Town <townba AT pobox DOT com>=0A=
* dcrt0.cc: New global variable `ignore_case_with_glob'.=0A=
(dll_crt0_1): Disable case-insensitive globbing before calling=0A=
`main'.=0A=
* environ.cc (glob_init): New static function to set or clear=0A=
`ignore_case_with_glob'.=0A=
(known): Changed "glob" entry to call `glob_init'.=0A=
* glob.c (match): Use case-insensitive globbing if needed.=0A=
------_=_NextPart_000_01C04B4A.60741FA0
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_01C04B4A.60741FA0--
- Raw text -