[GRASS-SVN] r32262 - grass/branches/develbranch_6/lib/gis

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jul 24 11:15:27 EDT 2008


Author: martinl
Date: 2008-07-24 11:15:27 -0400 (Thu, 24 Jul 2008)
New Revision: 32262

Modified:
   grass/branches/develbranch_6/lib/gis/parser.c
Log:
glynn: Only treat an argument as an option if there is no space before the first '=' (merged from trunk, r32259)

Modified: grass/branches/develbranch_6/lib/gis/parser.c
===================================================================
--- grass/branches/develbranch_6/lib/gis/parser.c	2008-07-24 15:03:13 UTC (rev 32261)
+++ grass/branches/develbranch_6/lib/gis/parser.c	2008-07-24 15:15:27 UTC (rev 32262)
@@ -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