summaryrefslogtreecommitdiffstats
path: root/contrib/tcsh/glob.c
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2000-04-20 04:22:36 +0000
committerobrien <obrien@FreeBSD.org>2000-04-20 04:22:36 +0000
commitefebb8d2fa02976f24760fdc8c7444d9cbfc1ca3 (patch)
treeb621d4cee9510d59a22e8ba84f80bd04ed79bd74 /contrib/tcsh/glob.c
parent4ad28cefef28ce6bdb44a0532cfe20a2076bc694 (diff)
downloadFreeBSD-src-efebb8d2fa02976f24760fdc8c7444d9cbfc1ca3.zip
FreeBSD-src-efebb8d2fa02976f24760fdc8c7444d9cbfc1ca3.tar.gz
6.09.01 vendor update.
Diffstat (limited to 'contrib/tcsh/glob.c')
-rw-r--r--contrib/tcsh/glob.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/contrib/tcsh/glob.c b/contrib/tcsh/glob.c
index 01dee4d..f6a2fd2 100644
--- a/contrib/tcsh/glob.c
+++ b/contrib/tcsh/glob.c
@@ -158,6 +158,12 @@ globcharcoll(c1, c2)
if (c1 == c2)
return (0);
+ /*
+ * From kevin lyda <kevin@suberic.net>:
+ * strcoll does not guarantee case sorting, so we pre-process now:
+ */
+ if (islower(c1) && isupper(c2))
+ return (1);
s1[0] = c1;
s2[0] = c2;
s1[1] = s2[1] = '\0';
@@ -348,6 +354,14 @@ glob(pattern, flags, errfunc, pglob)
if (flags & GLOB_QUOTE) {
/* Protect the quoted characters */
while (bufnext < bufend && (c = *patnext++) != EOS)
+#ifdef DSPMBYTE
+ if (Ismbyte1(c) && *patnext != EOS)
+ {
+ *bufnext++ = (Char) c;
+ *bufnext++ = (Char) *patnext++;
+ }
+ else
+#endif /* DSPMBYTE */
if (c == QUOTE) {
if ((c = *patnext++) == EOS) {
c = QUOTE;
@@ -367,6 +381,14 @@ glob(pattern, flags, errfunc, pglob)
qpatnext = patbuf;
/* we don't need to check for buffer overflow any more */
while ((c = *qpatnext++) != EOS) {
+#ifdef DSPMBYTE
+ if (Ismbyte1(c) && *qpatnext != EOS)
+ {
+ *bufnext++ = CHAR(c);
+ *bufnext++ = CHAR(*qpatnext++);
+ }
+ else
+#endif /* DSPMBYTE */
switch (c) {
case LBRACKET:
c = *qpatnext;
@@ -452,7 +474,7 @@ glob(pattern, flags, errfunc, pglob)
}
return (globextend(patbuf, pglob));
}
- else if (!(flags & GLOB_NOSORT))
+ else if (!(flags & GLOB_NOSORT) && (pglob->gl_pathc != oldpathc))
qsort((char *) (pglob->gl_pathv + pglob->gl_offs + oldpathc),
pglob->gl_pathc - oldpathc, sizeof(char *),
(int (*) __P((const void *, const void *))) compare);
OpenPOWER on IntegriCloud