Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions lib/std/modules/m_glob.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,18 @@ varargs string translate( string pat, int flag )
res += pat[i..i];
continue;
}
case '.':
case '.':
res += "\\" + pat[i..i];
continue;
case '*':
res += ".*";
continue;
case '?':
case '?':
res += ".";
continue;
case '[':
j=i;
// j=i; <= pat[i] == pat[j] == '['
j = i + 1
if( j<n && pat[j] == '!' ) j++;
#ifdef CARET_AS_NOT
if( j<n && pat[j] == '^' ) j++;
Expand Down Expand Up @@ -111,7 +112,7 @@ string* glob( mixed pathname ){
if( !stringp(pathname) ) return ({});
if( !has_magic(pathname) ){
if( path_exists( pathname ) ){
return ({ pathname });
return ({ pathname });
}
else{
return ({});
Expand All @@ -126,8 +127,8 @@ string* glob( mixed pathname ){
else{
list = ({ dirname });
}
result = ({}); // <= needed in both cases
if( !has_magic(basename) ){
result = ({});
i = sizeof(list);
while(i--){
dirname = list[i];
Expand All @@ -141,7 +142,6 @@ string* glob( mixed pathname ){
}
}
else{
result = ({});
i = sizeof(list);
while(i--){
dirname = list[i];
Expand All @@ -150,7 +150,7 @@ string* glob( mixed pathname ){
{
if( strlen(dirname) == 1 )
dirname = "";
else
else
dirname = dirname[0..<2];
}
sublist = glob1( dirname, basename );
Expand Down