Bläddra i källkod

Use abbreviation-matching for option values as well as for option names

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@57999 15284696-431f-4ddb-bdfa-cd5b030d7da7
Glynn Clements 11 år sedan
förälder
incheckning
41e7031e2b
1 ändrade filer med 2 tillägg och 7 borttagningar
  1. 2 7
      lib/gis/parser.c

+ 2 - 7
lib/gis/parser.c

@@ -914,13 +914,9 @@ static void set_option(const char *string)
     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_double(const char *ans, const char **opts)
 
 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 @@ static int check_string(const char *ans, const char **opts, int *result)
     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++;
 	}