[GRASS-SVN] r48434 - grass/trunk/vector/v.edit

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Sep 23 15:30:41 EDT 2011


Author: martinl
Date: 2011-09-23 12:30:41 -0700 (Fri, 23 Sep 2011)
New Revision: 48434

Modified:
   grass/trunk/vector/v.edit/args.c
   grass/trunk/vector/v.edit/main.c
Log:
v.edit: require <input> for `tool=add`


Modified: grass/trunk/vector/v.edit/args.c
===================================================================
--- grass/trunk/vector/v.edit/args.c	2011-09-23 18:28:27 UTC (rev 48433)
+++ grass/trunk/vector/v.edit/args.c	2011-09-23 19:30:41 UTC (rev 48434)
@@ -77,9 +77,9 @@
 
     params->in = G_define_standard_option(G_OPT_F_INPUT);
     params->in->required = NO;
-    params->in->label = _("ASCII file to be converted to binary vector map");
+    params->in->label = _("Name of file containing data in GRASS ASCII vector format");
     params->in->description =
-	_("If not given (or \"-\") reads from standard input");
+	_("\"-\" reads from standard input");
     params->in->guisection = _("Input");
 
     params->move = G_define_option();

Modified: grass/trunk/vector/v.edit/main.c
===================================================================
--- grass/trunk/vector/v.edit/main.c	2011-09-23 18:28:27 UTC (rev 48433)
+++ grass/trunk/vector/v.edit/main.c	2011-09-23 19:30:41 UTC (rev 48434)
@@ -68,17 +68,19 @@
     }
 
     /* open input file */
-    if (params.in->answer &&
-	strcmp(params.in->answer, "-") != 0) {
-	ascii = fopen(params.in->answer, "r");
-	if (ascii == NULL) {
-	    G_fatal_error(_("Unable to open file <%s>"),
-			  params.in->answer);
+    if (params.in->answer) {
+	if (strcmp(params.in->answer, "-") != 0) {
+	    ascii = fopen(params.in->answer, "r");
+	    if (ascii == NULL)
+		G_fatal_error(_("Unable to open file <%s>"),
+			      params.in->answer);
 	}
+	else {
+	    ascii = stdin;
+	}
     }
-    else if (action_mode != MODE_CREATE) {
-	ascii = stdin;
-    }
+    if (!ascii && action_mode == MODE_ADD)
+	G_fatal_error(_("Required parameter <%s> not set"), params.in->key);
     
     if (action_mode == MODE_CREATE) {
 	int overwrite;



More information about the grass-commit mailing list