Commit cc04ea9d authored by nanahira's avatar nanahira

Revert "fix getting command args"

This reverts commit 4db73567.
parent a8a12587
......@@ -63,57 +63,9 @@ int main(int argc, char* argv[]) {
wchar_t* command = GetCommandLineW();
char buffer[2048];
BufferIO::EncodeUTF8(command, buffer);
char* p = buffer;
argc = 0;
int j = 0;
bool in_QM = false, in_TEXT = false, in_SPACE = true;
while(*p) {
if(in_QM) {
if(*p == '\"')
in_QM = false;
else
++j;
} else {
switch(*p) {
case '\"': {
in_QM = true;
in_TEXT = true;
if(in_SPACE) {
argv[argc] = p + 1;
j = 0;
}
in_SPACE = FALSE;
break;
}
case ' ':
case '\t':
case '\n':
case '\r': {
if(in_TEXT) {
argv[argc][j] = '\0';
++argc;
}
in_TEXT = FALSE;
in_SPACE = TRUE;
break;
}
default: {
in_TEXT = TRUE;
if(in_SPACE) {
argv[argc] = p;
j = 1;
} else
++j;
in_SPACE = FALSE;
break;
}
}
}
++p;
}
argv[argc][j] = '\0';
++argc;
argv[argc] = NULL;
argv[0] = strtok(buffer, " ");
for(int i = 1; i < argc; ++i)
argv[i] = strtok(NULL, " ");
#endif // _WIN32
bool keep_on_return = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment