Index: misc.c =================================================================== --- misc.c (revisión: 38802) +++ misc.c (copia de trabajo) @@ -384,8 +384,106 @@ return arg; } +/* splitspace() is a function which uses JUST spaces as delimeters.split() uses "/" AND spaces. + The way of work is real similar to split(),search the difference ;) + splitspace is needed for commands as "move" command where paths as C:\this/is\allowed/ are allowed*/ +LPTSTR *splitspace (LPTSTR s, LPINT args, BOOL expand_wildcards) +{ + LPTSTR *arg; + LPTSTR start; + LPTSTR q; + INT ac; + INT len; + BOOL bQuoted = FALSE; + arg = cmd_alloc (sizeof (LPTSTR)); + if (!arg) + return NULL; + *arg = NULL; + ac = 0; + while (*s) + { + /* skip leading spaces */ + while (*s && (_istspace (*s) || _istcntrl (*s))) + ++s; + + /* if quote (") then set bQuoted */ + if (*s == _T('\"')) + { + ++s; + bQuoted = TRUE; + } + + start = s; + + /* the first character can be '/' */ + if (*s == _T('/')) + ++s; + + /* skip to next word delimiter or start of next option */ + if (bQuoted) + { + while (_istprint (*s) && (*s != _T('\"')) && (*s != _T('/'))) + ++s; + } + else + { + while (_istprint (*s) && !_istspace (*s)) + ++s; + } + + /* a word was found */ + if (s != start) + { + q = cmd_alloc (((len = s - start) + 1) * sizeof (TCHAR)); + if (!q) + { + return NULL; + } + memcpy (q, start, len * sizeof (TCHAR)); + q[len] = _T('\0'); + if (expand_wildcards && _T('/') != *start && + (NULL != _tcschr(q, _T('*')) || NULL != _tcschr(q, _T('?')))) + { + if (! expand(&ac, &arg, q)) + { + cmd_free (q); + freep (arg); + return NULL; + } + } + else + { + if (! add_entry(&ac, &arg, q)) + { + cmd_free (q); + freep (arg); + return NULL; + } + } + cmd_free (q); + } + + /* adjust string pointer if quoted (") */ + if (bQuoted) + { + /* Check to make sure if there is no ending " + * we dont run over the null char */ + if(*s == _T('\0')) + { + break; + } + ++s; + bQuoted = FALSE; + } + } + + *args = ac; + + return arg; +} + /* * freep -- frees memory used for a call to split * Index: move.c =================================================================== --- move.c (revisión: 38802) +++ move.c (copia de trabajo) @@ -137,7 +137,7 @@ } nErrorLevel = 0; - arg = split (param, &argc, FALSE); + arg = splitspace(param, &argc, FALSE); nFiles = argc; /* read options */