Commit 2b3bc201 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

wmic: Strip spaces once.

parent c00da2e5
...@@ -405,22 +405,25 @@ int __cdecl wmain(int argc, WCHAR *argv[]) ...@@ -405,22 +405,25 @@ int __cdecl wmain(int argc, WCHAR *argv[])
while (fgetws(cmd, sizeof(cmd), stdin) != NULL) while (fgetws(cmd, sizeof(cmd), stdin) != NULL)
{ {
cmd[wcslen(cmd)-1] = 0; /* remove trailing '\n' */ const WCHAR *stripped;
WINE_TRACE("command: %s\n", debugstr_w(cmd)); cmd[wcslen(cmd) - 1] = 0; /* remove trailing '\n' */
if (!wcsicmp( strip_spaces(cmd), L"exit" ) || !wcsicmp( strip_spaces(cmd), L"quit" )) stripped = strip_spaces( cmd );
WINE_TRACE("command: %s\n", debugstr_w(stripped));
if (!wcsicmp( stripped, L"exit" ) || !wcsicmp( stripped, L"quit" ))
return 0; return 0;
if (!cmd[0]) if (!stripped[0])
output_error( STRING_USAGE ); output_error( STRING_USAGE );
else else
{ {
int _argc; int new_argc;
WCHAR **_argv; WCHAR **new_argv;
_argv = CommandLineToArgvW( strip_spaces(cmd), &_argc ); new_argv = CommandLineToArgvW( stripped, &new_argc );
ret = process_args( _argc, _argv ); ret = process_args( new_argc, new_argv );
LocalFree(_argv); LocalFree( new_argv );
output_newline(); output_newline();
} }
...@@ -429,5 +432,5 @@ int __cdecl wmain(int argc, WCHAR *argv[]) ...@@ -429,5 +432,5 @@ int __cdecl wmain(int argc, WCHAR *argv[])
return ret; return ret;
} }
return process_args( argc - 1, &argv[1] ); return process_args( argc - 1, argv + 1 );
} }
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