summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authorocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-03-08 06:32:40 +0000
committerocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-03-08 06:32:40 +0000
commit44175158a2d9b091b06944a35ef42d747472651d (patch)
treea545f9cfba393ac405e6d4e3517302f9d8a06ac1 /dir.c
parent5b989069366705b7fdfe19ac43bbe1a0cd798837 (diff)
* dir.c (range): treat incomplete '[' as ordinary character (like
has_magic does). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@5922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/dir.c b/dir.c
index b26eda4..48e93ca 100644
--- a/dir.c
+++ b/dir.c
@@ -97,6 +97,7 @@ range(pat, test, flags)
char test;
int flags;
{
+ char *first = pat;
int not, ok = 0;
int nocase = flags & FNM_CASEFOLD;
int escape = !(flags & FNM_NOESCAPE);
@@ -119,13 +120,13 @@ range(pat, test, flags)
pat++;
cend = pat[1];
if (!cend)
- return 0;
+ break;
pat += 2;
}
if (downcase(cstart) <= test && test <= downcase(cend))
ok = 1;
}
- return 0;
+ return test == '[' ? first : 0;
}
#define ISDIRSEP(c) (pathname && isdirsep(c))