[Scummvm-cvs-logs] SF.net SVN: scummvm: [23561] scummvm/trunk/base/commandLine.cpp

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Sat Jul 22 17:16:33 CEST 2006


Revision: 23561
Author:   eriktorbjorn
Date:     2006-07-22 08:16:28 -0700 (Sat, 22 Jul 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=23561&view=rev

Log Message:
-----------
Fixed DO_OPTION_OPT so that the '=' is no longer required in long options. (The
value is, as the name implies, optional.) This fixes bug #1526483.

Modified Paths:
--------------
    scummvm/trunk/base/commandLine.cpp
Modified: scummvm/trunk/base/commandLine.cpp
===================================================================
--- scummvm/trunk/base/commandLine.cpp	2006-07-22 15:05:59 UTC (rev 23560)
+++ scummvm/trunk/base/commandLine.cpp	2006-07-22 15:16:28 UTC (rev 23561)
@@ -261,12 +261,15 @@
 
 // Use this for options which have an *optional* value
 #define DO_OPTION_OPT(shortCmd, longCmd, defaultVal) \
-	if (isLongCmd ? (!memcmp(s+2, longCmd"=", sizeof(longCmd"=") - 1)) : (tolower(s[1]) == shortCmd)) { \
+	if (isLongCmd ? (!strcmp(s+2, longCmd) || !memcmp(s+2, longCmd"=", sizeof(longCmd"=") - 1)) : (tolower(s[1]) == shortCmd)) { \
 		s += 2; \
-		if (isLongCmd) \
-			s += sizeof(longCmd"=") - 1; \
+		if (isLongCmd) { \
+			s += sizeof(longCmd) - 1; \
+			if (*s == '=') \
+				s++; \
+		} \
 		const char *option = s; \
-		if (*s == '\0') { option = s2; i++; } \
+		if (*s == '\0' && !isLongCmd) { option = s2; i++; } \
 		if (!option) option = defaultVal; \
 		if (option) settings[longCmd] = option;
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the Scummvm-git-logs mailing list