# HG changeset patch # User Daniel Atallah # Date 1227584428 0 # Node ID daefbf001774f9e68beb95b9d14f5a5536082190 # Parent d70eb6304eae9df820982e28c2290fb65128fb58 Fix the initial parsing of args in the win32 launcher to be more robust. This should prevent stuff like "--login=blah@something-d.tld" from making the debug console appear. Fixes #7627 diff -r d70eb6304eae -r daefbf001774 pidgin/win32/winpidgin.c --- a/pidgin/win32/winpidgin.c Tue Nov 25 02:43:56 2008 +0000 +++ b/pidgin/win32/winpidgin.c Tue Nov 25 03:40:28 2008 +0000 @@ -621,9 +621,22 @@ char *tmp; int pidgin_argc = __argc; char **pidgin_argv = __argv; + int i; + BOOL debug = FALSE, help = FALSE, version = FALSE, multiple = FALSE; /* If debug or help or version flag used, create console for output */ - if (strstr(lpszCmdLine, "-d") || strstr(lpszCmdLine, "-h") || strstr(lpszCmdLine, "-v")) { + for (i = 1; i < __argc; i++) { + if (strstr(__argv[i], "-d") || strstr(__argv[i], "--debug")) + debug = TRUE; + else if (strstr(__argv[i], "-h") || strstr(__argv[i], "--help")) + help = TRUE; + else if (strstr(__argv[i], "-v") || strstr(__argv[i], "--version")) + version = TRUE; + else if (strstr(__argv[i], "-m") || strstr(__argv[i], "--multiple")) + multiple = TRUE; + } + + if (debug || help || version) { /* If stdout hasn't been redirected to a file, alloc a console * (_istty() doesn't work for stuff using the GUI subsystem) */ if (_fileno(stdout) == -1 || _fileno(stdout) == -2) { @@ -710,8 +723,8 @@ winpidgin_add_stuff_to_path(); /* If help, version or multiple flag used, do not check Mutex */ - if (!strstr(lpszCmdLine, "-h") && !strstr(lpszCmdLine, "-v")) - if (!winpidgin_set_running(getenv("PIDGIN_MULTI_INST") == NULL && strstr(lpszCmdLine, "-m") == NULL)) + if (!help && !version) + if (!winpidgin_set_running(getenv("PIDGIN_MULTI_INST") == NULL && !multiple)) return 0; /* Now we are ready for Pidgin .. */