فهرست منبع

libgis parser: backport of GRASS_FULL_OPTION_NAMES; attempt to document GRASS_FULL_OPTION_NAMES (trac https://trac.osgeo.org/grass/ticket/2409)

git-svn-id: https://svn.osgeo.org/grass/grass/branches/releasebranch_7_0@63774 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Neteler 10 سال پیش
والد
کامیت
6cd15bdf2f
2فایلهای تغییر یافته به همراه11 افزوده شده و 4 حذف شده
  1. 7 1
      lib/gis/parser.c
  2. 4 3
      lib/init/variables.html

+ 7 - 1
lib/gis/parser.c

@@ -971,7 +971,7 @@ void set_option(const char *string)
         if (strncmp(the_key, at_opt->key, key_len) == 0 ||
 	    match_option(the_key, at_opt->key)) {
 	    if (found >= MAX_MATCHES)
-		G_fatal_error("too many matches (limit %d)", MAX_MATCHES);
+		G_fatal_error("Too many matches (limit %d)", MAX_MATCHES);
 	    matches[found++] = at_opt;
 	}
     }
@@ -1034,6 +1034,9 @@ void set_option(const char *string)
         append_error(err);
         return;
     }
+
+    if (getenv("GRASS_FULL_OPTION_NAMES") && strcmp(the_key, opt->key) != 0)
+	G_warning(_("<%s> is an abbreviation for <%s>"), the_key, opt->key);
     
     /* Allocate memory where answer is stored */
     if (opt->count++) {
@@ -1277,6 +1280,9 @@ int check_string(const char *ans, const char **opts, int *result)
     if (found == 1)
 	*result = matches[0];
 
+    if (found > 0 && getenv("GRASS_FULL_OPTION_NAMES") && strcmp(ans, opts[matches[0]]) != 0)
+	G_warning(_("<%s> is an abbreviation for <%s>"), ans, opts[matches[0]]);
+
     switch (found) {
     case 0: return OUT_OF_RANGE;
     case 1: return REPLACED;

+ 4 - 3
lib/init/variables.html

@@ -135,9 +135,10 @@ PERMANENT
     specifies an alternative location (to <tt>$GISBASE/etc/fontcap</tt>) for 
     the font configuration file.</dd>
   
-  <dt>GRASS_GNUPLOT</dt>
-  <dd>[<!-- m.svfit, s.probplt, s.sv -->i.spectral]<br>
-    program to use for plotting <em>gnuplot</em> data.</dd>
+  <dt>GRASS_FULL_OPTION_NAMES</dt>
+  <dd>[parser]<br>
+    Generates a warning if GRASS_FULL_OPTION_NAMES is set (to anything) and
+    a found string is not an exact match for the given string.</dd>
   
   <dt>GRASS_GUI</dt>
   <dd>either <tt>text</tt> (text user interface), <tt>gtext</tt> (text