1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
eban 2000-09-25 13:39:58 +00:00
parent b617f5270c
commit ba2b829a0f

View file

@ -873,19 +873,18 @@ NtCmdGlob (NtCmdLineElement *patt)
{ {
ListInfo listinfo; ListInfo listinfo;
char buffer[MAXPATHLEN], *buf = buffer; char buffer[MAXPATHLEN], *buf = buffer;
char *p, *pend, *pb; char *p;
listinfo.head = listinfo.tail = 0; listinfo.head = listinfo.tail = 0;
if (patt->len >= MAXPATHLEN) if (patt->len >= MAXPATHLEN)
buf = ruby_xmalloc(patt->len + 1); buf = ruby_xmalloc(patt->len + 1);
p = patt->str; strncpy (buf, patt->str, patt->len);
pend = p + patt->len; buf[patt->len] = '\0';
pb = buf; for (p = buf; *p; p = CharNext(p))
for (; p < pend; p = CharNext(p)) if (*p == '\\')
*pb++ = *p == '\\' ? '/' : *p; *p = '/';
buf[patt->len] = 0;
rb_glob(buf, insert, (VALUE)&listinfo); rb_glob(buf, insert, (VALUE)&listinfo);
if (buf != buffer) if (buf != buffer)
free(buf); free(buf);