diff options
| author | eban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-11-20 01:24:28 +0000 |
|---|---|---|
| committer | eban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-11-20 01:24:28 +0000 |
| commit | 68e2ee693f7bc4a4c2841e7ff501e229c9e24ded (patch) | |
| tree | 2deb76f2fdcf895512edccb00a33ac02f3e7dabe /dir.c | |
| parent | 38d675b22a878ac68353528046833527c39ff619 (diff) | |
| download | ruby-68e2ee693f7bc4a4c2841e7ff501e229c9e24ded.tar.gz ruby-68e2ee693f7bc4a4c2841e7ff501e229c9e24ded.tar.xz ruby-68e2ee693f7bc4a4c2841e7ff501e229c9e24ded.zip | |
eban
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@1047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'dir.c')
| -rw-r--r-- | dir.c | 29 |
1 files changed, 24 insertions, 5 deletions
@@ -558,8 +558,9 @@ extract_elem(path) #endif void -rb_glob(path, func, arg) +rb_glob_helper(path, flag, func, arg) char *path; + int flag; void (*func)(); VALUE arg; { @@ -597,7 +598,7 @@ rb_glob(path, func, arg) recursive = 1; buf = ALLOC_N(char, strlen(base)+strlen(m)+3); sprintf(buf, "%s%s%s", base, (*base)?"":".", m); - rb_glob(buf, func, arg); + rb_glob_helper(buf, flag, func, arg); free(buf); } dirp = opendir(dir); @@ -613,11 +614,11 @@ rb_glob(path, func, arg) continue; buf = ALLOC_N(char, strlen(base)+NAMLEN(dp)+strlen(m)+6); sprintf(buf, "%s%s%s/**%s", base, (BASE)?"/":"", dp->d_name, m); - rb_glob(buf, func, arg); + rb_glob_helper(buf, flag, func, arg); free(buf); continue; } - if (fnmatch(magic, dp->d_name, FNM_PERIOD|FNM_PATHNAME) == 0) { + if (fnmatch(magic, dp->d_name, flag) == 0) { buf = ALLOC_N(char, strlen(base)+NAMLEN(dp)+2); sprintf(buf, "%s%s%s", base, (BASE)?"/":"", dp->d_name); if (!m) { @@ -642,7 +643,7 @@ rb_glob(path, func, arg) char *t = ALLOC_N(char, len+mlen+1); sprintf(t, "%s%s", link->path, m); - rb_glob(t, func, arg); + rb_glob_helper(t, flag, func, arg); free(t); } tmp = link; @@ -655,6 +656,24 @@ rb_glob(path, func, arg) } } +void +rb_glob(path, func, arg) + char *path; + void (*func)(); + VALUE arg; +{ + rb_glob_helper(path, FNM_PERIOD|FNM_PATHNAME, func, arg); +} + +void +rb_iglob(path, func, arg) + char *path; + void (*func)(); + VALUE arg; +{ + rb_glob_helper(path, FNM_PERIOD|FNM_PATHNAME|FNM_NOCASE, func, arg); +} + static void push_pattern(path, ary) char *path; |
