eban
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
15b9494baa
commit
3634fde44d
@ -1,3 +1,7 @@
|
|||||||
|
Mon Nov 20 10:20:21 2000 WATANABE Hirofumi <eban@ruby-lang.org>
|
||||||
|
|
||||||
|
* dir.c, win32/win32.c, ruby.h: add rb_iglob().
|
||||||
|
|
||||||
Sat Nov 18 14:07:20 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
|
Sat Nov 18 14:07:20 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
|
||||||
|
|
||||||
* lib/net/http.rb: Socket#readline() reads until "\n", not "\r\n"
|
* lib/net/http.rb: Socket#readline() reads until "\n", not "\r\n"
|
||||||
|
29
dir.c
29
dir.c
@ -558,8 +558,9 @@ extract_elem(path)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
rb_glob(path, func, arg)
|
rb_glob_helper(path, flag, func, arg)
|
||||||
char *path;
|
char *path;
|
||||||
|
int flag;
|
||||||
void (*func)();
|
void (*func)();
|
||||||
VALUE arg;
|
VALUE arg;
|
||||||
{
|
{
|
||||||
@ -597,7 +598,7 @@ rb_glob(path, func, arg)
|
|||||||
recursive = 1;
|
recursive = 1;
|
||||||
buf = ALLOC_N(char, strlen(base)+strlen(m)+3);
|
buf = ALLOC_N(char, strlen(base)+strlen(m)+3);
|
||||||
sprintf(buf, "%s%s%s", base, (*base)?"":".", m);
|
sprintf(buf, "%s%s%s", base, (*base)?"":".", m);
|
||||||
rb_glob(buf, func, arg);
|
rb_glob_helper(buf, flag, func, arg);
|
||||||
free(buf);
|
free(buf);
|
||||||
}
|
}
|
||||||
dirp = opendir(dir);
|
dirp = opendir(dir);
|
||||||
@ -613,11 +614,11 @@ rb_glob(path, func, arg)
|
|||||||
continue;
|
continue;
|
||||||
buf = ALLOC_N(char, strlen(base)+NAMLEN(dp)+strlen(m)+6);
|
buf = ALLOC_N(char, strlen(base)+NAMLEN(dp)+strlen(m)+6);
|
||||||
sprintf(buf, "%s%s%s/**%s", base, (BASE)?"/":"", dp->d_name, m);
|
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);
|
free(buf);
|
||||||
continue;
|
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);
|
buf = ALLOC_N(char, strlen(base)+NAMLEN(dp)+2);
|
||||||
sprintf(buf, "%s%s%s", base, (BASE)?"/":"", dp->d_name);
|
sprintf(buf, "%s%s%s", base, (BASE)?"/":"", dp->d_name);
|
||||||
if (!m) {
|
if (!m) {
|
||||||
@ -642,7 +643,7 @@ rb_glob(path, func, arg)
|
|||||||
char *t = ALLOC_N(char, len+mlen+1);
|
char *t = ALLOC_N(char, len+mlen+1);
|
||||||
|
|
||||||
sprintf(t, "%s%s", link->path, m);
|
sprintf(t, "%s%s", link->path, m);
|
||||||
rb_glob(t, func, arg);
|
rb_glob_helper(t, flag, func, arg);
|
||||||
free(t);
|
free(t);
|
||||||
}
|
}
|
||||||
tmp = link;
|
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
|
static void
|
||||||
push_pattern(path, ary)
|
push_pattern(path, ary)
|
||||||
char *path;
|
char *path;
|
||||||
|
1
ruby.h
1
ruby.h
@ -397,6 +397,7 @@ void xfree _((void*));
|
|||||||
#define MEMCMP(p1,p2,type,n) memcmp((p1), (p2), sizeof(type)*(n))
|
#define MEMCMP(p1,p2,type,n) memcmp((p1), (p2), sizeof(type)*(n))
|
||||||
|
|
||||||
void rb_glob _((char*,void(*)(),VALUE));
|
void rb_glob _((char*,void(*)(),VALUE));
|
||||||
|
void rb_iglob _((char*,void(*)(),VALUE));
|
||||||
|
|
||||||
VALUE rb_define_class _((const char*,VALUE));
|
VALUE rb_define_class _((const char*,VALUE));
|
||||||
VALUE rb_define_module _((const char*));
|
VALUE rb_define_module _((const char*));
|
||||||
|
@ -961,7 +961,7 @@ NtCmdGlob (NtCmdLineElement *patt)
|
|||||||
for (p = buf; *p; p = CharNext(p))
|
for (p = buf; *p; p = CharNext(p))
|
||||||
if (*p == '\\')
|
if (*p == '\\')
|
||||||
*p = '/';
|
*p = '/';
|
||||||
rb_glob(buf, insert, (VALUE)&listinfo);
|
rb_iglob(buf, insert, (VALUE)&listinfo);
|
||||||
if (buf != buffer)
|
if (buf != buffer)
|
||||||
free(buf);
|
free(buf);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user