mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
- Do not interpret spaces within a quoted string as break marker.
svn path=/trunk/; revision=4857
This commit is contained in:
parent
a72bd6590c
commit
d4c1149b14
1 changed files with 20 additions and 2 deletions
|
@ -89,15 +89,33 @@ int expand(char* name, int flag)
|
||||||
|
|
||||||
int __getmainargs(int* argc, char*** argv, char*** env, int flag)
|
int __getmainargs(int* argc, char*** argv, char*** env, int flag)
|
||||||
{
|
{
|
||||||
int i, afterlastspace;
|
int i, afterlastspace, ignorespace, len;
|
||||||
|
|
||||||
/* missing threading init */
|
/* missing threading init */
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
afterlastspace = 0;
|
afterlastspace = 0;
|
||||||
|
ignorespace = 0;
|
||||||
|
len = strlen(_acmdln);
|
||||||
|
|
||||||
while (_acmdln[i]) {
|
while (_acmdln[i]) {
|
||||||
if (_acmdln[i] == ' ') {
|
if (_acmdln[i] == '"') {
|
||||||
|
if (_acmdln[i + 1] == '"') {
|
||||||
|
memmove(_acmdln + i, _acmdln + i + 1, len - i);
|
||||||
|
len--;
|
||||||
|
} else {
|
||||||
|
if(ignorespace) {
|
||||||
|
ignorespace = 0;
|
||||||
|
} else {
|
||||||
|
ignorespace = 1;
|
||||||
|
}
|
||||||
|
memmove(_acmdln + i, _acmdln + i + 1, len - i);
|
||||||
|
len--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_acmdln[i] == ' ' && !ignorespace) {
|
||||||
expand(strndup(_acmdln + afterlastspace, i - afterlastspace), flag);
|
expand(strndup(_acmdln + afterlastspace, i - afterlastspace), flag);
|
||||||
i++;
|
i++;
|
||||||
while (_acmdln[i]==' ')
|
while (_acmdln[i]==' ')
|
||||||
|
|
Loading…
Reference in a new issue