pidgin: c2d2852c: Patch from Johnson Earls to improve the ...

datallah at pidgin.im datallah at pidgin.im
Thu Sep 10 00:15:52 EDT 2009


-----------------------------------------------------------------
Revision: c2d2852cc366773fab95df3c1eadda30df283c91
Ancestor: cb46b045aa6e927a3814d9053c2b1c0f08d6fa62
Author: datallah at pidgin.im
Date: 2009-09-10T04:11:02
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/c2d2852cc366773fab95df3c1eadda30df283c91

Modified files:
        pidgin/win32/winpidgin.c

ChangeLog: 

Patch from Johnson Earls to improve the win32 launcher detection of whether  we
need to setup the console for stdout.
Fixes #10182

-------------- next part --------------
============================================================
--- pidgin/win32/winpidgin.c	0c3f20676e8704538134058d3b2409f9858ed9d6
+++ pidgin/win32/winpidgin.c	2771e4991642a3939cffc84ae6e512dce2325347
@@ -626,14 +626,28 @@ WinMain (struct HINSTANCE__ *hInstance, 
 
 	/* If debug or help or version flag used, create console for output */
 	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 (strlen(__argv[i]) > 1 && __argv[i][0] == '-') {
+			/* check if we're looking at -- or - option */
+			if (__argv[i][1] == '-') {
+				if (strstr(__argv[i], "--debug") == __argv[i])
+					debug = TRUE;
+				else if (strstr(__argv[i], "--help") == __argv[i])
+					help = TRUE;
+				else if (strstr(__argv[i], "--version") == __argv[i])
+					version = TRUE;
+				else if (strstr(__argv[i], "--multiple") == __argv[i])
+					multiple = TRUE;
+			} else {
+				if (strchr(__argv[i], 'd'))
+					debug = TRUE;
+				else if (strchr(__argv[i], 'h'))
+					help = TRUE;
+				else if (strchr(__argv[i], 'v'))
+					version = TRUE;
+				else if (strchr(__argv[i], 'm'))
+					multiple = TRUE;
+			}
+		}
 	}
 
 	if (debug || help || version) {
@@ -705,10 +719,9 @@ WinMain (struct HINSTANCE__ *hInstance, 
 		/* Remove the --portable-mode arg from the args passed to pidgin so it doesn't choke */
 		pidgin_argv = malloc(sizeof(char*) * pidgin_argc);
 		for (; i < __argc; i++) {
-			if (strstr(__argv[i], "--portable-mode") == NULL) {
-				pidgin_argv[c] = __argv[i];
-				c++;
-			} else
+			if (strstr(__argv[i], "--portable-mode") == NULL)
+				pidgin_argv[c++] = __argv[i];
+			else
 				pidgin_argc--;
 		}
 	}


More information about the Commits mailing list