mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
eban
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b617f5270c
commit
ba2b829a0f
1 changed files with 6 additions and 7 deletions
|
@ -873,19 +873,18 @@ NtCmdGlob (NtCmdLineElement *patt)
|
|||
{
|
||||
ListInfo listinfo;
|
||||
char buffer[MAXPATHLEN], *buf = buffer;
|
||||
char *p, *pend, *pb;
|
||||
char *p;
|
||||
|
||||
listinfo.head = listinfo.tail = 0;
|
||||
|
||||
if (patt->len >= MAXPATHLEN)
|
||||
buf = ruby_xmalloc(patt->len + 1);
|
||||
|
||||
p = patt->str;
|
||||
pend = p + patt->len;
|
||||
pb = buf;
|
||||
for (; p < pend; p = CharNext(p))
|
||||
*pb++ = *p == '\\' ? '/' : *p;
|
||||
buf[patt->len] = 0;
|
||||
strncpy (buf, patt->str, patt->len);
|
||||
buf[patt->len] = '\0';
|
||||
for (p = buf; *p; p = CharNext(p))
|
||||
if (*p == '\\')
|
||||
*p = '/';
|
||||
rb_glob(buf, insert, (VALUE)&listinfo);
|
||||
if (buf != buffer)
|
||||
free(buf);
|
||||
|
|
Loading…
Reference in a new issue