[GRASS-SVN] r30111 - grass/trunk/display/d.what.rast

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Feb 13 05:56:30 EST 2008


Author: hamish
Date: 2008-02-13 05:56:30 -0500 (Wed, 13 Feb 2008)
New Revision: 30111

Modified:
   grass/trunk/display/d.what.rast/main.c
   grass/trunk/display/d.what.rast/opencell.c
Log:
GNAME_MAX, i18n, G_warning()

Modified: grass/trunk/display/d.what.rast/main.c
===================================================================
--- grass/trunk/display/d.what.rast/main.c	2008-02-13 10:27:49 UTC (rev 30110)
+++ grass/trunk/display/d.what.rast/main.c	2008-02-13 10:56:30 UTC (rev 30111)
@@ -8,7 +8,7 @@
  *               Huidae Cho <grass4u gmail.com>, 
  *               Eric G. Miller <egm2 jps.net>, 
  *               Glynn Clements <glynn gclements.plus.com>, 
- *               Hamish Bowman <hamish_nospam yahoo.com>
+ *               Hamish Bowman <hamish_b yahoo.com>
  * PURPOSE:      interactive query of cat/label of raster map in display
  * COPYRIGHT:    (C) 1999-2006 by the GRASS Development Team
  *
@@ -42,7 +42,7 @@
 
 	module = G_define_module();
 	module->keywords = _("display");
-    module->description = 
+	module->description = 
 	  _("Allows the user to interactively query the category contents "
 	  "of multiple raster map layers at user specified locations "
 	  "within the current geographic region.");
@@ -143,8 +143,8 @@
 		width = mwidth = 0;
 		for (i=0; i<nrasts; i++)
 		{
-			name[i] = (char *)G_malloc(80);
-			mapset[i] = (char *)G_malloc(80);
+			name[i] = (char *)G_malloc(GNAME_MAX);
+			mapset[i] = (char *)G_malloc(GMAPSET_MAX);
 
 			if ((fd[i] = opencell (rast[i], name[i], mapset[i])) < 0)
 			    G_fatal_error(_("Raster map <%s> not found"), rast[i]);

Modified: grass/trunk/display/d.what.rast/opencell.c
===================================================================
--- grass/trunk/display/d.what.rast/opencell.c	2008-02-13 10:27:49 UTC (rev 30110)
+++ grass/trunk/display/d.what.rast/opencell.c	2008-02-13 10:56:30 UTC (rev 30111)
@@ -1,5 +1,6 @@
 #include <string.h>
 #include <grass/gis.h>
+#include <grass/glocale.h>
 
 int 
 opencell (char *fullname, char *name, char *mapset)
@@ -11,16 +12,18 @@
 	m = G_find_cell2 (name, "");
 	if (m == NULL)
 	{
-		fprintf (stderr, "warning: %s - raster map not found\n", name);
-		return -1;
+	    G_warning(_("Raster map <%s> not found"), name);
+	    return -1;
 	}
+
 	if (strlen (m) == 0)
-	    strcpy (mapset, G_mapset ());
+	    strcpy (mapset, G_mapset());
 	else
 	    strcpy (mapset, m);
+
 	fd = G_open_cell_old (name, mapset);
 	if (fd < 0)
-		fprintf (stderr, "warning: unable to open [%s] in [%s]\n",
-		    name, mapset);
+	    G_warning(_("Unable to open raster map <%s>"), name);
+
 	return fd;
 }



More information about the grass-commit mailing list