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

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Oct 14 10:43:45 PDT 2013


Author: glynn
Date: 2013-10-14 10:43:45 -0700 (Mon, 14 Oct 2013)
New Revision: 57999

Modified:
   grass/trunk/lib/gis/parser.c
Log:
Use abbreviation-matching for option values as well as for option names


Modified: grass/trunk/lib/gis/parser.c
===================================================================
--- grass/trunk/lib/gis/parser.c	2013-10-14 17:37:37 UTC (rev 57998)
+++ grass/trunk/lib/gis/parser.c	2013-10-14 17:43:45 UTC (rev 57999)
@@ -914,13 +914,9 @@
     for (at_opt = &st->first_option; at_opt; at_opt = at_opt->next_opt) {
 	if (!at_opt->key)
 	    continue;
-#if 1
+
 	if (!match_option(the_key, at_opt->key))
 	    continue;
-#else
-	if (strncmp(the_key, at_opt->key, key_len))
-	    continue;
-#endif
 
 	got_one++;
 	opt = at_opt;
@@ -1147,7 +1143,6 @@
 
 static int check_string(const char *ans, const char **opts, int *result)
 {
-    int len = strlen(ans);
     int found = 0;
     int i;
 
@@ -1157,7 +1152,7 @@
     for (i = 0; opts[i]; i++) {
 	if (strcmp(ans, opts[i]) == 0)
 	    return 0;
-	if (strncmp(ans, opts[i], len) == 0) {
+	if (match_option(ans, opts[i])) {
 	    *result = i;
 	    found++;
 	}



More information about the grass-commit mailing list