Commit ebd110bc authored by François Gouget's avatar François Gouget Committed by Alexandre Julliard

Fix command-line parsing for Winelib applications.

parent 933733ce
...@@ -629,8 +629,18 @@ void BuildSpec32File( FILE *outfile ) ...@@ -629,8 +629,18 @@ void BuildSpec32File( FILE *outfile )
" extern char **__wine_main_argv;\n" " extern char **__wine_main_argv;\n"
" STARTUPINFOA info;\n" " STARTUPINFOA info;\n"
" char *cmdline = GetCommandLineA();\n" " char *cmdline = GetCommandLineA();\n"
" while (*cmdline && *cmdline != ' ') cmdline++;\n" " int bcount=0, in_quotes=0;\n"
" if (*cmdline) cmdline++;\n" " while (*cmdline) {\n"
" if ((*cmdline=='\\t' || *cmdline==' ') && !in_quotes) break;\n"
" else if (*cmdline=='\\\\') bcount++;\n"
" else if (*cmdline=='\\\"') {\n"
" if ((bcount & 1)==0) in_quotes=!in_quotes;\n"
" bcount=0;\n"
" }\n"
" else bcount=0;\n"
" cmdline++;\n"
" }\n"
" while (*cmdline=='\\t' || *cmdline==' ') cmdline++;\n"
" GetStartupInfoA( &info );\n" " GetStartupInfoA( &info );\n"
" if (!(info.dwFlags & 1)) info.wShowWindow = 1;\n" " if (!(info.dwFlags & 1)) info.wShowWindow = 1;\n"
" _ARGC = __wine_main_argc;\n" " _ARGC = __wine_main_argc;\n"
...@@ -666,8 +676,18 @@ void BuildSpec32File( FILE *outfile ) ...@@ -666,8 +676,18 @@ void BuildSpec32File( FILE *outfile )
" extern WCHAR **__wine_main_wargv;\n" " extern WCHAR **__wine_main_wargv;\n"
" STARTUPINFOA info;\n" " STARTUPINFOA info;\n"
" char *cmdline = GetCommandLineA();\n" " char *cmdline = GetCommandLineA();\n"
" while (*cmdline && *cmdline != ' ') cmdline++;\n" " int bcount=0, in_quotes=0;\n"
" if (*cmdline) cmdline++;\n" " while (*cmdline) {\n"
" if ((*cmdline=='\\t' || *cmdline==' ') && !in_quotes) break;\n"
" else if (*cmdline=='\\\\') bcount++;\n"
" else if (*cmdline=='\\\"') {\n"
" if ((bcount & 1)==0) in_quotes=!in_quotes;\n"
" bcount=0;\n"
" }\n"
" else bcount=0;\n"
" cmdline++;\n"
" }\n"
" while (*cmdline=='\\t' || *cmdline==' ') cmdline++;\n"
" GetStartupInfoA( &info );\n" " GetStartupInfoA( &info );\n"
" if (!(info.dwFlags & 1)) info.wShowWindow = 1;\n" " if (!(info.dwFlags & 1)) info.wShowWindow = 1;\n"
" _ARGC = __wine_main_argc;\n" " _ARGC = __wine_main_argc;\n"
......
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