* dcrt0.cc: New global variable `ignore_case_with_glob'.
(dll_crt0_1): Disable case-insensitive globbing before calling `main'. * environ.cc (glob_init): New static function to set or clear `ignore_case_with_glob'. (known): Changed "glob" entry to call `glob_init'. * glob.c (match): Use case-insensitive globbing if needed.
This commit is contained in:
parent
466ebd61d3
commit
6ccb6bcf3d
|
@ -1,3 +1,12 @@
|
|||
Fri Nov 10 13:48:44 2000 Bradley A. Town <townba@pobox.com>
|
||||
|
||||
* dcrt0.cc: New global variable `ignore_case_with_glob'.
|
||||
(dll_crt0_1): Disable case-insensitive globbing before calling `main'.
|
||||
* environ.cc (glob_init): New static function to set or clear
|
||||
`ignore_case_with_glob'.
|
||||
(known): Changed "glob" entry to call `glob_init'.
|
||||
* glob.c (match): Use case-insensitive globbing if needed.
|
||||
|
||||
Thu Nov 9 14:30:00 2000 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* dir.cc (readdir): Avoid reading from the beginning when
|
||||
|
|
|
@ -106,6 +106,7 @@ extern "C"
|
|||
/* resourcelocks */ &_reslock, /* threadinterface */ &_mtinterf,
|
||||
/* impure_ptr */ &reent_data,
|
||||
};
|
||||
BOOL ignore_case_with_glob = FALSE;
|
||||
};
|
||||
|
||||
char *old_title = NULL;
|
||||
|
@ -835,6 +836,9 @@ dll_crt0_1 ()
|
|||
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
|
||||
LoadLibrary serialization. */
|
||||
|
|
|
@ -27,6 +27,7 @@ details. */
|
|||
#include "perprocess.h"
|
||||
|
||||
extern BOOL allow_glob;
|
||||
extern BOOL ignore_case_with_glob;
|
||||
extern BOOL allow_ntea;
|
||||
extern BOOL strip_title_path;
|
||||
extern DWORD chunksize;
|
||||
|
@ -380,6 +381,31 @@ enum settings
|
|||
set_process_state,
|
||||
};
|
||||
|
||||
/* When BUF is:
|
||||
* null or empty: disables globbing
|
||||
* "ignorecase": enables case-insensitive globbing
|
||||
* anything else: enables case-sensitive globbing
|
||||
*/
|
||||
static void
|
||||
glob_init (const char *buf)
|
||||
{
|
||||
if (!buf || !*buf)
|
||||
{
|
||||
allow_glob = FALSE;
|
||||
ignore_case_with_glob = FALSE;
|
||||
}
|
||||
else if (strncasematch (buf, "ignorecase", 10))
|
||||
{
|
||||
allow_glob = TRUE;
|
||||
ignore_case_with_glob = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
allow_glob = TRUE;
|
||||
ignore_case_with_glob = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* 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.
|
||||
|
@ -409,7 +435,7 @@ struct parse_thing
|
|||
{"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}}},
|
||||
|
|
|
@ -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 *, 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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue