summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Atallah <datallah@pidgin.im>2008-11-25 03:40:28 +0000
committerDaniel Atallah <datallah@pidgin.im>2008-11-25 03:40:28 +0000
commit584e1326d2fea19d6e3afcc12536794e1d0ce43f (patch)
treecefb7c1480c352e34d4b75dfde67c59ba59acedc
parent9d13d25637e8fb8cc1b1883891e4b48c94956a44 (diff)
downloadpidgin-584e1326d2fea19d6e3afcc12536794e1d0ce43f.tar.gz
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
-rw-r--r--pidgin/win32/winpidgin.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/pidgin/win32/winpidgin.c b/pidgin/win32/winpidgin.c
index 74917a750d..c954ab299e 100644
--- a/pidgin/win32/winpidgin.c
+++ b/pidgin/win32/winpidgin.c
@@ -621,9 +621,22 @@ WinMain (struct HINSTANCE__ *hInstance, struct HINSTANCE__ *hPrevInstance,
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 @@ WinMain (struct HINSTANCE__ *hInstance, struct HINSTANCE__ *hPrevInstance,
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 .. */