[GRASS-SVN] r33133 - in grass/trunk/raster: r.average r.basins.fill r.bitpattern r.clump r.composite r.contour r.covar r.describe r.drain r.grow r.grow.distance r.info r.lake r.median r.mode r.neighbors r.out.arc r.out.ascii r.out.bin r.out.mat r.out.png r.out.pov r.out.ppm r.out.ppm3 r.out.tiff r.out.vrml r.out.vtk

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Aug 27 18:02:44 EDT 2008


Author: glynn
Date: 2008-08-27 18:02:44 -0400 (Wed, 27 Aug 2008)
New Revision: 33133

Modified:
   grass/trunk/raster/r.average/main.c
   grass/trunk/raster/r.basins.fill/local_proto.h
   grass/trunk/raster/r.basins.fill/main.c
   grass/trunk/raster/r.basins.fill/read_map.c
   grass/trunk/raster/r.bitpattern/main.c
   grass/trunk/raster/r.clump/main.c
   grass/trunk/raster/r.composite/main.c
   grass/trunk/raster/r.contour/main.c
   grass/trunk/raster/r.covar/main.c
   grass/trunk/raster/r.describe/describe.c
   grass/trunk/raster/r.describe/local_proto.h
   grass/trunk/raster/r.describe/main.c
   grass/trunk/raster/r.drain/main.c
   grass/trunk/raster/r.grow.distance/main.c
   grass/trunk/raster/r.grow/main.c
   grass/trunk/raster/r.info/main.c
   grass/trunk/raster/r.lake/main.c
   grass/trunk/raster/r.median/main.c
   grass/trunk/raster/r.mode/main.c
   grass/trunk/raster/r.neighbors/main.c
   grass/trunk/raster/r.neighbors/ncb.h
   grass/trunk/raster/r.neighbors/null_cats.c
   grass/trunk/raster/r.out.arc/main.c
   grass/trunk/raster/r.out.ascii/formspecific.c
   grass/trunk/raster/r.out.ascii/localproto.h
   grass/trunk/raster/r.out.ascii/main.c
   grass/trunk/raster/r.out.bin/main.c
   grass/trunk/raster/r.out.mat/main.c
   grass/trunk/raster/r.out.png/main.c
   grass/trunk/raster/r.out.pov/main.c
   grass/trunk/raster/r.out.ppm/main.c
   grass/trunk/raster/r.out.ppm3/main.c
   grass/trunk/raster/r.out.tiff/main.c
   grass/trunk/raster/r.out.vrml/main.c
   grass/trunk/raster/r.out.vtk/main.c
Log:
Remove explicit mapset references and G_find_* calls


Modified: grass/trunk/raster/r.average/main.c
===================================================================
--- grass/trunk/raster/r.average/main.c	2008-08-27 21:59:09 UTC (rev 33132)
+++ grass/trunk/raster/r.average/main.c	2008-08-27 22:02:44 UTC (rev 33133)
@@ -34,7 +34,6 @@
 int main(int argc, char *argv[])
 {
     char command[1024];
-    char *mapset;
     struct GModule *module;
     struct Option *basemap, *covermap, *outputmap;
     struct Flag *flag_c;
@@ -68,14 +67,8 @@
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
-    if (!G_find_cell(basemap->answer, ""))
-	G_fatal_error(_("Raster map <%s> not found"), basemap->answer);
-
-    if (!(mapset = G_find_cell(covermap->answer, "")))
-	G_fatal_error(_("Raster map <%s> not found"), covermap->answer);
-
     if ((usecats = flag_c->answer)) {
-	if (G_read_cats(covermap->answer, mapset, &cats) < 0)
+	if (G_read_cats(covermap->answer, "", &cats) < 0)
 	    G_fatal_error(_("Error reading category file for <%s>"),
 			  covermap->answer);
     }

Modified: grass/trunk/raster/r.basins.fill/local_proto.h
===================================================================
--- grass/trunk/raster/r.basins.fill/local_proto.h	2008-08-27 21:59:09 UTC (rev 33132)
+++ grass/trunk/raster/r.basins.fill/local_proto.h	2008-08-27 22:02:44 UTC (rev 33133)
@@ -20,7 +20,7 @@
 #define __LOCAL_PROTO_H__
 
 /* read_map.c */
-CELL *read_map(char *, char *, int, int, int);
+CELL *read_map(const char *, int, int, int);
 
 
 #endif /* __LOCAL_PROTO_H__ */

Modified: grass/trunk/raster/r.basins.fill/main.c
===================================================================
--- grass/trunk/raster/r.basins.fill/main.c	2008-08-27 21:59:09 UTC (rev 33132)
+++ grass/trunk/raster/r.basins.fill/main.c	2008-08-27 22:02:44 UTC (rev 33133)
@@ -38,14 +38,14 @@
 {
     int partfd;
     int nrows, ncols;
-    char drain_name[GNAME_MAX], *drain_mapset;
-    char ridge_name[GNAME_MAX], *ridge_mapset;
-    char part_name[GNAME_MAX], *part_mapset;
+    const char *drain_name;
+    const char *ridge_name;
+    const char *part_name;
     CELL *drain, *ridge;
     struct Cell_head window;
     int row, col, npass, tpass;
     struct GModule *module;
-    struct Option *opt1, *opt2, *opt3, *opt4;
+    struct Option *num_opt, *drain_opt, *ridge_opt, *part_opt;
 
     G_gisinit(argv[0]);
 
@@ -54,63 +54,54 @@
     module->description =
 	_("Generates a raster map layer showing " "watershed subbasins.");
 
-    opt1 = G_define_option();
-    opt1->key = "number";
-    opt1->type = TYPE_INTEGER;
-    opt1->required = YES;
-    opt1->description = _("Number of passes through the dataset");
-    opt1->gisprompt = "old,cell,raster";
+    num_opt = G_define_option();
+    num_opt->key = "number";
+    num_opt->type = TYPE_INTEGER;
+    num_opt->required = YES;
+    num_opt->description = _("Number of passes through the dataset");
+    num_opt->gisprompt = "old,cell,raster";
 
-    opt2 = G_define_option();
-    opt2->key = "c_map";
-    opt2->type = TYPE_STRING;
-    opt2->required = YES;
-    opt2->description = _("Coded stream network file name");
-    opt2->gisprompt = "old,cell,raster";
+    drain_opt = G_define_option();
+    drain_opt->key = "c_map";
+    drain_opt->type = TYPE_STRING;
+    drain_opt->required = YES;
+    drain_opt->description = _("Coded stream network file name");
+    drain_opt->gisprompt = "old,cell,raster";
 
-    opt3 = G_define_option();
-    opt3->key = "t_map";
-    opt3->type = TYPE_STRING;
-    opt3->required = YES;
-    opt3->description = _("Thinned ridge network file name");
-    opt3->gisprompt = "old,cell,raster";
+    ridge_opt = G_define_option();
+    ridge_opt->key = "t_map";
+    ridge_opt->type = TYPE_STRING;
+    ridge_opt->required = YES;
+    ridge_opt->description = _("Thinned ridge network file name");
+    ridge_opt->gisprompt = "old,cell,raster";
 
-    opt4 = G_define_option();
-    opt4->key = "result";
-    opt4->type = TYPE_STRING;
-    opt4->required = YES;
-    opt4->description = _("Name for the resultant watershed partition file");
-    opt4->gisprompt = "new,cell,raster";
+    part_opt = G_define_option();
+    part_opt->key = "result";
+    part_opt->type = TYPE_STRING;
+    part_opt->required = YES;
+    part_opt->description = _("Name for the resultant watershed partition file");
+    part_opt->gisprompt = "new,cell,raster";
 
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
-    sscanf(opt1->answer, "%d", &tpass);
+    sscanf(num_opt->answer, "%d", &tpass);
 
-    strcpy(drain_name, opt2->answer);
-    drain_mapset = G_find_cell2(drain_name, "");
-    if (drain_mapset == NULL)
-	G_fatal_error(_("Raster map <%s> not found"), opt2->answer);
+    drain_name = drain_opt->answer;
 
     /* this isn't a nice thing to do. G_align_window() should be used first */
-    G_get_cellhd(drain_name, drain_mapset, &window);
+    G_get_cellhd(drain_name, "", &window);
     G_set_window(&window);
 
     nrows = G_window_rows();
     ncols = G_window_cols();
 
-    strcpy(ridge_name, opt3->answer);
-    ridge_mapset = G_find_cell2(ridge_name, "");
-    if (ridge_mapset == NULL)
-	G_fatal_error(_("Raster map <%s> not found"), opt3->answer);
+    ridge_name = ridge_opt->answer;
 
-    strcpy(part_name, opt4->answer);
-    part_mapset = G_find_cell2(part_name, "");
-    if (part_mapset != NULL)
-	G_fatal_error(_("Raster map <%s> already exists"), opt4->answer);
+    part_name = part_opt->answer;
 
-    drain = read_map(drain_name, drain_mapset, NOMASK, nrows, ncols);
-    ridge = read_map(ridge_name, ridge_mapset, NOMASK, nrows, ncols);
+    drain = read_map(drain_name, NOMASK, nrows, ncols);
+    ridge = read_map(ridge_name, NOMASK, nrows, ncols);
 
     partfd = G_open_cell_new(part_name);
     if (partfd < 0)

Modified: grass/trunk/raster/r.basins.fill/read_map.c
===================================================================
--- grass/trunk/raster/r.basins.fill/read_map.c	2008-08-27 21:59:09 UTC (rev 33132)
+++ grass/trunk/raster/r.basins.fill/read_map.c	2008-08-27 22:02:44 UTC (rev 33133)
@@ -17,25 +17,26 @@
 ****************************************************************************/
 
 #include <grass/gis.h>
+#include <grass/glocale.h>
 #include "local_proto.h"
 
 
-CELL *read_map(char *name, char *mapset, int nomask, int nrows, int ncols)
+CELL *read_map(const char *name, int nomask, int nrows, int ncols)
 {
     int fd;
     CELL *map;
     int row;
-    int (*get_row) ();
+    int (*get_row)(int, CELL *, int);
 
     /* allocate entire map */
     map = (CELL *) G_malloc(nrows * ncols * sizeof(CELL));
 
     /* open the map */
-    if ((fd = G_open_cell_old(name, mapset)) < 0)
-	G_fatal_error("unable to open [%s] in [%s]", name, mapset);
+    if ((fd = G_open_cell_old(name, "")) < 0)
+	G_fatal_error(_("Unable to open <%s>"), name);
 
     /* read the map */
-    G_message("READING [%s] in [%s] ... ", name, mapset);
+    G_message(_("Reading <%s> ... "), name);
 
     if (nomask)
 	get_row = G_get_map_row_nomask;
@@ -45,7 +46,7 @@
     for (row = 0; row < nrows; row++) {
 	G_percent(row, nrows, 10);
 	if ((*get_row) (fd, map + row * ncols, row) < 0)
-	    G_fatal_error("error reading [%s] in [%s]", name, mapset);
+	    G_fatal_error(_("Error reading <%s>"), name);
     }
     G_percent(nrows, nrows, 10);
 

Modified: grass/trunk/raster/r.bitpattern/main.c
===================================================================
--- grass/trunk/raster/r.bitpattern/main.c	2008-08-27 21:59:09 UTC (rev 33132)
+++ grass/trunk/raster/r.bitpattern/main.c	2008-08-27 22:02:44 UTC (rev 33133)
@@ -43,7 +43,7 @@
 int main(int argc, char *argv[])
 {
     struct Cell_head cellhd;
-    char *name, *result, *mapset;
+    char *name, *result;
     void *inrast;
     unsigned char *outrast;
     int nrows, ncols;
@@ -95,19 +95,14 @@
     pat = atoi(pattern->answer);
     patv = atoi(patval->answer);
 
-    /* find map in mapset */
-    mapset = G_find_cell2(name, "");
-    if (mapset == NULL)
-	G_fatal_error(_("Raster map <%s> not found"), name);
-
     /*if Gispf() error */
-    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);
 
     /* Allocate input buffer */

Modified: grass/trunk/raster/r.clump/main.c
===================================================================
--- grass/trunk/raster/r.clump/main.c	2008-08-27 21:59:09 UTC (rev 33132)
+++ grass/trunk/raster/r.clump/main.c	2008-08-27 22:02:44 UTC (rev 33133)
@@ -28,16 +28,15 @@
     struct Colors colr;
     struct Range range;
     CELL min, max;
-    char *mapset;
     int in_fd, out_fd;
     char title[512];
     char name[GNAME_MAX];
     char *OUTPUT;
     char *INPUT;
     struct GModule *module;
-    struct Option *opt1;
-    struct Option *opt2;
-    struct Option *opt3;
+    struct Option *opt_in;
+    struct Option *opt_out;
+    struct Option *opt_title;
 
     G_gisinit(argv[0]);
 
@@ -49,30 +48,26 @@
 	_("Recategorizes data in a raster map layer by grouping cells "
 	  "that form physically discrete areas into unique categories.");
 
-    opt1 = G_define_standard_option(G_OPT_R_INPUT);
+    opt_in = G_define_standard_option(G_OPT_R_INPUT);
 
-    opt2 = G_define_standard_option(G_OPT_R_OUTPUT);
+    opt_out = G_define_standard_option(G_OPT_R_OUTPUT);
 
-    opt3 = G_define_option();
-    opt3->key = "title";
-    opt3->key_desc = "\"string\"";
-    opt3->type = TYPE_STRING;
-    opt3->required = NO;
-    opt3->description = _("Title, in quotes");
+    opt_title = G_define_option();
+    opt_title->key = "title";
+    opt_title->type = TYPE_STRING;
+    opt_title->required = NO;
+    opt_title->description = _("Title");
 
     /* parse options */
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
-    INPUT = opt1->answer;
-    OUTPUT = opt2->answer;
+    INPUT = opt_in->answer;
+    OUTPUT = opt_out->answer;
 
     strcpy(name, INPUT);
-    mapset = G_find_cell2(name, "");
-    if (!mapset)
-	G_fatal_error(_("Raster map <%s> not found"), INPUT);
 
-    in_fd = G_open_cell_old(name, mapset);
+    in_fd = G_open_cell_old(name, "");
     if (in_fd < 0)
 	G_fatal_error(_("Unable to open raster map <%s>"), INPUT);
 
@@ -89,10 +84,10 @@
 
 
     /* build title */
-    if (opt3->answer != NULL)
-	strcpy(title, opt3->answer);
+    if (opt_title->answer != NULL)
+	strcpy(title, opt_title->answer);
     else
-	sprintf(title, "clump of %s in %s", name, mapset);
+	sprintf(title, "clump of %s", name);
 
     G_put_cell_title(OUTPUT, title);
     G_read_range(OUTPUT, G_mapset(), &range);

Modified: grass/trunk/raster/r.composite/main.c
===================================================================
--- grass/trunk/raster/r.composite/main.c	2008-08-27 21:59:09 UTC (rev 33132)
+++ grass/trunk/raster/r.composite/main.c	2008-08-27 22:02:44 UTC (rev 33133)
@@ -59,7 +59,6 @@
     CELL *out_array;
     struct Colors out_colors;
     int levels;
-    char *mapset;
     int atrow, atcol;
     struct Cell_head window;
     unsigned char *dummy, *nulls;
@@ -152,12 +151,8 @@
 	/* Get name of layer to be used */
 	b->name = b->opt_name->answer;
 
-	mapset = G_find_cell2(b->name, "");
-	if (mapset == NULL)
-	    G_fatal_error(_("Raster map <%s> not found"), b->name);
-
 	/* Make sure map is available */
-	if ((b->file = G_open_cell_old(b->name, mapset)) == -1)
+	if ((b->file = G_open_cell_old(b->name, "")) == -1)
 	    G_fatal_error(_("Unable to open raster map <%s>"), b->name);
 
 	b->type = G_get_raster_map_type(b->file);
@@ -165,7 +160,7 @@
 	b->size = G_raster_size(b->type);
 
 	/* Reading color lookup table */
-	if (G_read_colors(b->name, mapset, &b->colors) == -1)
+	if (G_read_colors(b->name, "", &b->colors) == -1)
 	    G_fatal_error(_("Color file for <%s> not available"), b->name);
 
 	for (j = 0; j < 3; j++)
@@ -186,10 +181,6 @@
     /* open output files */
     out_name = opt_out->answer;
 
-    mapset = G_find_cell2(out_name, "");
-    if (mapset != NULL)
-	G_remove("cell", out_name);
-
     if ((out_file = G_open_cell_new(out_name)) < 0)
 	G_fatal_error(_("Unable to create raster map <%s>"), out_name);
 

Modified: grass/trunk/raster/r.contour/main.c
===================================================================
--- grass/trunk/raster/r.contour/main.c	2008-08-27 21:59:09 UTC (rev 33132)
+++ grass/trunk/raster/r.contour/main.c	2008-08-27 22:02:44 UTC (rev 33133)
@@ -65,7 +65,6 @@
 
     struct Cell_head Wind;
     char *name;
-    char *mapset;
     struct Map_info Map;
     DCELL **z_array;
     struct FPRange range;
@@ -131,15 +130,12 @@
     }
 
     name = map->answer;
-    mapset = G_find_cell2(name, "");
-    if (mapset == NULL)
-	G_fatal_error(_("Raster map <%s> not found"), name);
 
-    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);
 
-    if (G_read_fp_range(name, mapset, &range) < 0)
+    if (G_read_fp_range(name, "", &range) < 0)
 	G_fatal_error(_("Could not read range file"));
 
     /* get window info */

Modified: grass/trunk/raster/r.covar/main.c
===================================================================
--- grass/trunk/raster/r.covar/main.c	2008-08-27 21:59:09 UTC (rev 33132)
+++ grass/trunk/raster/r.covar/main.c	2008-08-27 22:02:44 UTC (rev 33133)
@@ -28,7 +28,7 @@
 {
     int nrows, ncols;
     DCELL **dcell;
-    char *name, *mapset;
+    char *name;
     double *sum, **sum2;
     double count;
     double ii, jj;
@@ -75,10 +75,7 @@
 	sum2[i] = (double *)G_calloc(nfiles, sizeof(double));
 	dcell[i] = G_allocate_d_raster_buf();
 	name = maps->answers[i];
-	mapset = G_find_cell(name, "");
-	if (!mapset)
-	    G_fatal_error(_("Raster map <%s> not found"), name);
-	fd[i] = G_open_cell_old(name, mapset);
+	fd[i] = G_open_cell_old(name, "");
 	if (fd[i] < 0)
 	    G_fatal_error(_("Unable to open raster map <%s>"), name);
     }

Modified: grass/trunk/raster/r.describe/describe.c
===================================================================
--- grass/trunk/raster/r.describe/describe.c	2008-08-27 21:59:09 UTC (rev 33132)
+++ grass/trunk/raster/r.describe/describe.c	2008-08-27 22:02:44 UTC (rev 33133)
@@ -17,10 +17,11 @@
  ***************************************************************************/
 
 #include <grass/gis.h>
+#include <grass/glocale.h>
 #include "local_proto.h"
 
 
-int describe(char *name, char *mapset, int compact, char *no_data_str,
+int describe(const char *name, int compact, char *no_data_str,
 	     int range, int windowed, int nsteps, int as_int, int skip_nulls)
 {
     int fd;
@@ -35,23 +36,19 @@
     struct Quant q;
     struct FPRange r;
     DCELL dmin, dmax;
-    int (*get_row) ();
+    int (*get_row)(int, CELL *, int);
 
     if (windowed) {
 	get_row = G_get_c_raster_row;
     }
     else {
-	char msg[100];
+	if (G_get_cellhd(name, "", &window) < 0)
+	    G_fatal_error(_("Unable to get cell header for <%s>"), name);
 
-	if (G_get_cellhd(name, mapset, &window) < 0) {
-	    sprintf(msg, "can't get cell header for [%s] in [%s]", name,
-		    mapset);
-	    G_fatal_error(msg);
-	}
 	G_set_window(&window);
 	get_row = G_get_c_raster_row_nomask;
     }
-    fd = G_open_cell_old(name, mapset);
+    fd = G_open_cell_old(name, "");
     if (fd < 0)
 	return 0;
 
@@ -87,7 +84,7 @@
     /* set up quantization rules */
     if (map_type != CELL_TYPE) {
 	G_quant_init(&q);
-	G_read_fp_range(name, mapset, &r);
+	G_read_fp_range(name, "", &r);
 	G_get_fp_range_min_max(&r, &dmin, &dmax);
 	G_quant_add_rule(&q, dmin, dmax, 1, nsteps);
 	G_set_quant_rules(fd, &q);
@@ -96,7 +93,7 @@
     nrows = G_window_rows();
     ncols = G_window_cols();
 
-    G_verbose_message("Reading [%s in %s] ...", name, mapset);
+    G_verbose_message(_("Reading <%s> ..."), name);
     for (row = 0; row < nrows; row++) {
 	G_percent(row, nrows, 2);
 	if ((*get_row) (fd, b = buf, row) < 0)

Modified: grass/trunk/raster/r.describe/local_proto.h
===================================================================
--- grass/trunk/raster/r.describe/local_proto.h	2008-08-27 21:59:09 UTC (rev 33132)
+++ grass/trunk/raster/r.describe/local_proto.h	2008-08-27 22:02:44 UTC (rev 33133)
@@ -20,7 +20,7 @@
 #define __R_DESC_LOCAL_PROTO_H__
 
 /* describe.c */
-int describe(char *, char *, int, char *, int, int, int, int, int);
+int describe(const char *, int, char *, int, int, int, int, int);
 
 /* dumplist.c */
 int long_list(struct Cell_stats *, DCELL, DCELL, char *, int, RASTER_MAP_TYPE,

Modified: grass/trunk/raster/r.describe/main.c
===================================================================
--- grass/trunk/raster/r.describe/main.c	2008-08-27 21:59:09 UTC (rev 33132)
+++ grass/trunk/raster/r.describe/main.c	2008-08-27 22:02:44 UTC (rev 33133)
@@ -31,8 +31,6 @@
     int range;
     int windowed;
     int nsteps;
-    char name[GNAME_MAX];
-    char *mapset;
     char *no_data_str;
     struct GModule *module;
     struct
@@ -111,15 +109,8 @@
 	G_fatal_error(_("%s = %s -- must be greater than zero"),
 		      option.nsteps->key, option.nsteps->answer);
 
-    strcpy(name, option.map->answer);
+    describe(option.map->answer, compact, no_data_str,
+	     range, windowed, nsteps, as_int, flag.n->answer);
 
-    if ((mapset = G_find_cell2(name, ""))) {
-	describe(name, mapset, compact, no_data_str,
-		 range, windowed, nsteps, as_int, flag.n->answer);
-	exit(EXIT_SUCCESS);
-    }
-
-    G_fatal_error(_("%s: [%s] not found"), G_program_name(), name);
-
     return EXIT_SUCCESS;
 }

Modified: grass/trunk/raster/r.drain/main.c
===================================================================
--- grass/trunk/raster/r.drain/main.c	2008-08-27 21:59:09 UTC (rev 33132)
+++ grass/trunk/raster/r.drain/main.c	2008-08-27 22:02:44 UTC (rev 33133)
@@ -74,9 +74,8 @@
     int nrows, ncols, points_row[MAX_POINTS], points_col[MAX_POINTS], npoints;
     int cell_open(), cell_open_new();
     int map_id;
-    char map_name[GNAME_MAX], *map_mapset, new_map_name[GNAME_MAX];
+    char map_name[GNAME_MAX], new_map_name[GNAME_MAX];
     char *tempfile1, *tempfile2;
-    char *search_mapset;
     struct History history;
 
     struct Cell_head window;
@@ -147,13 +146,8 @@
     strcpy(map_name, opt1->answer);
     strcpy(new_map_name, opt2->answer);
 
-    /* get the name of the elevation map layer for filling */
-    map_mapset = G_find_cell(map_name, "");
-    if (!map_mapset)
-	G_fatal_error(_("Raster map <%s> not found"), map_name);
-
     /*      allocate cell buf for the map layer */
-    in_type = G_raster_map_type(map_name, map_mapset);
+    in_type = G_raster_map_type(map_name, "");
 
     /* set the pointers for multi-typed functions */
     set_func_pointers(in_type);
@@ -210,13 +204,8 @@
 	    int dims, strs, dbls;
 	    RASTER_MAP_TYPE cat;
 
-	    search_mapset = G_find_sites(vpointopt->answers[i], "");
-	    if (search_mapset == NULL)
-		G_fatal_error(_("Vector map <%s> not found"),
-			      vpointopt->answers[i]);
+	    fp = G_fopen_sites_old(vpointopt->answers[i], "");
 
-	    fp = G_fopen_sites_old(vpointopt->answers[i], search_mapset);
-
 	    if (0 != G_site_describe(fp, &dims, &cat, &strs, &dbls))
 		G_fatal_error(_("Failed to guess site file format"));
 
@@ -294,7 +283,7 @@
     in_buf = get_buf();
 
     /* open the original map and get its file id  */
-    map_id = G_open_cell_old(map_name, map_mapset);
+    map_id = G_open_cell_old(map_name, "");
 
     /* get some temp files */
     tempfile1 = G_tempfile();

Modified: grass/trunk/raster/r.grow/main.c
===================================================================
--- grass/trunk/raster/r.grow/main.c	2008-08-27 21:59:09 UTC (rev 33132)
+++ grass/trunk/raster/r.grow/main.c	2008-08-27 22:02:44 UTC (rev 33133)
@@ -112,7 +112,6 @@
     double radius;
     int oldval = 0;
     int newval = 0;
-    char *mapset;
     RASTER_MAP_TYPE type;
     int in_fd;
     int out_fd;
@@ -181,10 +180,6 @@
 
     verbose = !flag.q->answer;
 
-    mapset = G_find_cell(in_name, "");
-    if (!mapset)
-	G_fatal_error(_("Raster map <%s> not found"), in_name);
-
     nrows = G_window_rows();
     ncols = G_window_cols();
 
@@ -197,7 +192,7 @@
     else
 	G_fatal_error(_("Unknown metric: [%s]."), opt.met->answer);
 
-    in_fd = G_open_cell_old(in_name, mapset);
+    in_fd = G_open_cell_old(in_name, "");
     if (in_fd < 0)
 	G_fatal_error(_("Unable to open raster map <%s>"), in_name);
 
@@ -207,12 +202,12 @@
     if (out_fd < 0)
 	G_fatal_error(_("Unable to create raster map <%s>"), out_name);
 
-    if (G_read_cats(in_name, mapset, &cats) == -1) {
+    if (G_read_cats(in_name, "", &cats) == -1) {
 	G_warning(_("Error reading category file for <%s>"), in_name);
 	G_init_cats(0, "", &cats);
     }
 
-    if (G_read_colors(in_name, mapset, &colr) == -1) {
+    if (G_read_colors(in_name, "", &colr) == -1) {
 	G_warning(_("Error in reading color file for <%s>"), in_name);
 	colrfile = 0;
     }

Modified: grass/trunk/raster/r.grow.distance/main.c
===================================================================
--- grass/trunk/raster/r.grow.distance/main.c	2008-08-27 21:59:09 UTC (rev 33132)
+++ grass/trunk/raster/r.grow.distance/main.c	2008-08-27 22:02:44 UTC (rev 33133)
@@ -102,7 +102,6 @@
     } opt;
     char *in_name;
     char *out_name;
-    char *mapset;
     int in_fd;
     int out_fd;
     char *temp_name;
@@ -139,10 +138,6 @@
     in_name = opt.in->answer;
     out_name = opt.out->answer;
 
-    mapset = G_find_cell(in_name, "");
-    if (!mapset)
-	G_fatal_error(_("Raster map <%s> not found"), in_name);
-
     if (strcmp(opt.met->answer, "euclidian") == 0)
 	distance = &distance_euclidian_squared;
     else if (strcmp(opt.met->answer, "squared") == 0)
@@ -154,7 +149,7 @@
     else
 	G_fatal_error(_("Unknown metric: [%s]."), opt.met->answer);
 
-    in_fd = G_open_cell_old(in_name, mapset);
+    in_fd = G_open_cell_old(in_name, "");
     if (in_fd < 0)
 	G_fatal_error(_("Unable to open raster map <%s>"), in_name);
 

Modified: grass/trunk/raster/r.info/main.c
===================================================================
--- grass/trunk/raster/r.info/main.c	2008-08-27 21:59:09 UTC (rev 33132)
+++ grass/trunk/raster/r.info/main.c	2008-08-27 22:02:44 UTC (rev 33133)
@@ -117,19 +117,19 @@
     if ((mapset = G_find_cell2(name, "")) == NULL)
 	G_fatal_error(_("Raster map <%s> not found"), name);
 
-    head_ok = G_get_cellhd(name, mapset, &cellhd) >= 0;
-    cats_ok = G_read_cats(name, mapset, &cats) >= 0;
-    hist_ok = G_read_history(name, mapset, &hist) >= 0;
-    is_reclass = G_get_reclass(name, mapset, &reclass);
-    data_type = G_raster_map_type(name, mapset);
+    head_ok = G_get_cellhd(name, "", &cellhd) >= 0;
+    cats_ok = G_read_cats(name, "", &cats) >= 0;
+    hist_ok = G_read_history(name, "", &hist) >= 0;
+    is_reclass = G_get_reclass(name, "", &reclass);
+    data_type = G_raster_map_type(name, "");
 
-    if (G_read_raster_units(name, mapset, units) != 0)
+    if (G_read_raster_units(name, "", units) != 0)
 	units[0] = '\0';
-    if (G_read_raster_vdatum(name, mapset, vdatum) != 0)
+    if (G_read_raster_vdatum(name, "", vdatum) != 0)
 	vdatum[0] = '\0';
 
     /*Check the Timestamp */
-    time_ok = G_read_raster_timestamp(name, mapset, &ts) > 0;
+    time_ok = G_read_raster_timestamp(name, "", &ts) > 0;
     /*Check for valid entries, show none if no timestamp available */
     if (time_ok) {
 	if (ts.count > 0)
@@ -138,7 +138,7 @@
 	    second_time_ok = 1;
     }
 
-    if (G_read_fp_range(name, mapset, &range) < 0)
+    if (G_read_fp_range(name, "", &range) < 0)
 	G_fatal_error(_("Unable to read range file"));
     G_get_fp_range_min_max(&range, &zmin, &zmax);
 
@@ -228,7 +228,7 @@
 			 tmp1, tmp2, tmp3);
 
 	    if (data_type == CELL_TYPE) {
-		if (2 == G_read_range(name, mapset, &crange))
+		if (2 == G_read_range(name, "", &crange))
 		    compose_line(out,
 				 "  Range of data:    min = NULL  max = NULL");
 		else
@@ -320,7 +320,7 @@
 
 	if (rflag->answer) {
 	    if (data_type == CELL_TYPE) {
-		if (2 == G_read_range(name, mapset, &crange)) {
+		if (2 == G_read_range(name, "", &crange)) {
 		    fprintf(out, "min=NULL\n");
 		    fprintf(out, "max=NULL\n");
 		}

Modified: grass/trunk/raster/r.lake/main.c
===================================================================
--- grass/trunk/raster/r.lake/main.c	2008-08-27 21:59:09 UTC (rev 33132)
+++ grass/trunk/raster/r.lake/main.c	2008-08-27 22:02:44 UTC (rev 33133)
@@ -131,7 +131,7 @@
 
 int main(int argc, char *argv[])
 {
-    char *terrainmap, *seedmap, *lakemap, *mapset;
+    char *terrainmap, *seedmap, *lakemap;
     int rows, cols, in_terran_fd, out_fd, lake_fd, row, col, pases, pass;
     int lastcount, curcount, start_col, start_row;
     double east, north, area = 0, volume = 0;
@@ -237,25 +237,15 @@
     }
 
     /* Open terran map */
-    mapset = G_find_cell2(terrainmap, "");
-    if (mapset == NULL)
-	G_fatal_error(_("Raster map <%s> not found"), terrainmap);
-
-    in_terran_fd = G_open_cell_old(terrainmap, mapset);
+    in_terran_fd = G_open_cell_old(terrainmap, "");
     if (in_terran_fd < 0)
-	G_fatal_error(_("Unable to open raster map <%s>"),
-		      G_fully_qualified_name(terrainmap, mapset));
+	G_fatal_error(_("Unable to open raster map <%s>"), terrainmap);
 
     /* Open seed map */
     if (smap_opt->answer) {
-	mapset = G_find_cell2(seedmap, "");
-	if (mapset == NULL)
-	    G_fatal_error(_("Raster map <%s> not found"), seedmap);
-
-	out_fd = G_open_cell_old(seedmap, mapset);
+	out_fd = G_open_cell_old(seedmap, "");
 	if (out_fd < 0)
-	    G_fatal_error(_("Unable to open raster map <%s>"),
-			  G_fully_qualified_name(seedmap, mapset));
+	    G_fatal_error(_("Unable to open raster map <%s>"), seedmap);
     }
 
     /* Pointers to rows. Row = ptr to 'col' size array. */

Modified: grass/trunk/raster/r.median/main.c
===================================================================
--- grass/trunk/raster/r.median/main.c	2008-08-27 21:59:09 UTC (rev 33132)
+++ grass/trunk/raster/r.median/main.c	2008-08-27 22:02:44 UTC (rev 33133)
@@ -29,8 +29,8 @@
     {
 	struct Option *base, *cover, *output;
     } parm;
-    char *basemap, *base_mapset;
-    char *covermap, *cover_mapset;
+    char *basemap;
+    char *covermap;
     char *outmap;
     char command[1024];
     struct Categories cover_cats;
@@ -66,36 +66,20 @@
     covermap = parm.cover->answer;
     outmap = parm.output->answer;
 
-    base_mapset = G_find_cell2(basemap, "");
-    if (base_mapset == NULL)
-	G_fatal_error(_("Base raster map <%s> not found"), basemap);
-
-    cover_mapset = G_find_cell2(covermap, "");
-    if (cover_mapset == NULL)
-	G_fatal_error(_("Raster map <%s> not found"), covermap);
-
-    if (strcmp(G_mapset(), base_mapset) == 0 && strcmp(basemap, outmap) == 0)
-	G_fatal_error(_("Base map and output map <%s> must be different"),
-		      outmap);
-    if (G_read_cats(covermap, cover_mapset, &cover_cats) < 0)
+    if (G_read_cats(covermap, "", &cover_cats) < 0)
 	G_fatal_error(_("Unable to read category labels of raster map <%s>"),
 		      covermap);
 
-    strcpy(command, "r.stats -an \"");
-    strcat(command, G_fully_qualified_name(basemap, base_mapset));
-    strcat(command, ",");
-    strcat(command, G_fully_qualified_name(covermap, cover_mapset));
-    strcat(command, "\"");
+    sprintf(command, "r.stats -an \"%s,%s\"", basemap, covermap);
 
     /* strcpy (command,"cat /tmp/t"); */
     G_debug(3, "command: %s", command);
     stats_fd = popen(command, "r");
 
-    G_debug(3, "r.reclass i=\"%s\" o=\"%s\"",
-	    G_fully_qualified_name(basemap, base_mapset), outmap);
-    sprintf(command, "r.reclass i=\"%s\" o=\"%s\"",
-	    G_fully_qualified_name(basemap, base_mapset), outmap);
+    G_debug(3, "r.reclass i=\"%s\" o=\"%s\"", basemap, outmap);
 
+    sprintf(command, "r.reclass i=\"%s\" o=\"%s\"", basemap, outmap);
+
     reclass_fd = popen(command, "w");
 
     first = 1;

Modified: grass/trunk/raster/r.mode/main.c
===================================================================
--- grass/trunk/raster/r.mode/main.c	2008-08-27 21:59:09 UTC (rev 33132)
+++ grass/trunk/raster/r.mode/main.c	2008-08-27 22:02:44 UTC (rev 33133)
@@ -34,8 +34,8 @@
     {
 	struct Option *base, *cover, *output;
     } parm;
-    char *basemap, *base_mapset;
-    char *covermap, *cover_mapset;
+    char *basemap;
+    char *covermap;
     char *outmap;
     char command[1024];
     struct Categories cover_cats;
@@ -81,35 +81,16 @@
     covermap = parm.cover->answer;
     outmap = parm.output->answer;
 
-    base_mapset = G_find_cell2(basemap, "");
-    if (base_mapset == NULL) {
-	G_fatal_error(_("%s: base raster map not found"), basemap);
-    }
-
-    cover_mapset = G_find_cell2(covermap, "");
-    if (cover_mapset == NULL) {
-	G_fatal_error(_("%s: cover raster map not found"), covermap);
-    }
-
-    if (strcmp(G_mapset(), base_mapset) == 0 && strcmp(basemap, outmap) == 0) {
-	G_fatal_error(_("%s: base map and output map must be different"),
-		      outmap);
-    }
-    if (G_read_cats(covermap, cover_mapset, &cover_cats) < 0) {
+    if (G_read_cats(covermap, "", &cover_cats) < 0) {
 	G_fatal_error(_("%s: Unable to read category labels"), covermap);
     }
 
-    strcpy(command, "r.stats -an \"");
-    strcat(command, G_fully_qualified_name(basemap, base_mapset));
-    strcat(command, ",");
-    strcat(command, G_fully_qualified_name(covermap, cover_mapset));
-    strcat(command, "\"");
+    sprintf(command, "r.stats -an \"%s,%s\"", basemap, covermap);
 
     /* printf(command); */
     stats = popen(command, "r");
 
-    sprintf(command, "r.reclass i=\"%s\" o=\"%s\"",
-	    G_fully_qualified_name(basemap, base_mapset), outmap);
+    sprintf(command, "r.reclass i=\"%s\" o=\"%s\"", basemap, outmap);
 
     /* printf(command); */
     reclass = popen(command, "w");

Modified: grass/trunk/raster/r.neighbors/main.c
===================================================================
--- grass/trunk/raster/r.neighbors/main.c	2008-08-27 21:59:09 UTC (rev 33132)
+++ grass/trunk/raster/r.neighbors/main.c	2008-08-27 22:02:44 UTC (rev 33133)
@@ -171,15 +171,11 @@
     if (parm.weight->answer && flag.circle->answer)
 	G_fatal_error(_("weight= and -c are mutually exclusive"));
 
-    p = ncb.oldcell.name = parm.input->answer;
-    if (NULL == (ncb.oldcell.mapset = G_find_cell2(p, ""))) {
-	G_fatal_error(_("Raster map <%s> not found"), p);
-    }
-    p = ncb.newcell.name = parm.output->answer;
-    ncb.newcell.mapset = G_mapset();
+    ncb.oldcell = parm.input->answer;
+    ncb.newcell = parm.output->answer;
 
     if (!flag.align->answer) {
-	if (G_get_cellhd(ncb.oldcell.name, ncb.oldcell.mapset, &cellhd) < 0)
+	if (G_get_cellhd(ncb.oldcell, "", &cellhd) < 0)
 	    exit(EXIT_FAILURE);
 	G_get_window(&window);
 	G_align_window(&window, &cellhd);
@@ -190,9 +186,9 @@
     ncols = G_window_cols();
 
     /* open raster maps */
-    if ((in_fd = G_open_cell_old(ncb.oldcell.name, ncb.oldcell.mapset)) < 0)
-	G_fatal_error(_("Unable to open raster map <%s> in mapset <%s>"),
-		      ncb.oldcell.name, ncb.oldcell.mapset);
+    if ((in_fd = G_open_cell_old(ncb.oldcell, "")) < 0)
+	G_fatal_error(_("Unable to open raster map <%s>"),
+		      ncb.oldcell);
 
     map_type = G_get_raster_map_type(in_fd);
 
@@ -218,7 +214,7 @@
     if (copycolr) {
 	G_suppress_warnings(1);
 	copycolr =
-	    (G_read_colors(ncb.oldcell.name, ncb.oldcell.mapset, &colr) > 0);
+	    (G_read_colors(ncb.oldcell, "", &colr) > 0);
 	G_suppress_warnings(0);
     }
 
@@ -240,7 +236,7 @@
 	strcpy(ncb.title, parm.title->answer);
     else
 	sprintf(ncb.title, "%dx%d neighborhood: %s of %s",
-		ncb.nsize, ncb.nsize, menu[method].name, ncb.oldcell.name);
+		ncb.nsize, ncb.nsize, menu[method].name, ncb.oldcell);
 
 
     /* initialize the cell bufs with 'dist' rows of the old cellfile */
@@ -250,12 +246,12 @@
 	readcell(in_fd, readrow++, nrows, ncols);
 
     /* open raster map */
-    in_fd = G_open_cell_old(ncb.oldcell.name, ncb.oldcell.mapset);
+    in_fd = G_open_cell_old(ncb.oldcell, "");
     if (in_fd < 0)
 	exit(EXIT_FAILURE);
 
     /*open the new raster map */
-    out_fd = G_open_raster_new(ncb.newcell.name, map_type);
+    out_fd = G_open_raster_new(ncb.newcell, map_type);
     if (out_fd < 0)
 	exit(EXIT_FAILURE);
 
@@ -303,14 +299,14 @@
     if ((cat_names = menu[method].cat_names))
 	cat_names();
 
-    G_write_cats(ncb.newcell.name, &ncb.cats);
+    G_write_cats(ncb.newcell, &ncb.cats);
 
     if (copycolr)
-	G_write_colors(ncb.newcell.name, ncb.newcell.mapset, &colr);
+	G_write_colors(ncb.newcell, G_mapset(), &colr);
 
-    G_short_history(ncb.newcell.name, "raster", &history);
+    G_short_history(ncb.newcell, "raster", &history);
     G_command_history(&history);
-    G_write_history(ncb.newcell.name, &history);
+    G_write_history(ncb.newcell, &history);
 
 
     exit(EXIT_SUCCESS);

Modified: grass/trunk/raster/r.neighbors/ncb.h
===================================================================
--- grass/trunk/raster/r.neighbors/ncb.h	2008-08-27 21:59:09 UTC (rev 33132)
+++ grass/trunk/raster/r.neighbors/ncb.h	2008-08-27 22:02:44 UTC (rev 33133)
@@ -10,12 +10,8 @@
     FILE *out;
     char **mask;
     DCELL **weights;
-    struct
-    {
-	char *name;
-	char *mapset;
-    }
-    oldcell, newcell;
+    const char *oldcell;
+    const char *newcell;
 };
 
 extern struct ncb ncb;

Modified: grass/trunk/raster/r.neighbors/null_cats.c
===================================================================
--- grass/trunk/raster/r.neighbors/null_cats.c	2008-08-27 21:59:09 UTC (rev 33132)
+++ grass/trunk/raster/r.neighbors/null_cats.c	2008-08-27 22:02:44 UTC (rev 33133)
@@ -5,7 +5,7 @@
 {
     int ncats;
 
-    ncats = G_number_of_cats(ncb.newcell.name, ncb.newcell.mapset);
+    ncats = G_number_of_cats(ncb.newcell, G_mapset());
     G_init_cats(ncats, ncb.title, &ncb.cats);
 
     return 0;

Modified: grass/trunk/raster/r.out.arc/main.c
===================================================================
--- grass/trunk/raster/r.out.arc/main.c	2008-08-27 21:59:09 UTC (rev 33132)
+++ grass/trunk/raster/r.out.arc/main.c	2008-08-27 22:02:44 UTC (rev 33133)
@@ -30,7 +30,6 @@
      */
     RASTER_MAP_TYPE out_type, map_type;
     char *outfile;
-    char *mapset;
     char null_str[80];
     char cell_buf[300];
     int fd;
@@ -109,11 +108,7 @@
 
     sprintf(null_str, "-9999");
 
-    mapset = G_find_cell(parm.map->answer, "");
-    if (mapset == NULL)
-	G_fatal_error(_("Raster map <%s> not found"), parm.map->answer);
-
-    fd = G_open_cell_old(parm.map->answer, mapset);
+    fd = G_open_cell_old(parm.map->answer, "");
     if (fd < 0)
 	G_fatal_error(_("Unable to open raster map <%s>"), parm.map->answer);
 

Modified: grass/trunk/raster/r.out.ascii/formspecific.c
===================================================================
--- grass/trunk/raster/r.out.ascii/formspecific.c	2008-08-27 21:59:09 UTC (rev 33132)
+++ grass/trunk/raster/r.out.ascii/formspecific.c	2008-08-27 22:02:44 UTC (rev 33133)
@@ -126,14 +126,14 @@
 }
 
 /* write the Surfer grid heading */
-int writeGSheader(FILE * fp, char *name, char *mapset)
+int writeGSheader(FILE * fp, const char *name)
 {
     struct Cell_head region;
     char fromc[128], toc[128];
     struct FPRange range;
     DCELL Z_MIN, Z_MAX;
 
-    if (G_read_fp_range(name, mapset, &range) < 0)
+    if (G_read_fp_range(name, "", &range) < 0)
 	return 1;
 
     fprintf(fp, "DSAA \n");

Modified: grass/trunk/raster/r.out.ascii/localproto.h
===================================================================
--- grass/trunk/raster/r.out.ascii/localproto.h	2008-08-27 21:59:09 UTC (rev 33132)
+++ grass/trunk/raster/r.out.ascii/localproto.h	2008-08-27 22:02:44 UTC (rev 33133)
@@ -4,5 +4,5 @@
 int writeMFheader(FILE *, int, int, int);
 int write_MODFLOW(int, FILE *, int, int, int, int, int);
 
-int writeGSheader(FILE *, char *, char *);
+int writeGSheader(FILE *, const char *);
 int write_GSGRID(int, FILE *, int, int, int, int, char *, int);

Modified: grass/trunk/raster/r.out.ascii/main.c
===================================================================
--- grass/trunk/raster/r.out.ascii/main.c	2008-08-27 21:59:09 UTC (rev 33132)
+++ grass/trunk/raster/r.out.ascii/main.c	2008-08-27 22:02:44 UTC (rev 33133)
@@ -29,7 +29,6 @@
 {
     RASTER_MAP_TYPE out_type, map_type;
     char *name;
-    char *mapset;
     char *null_str;
     char surfer_null_str[13] = { "1.70141e+038" };
     int fd;
@@ -140,13 +139,9 @@
 	G_fatal_error(_("Use -M or -s, not both"));
 
     name = parm.map->answer;
-    mapset = G_find_cell2(name, "");
 
-    if (!mapset)
-	G_fatal_error(_("Raster map <%s> not found"), 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);
 
@@ -177,7 +172,7 @@
     /* process the requested output format */
     if (flag.surfer->answer) {
 	if (!flag.noheader->answer) {
-	    if (writeGSheader(fp, name, mapset))
+	    if (writeGSheader(fp, name))
 		G_fatal_error(_("Unable to read fp range for <%s>"), name);
 	}
 	rc = write_GSGRID(fd, fp, nrows, ncols, out_type, dp, surfer_null_str,

Modified: grass/trunk/raster/r.out.bin/main.c
===================================================================
--- grass/trunk/raster/r.out.bin/main.c	2008-08-27 21:59:09 UTC (rev 33132)
+++ grass/trunk/raster/r.out.bin/main.c	2008-08-27 22:02:44 UTC (rev 33133)
@@ -24,7 +24,6 @@
     RASTER_MAP_TYPE out_type, map_type;
     char *name;
     char outfile[GNAME_MAX];
-    char *mapset;
     int null_str = 0;
     char buf[128];
     int fd;
@@ -123,12 +122,7 @@
 
     G_get_window(&region);
 
-    mapset = G_find_cell(name, "");
-
-    if (mapset == NULL)
-	G_fatal_error(_("Raster map <%s> not found"), name);
-
-    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);
 
@@ -159,7 +153,7 @@
 
     /* Set up Parameters for GMT header */
     if (flag.gmt_hd->answer) {
-	G_read_fp_range(name, mapset, &range);
+	G_read_fp_range(name, "", &range);
 	G_get_fp_range_min_max(&range, &Z_MIN, &Z_MAX);
 
 	header.nx = region.cols;

Modified: grass/trunk/raster/r.out.mat/main.c
===================================================================
--- grass/trunk/raster/r.out.mat/main.c	2008-08-27 21:59:09 UTC (rev 33132)
+++ grass/trunk/raster/r.out.mat/main.c	2008-08-27 22:02:44 UTC (rev 33133)
@@ -43,7 +43,7 @@
     float val_f;		/* for misc use */
     double val_d;		/* for misc use */
 
-    char *infile, *outfile, *mapset, *maptitle, *basename;
+    char *infile, *outfile, *maptitle, *basename;
     struct Cell_head region;
     void *raster, *ptr;
     RASTER_MAP_TYPE map_type;
@@ -81,12 +81,7 @@
     outfile = G_malloc(strlen(basename) + 5);
     sprintf(outfile, "%s.mat", basename);
 
-    mapset = G_find_cell(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);
 
@@ -143,7 +138,7 @@
 
 
     /********** Write title (if there is one) **********/
-    maptitle = G_get_cell_title(infile, mapset);
+    maptitle = G_get_cell_title(infile, "");
     if (strlen(maptitle) >= 1) {
 
 	/** write text element (map title) **/

Modified: grass/trunk/raster/r.out.png/main.c
===================================================================
--- grass/trunk/raster/r.out.png/main.c	2008-08-27 21:59:09 UTC (rev 33132)
+++ grass/trunk/raster/r.out.png/main.c	2008-08-27 22:02:44 UTC (rev 33133)
@@ -49,8 +49,8 @@
 {
     struct GModule *module;
     struct Option *rast, *png_file;
-    char *cellmap, *map, *p, *basename = NULL, *ofile;
-    char rastermap[1024];
+    char *rastermap;
+    char *basename = NULL, *ofile;
     unsigned char *set, *ored, *ogrn, *oblu;
     CELL *cell_buf;
     FCELL *fcell_buf;
@@ -108,15 +108,14 @@
     rast->required = YES;
     rast->multiple = NO;
     rast->gisprompt = "old,cell,Raster";
-    rast->description = "Raster file to be converted.";
+    rast->description = _("Raster file to be converted.");
 
     png_file = G_define_option();
     png_file->key = "output";
     png_file->type = TYPE_STRING;
-    png_file->required = NO;
+    png_file->required = YES;
     png_file->multiple = NO;
-    png_file->answer = "<rasterfilename>.png";
-    png_file->description = "Name for new PNG file. (use out=- for stdout)";
+    png_file->description = _("Name for new PNG file. (use out=- for stdout)");
 
     /* see what can be done to convert'em -A.Sh.
      * gscale = G_define_flag ();
@@ -132,23 +131,12 @@
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
-    strncpy(rastermap, rast->answer, 1024 * sizeof(char));
+    rastermap = rast->answer;
 
-    if (strcmp(png_file->answer, "<rasterfilename>.png")) {
-	if (strcmp(png_file->answer, "-"))
-	    basename = G_store(png_file->answer);
-	else
-	    do_stdout = 1;
-    }
-    else {
-	map = p = rast->answer;
-	/* knock off any GRASS location suffix */
-	if ((char *)NULL != (p = strrchr(map, '@'))) {
-	    if (p != map)
-		*p = '\0';
-	}
-	basename = G_store(map);
-    }
+    if (strcmp(png_file->answer, "-") != 0)
+	basename = G_store(png_file->answer);
+    else
+	do_stdout = 1;
 
     if (basename) {
 	G_basename(basename, "png");
@@ -163,23 +151,17 @@
     G_message(_("rows = %d, cols = %d"), w.rows, w.cols);
 
     /* open raster map for reading */
-    {
-	cellmap = G_find_file2("cell", rastermap, "");
-	if (!cellmap)
-	    G_fatal_error("Couldn't find raster map %s", rastermap);
+    if ((cellfile = G_open_cell_old(rast->answer, "")) == -1)
+	G_fatal_error(_("Unable to open cellfile for <%s>"), rastermap);
 
-	if ((cellfile = G_open_cell_old(rast->answer, cellmap)) == -1)
-	    G_fatal_error("Not able to open cellfile for [%s]", rastermap);
-    }
-
     cell_buf = G_allocate_c_raster_buf();
     fcell_buf = G_allocate_f_raster_buf();
     dcell_buf = G_allocate_d_raster_buf();
 
-    ored = (unsigned char *)G_malloc(w.cols * sizeof(unsigned char));
-    ogrn = (unsigned char *)G_malloc(w.cols * sizeof(unsigned char));
-    oblu = (unsigned char *)G_malloc(w.cols * sizeof(unsigned char));
-    set = (unsigned char *)G_malloc(w.cols * sizeof(unsigned char));
+    ored = G_malloc(w.cols);
+    ogrn = G_malloc(w.cols);
+    oblu = G_malloc(w.cols);
+    set  = G_malloc(w.cols);
 
     /* open png file for writing */
     {
@@ -239,7 +221,7 @@
     {
 	struct Colors colors;
 
-	G_read_colors(rast->answer, cellmap, &colors);
+	G_read_colors(rast->answer, "", &colors);
 
 	rtype = G_get_raster_map_type(cellfile);
 	if (rtype == CELL_TYPE)

Modified: grass/trunk/raster/r.out.pov/main.c
===================================================================
--- grass/trunk/raster/r.out.pov/main.c	2008-08-27 21:59:09 UTC (rev 33132)
+++ grass/trunk/raster/r.out.pov/main.c	2008-08-27 22:02:44 UTC (rev 33133)
@@ -101,7 +101,6 @@
 
     CELL *cell;
     char *name;
-    char *mapset;
     int fd;
     int nrows, ncols;
     double bias;
@@ -169,11 +168,8 @@
 	sscanf(parm.scaleFactor->answer, "%lf", &verticalScale);
 
     name = parm.map->answer;
-    mapset = G_find_cell2(name, "");
-    if (mapset == NULL)
-	G_fatal_error(_("Raster map <%s> not found"), name);
 
-    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);
 
@@ -208,7 +204,7 @@
     southMost = region.south;
 
     G_init_range(&range);
-    G_read_range(name, mapset, &range);
+    G_read_range(name, "", &range);
     G_get_range_min_max(&range, &range_min, &range_max);
     if (range.min < 0 || range.max < 0)
 	G_warning(_("Negative elevation values in input"));

Modified: grass/trunk/raster/r.out.ppm/main.c
===================================================================
--- grass/trunk/raster/r.out.ppm/main.c	2008-08-27 21:59:09 UTC (rev 33132)
+++ grass/trunk/raster/r.out.ppm/main.c	2008-08-27 22:02:44 UTC (rev 33133)
@@ -34,7 +34,7 @@
     struct GModule *module;
     struct Option *rast, *ppm_file;
     struct Flag *gscale;
-    char *cellmap, *map, *p, ofile[1000];
+    char *map, *p, ofile[1000];
     unsigned char *set, *ored, *ogrn, *oblu;
     CELL *cell_buf;
     FCELL *fcell_buf;
@@ -95,25 +95,17 @@
     G_message(_("rows = %d, cols = %d"), w.rows, w.cols);
 
     /* open raster map for reading */
-    {
-	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, "")) == -1)
+	G_fatal_error(_("Unable to open raster map <%s>"), rast->answer);
 
-	if ((cellfile = G_open_cell_old(rast->answer, cellmap)) == -1) {
-	    G_fatal_error(_("Unable to open raster map <%s>"), rast->answer);
-	}
-    }
-
     cell_buf = G_allocate_c_raster_buf();
     fcell_buf = G_allocate_f_raster_buf();
     dcell_buf = G_allocate_d_raster_buf();
 
-    ored = (unsigned char *)G_malloc(w.cols * sizeof(unsigned char));
-    ogrn = (unsigned char *)G_malloc(w.cols * sizeof(unsigned char));
-    oblu = (unsigned char *)G_malloc(w.cols * sizeof(unsigned char));
-    set = (unsigned char *)G_malloc(w.cols * sizeof(unsigned char));
+    ored = G_malloc(w.cols);
+    ogrn = G_malloc(w.cols);
+    oblu = G_malloc(w.cols);
+    set  = G_malloc(w.cols);
 
     /* open ppm file for writing */
     {
@@ -154,7 +146,7 @@
     {
 	struct Colors colors;
 
-	G_read_colors(rast->answer, cellmap, &colors);
+	G_read_colors(rast->answer, "", &colors);
 
 	rtype = G_get_raster_map_type(cellfile);
 	if (rtype == CELL_TYPE)

Modified: grass/trunk/raster/r.out.ppm3/main.c
===================================================================
--- grass/trunk/raster/r.out.ppm3/main.c	2008-08-27 21:59:09 UTC (rev 33132)
+++ grass/trunk/raster/r.out.ppm3/main.c	2008-08-27 22:02:44 UTC (rev 33133)
@@ -97,22 +97,16 @@
     for (i = 0; i < 3; i++) {
 	/* Get name of layer */
 	char *name = B[i].opt->answer;
-	char *mapset;
 
-	/* Get mapset of layer */
-	mapset = G_find_cell2(name, "");
-	if (!mapset)
-	    G_fatal_error(_("Raster map <%s> not found"), name);
-
 	/* Open raster map */
-	if ((B[i].file = G_open_cell_old(name, mapset)) == -1)
+	if ((B[i].file = G_open_cell_old(name, "")) == -1)
 	    G_fatal_error(_("Unable to open raster map <%s>"), name);
 
 	/* Get map type (CELL/FCELL/DCELL) */
 	B[i].type = G_get_raster_map_type(B[i].file);
 
 	/* Get color table */
-	if (G_read_colors(name, mapset, &B[i].colors) == -1)
+	if (G_read_colors(name, "", &B[i].colors) == -1)
 	    G_fatal_error(_("Color file for <%s> not available"), name);
 
 	/* Allocate input buffer */

Modified: grass/trunk/raster/r.out.tiff/main.c
===================================================================
--- grass/trunk/raster/r.out.tiff/main.c	2008-08-27 21:59:09 UTC (rev 33132)
+++ grass/trunk/raster/r.out.tiff/main.c	2008-08-27 22:02:44 UTC (rev 33133)
@@ -86,7 +86,7 @@
     struct Cell_head cellhd;
     struct GModule *module;
     int col, tfw, palette, tiled;
-    char *mapset, *basename, *filename;
+    char *basename, *filename;
     struct Colors colors;
     int red, grn, blu, mapsize, isfp;
 
@@ -144,22 +144,18 @@
     palette = pflag->answer;
     tfw = tflag->answer;
 
-    mapset = G_find_cell(inopt->answer, "");
-    if (!mapset)
-	G_fatal_error(_("Raster map <%s> not found"), inopt->answer);
-
-    if ((G_get_cellhd(inopt->answer, mapset, &cellhd) < 0))
+    if ((G_get_cellhd(inopt->answer, "", &cellhd) < 0))
 	G_fatal_error(_("Unable to read header of raster map <%s>"),
 		      inopt->answer);
 
     if ((G_get_window(&cellhd) < 0))
 	G_fatal_error(_("Can't set window"));
 
-    G_read_colors(inopt->answer, mapset, &colors);
-    if ((isfp = G_raster_map_is_fp(inopt->answer, mapset)))
-	G_warning(_("Raster map <%s> in mapset <%s> is a floating point "
-		    "map. Decimal values will be rounded to integer!"),
-		  inopt->answer, mapset);
+    G_read_colors(inopt->answer, "", &colors);
+    if ((isfp = G_raster_map_is_fp(inopt->answer, "")))
+	G_warning(_("Raster map <%s>> is a floating point "
+		    "map. Fractional values will be rounded to integer"),
+		  inopt->answer);
 
     G_set_null_value_color(255, 255, 255, &colors);
     if (palette && (colors.cmax - colors.cmin > 255))
@@ -167,7 +163,7 @@
 			"than 256 colors for the available range of data"));
 
     cell = G_allocate_cell_buf();
-    if ((in = G_open_cell_old(inopt->answer, mapset)) < 0)
+    if ((in = G_open_cell_old(inopt->answer, "")) < 0)
 	G_fatal_error(_("Unable to open raster map <%s>"), inopt->answer);
 
     basename = G_store(outopt->answer);

Modified: grass/trunk/raster/r.out.vrml/main.c
===================================================================
--- grass/trunk/raster/r.out.vrml/main.c	2008-08-27 21:59:09 UTC (rev 33132)
+++ grass/trunk/raster/r.out.vrml/main.c	2008-08-27 22:02:44 UTC (rev 33133)
@@ -30,11 +30,10 @@
 
     struct Option *rast_el, *rast_co, *out;
     struct Option *exag_opt;
-    char *t_mapset;
     FILEDESC elevfd = 0, colorfd = 0;
     FILE *vout = NULL;
     struct Colors colr;
-    char errbuf[100], outfile[256];
+    char outfile[GPATH_MAX];
     int shh, color_ok;
     double exag, min, max;
     struct GModule *module;
@@ -81,17 +80,8 @@
 
     G_get_set_window(&W);
 
-    t_mapset = NULL;
-    t_mapset = G_find_file2("cell", rast_el->answer, "");
-    if (!t_mapset) {
-	sprintf(errbuf, "Couldn't find raster map %s", rast_el->answer);
-	G_fatal_error(errbuf);
-    }
-    if ((elevfd = G_open_cell_old(rast_el->answer, t_mapset)) == -1) {
-	sprintf(errbuf, "Not able to open cellfile for [%s]",
-		rast_el->answer);
-	G_fatal_error(errbuf);
-    }
+    if ((elevfd = G_open_cell_old(rast_el->answer, "")) == -1)
+	G_fatal_error("Unable to open cellfile for <%s>", rast_el->answer);
 
     {
 	CELL cmin, cmax;
@@ -100,24 +90,20 @@
 	DCELL dmin, dmax;
 	struct FPRange fp_range;
 
-	is_fp = G_raster_map_is_fp(rast_el->answer, t_mapset);
+	is_fp = G_raster_map_is_fp(rast_el->answer, "");
 	if (is_fp) {
-	    if (G_read_fp_range(rast_el->answer, t_mapset, &fp_range) != 1) {
-		sprintf(errbuf,
-			"Range info for [%s] not available (run r.support)\n",
-			rast_el->answer);
-		G_fatal_error(errbuf);
+	    if (G_read_fp_range(rast_el->answer, "", &fp_range) != 1) {
+		G_fatal_error(_("Range info for [%s] not available (run r.support)"),
+			      rast_el->answer);
 	    }
 	    G_get_fp_range_min_max(&fp_range, &dmin, &dmax);
 	    min = dmin;
 	    max = dmax;
 	}
 	else {
-	    if (G_read_range(rast_el->answer, t_mapset, &range) == -1) {
-		sprintf(errbuf,
-			"Range info for [%s] not available (run r.support)\n",
-			rast_el->answer);
-		G_fatal_error(errbuf);
+	    if (G_read_range(rast_el->answer, "", &range) == -1) {
+		G_fatal_error(_("Range info for <%s> not available (run r.support)"),
+			      rast_el->answer);
 	    }
 	    G_get_range_min_max(&range, &cmin, &cmax);
 	    min = cmin;
@@ -126,19 +112,10 @@
     }
 
     if (rast_co->answer) {
-	t_mapset = NULL;
-	t_mapset = G_find_file2("cell", rast_co->answer, "");
-	if (!t_mapset) {
-	    sprintf(errbuf, "Couldn't find raster map %s", rast_co->answer);
-	    G_warning(errbuf);
-	}
-	else if ((colorfd = G_open_cell_old(rast_co->answer, t_mapset)) == -1) {
-	    sprintf(errbuf, "Not able to open cellfile for [%s]",
-		    rast_co->answer);
-	    G_warning(errbuf);
-	}
+	if ((colorfd = G_open_cell_old(rast_co->answer, "")) == -1)
+	    G_warning(_("Unable to open cellfile for <%s>"), rast_co->answer);
 	else {
-	    G_read_colors(rast_co->answer, t_mapset, &colr);
+	    G_read_colors(rast_co->answer, "", &colr);
 	    color_ok = 1;
 	}
     }
@@ -162,8 +139,7 @@
 	/* open file for writing VRML */
 	G_message(_("Opening %s for writing... "), outfile);
 	if (NULL == (vout = fopen(outfile, "w"))) {
-	    sprintf(errbuf, "Couldn't open output file %s", outfile);
-	    G_fatal_error(errbuf);
+	    G_fatal_error(_("Unable to open output file <%s>"), outfile);
 	}
     }
 

Modified: grass/trunk/raster/r.out.vtk/main.c
===================================================================
--- grass/trunk/raster/r.out.vtk/main.c	2008-08-27 21:59:09 UTC (rev 33132)
+++ grass/trunk/raster/r.out.vtk/main.c	2008-08-27 22:02:44 UTC (rev 33133)
@@ -31,101 +31,7 @@
 double x_extent;
 double y_extent;
 
-/*local protos */
-static void check_input_maps(void);
-
-
 /* ************************************************************************* */
-/* Check the input maps **************************************************** */
-/* ************************************************************************* */
-void check_input_maps(void)
-{
-    char *mapset = NULL;
-    int i;
-
-    /*Check for elevation map */
-    if (param.elevationmap->answer) {
-
-	mapset = G_find_cell2(param.elevationmap->answer, "");
-	if (mapset == NULL) {
-	    G_fatal_error(_("Raster map <%s> not found"),
-			  param.elevationmap->answer);
-	    exit(EXIT_FAILURE);
-	}
-    }
-
-    /*Check for normal input map */
-    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);
-	    }
-	}
-    }
-
-    /*RGB raster maps */
-    if (param.rgbmaps->answers != NULL) {
-	if (param.rgbmaps->answers[0] != NULL &&
-	    param.rgbmaps->answers[1] != NULL &&
-	    param.rgbmaps->answers[2] != NULL) {
-
-	    /*Loop over all input maps! */
-	    for (i = 0; i < 3; i++) {
-
-		mapset = NULL;
-		mapset = G_find_cell2(param.rgbmaps->answers[i], "");
-		if (mapset == NULL) {
-		    G_fatal_error(_("RGB raster map <%s> not found"),
-				  param.rgbmaps->answers[i]);
-		    exit(EXIT_FAILURE);
-		}
-	    }
-	}
-	else {
-	    G_fatal_error(_("Cannot create RGB data, please provide three maps [r,g,b]"));
-	}
-    }
-
-    /*Vector raster maps */
-    if (param.vectmaps->answers != NULL) {
-	if (param.vectmaps->answers[0] != NULL &&
-	    param.vectmaps->answers[1] != NULL &&
-	    param.vectmaps->answers[2] != NULL) {
-
-	    /*Loop over all input maps! */
-	    for (i = 0; i < 3; i++) {
-
-		mapset = NULL;
-		mapset = G_find_cell2(param.vectmaps->answers[i], "");
-		if (mapset == NULL) {
-		    G_fatal_error(_("Vector cell map <%s> not found"),
-				  param.vectmaps->answers[i]);
-		    exit(EXIT_FAILURE);
-		}
-	    }
-	}
-	else {
-	    G_fatal_error(_("Cannot create vector data, please provide three maps [x,y,z]"));
-	}
-    }
-
-    /*Give a warning if no output cell/point or rgb data was specified */
-    if (param.input->answers == NULL && param.rgbmaps->answers == NULL &&
-	param.vectmaps->answers == NULL) {
-	G_warning
-	    ("No g3d data, RGB or vector maps are provided! Will only write the geometry.");
-    }
-
-    return;
-}
-
-
-/* ************************************************************************* */
 /* MAIN ******************************************************************** */
 /* ************************************************************************* */
 int main(int argc, char *argv[])
@@ -135,7 +41,7 @@
     FILE *fp = NULL;
     struct GModule *module;
     int i = 0, polytype = 0;
-    char *null_value, *mapset;
+    char *null_value;
     int out_type;
     int fd;			/*Normale maps ;) */
     int rgbfd[3];
@@ -171,9 +77,6 @@
     else
 	fp = stdout;
 
-    /*Check the input maps */
-    check_input_maps();
-
     /*Correct the coordinates, so the precision of VTK is not hurt :( */
     if (param.coorcorr->answer) {
 	/*Get the default region for coordiante correction */
@@ -218,10 +121,8 @@
 
 	G_debug(3, _("Open Raster file %s"), param.elevationmap->answer);
 
-	mapset = G_find_cell2(param.elevationmap->answer, "");
-
 	/* open raster map */
-	fd = G_open_cell_old(param.elevationmap->answer, mapset);
+	fd = G_open_cell_old(param.elevationmap->answer, "");
 	if (fd < 0)
 	    G_fatal_error(_("Unable to open raster map <%s>"),
 			  param.elevationmap->answer);
@@ -283,11 +184,8 @@
 
 	    G_debug(3, _("Open Raster file %s"), param.input->answers[i]);
 
-	    mapset = NULL;
-	    mapset = G_find_cell2(param.input->answers[i], "");
-
 	    /* open raster map */
-	    fd = G_open_cell_old(param.input->answers[i], mapset);
+	    fd = G_open_cell_old(param.input->answers[i], "");
 	    if (fd < 0)
 		G_fatal_error(_("Unable to open raster map <%s>"),
 			      param.input->answers[i]);
@@ -311,12 +209,8 @@
 		G_debug(3, _("Open Raster file %s"),
 			param.rgbmaps->answers[i]);
 
-		mapset = NULL;
-
-		mapset = G_find_cell2(param.rgbmaps->answers[i], "");
-
 		/* open raster map */
-		rgbfd[i] = G_open_cell_old(param.rgbmaps->answers[i], mapset);
+		rgbfd[i] = G_open_cell_old(param.rgbmaps->answers[i], "");
 		if (rgbfd[i] < 0)
 		    G_fatal_error(_("Unable to open raster map <%s>"),
 				  param.rgbmaps->answers[i]);
@@ -357,13 +251,9 @@
 		G_debug(3, _("Open Raster file %s"),
 			param.vectmaps->answers[i]);
 
-		mapset = NULL;
-
-		mapset = G_find_cell2(param.vectmaps->answers[i], "");
-
 		/* open raster map */
 		vectfd[i] =
-		    G_open_cell_old(param.vectmaps->answers[i], mapset);
+		    G_open_cell_old(param.vectmaps->answers[i], "");
 		if (vectfd[i] < 0)
 		    G_fatal_error(_("Unable to open raster map <%s>"),
 				  param.vectmaps->answers[i]);



More information about the grass-commit mailing list