[GRASS-SVN] r32259 - grass/trunk/lib/gis

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jul 24 10:46:09 EDT 2008


Author: glynn
Date: 2008-07-24 10:46:09 -0400 (Thu, 24 Jul 2008)
New Revision: 32259

Modified:
   grass/trunk/lib/gis/parser.c
Log:
Only treat an argument as an option if there is no space before the first '='


Modified: grass/trunk/lib/gis/parser.c
===================================================================
--- grass/trunk/lib/gis/parser.c	2008-07-24 14:40:37 UTC (rev 32258)
+++ grass/trunk/lib/gis/parser.c	2008-07-24 14:46:09 UTC (rev 32259)
@@ -121,6 +121,7 @@
 static int show(const char *,int);
 static int set_flag (int);
 static int contains (const char *,int);
+static int is_option(const char *);
 static int set_option( char *);
 static int check_opts();
 static int check_an_opt(const char *, int , const char *,const char *);
@@ -938,7 +939,7 @@
 
 			}
 			/* If we see standard option format (option=val) */
-			else if (contains(ptr, '='))
+			else if (is_option(ptr))
 			{
 				error += set_option(ptr) ;
 				need_first_opt = 0 ;
@@ -2149,6 +2150,21 @@
 	return(0) ;
 }
 
+static int is_option(const char *string)
+{
+	const char *p = strchr(string, '=');
+
+	if (!p)
+		return 0;
+	if (p == string)
+		return 0;
+	p--;
+	if (*p == ' ' || *p == '\t')
+		return 0;
+
+	return 1;
+}
+
 static int set_option (char *string)
 {
 	struct Option *at_opt = NULL;



More information about the grass-commit mailing list