[GRASS-SVN] r33142 - in grass/trunk/raster: r.patch r.profile r.quant r.random r.recode r.region r.resamp.rst r.resample r.rescale r.rescale.eq r.series r.statistics r.stats r.sum r.sun r.sunmask r.support.stats r.surf.area r.surf.gauss r.surf.idw r.surf.idw2 r.surf.random r.texture r.thin r.timestamp r.to.rast3 r.to.rast3elev r.topidx r.topmodel r.transect r.univar r.volume r.walk r.what r.what.color

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Aug 28 16:08:49 EDT 2008


Author: glynn
Date: 2008-08-28 16:08:49 -0400 (Thu, 28 Aug 2008)
New Revision: 33142

Removed:
   grass/trunk/raster/r.resamp.rst/local_proto.h
   grass/trunk/raster/r.resample/diff.sh
   grass/trunk/raster/r.topidx/check_ready.c
   grass/trunk/raster/r.what/die.c
   grass/trunk/raster/r.what/local_proto.h
   grass/trunk/raster/r.what/usage.c
Modified:
   grass/trunk/raster/r.patch/main.c
   grass/trunk/raster/r.profile/main.c
   grass/trunk/raster/r.quant/global.h
   grass/trunk/raster/r.quant/main.c
   grass/trunk/raster/r.quant/read_rules.c
   grass/trunk/raster/r.random/count.c
   grass/trunk/raster/r.random/local_proto.h
   grass/trunk/raster/r.random/main.c
   grass/trunk/raster/r.random/support.c
   grass/trunk/raster/r.recode/global.h
   grass/trunk/raster/r.recode/main.c
   grass/trunk/raster/r.recode/read_rules.c
   grass/trunk/raster/r.recode/recode.c
   grass/trunk/raster/r.region/main.c
   grass/trunk/raster/r.resamp.rst/main.c
   grass/trunk/raster/r.resample/main.c
   grass/trunk/raster/r.rescale.eq/get_stats.c
   grass/trunk/raster/r.rescale.eq/local_proto.h
   grass/trunk/raster/r.rescale.eq/main.c
   grass/trunk/raster/r.rescale/get_range.c
   grass/trunk/raster/r.rescale/local_proto.h
   grass/trunk/raster/r.rescale/main.c
   grass/trunk/raster/r.series/main.c
   grass/trunk/raster/r.statistics/main.c
   grass/trunk/raster/r.statistics/method.h
   grass/trunk/raster/r.statistics/o_adev.c
   grass/trunk/raster/r.statistics/o_average.c
   grass/trunk/raster/r.statistics/o_distrib.c
   grass/trunk/raster/r.statistics/o_divr.c
   grass/trunk/raster/r.statistics/o_kurt.c
   grass/trunk/raster/r.statistics/o_max.c
   grass/trunk/raster/r.statistics/o_median.c
   grass/trunk/raster/r.statistics/o_min.c
   grass/trunk/raster/r.statistics/o_mode.c
   grass/trunk/raster/r.statistics/o_sdev.c
   grass/trunk/raster/r.statistics/o_skew.c
   grass/trunk/raster/r.statistics/o_sum.c
   grass/trunk/raster/r.statistics/o_var.c
   grass/trunk/raster/r.stats/main.c
   grass/trunk/raster/r.sum/main.c
   grass/trunk/raster/r.sun/main.c
   grass/trunk/raster/r.sunmask/main.c
   grass/trunk/raster/r.support.stats/check.c
   grass/trunk/raster/r.support.stats/histo.c
   grass/trunk/raster/r.support.stats/local_proto.h
   grass/trunk/raster/r.support.stats/main.c
   grass/trunk/raster/r.surf.area/main.c
   grass/trunk/raster/r.surf.gauss/main.c
   grass/trunk/raster/r.surf.idw/main.c
   grass/trunk/raster/r.surf.idw2/read_cell.c
   grass/trunk/raster/r.surf.random/main.c
   grass/trunk/raster/r.texture/main.c
   grass/trunk/raster/r.thin/io.c
   grass/trunk/raster/r.timestamp/main.c
   grass/trunk/raster/r.to.rast3/main.c
   grass/trunk/raster/r.to.rast3elev/main.c
   grass/trunk/raster/r.topidx/file_io.c
   grass/trunk/raster/r.topidx/global.h
   grass/trunk/raster/r.topidx/main.c
   grass/trunk/raster/r.topmodel/check_ready.c
   grass/trunk/raster/r.topmodel/main.c
   grass/trunk/raster/r.topmodel/misc.c
   grass/trunk/raster/r.transect/main.c
   grass/trunk/raster/r.univar/r.univar_main.c
   grass/trunk/raster/r.volume/main.c
   grass/trunk/raster/r.walk/main.c
   grass/trunk/raster/r.walk/stash.h
   grass/trunk/raster/r.what.color/main.c
   grass/trunk/raster/r.what/main.c
Log:
Remove explicit mapset references and G_find_* calls
Miscellaneous clean-up


Modified: grass/trunk/raster/r.patch/main.c
===================================================================
--- grass/trunk/raster/r.patch/main.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.patch/main.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -93,19 +93,12 @@
 
     for (i = 0; i < nfiles; i++) {
 	const char *name = names[i];
-	const char *mapset = G_find_cell2(name, "");
 	int fd;
 
-	if (mapset == NULL) {
-	    G_warning(_("Raster map <%s> not found"), name);
-	    G_sleep(3);
-	    ok = 0;
-	}
-
 	if (!ok)
 	    continue;
 
-	fd = G_open_cell_old(name, mapset);
+	fd = G_open_cell_old(name, "");
 	if (fd < 0) {
 	    ok = 0;
 	    continue;

Modified: grass/trunk/raster/r.profile/main.c
===================================================================
--- grass/trunk/raster/r.profile/main.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.profile/main.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -21,7 +21,7 @@
 
 int main(int argc, char *argv[])
 {
-    char *name, *outfile, *mapset;
+    char *name, *outfile;
     int fd, projection;
     FILE *fp;
     double res;
@@ -128,14 +128,12 @@
 	coords = 1;
 
     /* Open Raster File */
-    if (NULL == (mapset = G_find_cell2(name, "")))
-	G_fatal_error(_("Raster map <%s> not found"), name);
-    if (0 > (fd = G_open_cell_old(name, mapset)))
+    if ((fd = G_open_cell_old(name, "")) < 0)
 	G_fatal_error(_("Unable to open raster map <%s>"), name);
 
     /* initialize color structure */
     if (clr)
-	G_read_colors(name, mapset, &colors);
+	G_read_colors(name, "", &colors);
 
     /* Open ASCII file for output or stdout */
     outfile = parm.output->answer;

Modified: grass/trunk/raster/r.quant/global.h
===================================================================
--- grass/trunk/raster/r.quant/global.h	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.quant/global.h	2008-08-28 20:08:49 UTC (rev 33142)
@@ -3,8 +3,7 @@
 extern struct Quant quant_struct;
 extern CELL old_min, old_max;
 extern DCELL old_dmin, old_dmax;
-extern char *name[GNAME_MAX];	/* input map names */
-extern char *mapset[GMAPSET_MAX];	/* input mapsets */
+extern char **name;	/* input map names */
 extern int noi;
 
 /* read_rules.c */

Modified: grass/trunk/raster/r.quant/main.c
===================================================================
--- grass/trunk/raster/r.quant/main.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.quant/main.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -25,8 +25,7 @@
 struct Quant quant_struct;
 CELL old_min, old_max;
 DCELL old_dmin, old_dmax;
-char *name[GNAME_MAX];		/* input map names */
-char *mapset[GMAPSET_MAX];	/* input mapsets */
+char **name;		/* input map names */
 int noi;
 
 int main(int argc, char *argv[])
@@ -39,7 +38,7 @@
     int i;
     CELL new_min, new_max;
     DCELL new_dmin, new_dmax;
-    char *basename, *basemapset;
+    char *basename;
 
     G_gisinit(argv[0]);
 
@@ -116,14 +115,14 @@
     if (i == 1)
 	G_fatal_error(_("fprange= and range= must be used together"));
 
+    for (noi = 0; input->answers[noi]; noi++)
+	;
+    name = G_malloc(noi * sizeof(char *));
     /* read and check inputs */
     for (noi = 0; input->answers[noi]; noi++) {
 	name[noi] = G_store(input->answers[noi]);
-	mapset[noi] = G_find_cell2(name[noi], "");
-	if (!mapset[noi])
-	    G_fatal_error(_("%s - not found"), name[noi]);
 
-	if (G_raster_map_type(name[noi], mapset[noi]) == CELL_TYPE)
+	if (G_raster_map_type(name[noi], G_mapset()) == CELL_TYPE)
 	    G_fatal_error(_("%s is integer map, it can't be quantized"),
 			  name[noi]);
     }
@@ -144,15 +143,11 @@
     else if (basename)
 	/* set the quant to that of basemap */
     {
-	basemapset = G_find_cell2(basename, "");
-	if (!basemapset)
-	    G_fatal_error(_("%s - not found"), basename);
-
-	if (G_raster_map_type(basename, basemapset) == CELL_TYPE)
+	if (G_raster_map_type(basename, "") == CELL_TYPE)
 	    G_fatal_error(_("%s is integer map, it can't be used as basemap"),
 			  basename);
 
-	if (G_read_quant(basename, basemapset, &quant_struct) <= 0)
+	if (G_read_quant(basename, "", &quant_struct) <= 0)
 	    G_fatal_error(_("unable to read quant rules for basemap <%s>"),
 			  basename);
     }
@@ -183,7 +178,7 @@
     }				/* use rules */
 
     for (i = 0; i < noi; i++) {
-	if (G_write_quant(name[i], mapset[i], &quant_struct) < 0)
+	if (G_write_quant(name[i], G_mapset(), &quant_struct) < 0)
 	    G_message(_("Quant table not changed for %s"), name[i]);
 	else
 	    G_message(_("New quant table created for %s"), name[i]);

Modified: grass/trunk/raster/r.quant/read_rules.c
===================================================================
--- grass/trunk/raster/r.quant/read_rules.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.quant/read_rules.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -17,13 +17,13 @@
 
     /* read the fpranges and ranges of all input maps */
     for (i = 0; i < noi; i++) {
-	if (G_read_fp_range(name[i], mapset[i], &drange) <= 0) {
+	if (G_read_fp_range(name[i], G_mapset(), &drange) <= 0) {
 	    sprintf(buff, "Can't read f_range for map %s", name[i]);
 	    G_fatal_error(buff);
 	}
 	G_get_fp_range_min_max(&drange, &tmp_dmin, &tmp_dmax);
 
-	if (G_read_range(name[i], mapset[i], &range) <= 0) {
+	if (G_read_range(name[i], G_mapset(), &range) <= 0) {
 	    sprintf(buff, "Can't read range for map %s", name[i]);
 	    G_fatal_error(buff);
 	}
@@ -43,7 +43,7 @@
 
 int report_range(void)
 {
-    char buff[1024], buff2[300];
+    char buff[300], buff2[300];
 
     if (G_is_d_null_value(&old_dmin) || G_is_d_null_value(&old_dmax))
 	G_message(_("Old data range is empty"));

Modified: grass/trunk/raster/r.random/count.c
===================================================================
--- grass/trunk/raster/r.random/count.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.random/count.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -19,13 +19,12 @@
 {
     int nrows, ncols, row, col;
 
-    theState->fd_old = G_open_cell_old(theState->inraster, theState->mapset);
+    theState->fd_old = G_open_cell_old(theState->inraster, "");
     if (theState->fd_old < 0)
 	G_fatal_error(_("Unable to open raster map <%s>"),
 		      theState->inraster);
     if (theState->docover == 1) {
-	theState->fd_cold =
-	    G_open_cell_old(theState->inrcover, theState->cmapset);
+	theState->fd_cold = G_open_cell_old(theState->inrcover, "");
 	if (theState->fd_cold < 0)
 	    G_fatal_error(_("Unable to open raster map <%s>"),
 			  theState->inrcover);

Modified: grass/trunk/raster/r.random/local_proto.h
===================================================================
--- grass/trunk/raster/r.random/local_proto.h	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.random/local_proto.h	2008-08-28 20:08:49 UTC (rev 33142)
@@ -23,7 +23,7 @@
 /* Put all the state infomation into a struct */
 struct rr_state
 {
-    char *inraster, *inrcover, *outraster, *mapset, *cmapset, *outvector;
+    char *inraster, *inrcover, *outraster, *outvector;
     int use_nulls, docover, fd_old, fd_cold, fd_new;
     long nCells, nNulls, nRand, cnCells, cnNulls;
     struct RASTER_MAP_PTR nulls, cnulls, buf, cover, min, max, cmin, cmax;

Modified: grass/trunk/raster/r.random/main.c
===================================================================
--- grass/trunk/raster/r.random/main.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.random/main.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -101,33 +101,22 @@
     }
     else {
 	myState.docover = 0;
-	myState.cmapset = NULL;
 	myState.inrcover = NULL;
     }
     myState.outraster = parm.raster->answer;
     myState.outvector = parm.sites->answer;
     myState.z_geometry = flag.z_geometry->answer;
 
-    myState.mapset = G_find_cell(myState.inraster, "");
-    if (myState.mapset == NULL)
-	G_fatal_error(_("Raster map <%s> not found"), myState.inraster);
-
-    if (myState.docover == 1) {
-	myState.cmapset = G_find_cell(myState.inrcover, "");
-	if (myState.cmapset == NULL)
-	    G_fatal_error(_("Raster map <%s> not found"), myState.inrcover);
-    }
-
     /* If they only want info we ignore the rest */
     get_stats(&myState);
 
     if (flag.info->answer) {
-	G_message("Raster:      %s@%s\n"
-		  "Cover:       %s@%s\n"
+	G_message("Raster:      %s\n"
+		  "Cover:       %s\n"
 		  "Cell Count:  %d\n"
 		  "Null Cells:  %d\n\n",
-		  myState.inraster, myState.mapset, myState.inrcover,
-		  myState.cmapset, (int)myState.nCells, (int)myState.nNulls);
+		  myState.inraster, myState.inrcover,
+		  (int)myState.nCells, (int)myState.nNulls);
 
 	exit(EXIT_SUCCESS);
     }

Modified: grass/trunk/raster/r.random/support.c
===================================================================
--- grass/trunk/raster/r.random/support.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.random/support.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -9,7 +9,7 @@
     struct History hist;
     struct Categories cats;
     struct Colors clr;
-    char *inraster, *mapset;
+    char *inraster;
     struct RASTER_MAP_PTR nulls;
 
     /* write categories for output raster 
@@ -17,16 +17,14 @@
      */
     if (theState->docover == 1) {
 	inraster = theState->inrcover;
-	mapset = theState->cmapset;
 	nulls = theState->cnulls;
     }
     else {
 	inraster = theState->inraster;
-	mapset = theState->mapset;
 	nulls = theState->nulls;
     }
-    if (G_read_raster_cats(inraster, mapset, &cats) >= 0) {
-	sprintf(title, "Random points on [%s in %s]", inraster, mapset);
+    if (G_read_raster_cats(inraster, "", &cats) >= 0) {
+	sprintf(title, "Random points on <%s>", inraster);
 	G_set_cats_title(title, &cats);
 	if (theState->use_nulls)
 	    G_set_raster_cat(nulls.data.v,
@@ -39,15 +37,15 @@
     /* write history for output raster */
     if (G_read_history(theState->outraster, G_mapset(), &hist) >= 0) {
 	G_short_history(theState->outraster, "raster", &hist);
-	sprintf(hist.datsrc_1, "Based on map <%s@%s>", inraster, mapset);
+	sprintf(hist.datsrc_1, "Based on map <%s>", inraster);
 	if (percent)
 	    sprintf(hist.datsrc_2,
 		    "Random points over %.2f percent of the base map <%s>",
 		    percentage, inraster);
 	else
 	    sprintf(hist.datsrc_2,
-		    "%ld random points on the base map <%s@%s>",
-		    theState->nRand, theState->inraster, theState->mapset);
+		    "%ld random points on the base map <%s>",
+		    theState->nRand, theState->inraster);
 	G_write_history(theState->outraster, &hist);
 
     }
@@ -62,7 +60,7 @@
     }
 
     /* set colors for output raster */
-    if (G_read_colors(inraster, mapset, &clr) >= 0) {
+    if (G_read_colors(inraster, "", &clr) >= 0) {
 	if (theState->use_nulls) {
 	    G_add_raster_color_rule(nulls.data.v, 127, 127, 127,
 				    nulls.data.v, 127, 127, 127, &clr,

Modified: grass/trunk/raster/r.recode/global.h
===================================================================
--- grass/trunk/raster/r.recode/global.h	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.recode/global.h	2008-08-28 20:08:49 UTC (rev 33142)
@@ -7,7 +7,7 @@
 extern CELL old_min, old_max;
 extern DCELL old_dmin, old_dmax;
 extern int in_fd, out_fd, no_mask, align_wind, make_dcell, nrules, rule_size;
-extern char *name, *mapset, *result, *title;
+extern char *name, *result, *title;
 extern char **rules;
 
 /* read_rules.c */

Modified: grass/trunk/raster/r.recode/main.c
===================================================================
--- grass/trunk/raster/r.recode/main.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.recode/main.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -28,7 +28,7 @@
 CELL old_min, old_max;
 DCELL old_dmin, old_dmax;
 int in_fd, out_fd, no_mask, align_wind, make_dcell, nrules, rule_size;
-char *name, *mapset, *result, *title;
+char *name, *result, *title;
 char **rules;
 
 int main(int argc, char *argv[])
@@ -86,13 +86,6 @@
     align_wind = parm.a->answer;
     make_dcell = parm.d->answer;
 
-    mapset = G_find_cell2(name, "");
-    if (mapset == NULL)
-	G_fatal_error(_("Raster map <%s> not found"), name);
-
-    if (strcmp(name, result) == 0 && strcmp(mapset, G_mapset()) == 0)
-	G_fatal_error(_("Input map can NOT be the same as output map"));
-
     srcfp = stdin;
     if (parm.rules->answer) {
 	srcfp = fopen(parm.rules->answer, "r");

Modified: grass/trunk/raster/r.recode/read_rules.c
===================================================================
--- grass/trunk/raster/r.recode/read_rules.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.recode/read_rules.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -13,9 +13,9 @@
     char buff[1024], buff2[300];
     RASTER_MAP_TYPE inp_type;
 
-    inp_type = G_raster_map_type(name, mapset);
+    inp_type = G_raster_map_type(name, "");
     if (inp_type != CELL_TYPE) {
-	if (G_read_fp_range(name, mapset, &drange) <= 0)
+	if (G_read_fp_range(name, "", &drange) <= 0)
 	    G_fatal_error(_("Unable to read f_range for map %s"), name);
 
 	G_get_fp_range_min_max(&drange, &old_dmin, &old_dmax);
@@ -30,7 +30,7 @@
 		      buff, buff2);
 	}
     }
-    if (G_read_range(name, mapset, &range) <= 0)
+    if (G_read_range(name, "", &range) <= 0)
 	G_fatal_error(_("Unable to read range for map <%s>"), name);
 
     G_get_range_min_max(&range, &old_min, &old_max);

Modified: grass/trunk/raster/r.recode/recode.c
===================================================================
--- grass/trunk/raster/r.recode/recode.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.recode/recode.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -28,7 +28,7 @@
     /* set the window from the header for the input file */
     if (align_wind) {
 	G_get_window(&window);
-	if (G_get_cellhd(name, mapset, &cellhd) >= 0) {
+	if (G_get_cellhd(name, "", &cellhd) >= 0) {
 	    G_align_window(&window, &cellhd);
 	    G_set_window(&window);
 	}
@@ -40,7 +40,7 @@
     ncols = G_window_cols();
 
     /* open the input file for reading */
-    in_fd = G_open_cell_old(name, mapset);
+    in_fd = G_open_cell_old(name, "");
     if (in_fd < 0)
 	G_fatal_error("Can't open input map");
 

Modified: grass/trunk/raster/r.region/main.c
===================================================================
--- grass/trunk/raster/r.region/main.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.region/main.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -30,7 +30,6 @@
     struct Cell_head cellhd, window;
     char *value;
     char *name;
-    char *mapset;
     char *err;
 
     struct GModule *module;
@@ -153,12 +152,8 @@
 
     name = parm.map->answer;
 
-    mapset = G_find_cell2(name, "");
-    if (!mapset)
-	G_fatal_error(_("Raster map <%s> not found"), name);
-    if (G_get_cellhd(name, mapset, &cellhd) < 0)
-	G_fatal_error(_("Unable to read header of raster map <%s@%s>"), name,
-		      mapset);
+    if (G_get_cellhd(name, G_mapset(), &cellhd) < 0)
+	G_fatal_error(_("Unable to read header of raster map <%s>"), name);
 
     G_copy(&window, &cellhd, sizeof(window));
 
@@ -169,12 +164,8 @@
 	G_get_window(&window);
 
     if ((name = parm.region->answer)) {	/* region= */
-	mapset = G_find_file("windows", name, "");
-	if (!mapset)
-	    G_fatal_error(_("Region <%s> not found"), name);
-	if (G__get_window(&window, "windows", name, mapset) != NULL)
-	    G_fatal_error(_("Unable to read region <%s> in <%s>"), name,
-			  mapset);
+	if (G__get_window(&window, "windows", name, "") != NULL)
+	    G_fatal_error(_("Unable to read region <%s>"), name);
     }
 
     if ((name = parm.view->answer)) {	/* 3dview= */
@@ -182,24 +173,17 @@
 	FILE *fp;
 	int ret;
 
-	mapset = G_find_file2("3d.view", name, "");
-	if (!mapset)
-	    G_fatal_error(_("3dview file <%s> not found"), name);
-
 	G_3dview_warning(0);	/* suppress boundary mismatch warning */
 
-	fp = G_fopen_old("3d.view", name, mapset);
+	fp = G_fopen_old("3d.view", name, "");
 	if (!fp)
-	    G_fatal_error(_("Unable to open 3dview file <%s> in <%s>"), name,
-			  mapset);
+	    G_fatal_error(_("Unable to open 3dview file <%s>"), name);
 
-	ret = G_get_3dview(name, mapset, &v);
+	ret = G_get_3dview(name, "", &v);
 	if (ret < 0)
-	    G_fatal_error(_("Unable to read 3dview file <%s> in <%s>"), name,
-			  mapset);
+	    G_fatal_error(_("Unable to read 3dview file <%s>"), name);
 	if (ret == 0)
-	    G_fatal_error(_("Old 3dview file. Region <%s> not found in <%s>"),
-			  name, mapset);
+	    G_fatal_error(_("Old 3dview file. Region <%s> not found"), name);
 
 
 	window.north = v.vwin.north;
@@ -212,26 +196,17 @@
     }
 
     if ((name = parm.raster->answer)) {	/* raster= */
-	mapset = G_find_cell2(name, "");
-	if (!mapset)
-	    G_fatal_error(_("Raster map <%s> not found"), name);
-	if (G_get_cellhd(name, mapset, &window) < 0)
-	    G_fatal_error(_("Unable to read header of raster map <%s@%s>"),
-			  name, mapset);
+	if (G_get_cellhd(name, "", &window) < 0)
+	    G_fatal_error(_("Unable to read header of raster map <%s>"), name);
     }
 
     if ((name = parm.vect->answer)) {	/* vect= */
 	struct Map_info Map;
 	BOUND_BOX box;
 
-	mapset = G_find_vector2(name, "");
-	if (!mapset)
-	    G_fatal_error(_("Vector map <%s> not found"), name);
-
 	Vect_set_open_level(1);
-	if (Vect_open_old(&Map, name, mapset) != 1)
-	    G_fatal_error(_("Unable to open vector map <%s> in <%s>"), name,
-			  mapset);
+	if (Vect_open_old(&Map, name, "") != 1)
+	    G_fatal_error(_("Unable to open vector map <%s>"), name);
 
 	Vect_get_map_box(&Map, &box);
 	window.north = box.N;
@@ -335,14 +310,10 @@
     if ((name = parm.align->answer)) {	/* align= */
 	struct Cell_head temp_window;
 
-	mapset = G_find_cell2(name, "");
-	if (!mapset)
-	    G_fatal_error(_("Raster map <%s> not found"), name);
-	if (G_get_cellhd(name, mapset, &temp_window) < 0)
-	    G_fatal_error(_("Unable to read header of raster map <%s@%s>"),
-			  name, mapset);
+	if (G_get_cellhd(name, "", &temp_window) < 0)
+	    G_fatal_error(_("Unable to read header of raster map <%s>"), name);
 	if ((err = G_align_window(&window, &temp_window)))
-	    G_fatal_error("%s in %s: %s", name, mapset, err);
+	    G_fatal_error("%s: %s", name, err);
     }
 
     window.rows = cellhd.rows;

Deleted: grass/trunk/raster/r.resamp.rst/local_proto.h
===================================================================
--- grass/trunk/raster/r.resamp.rst/local_proto.h	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.resamp.rst/local_proto.h	2008-08-28 20:08:49 UTC (rev 33142)
@@ -1,3 +0,0 @@
-/* main.c */
-void create_temp_files(void);
-void clean_fatal_error(char *);

Modified: grass/trunk/raster/r.resamp.rst/main.c
===================================================================
--- grass/trunk/raster/r.resamp.rst/main.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.resamp.rst/main.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -43,45 +43,33 @@
 #include <grass/interpf.h>
 #include <grass/glocale.h>
 
-#include "local_proto.h"
+static double /* pargr */ ns_res, ew_res, inp_ew_res, inp_ns_res;
+static int inp_rows, inp_cols;
 
+static double inp_x_orig, inp_y_orig;
+static double dmin, ertre, deltx, delty;
+static int nsizr, nsizc;
 
-double /* pargr */ ns_res, ew_res, inp_ew_res, inp_ns_res;
-int inp_rows, inp_cols;
-double x_orig, y_orig;
-double inp_x_orig, inp_y_orig;
-double dmin, ertre, deltx, delty;
-int nsizr, nsizc;
-int KMAX2 /* , KMIN, KMAX */ ;
+static double /* datgr */ *az, *adx, *ady, *adxx, *adyy, *adxy;
+static double /* error */ ertot, ertre, zminac, zmaxac, zmult;
 
-double /* datgr */ *az, *adx, *ady, *adxx, *adyy, *adxy;
-double /* error */ ertot, ertre, zminac, zmaxac, zmult;
+static int NPOINT;
+static int deriv, overlap, cursegm, dtens;
+static double fi;
 
-int total = 0;
-int NPOINT = 0;
-int OUTRANGE = 0;
-int NPT = 0;
-int deriv, overlap, cursegm, dtens;
-double fi;
+static int cond1, cond2;
+static double fstar2, tfsta2, xmin, xmax, ymin, ymax, zmin, zmax, gmin, gmax,
+    c1min, c1max, c2min, c2max;
+static double dnorm;
+static double smc;
+static double theta, scalex;
 
-double DETERM;
-int NERROR, cond1, cond2;
-char fncdsm[32];
-char filnam[10];
-char msg[1024];
-double fstar2, tfsta2, xmin, xmax, ymin, ymax, zmin, zmax, gmin, gmax, c1min,
-    c1max, c2min, c2max;
-double dnorm;
-double smc;
-double theta, scalex;
+static FCELL *zero_array_cell;
+static struct interp_params params;
 
-FCELL *zero_array_cell;
-struct interp_params params;
+static FILE *fd4;			/* unused? */
+static int fdinp, fdsmooth = -1;
 
-FILE *fdredinp, *fdzout, *fddxout, *fddyout, *fdxxout, *fdyyout, *fxyout;
-FILE *fd4;			/* unused? */
-int fdinp, fdsmooth = -1;
-
 /*
  * x,y,z - input data npoint - number of input data fi - tension parameter
  * b - coef. of int. function a - matrix of system of linear equations az-
@@ -96,37 +84,42 @@
  * interpolation of z-values to given point x,y
  */
 
-char *input;
-char *smooth = NULL;
-char *mapset;
-char *elev = NULL;
-char *slope = NULL;
-char *aspect = NULL;
-char *pcurv = NULL;
-char *tcurv = NULL;
-char *mcurv = NULL;
-char *maskmap = NULL;
-char *redinp = NULL;
-int sdisk, disk;
-FILE *Tmp_fd_z = NULL;
-char *Tmp_file_z = NULL;
-FILE *Tmp_fd_dx = NULL;
-char *Tmp_file_dx = NULL;
-FILE *Tmp_fd_dy = NULL;
-char *Tmp_file_dy = NULL;
-FILE *Tmp_fd_xx = NULL;
-char *Tmp_file_xx = NULL;
-FILE *Tmp_fd_yy = NULL;
-char *Tmp_file_yy = NULL;
-FILE *Tmp_fd_xy = NULL;
-char *Tmp_file_xy = NULL;
+static char *input;
+static char *smooth;
+static char *elev;
+static char *slope;
+static char *aspect;
+static char *pcurv;
+static char *tcurv;
+static char *mcurv;
+static char *maskmap;
 
-struct BM *bitmask;
-struct Cell_head winhd;
-struct Cell_head inphd;
-struct Cell_head outhd;
-struct Cell_head smhd;
+static int sdisk, disk;
 
+static char *Tmp_file_z;
+static char *Tmp_file_dx;
+static char *Tmp_file_dy;
+static char *Tmp_file_xx;
+static char *Tmp_file_yy;
+static char *Tmp_file_xy;
+
+static FILE *Tmp_fd_z;
+static FILE *Tmp_fd_dx;
+static FILE *Tmp_fd_dy;
+static FILE *Tmp_fd_xx;
+static FILE *Tmp_fd_yy;
+static FILE *Tmp_fd_xy;
+static FILE *Tmp_fd_z;
+
+static struct BM *bitmask;
+static struct Cell_head winhd;
+static struct Cell_head inphd;
+static struct Cell_head outhd;
+static struct Cell_head smhd;
+
+static void create_temp_files(void);
+static void clean(void);
+
 int main(int argc, char *argv[])
 {
     int m1, ret_val;
@@ -319,10 +312,10 @@
     ertre = 0.1;
 
     if (!G_scan_resolution(parm.res_ew->answer, &ew_res, winhd.proj))
-	G_fatal_error(_("Cannot read ew_res value"));
+	G_fatal_error(_("Unable to read ew_res value"));
 
     if (!G_scan_resolution(parm.res_ns->answer, &ns_res, winhd.proj))
-	G_fatal_error(_("Cannot read ns_res value"));
+	G_fatal_error(_("Unable to read ns_res value"));
 
     if (sscanf(parm.fi->answer, "%lf", &fi) != 1)
 	G_fatal_error(_("Invalid value for tension"));
@@ -363,52 +356,29 @@
     disk = nsizc * nsizr * sizeof(int);
 
     az = G_alloc_vector(nsizc + 1);
-    if (!az)
-	G_fatal_error(_("Not enough memory for az"));
 
     if (cond1) {
 	adx = G_alloc_vector(nsizc + 1);
-	if (!adx)
-	    G_fatal_error(_("Not enough memory for adx"));
-
 	ady = G_alloc_vector(nsizc + 1);
-	if (!ady)
-	    G_fatal_error(_("Not enough memory for ady"));
-
 	if (cond2) {
 	    adxx = G_alloc_vector(nsizc + 1);
-	    if (!adxx)
-		G_fatal_error(_("Not enough memory for adxx"));
-
 	    adyy = G_alloc_vector(nsizc + 1);
-	    if (!adyy)
-		G_fatal_error(_("Not enough memory for adyy"));
-
 	    adxy = G_alloc_vector(nsizc + 1);
-	    if (!adxy)
-		G_fatal_error(_("Not enough memory for adxy"));
 	}
     }
-    mapset = NULL;
+
     if (smooth != NULL) {
 
-	mapset = G_find_file("cell", smooth, "");
-
-	if (mapset == NULL)
-	    G_fatal_error(_("Raster map <%s> not found"), smooth);
-
-	G_debug(1, "mapset for smooth map is [%s]", mapset);
-
-	if ((fdsmooth = G_open_cell_old(smooth, mapset)) < 0)
+	if ((fdsmooth = G_open_cell_old(smooth, "")) < 0)
 	    G_fatal_error(_("Unable to open raster map <%s>"), smooth);
 
-	if (G_get_cellhd(smooth, mapset, &smhd) < 0)
-	    G_fatal_error(_("[%s]: Cannot read map header"), smooth);
+	if (G_get_cellhd(smooth, "", &smhd) < 0)
+	    G_fatal_error(_("Unable to read header for <%s>"), smooth);
 
 	if ((winhd.ew_res != smhd.ew_res) || (winhd.ns_res != smhd.ns_res))
-	    G_fatal_error(_("[%s]: Map is the wrong resolution"), smooth);
+	    G_fatal_error(_("Map <%s> is the wrong resolution"), smooth);
 
-	if (G_read_fp_range(smooth, mapset, &range) >= 0)
+	if (G_read_fp_range(smooth, "", &range) >= 0)
 	    G_get_fp_range_min_max(&range, &cellmin, &cellmax);
 
 	fcellmin = (float)cellmin;
@@ -417,21 +387,13 @@
 	    G_fatal_error(_("Smoothing values can not be negative or NULL"));
     }
 
-    mapset = NULL;
-    mapset = G_find_file("cell", input, "");
+    if (G_get_cellhd(input, "", &inphd) < 0)
+	G_fatal_error(_("Unable to read header for <%s>"), input);
 
-    if (mapset == NULL)
-	G_fatal_error(_("Raster map <%s> not found"), input);
-
-    G_debug(1, "mapset for input map is [%s]", mapset);
-
-    if (G_get_cellhd(input, mapset, &inphd) < 0)
-	G_fatal_error(_("[%s]: Cannot read map header"), input);
-
     if ((winhd.ew_res != inphd.ew_res) || (winhd.ns_res != inphd.ns_res))
 	G_fatal_error(_("Input map resolution differs from current region resolution!"));
 
-    if ((fdinp = G_open_cell_old(input, mapset)) < 0)
+    if ((fdinp = G_open_cell_old(input, "")) < 0)
 	G_fatal_error(_("Unable to open raster map <%s>"), input);
 
 
@@ -467,7 +429,7 @@
 	smc = 0.01;
 
 
-    if (G_read_fp_range(input, mapset, &range) >= 0) {
+    if (G_read_fp_range(input, "", &range) >= 0) {
 	G_get_fp_range_min_max(&range, &cellmin, &cellmax);
     }
     else {
@@ -475,8 +437,8 @@
 	for (m1 = 0; m1 < inp_rows; m1++) {
 	    ret_val = G_get_f_raster_row(fdinp, cellrow, m1);
 	    if (ret_val < 0)
-		G_fatal_error(_("Cannot get row %d (error = %d)"), m1,
-			      ret_val);
+		G_fatal_error(_("Error reading row %d (error = %d)"),
+			      m1, ret_val);
 
 	    G_row_update_fp_range(cellrow, m1, &range, FCELL_TYPE);
 	}
@@ -515,13 +477,13 @@
 
     G_message(_("Temporarily changing the region to desired resolution ..."));
     if (G_set_window(&outhd) < 0)
-	G_fatal_error("Cannot set region to output region!");
+	G_fatal_error(_("Cannot set region to output region"));
 
     bitmask = IL_create_bitmask(&params);
     /* change region to initial region */
     G_message(_("Changing back to the original region ..."));
     if (G_set_window(&winhd) < 0)
-	G_fatal_error(_("Cannot set region to back to the initial region !!!"));
+	G_fatal_error(_("Cannot set region to back to the initial region"));
 
     ertot = 0.;
     cursegm = 0;
@@ -539,8 +501,10 @@
 
     G_message(_("dnorm in mainc after grid before out1= %f"), dnorm);
 
-    if (NPOINT < 0)
-	clean_fatal_error("split_and_interpolate() failed");
+    if (NPOINT < 0) {
+	clean();
+	G_fatal_error(_("split_and_interpolate() failed"));
+    }
 
     if (fd4 != NULL)
 	fprintf(fd4, "max. error found = %f \n", ertot);
@@ -558,36 +522,13 @@
 
     if (IL_resample_output_2d(&params, zmin, zmax, zminac, zmaxac, c1min,
 			      c1max, c2min, c2max, gmin, gmax, ertot, input,
-			      &dnorm, &outhd, &winhd, smooth, NPOINT) < 0)
-	clean_fatal_error
-	    ("Can not write raster maps -- try increasing cell size");
+			      &dnorm, &outhd, &winhd, smooth, NPOINT) < 0) {
+	clean();
+	G_fatal_error(_("Unable to write raster maps -- try increasing cell size"));
+    }
 
     G_free(zero_array_cell);
-    if (elev != NULL)
-	fclose(Tmp_fd_z);
-    if (slope != NULL)
-	fclose(Tmp_fd_dx);
-    if (aspect != NULL)
-	fclose(Tmp_fd_dy);
-    if (pcurv != NULL)
-	fclose(Tmp_fd_xx);
-    if (tcurv != NULL)
-	fclose(Tmp_fd_yy);
-    if (mcurv != NULL)
-	fclose(Tmp_fd_xy);
-
-    if (elev != NULL)
-	unlink(Tmp_file_z);
-    if (slope != NULL)
-	unlink(Tmp_file_dx);
-    if (aspect != NULL)
-	unlink(Tmp_file_dy);
-    if (pcurv != NULL)
-	unlink(Tmp_file_xx);
-    if (tcurv != NULL)
-	unlink(Tmp_file_yy);
-    if (mcurv != NULL)
-	unlink(Tmp_file_xy);
+    clean();
     if (fd4)
 	fclose(fd4);
     G_close_cell(fdinp);
@@ -598,126 +539,55 @@
     exit(EXIT_SUCCESS);
 }
 
-
-void create_temp_files(void)
+static FILE *create_temp_file(const char *name, char **tmpname)
 {
+    FILE *fp;
+    char *tmp;
     int i;
 
-    zero_array_cell = (FCELL *) G_malloc(sizeof(FCELL) * nsizc);
-    if (!zero_array_cell)
-	G_fatal_error(_("Not enough memory for zero_array_cell"));
+    if (!name)
+	return NULL;
 
-    for (i = 0; i < nsizc; i++) {
-	zero_array_cell[i] = (FCELL) 0;
-    }
+    *tmpname = tmp = G_tempfile();
+    fp = fopen(tmp, "w+");
+    if (!fp)
+	G_fatal_error(_("Unable to open temporary file <%s>"), tmpname);
 
-    if (elev != NULL) {
-	Tmp_file_z = G_tempfile();
-	if (NULL == (Tmp_fd_z = fopen(Tmp_file_z, "w+")))
-	    G_fatal_error(_("Unable to open temporary file <%s>"),
-			  Tmp_file_z);
-
-	for (i = 0; i < nsizr; i++) {
-	    if (!(fwrite(zero_array_cell, sizeof(FCELL), nsizc, Tmp_fd_z)))
-		clean_fatal_error
-		    (_("Not enough disk space -- cannot write files"));
+    for (i = 0; i < nsizr; i++) {
+	if (fwrite(zero_array_cell, sizeof(FCELL), nsizc, fp) != nsizc) {
+	    clean();
+	    G_fatal_error(_("Error writing temporary file <%s>"), tmpname);
 	}
     }
-    if (slope != NULL) {
-	Tmp_file_dx = G_tempfile();
-	if (NULL == (Tmp_fd_dx = fopen(Tmp_file_dx, "w+"))) {
-	    sprintf(msg, _("Unable to open temporary file <%s>"),
-		    Tmp_file_dx);
-	    clean_fatal_error(msg);
-	}
-	for (i = 0; i < nsizr; i++) {
-	    if (!(fwrite(zero_array_cell, sizeof(FCELL), nsizc, Tmp_fd_dx)))
-		clean_fatal_error
-		    (_("Not enough disk space -- cannot write files"));
-	}
-    }
-    if (aspect != NULL) {
-	Tmp_file_dy = G_tempfile();
-	if (NULL == (Tmp_fd_dy = fopen(Tmp_file_dy, "w+"))) {
-	    sprintf(msg, _("Unable to open temporary file <%s>"),
-		    Tmp_file_dy);
-	    clean_fatal_error(msg);
-	}
-	for (i = 0; i < nsizr; i++) {
-	    if (!(fwrite(zero_array_cell, sizeof(FCELL), nsizc, Tmp_fd_dy)))
-		clean_fatal_error
-		    (_("Not enough disk space -- cannot write files"));
-	}
-    }
 
-    if (pcurv != NULL) {
-	Tmp_file_xx = G_tempfile();
-	if (NULL == (Tmp_fd_xx = fopen(Tmp_file_xx, "w+"))) {
-	    sprintf(msg, _("Unable to open temporary file <%s>"),
-		    Tmp_file_xx);
-	    clean_fatal_error(msg);
-	}
-	for (i = 0; i < nsizr; i++) {
-	    if (!(fwrite(zero_array_cell, sizeof(FCELL), nsizc, Tmp_fd_xx)))
-		clean_fatal_error
-		    (_("Not enough disk space -- cannot write files"));
-	}
-    }
-    if (tcurv != NULL) {
-	Tmp_file_yy = G_tempfile();
-	if (NULL == (Tmp_fd_yy = fopen(Tmp_file_yy, "w+"))) {
-	    sprintf(msg, _("Unable to open temporary file <%s>"),
-		    Tmp_file_yy);
-	    clean_fatal_error(msg);
-	}
-	for (i = 0; i < nsizr; i++) {
-	    if (!(fwrite(zero_array_cell, sizeof(FCELL), nsizc, Tmp_fd_yy)))
-		clean_fatal_error
-		    (_("Not enough disk space -- cannot write files"));
-	}
-    }
-    if (mcurv != NULL) {
-	Tmp_file_xy = G_tempfile();
-	if (NULL == (Tmp_fd_xy = fopen(Tmp_file_xy, "w+"))) {
-	    sprintf(msg, _("Unable to open temporary file <%s>"),
-		    Tmp_file_xy);
-	    clean_fatal_error(msg);
-	}
-	for (i = 0; i < nsizr; i++) {
-	    if (!(fwrite(zero_array_cell, sizeof(FCELL), nsizc, Tmp_fd_xy)))
-		clean_fatal_error
-		    (_("Not enough disk space -- cannot write files"));
-	}
-    }
+    return fp;
+}
 
-    return;
+static void create_temp_files(void)
+{
+    zero_array_cell = (FCELL *) G_calloc(nsizc, sizeof(FCELL));
+
+    Tmp_fd_z  = create_temp_file(elev,   &Tmp_file_z );
+    Tmp_fd_dx = create_temp_file(slope,  &Tmp_file_dx);
+    Tmp_fd_dy = create_temp_file(aspect, &Tmp_file_dy);
+    Tmp_fd_xx = create_temp_file(pcurv,  &Tmp_file_xx);
+    Tmp_fd_yy = create_temp_file(tcurv,  &Tmp_file_yy);
+    Tmp_fd_xy = create_temp_file(mcurv,  &Tmp_file_xy);
 }
 
-void clean_fatal_error(char *str)
+static void clean(void)
 {
-    if (Tmp_fd_z) {
-	fclose(Tmp_fd_z);
-	unlink(Tmp_file_z);
-    }
-    if (Tmp_fd_dx) {
-	fclose(Tmp_fd_dx);
-	unlink(Tmp_file_dx);
-    }
-    if (Tmp_fd_dy) {
-	fclose(Tmp_fd_dy);
-	unlink(Tmp_file_dy);
-    }
-    if (Tmp_fd_xx) {
-	fclose(Tmp_fd_xx);
-	unlink(Tmp_file_xx);
-    }
-    if (Tmp_fd_yy) {
-	fclose(Tmp_fd_yy);
-	unlink(Tmp_file_yy);
-    }
-    if (Tmp_fd_xy) {
-	fclose(Tmp_fd_xy);
-	unlink(Tmp_file_xy);
-    }
-    G_fatal_error(str);
+    if (Tmp_fd_z)	fclose(Tmp_fd_z);
+    if (Tmp_fd_dx)	fclose(Tmp_fd_dx);
+    if (Tmp_fd_dy)	fclose(Tmp_fd_dy);
+    if (Tmp_fd_xx)	fclose(Tmp_fd_xx);
+    if (Tmp_fd_yy)	fclose(Tmp_fd_yy);
+    if (Tmp_fd_xy)	fclose(Tmp_fd_xy);
+
+    if (Tmp_file_z)	unlink(Tmp_file_z);
+    if (Tmp_file_dx)	unlink(Tmp_file_dx);
+    if (Tmp_file_dy)	unlink(Tmp_file_dy);
+    if (Tmp_file_xx)	unlink(Tmp_file_xx);
+    if (Tmp_file_yy)	unlink(Tmp_file_yy);
+    if (Tmp_file_xy)	unlink(Tmp_file_xy);
 }

Deleted: grass/trunk/raster/r.resample/diff.sh
===================================================================
--- grass/trunk/raster/r.resample/diff.sh	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.resample/diff.sh	2008-08-28 20:08:49 UTC (rev 33142)
@@ -1,17 +0,0 @@
-u_UPDIR=`pwd`
-echo making diffs in directory
-SRC_DIR=/sd1h/grass.data/fp_null/r.resample
-
-for i in `ls *.c`
-do
-  echo $i
-  diff -b $i $SRC_DIR/$i
-done
-
-for i in `ls *.h`
-do
-   echo $i
-   diff -b $i $SRC_DIR/$i
-done
-
-exit 0

Modified: grass/trunk/raster/r.resample/main.c
===================================================================
--- grass/trunk/raster/r.resample/main.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.resample/main.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -34,8 +34,8 @@
     struct Cell_head cellhd;
     struct Range range;
     int hist_ok, colr_ok, cats_ok;
-    char name[GNAME_MAX], *mapset;
-    char result[GNAME_MAX];
+    char *name;
+    char *result;
     void *rast;
     int nrows, ncols;
     int row;
@@ -75,24 +75,20 @@
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
-    strcpy(name, option.input->answer);
-    strcpy(result, option.output->answer);
+    name = option.input->answer;
+    result = option.output->answer;
 
-    mapset = G_find_cell2(name, "");
-    if (mapset == NULL)
-	G_fatal_error(_("Raster map <%s> not found"), name);
-
-    hist_ok = G_read_history(name, mapset, &hist) >= 0;
-    colr_ok = G_read_colors(name, mapset, &colr) > 0;
-    cats_ok = G_read_cats(name, mapset, &cats) >= 0;
+    hist_ok = G_read_history(name, "", &hist) >= 0;
+    colr_ok = G_read_colors(name, "", &colr) > 0;
+    cats_ok = G_read_cats(name, "", &cats) >= 0;
     if (cats_ok) {
 	G_unmark_raster_cats(&cats);
 	G_init_cats((CELL) 0, G_get_cats_title(&cats), &newcats);
     }
 
-    infd = G_open_cell_old(name, mapset);
+    infd = G_open_cell_old(name, "");
     if (infd < 0)
-	exit(EXIT_FAILURE);
+	G_fatal_error(_("Unable to open input map <%s>"), name);
 
     /* determine the map type;
        data_type is the type of data being processed,
@@ -100,31 +96,31 @@
     data_type = G_get_raster_map_type(infd);
     out_type = data_type;
 
-    if (G_get_cellhd(name, mapset, &cellhd) < 0)
-	exit(EXIT_FAILURE);
+    if (G_get_cellhd(name, "", &cellhd) < 0)
+	G_fatal_error(_("Unable to read header for <%s>"), name);
 
     /* raster buffer is big enough to hold data */
     rast = G_allocate_raster_buf(data_type);
     nrows = G_window_rows();
     ncols = G_window_cols();
     if (ncols <= 1)
-	rast = (void *)G_realloc((char *)rast, 2 * G_raster_size(data_type));
+	rast = G_realloc(rast, 2 * G_raster_size(data_type));
     /* we need the buffer at least 2 cells large */
 
     outfd = G_open_raster_new(result, out_type);
     G_set_null_value(rast, ncols, out_type);
 
     if (outfd < 0)
-	exit(EXIT_FAILURE);
+	G_fatal_error(_("Unable to open output map <%s>"), name);
 
     G_message(_("Percent complete: "));
 
     for (row = 0; row < nrows; row++) {
 	G_percent(row, nrows, 2);
 	if (G_get_raster_row(infd, rast, row, data_type) < 0)
-	    exit(EXIT_FAILURE);
+	    G_fatal_error(_("Error reading row %d"), row);
 	if (G_put_raster_row(outfd, rast, out_type) < 0)
-	    exit(EXIT_FAILURE);
+	    G_fatal_error(_("Error writing row %d"), row);
 	G_mark_raster_cats(rast, ncols, &cats, data_type);
     }
 

Modified: grass/trunk/raster/r.rescale/get_range.c
===================================================================
--- grass/trunk/raster/r.rescale/get_range.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.rescale/get_range.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -3,7 +3,7 @@
 #include <grass/glocale.h>
 #include "local_proto.h"
 
-int get_range(char *name, char *mapset, long *min, long *max)
+int get_range(const char *name, long *min, long *max)
 {
     struct Range range;
     int nrows, ncols, row, col;
@@ -12,12 +12,12 @@
     CELL cmin, cmax;
     struct Cell_head cellhd;
 
-    if (G_read_range(name, mapset, &range) < 0) {
+    if (G_read_range(name, "", &range) < 0) {
 	G_init_range(&range);	/* read the file to get the range */
-	G_get_cellhd(name, mapset, &cellhd);
+	G_get_cellhd(name, "", &cellhd);
 	G_set_window(&cellhd);
 	cell = G_allocate_cell_buf();
-	fd = G_open_cell_old(name, mapset);
+	fd = G_open_cell_old(name, "");
 	if (fd < 0)
 	    exit(1);
 	nrows = G_window_rows();

Modified: grass/trunk/raster/r.rescale/local_proto.h
===================================================================
--- grass/trunk/raster/r.rescale/local_proto.h	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.rescale/local_proto.h	2008-08-28 20:08:49 UTC (rev 33142)
@@ -1,2 +1,2 @@
 /* get_range.c */
-int get_range(char *, char *, long *, long *);
+int get_range(const char *, long *, long *);

Modified: grass/trunk/raster/r.rescale/main.c
===================================================================
--- grass/trunk/raster/r.rescale/main.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.rescale/main.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -21,7 +21,7 @@
 
 int main(int argc, char *argv[])
 {
-    char buf[512];
+    char buf[GPATH_MAX];
     FILE *fd;
     long old_min, old_max;
     long new_min, new_max;
@@ -31,7 +31,6 @@
     float divisor;
     char *old_name;
     char *new_name;
-    char *mapset;
     struct GModule *module;
     struct
     {
@@ -89,19 +88,13 @@
     old_name = parm.input->answer;
     new_name = parm.output->answer;
 
-    mapset = G_find_cell(old_name, "");
-    if (mapset == NULL) {
-	sprintf(buf, "%s - not found\n", old_name);
-	G_fatal_error(buf);
-    }
-
     if (parm.from->answer) {
 	sscanf(parm.from->answers[0], "%ld", &old_min);
 	sscanf(parm.from->answers[1], "%ld", &old_max);
 
     }
     else
-	get_range(old_name, mapset, &old_min, &old_max);
+	get_range(old_name, &old_min, &old_max);
     if (old_min > old_max) {
 	value = old_min;	/* swap */
 	old_min = old_max;
@@ -119,8 +112,8 @@
     G_message(_("Rescale %s[%ld,%ld] to %s[%ld,%ld]"),
 	      old_name, old_min, old_max, new_name, new_min, new_max);
 
-    sprintf(buf, "r.reclass input=\"%s\" output=\"%s\" title=\"", old_name,
-	    new_name);
+    sprintf(buf, "r.reclass input=\"%s\" output=\"%s\" title=\"",
+	    old_name, new_name);
     if (parm.title->answer)
 	strcat(buf, parm.title->answer);
     else {

Modified: grass/trunk/raster/r.rescale.eq/get_stats.c
===================================================================
--- grass/trunk/raster/r.rescale.eq/get_stats.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.rescale.eq/get_stats.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -1,14 +1,15 @@
 #include <stdlib.h>
 #include <grass/gis.h>
 #include <grass/glocale.h>
+#include "local_proto.h"
 
-int get_stats(char *name, char *mapset, struct Cell_stats *statf)
+int get_stats(const char *name, struct Cell_stats *statf)
 {
     int fd;
     CELL *cell;
     int row, nrows, ncols;
 
-    fd = G_open_cell_old(name, mapset);
+    fd = G_open_cell_old(name, "");
     if (fd < 0)
 	exit(1);
     nrows = G_window_rows();

Modified: grass/trunk/raster/r.rescale.eq/local_proto.h
===================================================================
--- grass/trunk/raster/r.rescale.eq/local_proto.h	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.rescale.eq/local_proto.h	2008-08-28 20:08:49 UTC (rev 33142)
@@ -2,4 +2,4 @@
 int get_range(struct Cell_stats *, CELL *, CELL *, int);
 
 /* get_stats.c */
-int get_stats(char *, char *, struct Cell_stats *);
+int get_stats(const char *, struct Cell_stats *);

Modified: grass/trunk/raster/r.rescale.eq/main.c
===================================================================
--- grass/trunk/raster/r.rescale.eq/main.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.rescale.eq/main.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -25,14 +25,13 @@
 
 int main(int argc, char *argv[])
 {
-    char buf[512];
+    char buf[GPATH_MAX];
     CELL old_min, old_max;
     CELL new_min, new_max;
     long cat;
     struct Cell_stats statf;
     char *old_name;
     char *new_name;
-    char *mapset;
     struct
     {
 	struct Option *input, *from, *output, *to, *title;
@@ -93,13 +92,7 @@
     old_name = parm.input->answer;
     new_name = parm.output->answer;
 
-    mapset = G_find_cell(old_name, "");
-    if (mapset == NULL) {
-	sprintf(buf, "%s - not found\n", old_name);
-	G_fatal_error(buf);
-    }
-
-    get_stats(old_name, mapset, &statf);
+    get_stats(old_name, &statf);
     if (parm.from->answer) {
 	sscanf(parm.from->answers[0], "%d", &old_min);
 	sscanf(parm.from->answers[1], "%d", &old_max);
@@ -123,8 +116,8 @@
     G_message(_("Rescale %s[%d,%d] to %s[%d,%d]"),
 	      old_name, old_min, old_max, new_name, new_min, new_max);
 
-    sprintf(buf, "r.reclass input=\"%s\" output=\"%s\" title=\"", old_name,
-	    new_name);
+    sprintf(buf, "r.reclass input=\"%s\" output=\"%s\" title=\"",
+	    old_name, new_name);
     if (parm.title->answer)
 	strcat(buf, parm.title->answer);
     else {

Modified: grass/trunk/raster/r.series/main.c
===================================================================
--- grass/trunk/raster/r.series/main.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.series/main.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -54,7 +54,7 @@
 
 struct input
 {
-    char *name, *mapset;
+    char *name;
     int fd;
     DCELL *buf;
 };
@@ -154,15 +154,11 @@
 	struct input *p = &inputs[i];
 
 	p->name = parm.input->answers[i];
-	p->mapset = G_find_cell2(p->name, "");
-	if (!p->mapset)
-	    G_fatal_error(_("Raster map <%s> not found"), p->name);
-	else
-	    G_message(_("Reading raster map <%s>..."), p->name);
-	p->fd = G_open_cell_old(p->name, p->mapset);
+	G_message(_("Reading raster map <%s>..."), p->name);
+	p->fd = G_open_cell_old(p->name, "");
 	if (p->fd < 0)
-	    G_fatal_error(_("Unable to open raster map <%s> in mapset <%s>"),
-			  p->name, p->mapset);
+	    G_fatal_error(_("Unable to open raster map <%s>"),
+			  p->name);
 	p->buf = G_allocate_d_raster_buf();
     }
 

Modified: grass/trunk/raster/r.statistics/main.c
===================================================================
--- grass/trunk/raster/r.statistics/main.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.statistics/main.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -46,7 +46,6 @@
 
 int main(int argc, char **argv)
 {
-    char *mapset;
     int o_method;
     struct GModule *module;
     struct Option *method, *basemap, *covermap, *outputmap;
@@ -93,21 +92,15 @@
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
-    if ((mapset = G_find_cell2(basemap->answer, "")) == 0)
-	G_fatal_error(_("Raster map <%s> not found"), basemap->answer);
-
-    if (G_raster_map_is_fp(basemap->answer, mapset) != 0)
+    if (G_raster_map_is_fp(basemap->answer, "") != 0)
 	G_fatal_error(_("This module currently only works for integer (CELL) maps"));
 
-    if ((mapset = G_find_cell2(covermap->answer, "")) == 0)
-	G_fatal_error(_("Raster map <%s> not found"), covermap->answer);
-
-    if (G_raster_map_is_fp(covermap->answer, mapset) != 0)
+    if (G_raster_map_is_fp(covermap->answer, "") != 0)
 	G_fatal_error(_("This module currently only works for integer (CELL) maps"));
 
-    if (G_read_cats(covermap->answer, mapset, &cats) < 0) {
-	G_fatal_error(_("Unable to read category file of raster map <%s@%s>"),
-		      covermap->answer, mapset);
+    if (G_read_cats(covermap->answer, "", &cats) < 0) {
+	G_fatal_error(_("Unable to read category file of raster map <%s>"),
+		      covermap->answer);
     }
 
     for (o_method = 0; menu[o_method].name; o_method++)

Modified: grass/trunk/raster/r.statistics/method.h
===================================================================
--- grass/trunk/raster/r.statistics/method.h	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.statistics/method.h	2008-08-28 20:08:49 UTC (rev 33142)
@@ -22,51 +22,51 @@
 
 struct menu
 {
-    char *name;			/* method name */
+    const char *name;		/* method name */
     int val;			/* number of function */
-    char *text;			/* menu display - full description */
+    const char *text;		/* menu display - full description */
 };
 
 extern struct menu menu[];
 
 /* o_adev.c */
-int o_adev(char *, char *, char *, int, struct Categories *);
+int o_adev(const char *, const char *, const char *, int, struct Categories *);
 
 /* o_average.c */
-int o_average(char *, char *, char *, int, struct Categories *);
+int o_average(const char *, const char *, const char *, int, struct Categories *);
 
 /* o_distrib.c */
-int o_distrib(char *, char *, char *, int);
+int o_distrib(const char *, const char *, const char *, int);
 
 /* o_kurt.c */
-int o_kurt(char *, char *, char *, int, struct Categories *);
+int o_kurt(const char *, const char *, const char *, int, struct Categories *);
 
 /* o_max.c */
-int o_max(char *, char *, char *, int, struct Categories *);
+int o_max(const char *, const char *, const char *, int, struct Categories *);
 
 /* o_median.c */
-int o_median(char *, char *, char *, int, struct Categories *);
+int o_median(const char *, const char *, const char *, int, struct Categories *);
 
 /* o_min.c */
-int o_min(char *, char *, char *, int, struct Categories *);
+int o_min(const char *, const char *, const char *, int, struct Categories *);
 
 /* o_mode.c */
-int o_mode(char *, char *, char *, int, struct Categories *);
+int o_mode(const char *, const char *, const char *, int, struct Categories *);
 
 /* o_sdev.c */
-int o_sdev(char *, char *, char *, int, struct Categories *);
+int o_sdev(const char *, const char *, const char *, int, struct Categories *);
 
 /* o_skew.c */
-int o_skew(char *, char *, char *, int, struct Categories *);
+int o_skew(const char *, const char *, const char *, int, struct Categories *);
 
 /* o_sum.c */
-int o_sum(char *, char *, char *, int, struct Categories *);
+int o_sum(const char *, const char *, const char *, int, struct Categories *);
 
 /* o_var.c */
-int o_var(char *, char *, char *, int, struct Categories *);
+int o_var(const char *, const char *, const char *, int, struct Categories *);
 
 /* o_divr.c */
-int o_divr(char *, char *, char *, int, struct Categories *);
+int o_divr(const char *, const char *, const char *, int, struct Categories *);
 
 /* read_stats.c */
 int read_stats(FILE *, long *, long *, double *);

Modified: grass/trunk/raster/r.statistics/o_adev.c
===================================================================
--- grass/trunk/raster/r.statistics/o_adev.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.statistics/o_adev.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -13,7 +13,7 @@
 
 
 int
-o_adev(char *basemap, char *covermap, char *outputmap, int usecats,
+o_adev(const char *basemap, const char *covermap, const char *outputmap, int usecats,
        struct Categories *cats)
 {
     char command[1024];

Modified: grass/trunk/raster/r.statistics/o_average.c
===================================================================
--- grass/trunk/raster/r.statistics/o_average.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.statistics/o_average.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -12,7 +12,7 @@
 
 
 int
-o_average(char *basemap, char *covermap, char *outputmap, int usecats,
+o_average(const char *basemap, const char *covermap, const char *outputmap, int usecats,
 	  struct Categories *cats)
 {
     char *me = "o_average";

Modified: grass/trunk/raster/r.statistics/o_distrib.c
===================================================================
--- grass/trunk/raster/r.statistics/o_distrib.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.statistics/o_distrib.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -10,7 +10,7 @@
 static int o_out(FILE *, long, long);
 
 
-int o_distrib(char *basemap, char *covermap, char *outputmap, int usecats)
+int o_distrib(const char *basemap, const char *covermap, const char *outputmap, int usecats)
 {
     char *me = "o_distrib";
     char command[1024];

Modified: grass/trunk/raster/r.statistics/o_divr.c
===================================================================
--- grass/trunk/raster/r.statistics/o_divr.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.statistics/o_divr.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -4,7 +4,7 @@
 #include "method.h"
 
 int
-o_divr(char *basemap, char *covermap, char *outputmap, int usecats,
+o_divr(const char *basemap, const char *covermap, const char *outputmap, int usecats,
        struct Categories *cats)
 {
     char command[1024];

Modified: grass/trunk/raster/r.statistics/o_kurt.c
===================================================================
--- grass/trunk/raster/r.statistics/o_kurt.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.statistics/o_kurt.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -13,7 +13,7 @@
 
 
 int
-o_kurt(char *basemap, char *covermap, char *outputmap, int usecats,
+o_kurt(const char *basemap, const char *covermap, const char *outputmap, int usecats,
        struct Categories *cats)
 {
     char command[1024];

Modified: grass/trunk/raster/r.statistics/o_max.c
===================================================================
--- grass/trunk/raster/r.statistics/o_max.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.statistics/o_max.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -4,7 +4,7 @@
 #include "method.h"
 
 int
-o_max(char *basemap, char *covermap, char *outputmap, int usecats,
+o_max(const char *basemap, const char *covermap, const char *outputmap, int usecats,
       struct Categories *cats)
 {
     char command[1024];

Modified: grass/trunk/raster/r.statistics/o_median.c
===================================================================
--- grass/trunk/raster/r.statistics/o_median.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.statistics/o_median.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -8,7 +8,7 @@
 
 
 int
-o_median(char *basemap, char *covermap, char *outputmap, int usecats,
+o_median(const char *basemap, const char *covermap, const char *outputmap, int usecats,
 	 struct Categories *cats)
 {
     char command[1024];

Modified: grass/trunk/raster/r.statistics/o_min.c
===================================================================
--- grass/trunk/raster/r.statistics/o_min.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.statistics/o_min.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -4,7 +4,7 @@
 #include "method.h"
 
 int
-o_min(char *basemap, char *covermap, char *outputmap, int usecats,
+o_min(const char *basemap, const char *covermap, const char *outputmap, int usecats,
       struct Categories *cats)
 {
     char command[1024];

Modified: grass/trunk/raster/r.statistics/o_mode.c
===================================================================
--- grass/trunk/raster/r.statistics/o_mode.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.statistics/o_mode.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -4,7 +4,7 @@
 #include "method.h"
 
 int
-o_mode(char *basemap, char *covermap, char *outputmap, int usecats,
+o_mode(const char *basemap, const char *covermap, const char *outputmap, int usecats,
        struct Categories *cats)
 {
     char command[1024];

Modified: grass/trunk/raster/r.statistics/o_sdev.c
===================================================================
--- grass/trunk/raster/r.statistics/o_sdev.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.statistics/o_sdev.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -13,7 +13,7 @@
 
 
 int
-o_sdev(char *basemap, char *covermap, char *outputmap, int usecats,
+o_sdev(const char *basemap, const char *covermap, const char *outputmap, int usecats,
        struct Categories *cats)
 {
     char command[1024];

Modified: grass/trunk/raster/r.statistics/o_skew.c
===================================================================
--- grass/trunk/raster/r.statistics/o_skew.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.statistics/o_skew.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -13,7 +13,7 @@
 
 
 int
-o_skew(char *basemap, char *covermap, char *outputmap, int usecats,
+o_skew(const char *basemap, const char *covermap, const char *outputmap, int usecats,
        struct Categories *cats)
 {
     char command[1024];

Modified: grass/trunk/raster/r.statistics/o_sum.c
===================================================================
--- grass/trunk/raster/r.statistics/o_sum.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.statistics/o_sum.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -12,7 +12,7 @@
 
 
 int
-o_sum(char *basemap, char *covermap, char *outputmap, int usecats,
+o_sum(const char *basemap, const char *covermap, const char *outputmap, int usecats,
       struct Categories *cats)
 {
     char *me = "o_sum";

Modified: grass/trunk/raster/r.statistics/o_var.c
===================================================================
--- grass/trunk/raster/r.statistics/o_var.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.statistics/o_var.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -13,7 +13,7 @@
 
 
 int
-o_var(char *basemap, char *covermap, char *outputmap, int usecats,
+o_var(const char *basemap, const char *covermap, const char *outputmap, int usecats,
       struct Categories *cats)
 {
     char command[1024];

Modified: grass/trunk/raster/r.stats/main.c
===================================================================
--- grass/trunk/raster/r.stats/main.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.stats/main.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -32,7 +32,6 @@
     char **names;
     char **ptr;
     char *name;
-    char *mapset;
 
     /* flags */
     int raw_data;
@@ -254,31 +253,27 @@
 
     for (; *ptr != NULL; ptr++) {
 	name = *ptr;
-	mapset = G_find_cell2(name, "");
-	if (!mapset)
-	    G_fatal_error(_("Raster map <%s> not found"), name);
 	fd = (int *)G_realloc(fd, (nfiles + 1) * sizeof(int));
 	is_fp = (int *)G_realloc(is_fp, (nfiles + 1) * sizeof(int));
 	DMAX = (DCELL *) G_realloc(DMAX, (nfiles + 1) * sizeof(DCELL));
 	DMIN = (DCELL *) G_realloc(DMIN, (nfiles + 1) * sizeof(DCELL));
 
-	fd[nfiles] = G_open_cell_old(name, mapset);
+	fd[nfiles] = G_open_cell_old(name, "");
 	if (fd[nfiles] < 0)
 	    exit(1);
 	if (!as_int)
-	    is_fp[nfiles] = G_raster_map_is_fp(name, mapset);
+	    is_fp[nfiles] = G_raster_map_is_fp(name, "");
 	else {
 	    is_fp[nfiles] = 0;
 	    if (cat_ranges || nsteps != 255)
 		G_warning(_("Raster map <%s> is reading as integer map! "
 			    "Flag '-%c' and/or '%s' option will be ignored."),
-			  G_fully_qualified_name(name, mapset), flag.C->key,
-			  option.nsteps->key);
+			  name, flag.C->key, option.nsteps->key);
 	}
 	if (with_labels || (cat_ranges && is_fp[nfiles])) {
 	    labels = (struct Categories *)
 		G_realloc(labels, (nfiles + 1) * sizeof(struct Categories));
-	    if (G_read_cats(name, mapset, &labels[nfiles]) < 0)
+	    if (G_read_cats(name, "", &labels[nfiles]) < 0)
 		G_init_cats((CELL) 0, "", &labels[nfiles]);
 	}
 	if (is_fp[nfiles])
@@ -288,21 +283,19 @@
 	    if (cat_ranges) {
 		if (!G_quant_nof_rules(&labels[nfiles].q)) {
 		    G_warning(_("Cats for raster map <%s> are either missing or have no explicit labels. "
-			       "Using %s=%d."), G_fully_qualified_name(name,
-								       mapset),
-			      option.nsteps->key, nsteps);
+			       "Using %s=%d."),
+			      name, option.nsteps->key, nsteps);
 		    cat_ranges = 0;
 		}
 		else if (nsteps != 255)
 		    G_warning(_("Flag '-%c' was given, using cats fp ranges of raster map <%s>, "
-			       "ignoring '%s' option"), flag.C->key,
-			      G_fully_qualified_name(name, mapset),
-			      option.nsteps->key);
+			       "ignoring '%s' option"),
+			      flag.C->key, name, option.nsteps->key);
 	    }
 	    if (!cat_ranges) {	/* DO NOT use else here, cat_ranges can change */
-		if (G_read_fp_range(name, mapset, &fp_range) < 0)
+		if (G_read_fp_range(name, "", &fp_range) < 0)
 		    G_fatal_error(_("Unable to read fp range of raster map <%s>"),
-				  G_fully_qualified_name(name, mapset));
+				  name);
 		G_get_fp_range_min_max(&fp_range, &DMIN[nfiles],
 				       &DMAX[nfiles]);
 		G_quant_add_rule(&q, DMIN[nfiles], DMAX[nfiles], 1, nsteps);
@@ -320,9 +313,8 @@
 	    }
 	}
 	else {
-	    if (G_read_range(name, mapset, &range) < 0)
-		G_fatal_error(_("Unable to read range for map <%s>"),
-			      G_fully_qualified_name(name, mapset));
+	    if (G_read_range(name, "", &range) < 0)
+		G_fatal_error(_("Unable to read range for map <%s>"), name);
 	    G_get_range_min_max(&range, &min, &max);
 	}
 	if (!null_set) {

Modified: grass/trunk/raster/r.sum/main.c
===================================================================
--- grass/trunk/raster/r.sum/main.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.sum/main.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -33,7 +33,6 @@
 
     struct GModule *module;
     struct Option *rast;
-    char *cellmap;
     FILEDESC cellfile = 0;
     FCELL *dbuf, *ibuf;
     int row, col, shh = 0;
@@ -57,13 +56,8 @@
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
-    cellmap = G_find_file2("cell", rast->answer, "");
-    if (!cellmap) {
-	G_fatal_error(_("Raster map <%s> not found"), rast->answer);
-    }
-    if ((cellfile = G_open_cell_old(rast->answer, cellmap)) == -1) {
+    if ((cellfile = G_open_cell_old(rast->answer, "")) < 0)
 	G_fatal_error(_("Unable to open raster map <%s>"), rast->answer);
-    }
 
 
     G_get_set_window(&w);

Modified: grass/trunk/raster/r.sun/main.c
===================================================================
--- grass/trunk/raster/r.sun/main.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.sun/main.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -78,8 +78,6 @@
 char *insol_time = NULL;
 char *diff_rad = NULL;
 char *refl_rad = NULL;
-char *mapset1 = NULL, *mapset2 = NULL, *mapset3 = NULL, *mapset4 = NULL,
-    *mapset5 = NULL, *mapset6 = NULL, *mapset7 = NULL, *mapset8 = NULL;
 char *per;
 char *shade;
 
@@ -518,29 +516,17 @@
 
     }
 
-    if ((mapset1 = G_find_cell(elevin, "")) == NULL)
-	G_fatal_error(_("elevin raster map <%s> not found"), elevin);
+    fd1 = G_open_cell_old(elevin, "");
+    fd2 = G_open_cell_old(aspin, "");
+    fd3 = G_open_cell_old(slopein, "");
 
-    if ((mapset2 = G_find_cell(aspin, "")) == NULL)
-	G_fatal_error(_("aspin raster map <%s> not found"), aspin);
-
-    if ((mapset3 = G_find_cell(slopein, "")) == NULL)
-	G_fatal_error(_("slopein raster map <%s> not found"), slopein);
-
-    fd1 = G_open_cell_old(elevin, mapset1);
-    fd2 = G_open_cell_old(aspin, mapset2);
-    fd3 = G_open_cell_old(slopein, mapset3);
-
     if (linkein != NULL) {
 	cell4 = G_allocate_f_raster_buf();
 	li = (float **)G_malloc(sizeof(float *) * (m));
 	for (l = 0; l < m; l++)
 	    li[l] = (float *)G_malloc(sizeof(float) * (n));
 
-	if ((mapset4 = G_find_cell(linkein, "")) == NULL)
-	    G_fatal_error(_("linkein raster map <%s> not found"), linkein);
-
-	fd4 = G_open_cell_old(linkein, mapset4);
+	fd4 = G_open_cell_old(linkein, "");
     }
 
     if (albedo != NULL) {
@@ -549,10 +535,7 @@
 	for (l = 0; l < m; l++)
 	    a[l] = (float *)G_malloc(sizeof(float) * (n));
 
-	if ((mapset5 = G_find_cell(albedo, "")) == NULL)
-	    G_fatal_error(_("albedo raster map <%s> not found"), albedo);
-
-	fd5 = G_open_cell_old(albedo, mapset5);
+	fd5 = G_open_cell_old(albedo, "");
     }
 
     if (latin != NULL) {
@@ -561,10 +544,7 @@
 	for (l = 0; l < m; l++)
 	    la[l] = (float *)G_malloc(sizeof(float) * (n));
 
-	if ((mapset6 = G_find_cell(latin, "")) == NULL)
-	    G_fatal_error(_("latin raster map <%s> not found"), latin);
-
-	fd6 = G_open_cell_old(latin, mapset6);
+	fd6 = G_open_cell_old(latin, "");
     }
 
     if (coefbh != NULL) {
@@ -573,10 +553,7 @@
 	for (l = 0; l < m; l++)
 	    cbhr[l] = (float *)G_malloc(sizeof(float) * (n));
 
-	if ((mapset7 = G_find_cell(coefbh, "")) == NULL)
-	    G_fatal_error(_("coefbh raster map <%s> not found"), coefbh);
-
-	fr1 = G_open_cell_old(coefbh, mapset7);
+	fr1 = G_open_cell_old(coefbh, "");
     }
 
     if (coefdh != NULL) {
@@ -585,10 +562,7 @@
 	for (l = 0; l < m; l++)
 	    cdhr[l] = (float *)G_malloc(sizeof(float) * (n));
 
-	if ((mapset8 = G_find_cell(coefdh, "")) == NULL)
-	    G_fatal_error(_("coefdh raster map <%s> not found"), coefdh);
-
-	fr2 = G_open_cell_old(coefdh, mapset8);
+	fr2 = G_open_cell_old(coefdh, "");
     }
 
 

Modified: grass/trunk/raster/r.sunmask/main.c
===================================================================
--- grass/trunk/raster/r.sunmask/main.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.sunmask/main.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -86,7 +86,6 @@
 
 int main(int argc, char *argv[])
 {
-    char *mapset;
     extern struct Cell_head window;
     union RASTER_PTR elevbuf, tmpbuf, outbuf;
     CELL min, max;
@@ -451,10 +450,7 @@
 	exit(EXIT_SUCCESS);
     }
 
-    /* Search for output layer in all mapsets ? yes. */
-    mapset = G_find_cell2(name, "");
-
-    if ((elev_fd = G_open_cell_old(name, mapset)) < 0)
+    if ((elev_fd = G_open_cell_old(name, "")) < 0)
 	G_fatal_error(_("Unable to open raster map <%s>"), name);
     if ((output_fd = G_open_cell_new(outname)) < 0)
 	G_fatal_error(_("Unable to create raster map <%s>"), outname);
@@ -465,14 +461,14 @@
     outbuf.v = G_allocate_raster_buf(CELL_TYPE);	/* binary map */
 
     if (data_type == CELL_TYPE) {
-	if ((G_read_range(name, mapset, &range)) < 0)
+	if ((G_read_range(name, "", &range)) < 0)
 	    G_fatal_error(_("Can't open range file for %s"), name);
 	G_get_range_min_max(&range, &min, &max);
 	dmin = (double)min;
 	dmax = (double)max;
     }
     else {
-	G_read_fp_range(name, mapset, &fprange);
+	G_read_fp_range(name, "", &fprange);
 	G_get_fp_range_min_max(&fprange, &dmin, &dmax);
     }
 

Modified: grass/trunk/raster/r.support.stats/check.c
===================================================================
--- grass/trunk/raster/r.support.stats/check.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.support.stats/check.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -26,7 +26,7 @@
  *
  * RETURN: 0 on success / 1 on failure
  */
-int check_stats(char *name, char *mapset)
+int check_stats(const char *name)
 {
     RASTER_MAP_TYPE data_type;
     struct Histogram histogram;
@@ -37,13 +37,13 @@
     int cats_ok;
     int max;
 
-    data_type = G_raster_map_type(name, mapset);
+    data_type = G_raster_map_type(name, "");
 
     G_message(_("Updating statistics for [%s]..."), name);
 
-    if (!do_histogram(name, mapset))
+    if (!do_histogram(name))
 	return 1;
-    if (G_read_histogram(name, mapset, &histogram) <= 0)
+    if (G_read_histogram(name, "", &histogram) <= 0)
 	return 1;
 
     /* Init histogram range */
@@ -71,7 +71,7 @@
 	G_write_fp_range(name, &fprange);
 
     /* Get category status and max */
-    cats_ok = (G_read_cats(name, mapset, &cats) >= 0);
+    cats_ok = (G_read_cats(name, "", &cats) >= 0);
     max = (data_type == CELL_TYPE ? range.max : fprange.max);
 
     /* Further category checks */

Modified: grass/trunk/raster/r.support.stats/histo.c
===================================================================
--- grass/trunk/raster/r.support.stats/histo.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.support.stats/histo.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -24,7 +24,7 @@
  *
  * RETURN: 0 on success / 1 on failure
  */
-int do_histogram(char *name, char *mapset)
+int do_histogram(const char *name)
 {
     CELL *cell;
     struct Cell_head cellhd;
@@ -33,11 +33,11 @@
     int row;
     int fd;
 
-    if (G_get_cellhd(name, mapset, &cellhd) < 0)
+    if (G_get_cellhd(name, "", &cellhd) < 0)
 	return 1;
 
     G_set_window(&cellhd);
-    if ((fd = G_open_cell_old(name, mapset)) < 0)
+    if ((fd = G_open_cell_old(name, "")) < 0)
 	return 1;
 
     nrows = G_window_rows();

Modified: grass/trunk/raster/r.support.stats/local_proto.h
===================================================================
--- grass/trunk/raster/r.support.stats/local_proto.h	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.support.stats/local_proto.h	2008-08-28 20:08:49 UTC (rev 33142)
@@ -21,10 +21,10 @@
 
 
 /* check.c */
-int check_stats(char *, char *);
+int check_stats(const char *);
 
 /* histo.c */
-int do_histogram(char *, char *);
+int do_histogram(const char *);
 
 
 #endif /* __LOCAL_PROTO_H__ */

Modified: grass/trunk/raster/r.support.stats/main.c
===================================================================
--- grass/trunk/raster/r.support.stats/main.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.support.stats/main.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -24,7 +24,6 @@
 
 int main(int argc, char *argv[])
 {
-    char *mapset;
     struct GModule *module;
     struct
     {
@@ -43,12 +42,8 @@
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
-    mapset = G_find_cell2(parm.raster->answer, G_mapset());
-    if (mapset == NULL)
-	G_fatal_error(_("Raster map <%s> not found"), parm.raster->answer);
+    check_stats(parm.raster->answer);
 
-    check_stats(parm.raster->answer, mapset);
-
     G_message(_("Statistics for <%s> updated"), parm.raster->answer);
 
     return EXIT_SUCCESS;

Modified: grass/trunk/raster/r.surf.area/main.c
===================================================================
--- grass/trunk/raster/r.surf.area/main.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.surf.area/main.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -75,7 +75,6 @@
 {
     struct GModule *module;
     struct Option *surf, *vscale;
-    char *cellmap;
     DCELL *cell_buf[2];
     int row;
     struct Cell_head w;
@@ -115,11 +114,7 @@
 
     /* open raster map for reading */
     {
-	cellmap = G_find_file2("cell", surf->answer, "");
-	if (!cellmap)
-	    G_fatal_error(_("Raster map <%s> not found"), surf->answer);
-
-	if ((cellfile = G_open_cell_old(surf->answer, cellmap)) == -1)
+	if ((cellfile = G_open_cell_old(surf->answer, "")) == -1)
 	    G_fatal_error(_("Unable to open raster map <%s>"), surf->answer);
     }
 

Modified: grass/trunk/raster/r.surf.gauss/main.c
===================================================================
--- grass/trunk/raster/r.surf.gauss/main.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.surf.gauss/main.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -28,19 +28,11 @@
     double gauss_mean, gauss_sigma;
 
     struct GModule *module;
-    struct Option *out;		/* Structures required for the G_parser()       */
-
-    /* call. These can be filled with the           */
-    struct Option *mean;	/* various defaults, mandatory paramters        */
-
-    /* etc. for the GRASS user interface.           */
+    struct Option *out;
+    struct Option *mean;
     struct Option *sigma;
 
-    G_gisinit(argv[0]);		/*      This GRASS library function MUST
-				   be called first to check for valid
-				   database and mapset. As usual argv[0]
-				   is the program name. This can be
-				   recalled using G_program_name(). */
+    G_gisinit(argv[0]);
 
     module = G_define_module();
     module->keywords = _("raster");
@@ -50,17 +42,16 @@
 	  "can be expressed by the user. It uses a gaussian "
 	  "random number generator.");
 
-    /****** SET PARSER OPTIONS ******/
     out = G_define_standard_option(G_OPT_R_OUTPUT);
     out->description = _("Name of the output random surface");
 
-    mean = G_define_option();	/*      Mean of the distribution  */
+    mean = G_define_option();
     mean->key = "mean";
     mean->description = _("Distribution mean");
     mean->type = TYPE_DOUBLE;
     mean->answer = "0.0";
 
-    sigma = G_define_option();	/*      Standard deviation of the distribution  */
+    sigma = G_define_option();
     sigma->key = "sigma";
     sigma->description = _("Standard deviation");
     sigma->type = TYPE_DOUBLE;
@@ -72,7 +63,6 @@
     sscanf(mean->answer, "%lf", &gauss_mean);
     sscanf(sigma->answer, "%lf", &gauss_sigma);
 
-    /****** CREATE THE RANDOM CELL FILE  ******/
     gaussurf(out->answer, gauss_mean, gauss_sigma);
 
     exit(EXIT_SUCCESS);

Modified: grass/trunk/raster/r.surf.idw/main.c
===================================================================
--- grass/trunk/raster/r.surf.idw/main.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.surf.idw/main.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -80,7 +80,6 @@
 
 int main(int argc, char **argv)
 {
-    char *layer_mapset, *current_mapset;
     MELEMENT *rowlist;
     SHORT nrows, ncols;
     SHORT datarows;
@@ -132,17 +131,10 @@
     input = parm.input->answer;
     output = parm.output->answer;
 
-    current_mapset = G_mapset();
-
     /*  Get database window parameters                              */
     if (G_get_window(&window) < 0)
 	G_fatal_error(_("Unable to read current region parameters"));
 
-    /* Make sure layer_map is available                                     */
-    layer_mapset = G_find_cell(input, "");
-    if (layer_mapset == NULL)
-	G_fatal_error(_("Raster map <%s> not found"), input);
-
     /*  find number of rows and columns in window                   */
     nrows = G_window_rows();
     ncols = G_window_cols();
@@ -155,14 +147,14 @@
     cell = G_allocate_cell_buf();
     if ((maskfd = G_maskfd()) >= 0 || error_flag) {	/* apply mask to output */
 	if (error_flag)		/* use input as mask when -e option chosen */
-	    maskfd = G_open_cell_old(input, layer_mapset);
+	    maskfd = G_open_cell_old(input, "");
 	mask = G_allocate_cell_buf();
     }
     else
 	mask = NULL;
 
     /*  Open input cell layer for reading                           */
-    fd = G_open_cell_old(input, layer_mapset);
+    fd = G_open_cell_old(input, "");
     if (fd < 0)
 	G_fatal_error(_("Unable to open raster map <%s>"), input);
 

Modified: grass/trunk/raster/r.surf.idw2/read_cell.c
===================================================================
--- grass/trunk/raster/r.surf.idw2/read_cell.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.surf.idw2/read_cell.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -12,24 +12,17 @@
     struct Cell_head window, cellhd;
     int row, col;
     double z, north;
-    char *mapset;
 
-    mapset = G_find_cell(name, "");
-    if (mapset == NULL) {
-	G_fatal_error(_("Raster map <%s> not found"), name);
-	exit(EXIT_FAILURE);
-    }
-
     G_get_window(&window);
 
     /* Set window to align with input raster map */
-    G_get_cellhd(name, mapset, &cellhd);
+    G_get_cellhd(name, "", &cellhd);
     G_align_window(&window, &cellhd);
     G_set_window(&window);
 
     cell = G_allocate_cell_buf();
 
-    fd = G_open_cell_old(name, mapset);
+    fd = G_open_cell_old(name, "");
     if (fd < 0) {
 	G_fatal_error(_("Unable to open raster map <%s>"), name);
 	exit(EXIT_FAILURE);

Modified: grass/trunk/raster/r.surf.random/main.c
===================================================================
--- grass/trunk/raster/r.surf.random/main.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.surf.random/main.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -25,20 +25,12 @@
     /****** INITIALISE ******/
 
     struct GModule *module;
-    struct Option *out;		/* Structures required for the G_parser()       */
-
-    /* call. These can be filled with the           */
-    struct Option *min;		/* various defaults, mandatory paramters        */
-
-    /* etc. for the GRASS user interface.           */
+    struct Option *out;
+    struct Option *min;
     struct Option *max;
     struct Flag *i_flag;
 
-    G_gisinit(argv[0]);		/* This GRASS library function MUST
-				   be called first to check for valid
-				   database and mapset. As usual argv[0]
-				   is the program name. This can be
-				   recalled using G_program_name(). */
+    G_gisinit(argv[0]);
 
     module = G_define_module();
     module->keywords = _("raster");
@@ -66,12 +58,10 @@
     i_flag->description = _("Create an integer map");
 
     if (G_parser(argc, argv))
-	exit(EXIT_FAILURE);	/* Returns a 0 if sucessful */
+	exit(EXIT_FAILURE);
 
-
     randsurf(out->answer, atoi(min->answer), atoi(max->answer),
 	     i_flag->answer);
 
-
     exit(EXIT_SUCCESS);
 }

Modified: grass/trunk/raster/r.texture/main.c
===================================================================
--- grass/trunk/raster/r.texture/main.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.texture/main.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -48,7 +48,7 @@
 int main(int argc, char *argv[])
 {
     struct Cell_head cellhd;
-    char *name, *result, *mapset, *filename;
+    char *name, *result, *filename;
     unsigned char *outrast;
     int nrows, ncols;
     int row, col, i, j;
@@ -207,18 +207,13 @@
 	&& moc2 && mcc)
 	G_fatal_error(_("Nothing to compute. Use at least one of the flags."));
 
-    /* find map in mapset */
-    mapset = G_find_cell2(name, "");
-    if (mapset == NULL)
-	G_fatal_error(_("Raster map <%s> not found"), name);
-
-    if ((infd = G_open_cell_old(name, mapset)) < 0)
+    if ((infd = G_open_cell_old(name, "")) < 0)
 	G_fatal_error(_("Unable to open raster map <%s>"), name);
 
     /* determine the inputmap type (CELL/FCELL/DCELL) */
     data_type = G_get_raster_map_type(infd);
 
-    if (G_get_cellhd(name, mapset, &cellhd) < 0)
+    if (G_get_cellhd(name, "", &cellhd) < 0)
 	G_fatal_error(_("Unable to read header of raster map <%s>"), name);
 
     out_data_type = FCELL_TYPE;

Modified: grass/trunk/raster/r.thin/io.c
===================================================================
--- grass/trunk/raster/r.thin/io.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.thin/io.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -83,7 +83,6 @@
 
 int open_file(char *name)
 {
-    char *mapset;
     int cell_file, buf_len;
     int i, row, col;
     char cell[100];
@@ -91,12 +90,8 @@
 
     /* open raster map */
     strcpy(cell, name);
-    if ((mapset = G_find_cell2(cell, "")) == NULL) {
+    if ((cell_file = G_open_cell_old(cell, "")) < 0) {
 	unlink(work_file_name);
-	G_fatal_error(_("Raster map <%s> not found"), name);
-    }
-    if ((cell_file = G_open_cell_old(cell, mapset)) < 0) {
-	unlink(work_file_name);
 	G_fatal_error(_("Unable to open raster map <%s>"), cell);
     }
 
@@ -128,8 +123,8 @@
     for (row = 0; row < n_rows; row++) {
 	if (G_get_map_row(cell_file, buf + PAD, row) < 0) {
 	    unlink(work_file_name);
-	    G_fatal_error(_("%s: Error reading from raster map <%s> in mapset <%s>"),
-			  error_prefix, cell, mapset);
+	    G_fatal_error(_("%s: Error reading from raster map <%s>"),
+			  error_prefix, cell);
 	}
 	if (write(work_file, buf, buf_len) != buf_len) {
 	    unlink(work_file_name);

Modified: grass/trunk/raster/r.timestamp/main.c
===================================================================
--- grass/trunk/raster/r.timestamp/main.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.timestamp/main.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -26,7 +26,6 @@
     struct Option *map, *date;
     struct TimeStamp ts;
     char *name;
-    char *mapset;
     int modify;
 
     G_gisinit(argv[0]);
@@ -51,16 +50,8 @@
 
     modify = date->answer != NULL;
 
-    if (modify)
-	mapset = G_find_cell(name, G_mapset());
-    else
-	mapset = G_find_cell(name, "");
-    if (mapset == NULL)
-	G_fatal_error("Map <%s> not found %s", name,
-		      modify ? "in current mapset" : "");
-
     if (!modify) {
-	if (G_read_raster_timestamp(name, mapset, &ts) == 1) {
+	if (G_read_raster_timestamp(name, "", &ts) == 1) {
 	    G__write_timestamp(stdout, &ts);
 	    exit(EXIT_SUCCESS);
 	}

Modified: grass/trunk/raster/r.to.rast3/main.c
===================================================================
--- grass/trunk/raster/r.to.rast3/main.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.to.rast3/main.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -39,7 +39,7 @@
 void fatal_error(void *map, int *fd, int depths, char *errorMsg);	/*Simple Error message */
 void set_params();		/*Fill the paramType structure */
 void raster_to_g3d(void *map, G3D_Region region, int *fd);	/*Write the raster */
-int open_input_raster_map(char *name, char *mapset);	/*opens the outputmap */
+int open_input_raster_map(const char *name);	/*opens the outputmap */
 void close_input_raster_map(int fd);	/*close the map */
 
 
@@ -183,7 +183,6 @@
     int *fd = NULL;		/*The filehandler array for the 2D inputmaps */
     int cols, rows, opencells;
     char *name;
-    char *mapset;
     int changemask = 0;
     int maptype_tmp, nofile = 0;
 
@@ -235,7 +234,6 @@
     if (fd == NULL)
 	fatal_error(map, NULL, 0, _("Out of memory"));
 
-    mapset = NULL;
     name = NULL;
 
     globalRastMapType = DCELL_TYPE;
@@ -246,24 +244,15 @@
     /*Loop over all output maps! open */
     for (i = 0; i < region.depths; i++) {
 	/*Open only existing maps */
-	if (param.input->answers[i] != NULL && nofile == 0) {
-	    mapset = NULL;
-	    name = NULL;
+	if (nofile == 0 && param.input->answers[i])
 	    name = param.input->answers[i];
-	    mapset = G_find_cell2(name, "");
-
-	    if (mapset == NULL) {
-		fatal_error(map, fd, opencells, _("Cell file not found"));
-	    }
-	}
-	else {
+	else
 	    nofile = 1;
-	}
 
 	/*if only one map is given, open it depths - times */
 	G_message(_("Open raster map %s - one time for each depth (%d/%d)"),
 		  name, i + 1, region.depths);
-	fd[i] = open_input_raster_map(name, mapset);
+	fd[i] = open_input_raster_map(name);
 	opencells++;
 
 	maptype_tmp = G_get_raster_map_type(fd[i]);
@@ -348,15 +337,15 @@
 /* ************************************************************************* */
 /* Open the raster input map *********************************************** */
 /* ************************************************************************* */
-int open_input_raster_map(char *name, char *mapset)
+int open_input_raster_map(const char *name)
 {
     int fd;
 
-    G_debug(3, "Open Raster file %s in Mapset %s", name, mapset);
+    G_debug(3, "Open Raster file %s", name);
 
 
     /* open raster map */
-    fd = G_open_cell_old(name, mapset);
+    fd = G_open_cell_old(name, "");
 
     if (fd < 0)
 	G_fatal_error(_("Unable to open raster map <%s>"), name);

Modified: grass/trunk/raster/r.to.rast3elev/main.c
===================================================================
--- grass/trunk/raster/r.to.rast3elev/main.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.to.rast3elev/main.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -52,7 +52,7 @@
 void fatal_error(Database db, char *errorMsg);	/*Simple Error message */
 void set_params();		/*Fill the paramType structure */
 void elev_raster_to_g3d(Database db, G3D_Region region);	/*Write the raster */
-int open_input_raster_map(char *name, char *mapset);	/*opens the outputmap */
+int open_input_raster_map(const char *name);	/*opens the outputmap */
 void close_input_raster_map(int fd);	/*close the map */
 double get_raster_value_as_double(int maptype, void *ptr, double nullval);
 void check_input_maps(Database * db);	/*Check input maps */
@@ -63,34 +63,15 @@
 /* ************************************************************************* */
 double get_raster_value_as_double(int MapType, void *ptr, double nullval)
 {
-    double val = nullval;
+    if (G_is_null_value(ptr, MapType))
+	return nullval;
 
-    if (MapType == CELL_TYPE) {
-	if (G_is_null_value(ptr, MapType)) {
-	    val = nullval;
-	}
-	else {
-	    val = *(CELL *) ptr;
-	}
+    switch (MapType) {
+    case CELL_TYPE:	return *(CELL *) ptr;
+    case FCELL_TYPE:	return *(FCELL *) ptr;
+    case DCELL_TYPE:	return *(DCELL *) ptr;
+    default:		return nullval;
     }
-    if (MapType == FCELL_TYPE) {
-	if (G_is_null_value(ptr, MapType)) {
-	    val = nullval;
-	}
-	else {
-	    val = *(FCELL *) ptr;
-	}
-    }
-    if (MapType == DCELL_TYPE) {
-	if (G_is_null_value(ptr, MapType)) {
-	    val = nullval;
-	}
-	else {
-	    val = *(DCELL *) ptr;
-	}
-    }
-
-    return val;
 }
 
 /* ************************************************************************* */
@@ -98,46 +79,23 @@
 /* ************************************************************************* */
 void check_input_maps(Database * db)
 {
-    char *mapset = NULL;
     int i;
     int elevcount = 0, inputcount = 0;
 
     G_debug(2, "Checking input maps");
 
     /*Check elev maps */
-    if (param.elev->answers != NULL) {
-	for (i = 0; param.elev->answers[i] != NULL; i++) {
-
-	    mapset = NULL;
-	    mapset = G_find_cell2(param.elev->answers[i], "");
-	    if (mapset == NULL) {
-		G_fatal_error(_("Raster map <%s> not found"),
-			      param.elev->answers[i]);
-		exit(EXIT_FAILURE);
-	    }
+    if (param.elev->answers != NULL)
+	for (i = 0; param.elev->answers[i] != NULL; i++)
 	    elevcount++;
-	}
-    }
 
     /*Check input maps */
-    if (param.input->answers != NULL) {
-	for (i = 0; param.input->answers[i] != NULL; i++) {
-
-	    mapset = NULL;
-	    mapset = G_find_cell2(param.input->answers[i], "");
-	    if (mapset == NULL) {
-		G_fatal_error(_("Raster map <%s> not found"),
-			      param.input->answers[i]);
-		exit(EXIT_FAILURE);
-	    }
+    if (param.input->answers != NULL)
+	for (i = 0; param.input->answers[i] != NULL; i++)
 	    inputcount++;
-	}
-    }
 
-    if (elevcount != inputcount) {
+    if (elevcount != inputcount)
 	G_fatal_error(_("The number of input and elevation maps is not equal"));
-	exit(EXIT_FAILURE);
-    }
 
     db->mapnum = inputcount;
 
@@ -147,14 +105,14 @@
 /* ************************************************************************* */
 /* Open the raster input map *********************************************** */
 /* ************************************************************************* */
-int open_input_raster_map(char *name, char *mapset)
+int open_input_raster_map(const char *name)
 {
     int fd;
 
-    G_debug(3, "Open Raster file %s in Mapset %s", name, mapset);
+    G_debug(3, "Open Raster file %s", name);
 
     /* open raster map */
-    fd = G_open_cell_old(name, mapset);
+    fd = G_open_cell_old(name, "");
 
     if (fd < 0)
 	G_fatal_error(_("Unable to open raster map <%s>"), name);
@@ -382,7 +340,6 @@
     struct GModule *module;
     int cols, rows, i;
     char *name = NULL;
-    char *mapset = NULL;
     int changemask = 0;
     Database db;
 
@@ -501,22 +458,16 @@
 
 	db.count = i;
 	/*Open input map */
-	mapset = NULL;
-	name = NULL;
 	name = param.input->answers[i];
-	mapset = G_find_cell2(name, "");
-	db.input = open_input_raster_map(name, mapset);
-	db.inputmaptype = G_raster_map_type(name, mapset);
+	db.input = open_input_raster_map(name);
+	db.inputmaptype = G_raster_map_type(name, "");
 
 	G_debug(2, "Open elev raster map %s", param.elev->answers[i]);
 
 	/*Open elev map */
-	mapset = NULL;
-	name = NULL;
 	name = param.elev->answers[i];
-	mapset = G_find_cell2(name, "");
-	db.elev = open_input_raster_map(name, mapset);
-	db.elevmaptype = G_raster_map_type(name, mapset);
+	db.elev = open_input_raster_map(name);
+	db.elevmaptype = G_raster_map_type(name, "");
 
 	/****************************************/
 	/*Write the data into the G3D Rastermap */

Deleted: grass/trunk/raster/r.topidx/check_ready.c
===================================================================
--- grass/trunk/raster/r.topidx/check_ready.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.topidx/check_ready.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -1,16 +0,0 @@
-#include "global.h"
-#include <grass/glocale.h>
-
-int check_ready(void)
-{
-    int retval;
-
-    retval = 0;
-
-    if (!G_find_file("cell", iname, mapset)) {
-	G_fatal_error(_("Raster map <%s> not found"), iname);
-	retval = 1;
-    }
-
-    return retval;
-}

Modified: grass/trunk/raster/r.topidx/file_io.c
===================================================================
--- grass/trunk/raster/r.topidx/file_io.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.topidx/file_io.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -12,7 +12,7 @@
     FCELL *fcell = NULL;
 
 
-    if ((fd = G_open_cell_old(iname, mapset)) < 0)
+    if ((fd = G_open_cell_old(iname, "")) < 0)
 	G_fatal_error(_("Cannot open raster map <%s>"), iname);
 
     data_type = G_get_raster_map_type(fd);

Modified: grass/trunk/raster/r.topidx/global.h
===================================================================
--- grass/trunk/raster/r.topidx/global.h	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.topidx/global.h	2008-08-28 20:08:49 UTC (rev 33142)
@@ -12,13 +12,12 @@
 #define	ZERO		0.0000001
 
 
-int check_ready(void);
 void getcells(void);
 void putcells(void);
 void initialize(void);
 void atanb(void);
 
-extern char *mapset, *iname, *oname;
+extern char *iname, *oname;
 extern struct Cell_head window;
 extern DCELL **cell;
 extern DCELL **atb, **a;

Modified: grass/trunk/raster/r.topidx/main.c
===================================================================
--- grass/trunk/raster/r.topidx/main.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.topidx/main.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -21,7 +21,7 @@
 #include <grass/glocale.h>
 #include "global.h"
 
-char *mapset, *iname, *oname;
+char *iname, *oname;
 struct Cell_head window;
 DCELL **cell;
 DCELL **atb, **a;
@@ -58,12 +58,8 @@
 		      G_program_name());
 
     iname = params.input->answer;
-    mapset = G_find_cell2(iname, "");
     oname = params.output->answer;
 
-    if (check_ready())
-	exit(EXIT_FAILURE);
-
     G_get_window(&window);
 
     getcells();

Modified: grass/trunk/raster/r.topmodel/check_ready.c
===================================================================
--- grass/trunk/raster/r.topmodel/check_ready.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.topmodel/check_ready.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -246,17 +246,17 @@
     retval = 0;
 
     if (!flg.input) {
-	if (map.elev && !G_find_file("cell", map.elev, mapset)) {
+	if (map.elev && !G_find_cell(map.elev, mapset)) {
 	    G_warning("%s - not exists", map.elev);
 	    retval = 1;
 	}
 
-	if (map.basin && !G_find_file("cell", map.basin, mapset)) {
+	if (map.basin && !G_find_cell(map.basin, mapset)) {
 	    G_warning("%s - not exists", map.basin);
 	    retval = 1;
 	}
 
-	if (map.fill && G_find_file("cell", map.fill, mapset)) {
+	if (map.fill && G_find_cell(map.fill, mapset)) {
 	    if (flg.overwr) {
 		flg.overwrlist |= FILL;
 	    }
@@ -266,7 +266,7 @@
 	    }
 	}
 
-	if (map.dir && G_find_file("cell", map.dir, mapset)) {
+	if (map.dir && G_find_cell(map.dir, mapset)) {
 	    if (flg.overwr) {
 		flg.overwrlist |= DIR;
 	    }
@@ -276,7 +276,7 @@
 	    }
 	}
 
-	if (map.belev && G_find_file("cell", map.belev, mapset)) {
+	if (map.belev && G_find_cell(map.belev, mapset)) {
 	    if (flg.overwr) {
 		flg.overwrlist |= BELEV;
 	    }
@@ -286,7 +286,7 @@
 	    }
 	}
 
-	if (map.topidx && G_find_file("cell", map.topidx, mapset)) {
+	if (map.topidx && G_find_cell(map.topidx, mapset)) {
 	    if (flg.overwr) {
 		flg.overwrlist |= TOPIDX;
 	    }
@@ -309,12 +309,12 @@
     }
     else {
 	if (map.belev) {
-	    if (!G_find_file("cell", map.belev, mapset)) {
+	    if (!G_find_cell(map.belev, mapset)) {
 		G_warning("%s - not exists", map.belev);
 		retval = 1;
 	    }
 	    else {
-		if (map.topidx && G_find_file("cell", map.topidx, mapset)) {
+		if (map.topidx && G_find_cell(map.topidx, mapset)) {
 		    if (flg.overwr) {
 			flg.overwrlist |= TOPIDX;
 		    }
@@ -338,7 +338,7 @@
 	    }
 	}
 	else if (map.topidx) {
-	    if (!G_find_file("cell", map.topidx, mapset)) {
+	    if (!G_find_cell(map.topidx, mapset)) {
 		G_warning("%s - not exists", map.topidx);
 		retval = 1;
 	    }

Modified: grass/trunk/raster/r.topmodel/main.c
===================================================================
--- grass/trunk/raster/r.topmodel/main.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.topmodel/main.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -26,7 +26,7 @@
 struct file file;
 struct misc misc;
 struct flg flg;
-char *gisbase, *mapset;
+char *mapset;
 
 int main(int argc, char **argv)
 {
@@ -198,11 +198,8 @@
     flg.input = flag.input->answer;
     flg.overwr = module->overwrite;
 
-
-    gisbase = G_gisbase();
     mapset = G_mapset();
 
-
     /* Check run conditions */
     if (check_ready())
 	exit(1);

Modified: grass/trunk/raster/r.topmodel/misc.c
===================================================================
--- grass/trunk/raster/r.topmodel/misc.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.topmodel/misc.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -38,7 +38,7 @@
     }
 
     if (hdmap) {
-	sprintf(buf, "%s/bin/g.region rast=%s > /dev/null", gisbase, hdmap);
+	sprintf(buf, "g.region rast=%s > /dev/null", hdmap);
 	G_message("g.region rast=%s ... ", hdmap);
 
 	if (run(buf))
@@ -50,9 +50,8 @@
 void depressionless(void)
 {
     char buf[GPATH_MAX];
-    sprintf(buf, "%s/bin/r.fill.dir "
-	    "input=%s elev=%s dir=%s type=grass > /dev/null",
-	    gisbase, map.elev, map.fill, map.dir);
+    sprintf(buf, "r.fill.dir input=%s elev=%s dir=%s type=grass > /dev/null",
+	    map.elev, map.fill, map.dir);
     G_message("r.fill.dir input=%s elev=%s dir=%s type=grass ... ",
 	      map.elev, map.fill, map.dir);
 
@@ -69,9 +68,8 @@
 void basin_elevation(void)
 {
     char buf[GPATH_MAX];
-    sprintf(buf, "%s/bin/r.mapcalc "
-	    "'%s = if(%s == 0 || isnull(%s), null(), %s)' > /dev/null",
-	    gisbase, map.belev, map.basin, map.basin, map.elev);
+    sprintf(buf, "r.mapcalc '%s = if(%s == 0 || isnull(%s), null(), %s)' > /dev/null",
+	    map.belev, map.basin, map.basin, map.elev);
     G_message("r.mapcalc '%s = if(%s == 0 || isnull(%s), null(), %s)'"
 	      " ... ", map.belev, map.basin, map.basin, map.elev);
 
@@ -87,9 +85,8 @@
 {
     char buf[GPATH_MAX];
     if (map.belev) {
-	sprintf(buf, "%s/bin/r.topidx "
-		"input=%s output=%s > /dev/null",
-		gisbase, map.belev, map.topidx);
+	sprintf(buf, "r.topidx input=%s output=%s > /dev/null",
+		map.belev, map.topidx);
 	G_message("r.topidx input=%s output=%s ... ", map.belev, map.topidx);
 
 	if (run(buf))
@@ -97,9 +94,9 @@
     }
 
     if (map.topidx) {
-	sprintf(buf, "%s/bin/r.stats -Anc "
+	sprintf(buf, "r.stats -Anc "
 		"input=%s nsteps=%d > %s",
-		gisbase, map.topidx, misc.nidxclass, file.idxstats);
+		map.topidx, misc.nidxclass, file.idxstats);
 	G_message("r.stats -Anc input=%s nsteps=%d > %s ... ",
 		  map.topidx, misc.nidxclass, file.idxstats);
 

Modified: grass/trunk/raster/r.transect/main.c
===================================================================
--- grass/trunk/raster/r.transect/main.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.transect/main.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -29,12 +29,10 @@
 {
     double e1, n1, e2, n2;
     char buf[256];
-    char command[2048];
+    char command[GPATH_MAX];
 
     int n, err;
     int projection;
-    char *mapset;
-    char name[GNAME_MAX];
 
     struct GModule *module;
     struct
@@ -42,8 +40,6 @@
 	struct Option *map;
 	struct Option *line;
 	struct Option *null_str;
-	/*      struct Option *width;
-	   struct Option *result; */
     } parms;
     struct Flag *coord;
     char coord_str[3];
@@ -59,16 +55,6 @@
     parms.map = G_define_standard_option(G_OPT_R_MAP);
     parms.map->description = _("Raster map to be queried");
 
-    /*  parms.result = G_define_option();
-       parms.result->key = "result";
-       parms.result->key_desc = "type";
-       parms.result->type = TYPE_STRING;
-       parms.result->description = _("Type of result to be output");
-       parms.result->required = NO;
-       parms.result->multiple = NO;
-       parms.result->options = "raw,median,average";
-       parms.result->answer = "raw";
-     */
     parms.line = G_define_option();
     parms.line->key = "line";
     parms.line->key_desc = "east,north,azimuth,distance";
@@ -84,13 +70,6 @@
     parms.null_str->answer = "*";
     parms.null_str->description = _("Char string to represent no data cell");
 
-    /*  parms.width = G_define_option();
-       parms.width->key = "width";
-       parms.width->type = TYPE_INTEGER;
-       parms.width->description = _("Transect width, in cells (odd number)");
-       parms.width->answer = "1";
-     */
-
     coord = G_define_flag();
     coord->key = 'g';
     coord->description =
@@ -101,22 +80,6 @@
 
     projection = G_projection();
 
-    /*  sscanf (parms.width->answer, "%d", &n);
-       if (n <= 0 || n%2 == 0)
-       {
-       fprintf(stderr,"<%s=%s> ** illegal value **\n",
-       parms.width->key, parms.width->answer);
-       G_usage();
-       exit(EXIT_FAILURE);
-       }
-     */
-
-    strncpy(name, parms.map->answer, 255);
-    mapset = G_find_cell(name, "");
-
-    if (mapset == NULL)
-	G_fatal_error(_("Raster map <%s> not found"), name);
-
     if (coord->answer)
 	strcpy(coord_str, "-g");
     else

Modified: grass/trunk/raster/r.univar/r.univar_main.c
===================================================================
--- grass/trunk/raster/r.univar/r.univar_main.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.univar/r.univar_main.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -138,19 +138,12 @@
 
 static int open_raster(const char *infile)
 {
-    char *mapset;
     int fd;
 
-    mapset = G_find_cell2(infile, "");
-    if (mapset == NULL) {
-	G_fatal_error(_("Raster map <%s> not found"), infile);
-    }
-
-    fd = G_open_cell_old(infile, mapset);
+    fd = G_open_cell_old(infile, "");
     if (fd < 0)
 	G_fatal_error(_("Unable to open raster map <%s>"), infile);
 
-    /* . */
     return fd;
 }
 

Modified: grass/trunk/raster/r.volume/main.c
===================================================================
--- grass/trunk/raster/r.volume/main.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.volume/main.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -39,8 +39,8 @@
     int out_mode, use_MASK, *n, *e;
     long int *count;
     int fd_data, fd_clump;
-    char buf[200], datamap[100], clumpmap[100], site_list[100];
-    char *curr_mapset, *data_mapset, *clump_mapset;
+    char *datamap, *clumpmap, *site_list;
+    char *clump_mapset;
     double avg, vol, total_vol, east, north, *sum;
     struct Cell_head window;
     struct Map_info *fd_sites = NULL;
@@ -99,17 +99,17 @@
     mysite = G_site_new_struct(CELL_TYPE, 2, 0, 4);
 
     /* get arguments */
-    strcpy(datamap, opt1->answer);
+    datamap = opt1->answer;
 
-    if (opt2->answer != NULL)
-	strcpy(clumpmap, opt2->answer);
+    if (opt2->answer)
+	clumpmap = opt2->answer;
     else
-	clumpmap[0] = '\0';
+	clumpmap = "";
 
-    if (opt3->answer != NULL)
-	strcpy(site_list, opt3->answer);
+    if (opt3->answer)
+	site_list = opt3->answer;
     else
-	site_list[0] = '\0';
+	site_list = "";
 
     out_mode = (!flag1->answer);
 
@@ -122,23 +122,14 @@
      */
     use_MASK = 0;
     if (*clumpmap == '\0') {
-	strcpy(clumpmap, "MASK");
+	clumpmap = "MASK";
 	use_MASK = 1;
-	if (G_find_cell(clumpmap, G_mapset()) == NULL)
-	    G_fatal_error(_("No clump map specified and MASK not set."));
     }
-    curr_mapset = G_mapset();
-    data_mapset = G_find_cell2(datamap, "");
-    if (!data_mapset)
-	G_fatal_error(_("Unable to find data map"));
-
-    fd_data = G_open_cell_old(datamap, data_mapset);
+    fd_data = G_open_cell_old(datamap, "");
     if (use_MASK)
-	clump_mapset = curr_mapset;
+	clump_mapset = G_mapset();
     else
-	clump_mapset = G_find_cell2(clumpmap, "");
-    if (!clump_mapset)
-	G_fatal_error(_("Unable to find clump map"));
+	clump_mapset = "";
 
     fd_clump = G_open_cell_old(clumpmap, clump_mapset);
 
@@ -178,13 +169,11 @@
 	G_get_map_row(fd_clump, clump_buf, row);
 	for (col = 0; col < cols; col++) {
 	    i = clump_buf[col];
-	    if (i > max) {
-		sprintf(buf,
-			"Row=%d Col=%d Cat=%d in clump map [%s]; max=%d.\n",
-			row, col, i, clumpmap, max);
-		strcat(buf, "Cat value > max returned by G_number_of_cats.");
-		G_fatal_error(buf);
-	    }
+	    if (i > max)
+		G_fatal_error(
+		    "Row=%d Col=%d Cat=%d in clump map [%s]; max=%d.\n"
+		    "Cat value > max returned by G_number_of_cats.",
+		    row, col, i, clumpmap, max);
 	    if (i < 1)
 		continue;	/* ignore zeros and negs */
 	    count[i]++;

Modified: grass/trunk/raster/r.walk/main.c
===================================================================
--- grass/trunk/raster/r.walk/main.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.walk/main.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -115,8 +115,6 @@
     {"coor", START_PT}
 };
 
-char cum_cost_layer[64];
-char cost_layer[64], dtm_layer[64];
 struct start_pt *head_start_pt = NULL;
 struct start_pt *head_end_pt = NULL;
 
@@ -128,13 +126,11 @@
 /* *************************************************************** */
 int main(int argc, char *argv[])
 {
+    const char *cum_cost_layer;
+    const char *start_layer, *cost_layer, *dtm_layer;
     void *dtm_cell, *cost_cell, *cum_cell, *cell2 = NULL;
     SEGMENT dtm_in_seg, cost_in_seg, out_seg;
-    char *dtm_mapset, *cost_mapset;
-    char *cum_cost_mapset;
-    char *current_mapset;
     char *dtm_in_file, *cost_in_file, *out_file;
-    char *search_mapset;
     double *dtm_value, *cost_value, *value_start_pt;
     char buf[400];
     extern struct Cell_head window;
@@ -215,6 +211,14 @@
     opt1->gisprompt = "new,cell,raster";
     opt1->description = _("Name of raster map to contain results");
 
+    opt14 = G_define_option();
+    opt14->key = "start_map";
+    opt14->type = TYPE_STRING;
+    opt14->required = NO;
+    opt14->gisprompt = "old,cell,raster";
+    opt14->description =
+	_("Name of input raster map containing starting points");
+
     opt7 = G_define_option();
     opt7->key = "start_points";
     opt7->type = TYPE_STRING;
@@ -416,15 +420,10 @@
 	Site *site = NULL;	/* pointer to Site */
 	int dims, strs, dbls;
 
-	search_mapset = "";
-	search_mapset = G_find_sites(opt7->answer, "");
-	if (search_mapset == NULL)
-	    G_fatal_error(_("Unable to find starting vector <%s> "),
-			  opt7->answer);
-	fp = G_fopen_sites_old(opt7->answer, search_mapset);
+	fp = G_fopen_sites_old(opt7->answer, "");
 
 	if (G_site_describe(fp, &dims, &cat, &strs, &dbls))
-	    G_fatal_error("Failed to guess site file format\n");
+	    G_fatal_error("Failed to guess site file format");
 	site = G_site_new_struct(cat, dims, strs, dbls);
 
 	for (; (G_site_get(fp, site) != EOF);) {
@@ -463,11 +462,7 @@
 	Site *site = NULL;	/* pointer to Site */
 	int dims, strs, dbls;
 
-	search_mapset = "";
-	search_mapset = G_find_sites(opt8->answer, "");
-	if (search_mapset == NULL)
-	    G_fatal_error(_("Unable to find stop vector <%s>"), opt8->answer);
-	fp = G_fopen_sites_old(opt8->answer, search_mapset);
+	fp = G_fopen_sites_old(opt8->answer, "");
 
 	if (G_site_describe(fp, &dims, &cat, &strs, &dbls))
 	    G_fatal_error("Failed to guess site file format\n");
@@ -513,31 +508,11 @@
 	keep_nulls = 0;		/* handled automagically... */
     }
 
-    strcpy(cum_cost_layer, opt1->answer);
-    current_mapset = G_mapset();
+    start_layer = opt14->answer;
+    dtm_layer = opt2->answer;
+    cost_layer = opt12->answer;
+    cum_cost_layer = opt1->answer;
 
-    /*  Search for output layer (cum_cost_layer) in all mapsets */
-
-    search_mapset = "";
-    cum_cost_mapset = G_find_cell2(cum_cost_layer, search_mapset);
-
-
-    /*  Check if dtm  layer exists in data base  */
-
-    strcpy(dtm_layer, opt2->answer);
-    dtm_mapset = G_find_cell2(dtm_layer, search_mapset);
-
-    /* Handling new cost layer */
-
-    strcpy(cost_layer, opt12->answer);
-    cost_mapset = G_find_cell2(cost_layer, search_mapset);
-
-    if (dtm_mapset == NULL)
-	G_fatal_error(_("Raster map <%s> not found"), dtm_layer);
-
-    if (cost_mapset == NULL)
-	G_fatal_error(_("Raster map <%s> not found"), cost_layer);
-
     /*  Find number of rows and columns in window    */
 
     nrows = G_window_rows();
@@ -546,8 +521,8 @@
 
     /*  Open cost cell layer for reading  */
 
-    dtm_fd = G_open_cell_old(dtm_layer, dtm_mapset);
-    cost_fd = G_open_cell_old(cost_layer, cost_mapset);
+    dtm_fd = G_open_cell_old(dtm_layer, "");
+    cost_fd = G_open_cell_old(cost_layer, "");
 
     if (dtm_fd < 0)
 	G_fatal_error(_("Unable to open raster map <%s>"), dtm_layer);
@@ -555,8 +530,8 @@
     if (cost_fd < 0)
 	G_fatal_error(_("Unable to open raster map <%s>"), cost_layer);
 
-    dtm_head_ok = G_get_cellhd(dtm_layer, dtm_mapset, &dtm_cellhd) >= 0;
-    cost_head_ok = G_get_cellhd(cost_layer, cost_mapset, &cost_cellhd) >= 0;
+    dtm_head_ok = G_get_cellhd(dtm_layer, "", &dtm_cellhd) >= 0;
+    cost_head_ok = G_get_cellhd(cost_layer, "", &cost_cellhd) >= 0;
 
     /*Reading headers from maps */
 
@@ -851,16 +826,10 @@
 
 	int dsize2;
 
-	cum_cost_mapset = G_find_cell2(cum_cost_layer, search_mapset);
-
-	if (cum_cost_mapset == NULL)
-	    G_fatal_error(_("Raster output map <%s> not found (no start_points given)"),
-			  cum_cost_layer);
-
-	cum_fd = G_open_cell_old(cum_cost_layer, cum_cost_mapset);
+	cum_fd = G_open_cell_old(start_layer, "");
 	if (cum_fd < 0)
 	    G_fatal_error(_("Unable to open raster map <%s>"),
-			  cum_cost_layer);
+			  start_layer);
 
 	data_type2 = G_get_raster_map_type(cum_fd);
 
@@ -868,10 +837,6 @@
 
 	cell2 = G_allocate_raster_buf(data_type2);
 
-	if (cell2 == NULL)
-	    G_fatal_error(_("Memory allocation error on reading start points from raster map %s"),
-			  cum_cost_layer);
-
 	G_message(_("Reading %s... "), cum_cost_layer);
 	for (row = 0; row < nrows; row++) {
 
@@ -1535,10 +1500,10 @@
     /*  Create colours for output map    */
 
     /*
-     * G_read_range (cum_cost_layer, current_mapset, &range);
+     * G_read_range (cum_cost_layer, "", &range);
      * G_get_range_min_max(&range, &min, &max);
      * G_make_color_wave(&colors,min, max);
-     * G_write_colors (cum_cost_layer,current_mapset,&colors);
+     * G_write_colors (cum_cost_layer,"",&colors);
      */
 
     /* writing history file */

Modified: grass/trunk/raster/r.walk/stash.h
===================================================================
--- grass/trunk/raster/r.walk/stash.h	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.walk/stash.h	2008-08-28 20:08:49 UTC (rev 33142)
@@ -25,8 +25,6 @@
     struct start_pt *next;
 };
 
-extern char cum_cost_layer[];
-extern char cost_layer[], dtm_layer[];
 extern struct start_pt *head_start_pt;
 extern struct start_pt *head_end_pt;
 

Deleted: grass/trunk/raster/r.what/die.c
===================================================================
--- grass/trunk/raster/r.what/die.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.what/die.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -1,12 +0,0 @@
-#include <grass/gis.h>
-#include "local_proto.h"
-
-void die(char *a, char *b)
-{
-    char *message;
-
-    G_asprintf(&message, "%s: %s %s", G_program_name(), a, b);
-    G_fatal_error(message);
-
-    return;
-}

Deleted: grass/trunk/raster/r.what/local_proto.h
===================================================================
--- grass/trunk/raster/r.what/local_proto.h	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.what/local_proto.h	2008-08-28 20:08:49 UTC (rev 33142)
@@ -1,11 +0,0 @@
-#ifndef _LOCAL_PROTO_H_
-#define _LOCAL_PROTO_H_
-/* die.c */
-void die(char *, char *);
-
-/* main.c */
-int oops(int, char *, char *);
-
-/* usage.c */
-void usage(void);
-#endif

Modified: grass/trunk/raster/r.what/main.c
===================================================================
--- grass/trunk/raster/r.what/main.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.what/main.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -21,7 +21,6 @@
 #include <unistd.h>
 #include <string.h>
 #include <grass/gis.h>
-#include "local_proto.h"
 #include <grass/glocale.h>
 
 struct order
@@ -37,6 +36,7 @@
     DCELL dvalue[NFILES];
 };
 
+static int oops(int, const char *, const char *);
 static int by_row(const void *, const void *);
 static int by_point(const void *, const void *);
 
@@ -47,7 +47,6 @@
 /* *************************************************************** */
 int main(int argc, char *argv[])
 {
-    char *mapset;
     int i, j;
     int nfiles;
     int withcats;
@@ -188,26 +187,24 @@
 	char name[GNAME_MAX];
 
 	if (nfiles >= NFILES)
-	    G_fatal_error(_("%s: can only do up to %d raster maps, sorry\n"),
-			  G_program_name(), NFILES);
+	    G_fatal_error(_("can only do up to %d raster maps"),
+			  NFILES);
 
 	strcpy(name, *ptr);
-	if (NULL == (mapset = G_find_cell2(name, "")))
-	    die(name, " - not found");
-	if (0 > (fd[nfiles] = G_open_cell_old(name, mapset)))
-	    die("can't open", name);
+	if ((fd[nfiles] = G_open_cell_old(name, "")) < 0)
+	    G_fatal_error(_("Unable to open <%s>"), name);
 
 	out_type[nfiles] = G_get_raster_map_type(fd[nfiles]);
 	if (flag3->answer)
 	    out_type[nfiles] = CELL_TYPE;
 
 	if (flag4->answer) {
-	    G_read_colors(name, mapset, &colors);
+	    G_read_colors(name, "", &colors);
 	    ncolor[nfiles] = colors;
 	}
 
-	if (withcats && G_read_cats(name, mapset, &cats[nfiles]) < 0)
-	    die(name, " - can't read category file");
+	if (withcats && G_read_cats(name, "", &cats[nfiles]) < 0)
+	    G_fatal_error(_("Unable to read category file for <%s>"), name);
 	nfiles++;
     }
 
@@ -330,14 +327,12 @@
 		cache_miss++;
 		if (row_in_window)
 		    for (i = 0; i < nfiles; i++) {
-			if (G_get_c_raster_row
-			    (fd[i], cell[i], cache[point].row) < 0)
-			    die(argv[i + 1], " - can't read");
+			if (G_get_c_raster_row(fd[i], cell[i], cache[point].row) < 0)
+			    G_fatal_error(_("Error reading <%s>"), argv[i + 1]);
 
 			if (out_type[i] != CELL_TYPE) {
-			    if (G_get_d_raster_row
-				(fd[i], dcell[i], cache[point].row) < 0)
-				die(argv[i + 1], " - can't read");
+			    if (G_get_d_raster_row(fd[i], dcell[i], cache[point].row) < 0)
+				G_fatal_error(_("Error reading <%s>"), argv[i + 1]);
 			}
 		    }
 
@@ -432,18 +427,18 @@
 /* *************************************************************** */
 /* *************************************************************** */
 /* *************************************************************** */
-int oops(int line, char *buf, char *msg)
+static int oops(int line, const char *buf, const char *msg)
 {
     static int first = 1;
 
     if (!tty) {
 	if (first) {
-	    G_warning("%s: ** input errors **\n", G_program_name());
+	    G_warning("Input errors:");
 	    first = 0;
 	}
-	G_warning("line %d: %s\n", line, buf);
+	G_warning("line %d: %s", line, buf);
     }
-    G_warning("** %s **\n", msg);
+    G_warning("%s", msg);
 
     return 0;
 }

Deleted: grass/trunk/raster/r.what/usage.c
===================================================================
--- grass/trunk/raster/r.what/usage.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.what/usage.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -1,14 +0,0 @@
-#include <stdlib.h>
-#include <grass/gis.h>
-#include "local_proto.h"
-
-void usage(void)
-{
-    char *message;
-
-    G_asprintf(&message, "%s [-fci] [null=string] layer1 [layer2] ...",
-	       G_program_name());
-    G_fatal_error(message);
-
-    return;
-}

Modified: grass/trunk/raster/r.what.color/main.c
===================================================================
--- grass/trunk/raster/r.what.color/main.c	2008-08-28 16:33:59 UTC (rev 33141)
+++ grass/trunk/raster/r.what.color/main.c	2008-08-28 20:08:49 UTC (rev 33142)
@@ -78,7 +78,6 @@
 	struct Flag *i;
     } flag;
     const char *name;
-    const char *mapset;
     struct Colors colors;
     RASTER_MAP_TYPE type;
 
@@ -121,16 +120,12 @@
 	G_fatal_error(_("Either \"-i\" or \"value=\" must be given"));
 
     name = opt.input->answer;
-    mapset = G_find_cell2(name, "");
 
-    if (!mapset)
-	G_fatal_error("Raster map <%s> not found", name);
-
-    type = G_raster_map_type(name, mapset);
+    type = G_raster_map_type(name, "");
     if (type < 0)
 	G_fatal_error("Unable to determine type of input map %s", name);
 
-    if (G_read_colors(name, mapset, &colors) < 0)
+    if (G_read_colors(name, "", &colors) < 0)
 	G_fatal_error("Unable to read colors for input map %s", name);
 
     fmt = opt.format->answer;



More information about the grass-commit mailing list