Преглед изворни кода

d.linegraph removed answer to directory option, fix also documentation

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@54437 15284696-431f-4ddb-bdfa-cd5b030d7da7
Luca Delucchi пре 12 година
родитељ
комит
fedf3cad7a
2 измењених фајлова са 15 додато и 6 уклоњено
  1. 2 3
      display/d.linegraph/d.linegraph.html
  2. 13 3
      display/d.linegraph/main.c

+ 2 - 3
display/d.linegraph/d.linegraph.html

@@ -18,9 +18,8 @@ deceptive.
 
 <p><dl>
 <dt><b>directoryname</b>
-<dd>Path to the directory where the input files are located. If this option
-is not used, the <em>d.linegraph</em> looks for files in the current directory.
-<dd>Example format: directory/usr/grass/data/graph
+<dd>Path to the directory where the input files are located. 
+<dd>Example format: /usr/grass/data/graph
 
 <dt><b>ycoloroption[,option,...]]</b>
 <dd>Color to be used for drawing the lines in the graph. If multiple Y data

+ 13 - 3
display/d.linegraph/main.c

@@ -139,7 +139,8 @@ int main(int argc, char **argv)
     dir_opt->description = _("Path to file location");
     dir_opt->type = TYPE_STRING;
     dir_opt->required = NO;
-    dir_opt->answer = ".";
+    /* Remove answer because create problem with full path */
+    /* dir_opt->answer = "."; */
 
     y_color_opt = G_define_option();
     y_color_opt->key = "y_color";
@@ -193,7 +194,11 @@ int main(int argc, char **argv)
        notice that in[0] will be the X file, and in[1-10]
        will be the Y file(s) */
 
-    sprintf(in[0].full_name, "%s/%s", dir_opt->answer, x_opt->answer);
+    if (dir_opt->answer != NULL) {
+	sprintf(in[0].full_name, "%s/%s", dir_opt->answer, x_opt->answer);
+    } else {
+	sprintf(in[0].full_name, "%s", x_opt->answer);
+    }
     sprintf(in[0].name, "%s", x_opt->answer);
 
     if ((in[0].fp = fopen(in[0].full_name, "r")) == NULL)
@@ -204,7 +209,12 @@ int main(int argc, char **argv)
     /* open all Y data files */
 
     for (i = 0, j = 1; (name = y_opt->answers[i]); i++, j++) {
-	sprintf(in[j].full_name, "%s/%s", dir_opt->answer, name);
+      
+	if (dir_opt->answer != NULL) {
+	    sprintf(in[j].full_name, "%s/%s", dir_opt->answer, name);
+	} else {
+	    sprintf(in[j].full_name, "%s", name);
+	}
 	sprintf(in[j].name, "%s", name);
 
 	if ((in[j].fp = fopen(in[j].full_name, "r")) == NULL)