[GRASS-SVN] r45581 - grass/trunk/ps/ps.map

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Mar 5 18:06:15 EST 2011


Author: martinl
Date: 2011-03-05 15:06:15 -0800 (Sat, 05 Mar 2011)
New Revision: 45581

Modified:
   grass/trunk/ps/ps.map/main.c
   grass/trunk/ps/ps.map/ps_raster.c
Log:
ps.map: require input=file/-
	some minor changes in messages


Modified: grass/trunk/ps/ps.map/main.c
===================================================================
--- grass/trunk/ps/ps.map/main.c	2011-03-05 22:36:52 UTC (rev 45580)
+++ grass/trunk/ps/ps.map/main.c	2011-03-05 23:06:15 UTC (rev 45581)
@@ -133,6 +133,8 @@
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
     
+    G_zero(&PS, sizeof(struct PS_data));
+    
     /* Print papers */
     if (pflag->answer) {
 	print_papers();
@@ -175,7 +177,7 @@
     ct.fontsize = 10;
     ct.cols = 1;
     tracefd = NULL;
-    inputfd = stdin;
+    inputfd = NULL;
     labels.count = 0;
     labels.other = NULL;
     can_reset_scale = 1;
@@ -183,8 +185,7 @@
     grp.do_group = 0;
     brd.R = brd.G = brd.B = 0.;
     brd.width = 1.;
-
-    G_zero(&PS, sizeof(struct PS_data));
+    
     PS.grid_color = BLACK;
     PS.min_y = 72.0 * (PS.page_height - PS.top_marg);
     PS.set_y = 100.0 * PS.min_y;
@@ -196,12 +197,22 @@
      * reset_map_location() to reset map size to fit to paper */
     
     /* arguments */
-    if (input_file->answer && strcmp(input_file->answer, "-")) {
-	if (NULL == freopen(input_file->answer, "r", stdin))
-	    G_fatal_error(_("Unable to open file '%s': %s"), 
-			  input_file->answer, strerror(errno));
+    if (input_file->answer) {
+	if (strcmp(input_file->answer, "-")) {
+	    inputfd = fopen(input_file->answer, "r");
+	    if (!inputfd)
+		G_fatal_error(_("Unable to open file '%s': %s"), 
+			      input_file->answer, strerror(errno));
+	}
+	else {
+	    inputfd = stdin;
+	}
     }
-
+    else {
+	G_fatal_error(_("Required parameter <%s> not set:\n\t(%s)"),
+		      input_file->key, input_file->label);
+    }
+    
     if (copies->answer) {
 	if (sscanf(copies->answer, "%d", &ps_copies) != 1) {
 	    ps_copies = 1;

Modified: grass/trunk/ps/ps.map/ps_raster.c
===================================================================
--- grass/trunk/ps/ps.map/ps_raster.c	2011-03-05 22:36:52 UTC (rev 45580)
+++ grass/trunk/ps/ps.map/ps_raster.c	2011-03-05 23:06:15 UTC (rev 45581)
@@ -99,10 +99,11 @@
 
     /* let user know what's happenning */
     if (PS.do_raster)
-	G_message(_("Reading raster map <%s in %s> ..."),
-		  PS.cell_name, PS.cell_mapset);
+	G_message(_("Reading raster map <%s>..."),
+		  G_fully_qualified_name(PS.cell_name, PS.cell_mapset));
     else
-	G_message(_("Reading raster maps in group <%s> ..."), grp.group_name);
+	G_message(_("Reading raster maps in group <%s>..."),
+		  grp.group_name);
 
     /* build the image RGB string */
     if (PS.do_raster) {



More information about the grass-commit mailing list