[GRASS-SVN] r32820 - in grass/trunk: doc/raster/r.example
general/g.region imagery/i.cca imagery/i.fft imagery/i.ifft
imagery/i.zc raster/r.average raster/r.bitpattern
raster/r.buffer raster/r.clump raster/r.cost
raster/r.in.ascii raster/r.in.gdal raster/r.in.mat
raster/r.kappa raster/r.los raster/r.median raster/r.mode
raster/r.neighbors raster/r.random raster/r.random.cells
raster/r.random.surface raster/r.reclass raster/r.recode
raster/r.resample raster/r.rescale raster/r.rescale.eq
raster/r.slope.aspect raster/r.surf.fractal
raster/r.surf.gauss raster/r.surf.idw raster/r.surf.idw2
raster/r.surf.random raster/r.texture raster/r.to.rast3
raster/r.to.rast3elev raster/r.walk raster/r.water.outlet
raster/r.watershed/ram raster/r.watershed/seg
raster/wildfire/r.ros raster/wildfire/r.spread
raster/wildfire/r.spreadpath raster3d/r3.cross.rast
raster3d/r3.mkdspf raster3d/r3.showdspf raster3d/r3.to.rast
swig/perl/R_slope_aspect/r_slope_aspect vector/v.edit
vector/v.in.ogr vector/v.kernel vector/v.surf.idw vector/v.to.rast3
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Aug 16 12:08:09 EDT 2008
Author: glynn
Date: 2008-08-16 12:08:08 -0400 (Sat, 16 Aug 2008)
New Revision: 32820
Removed:
grass/trunk/raster/r.surf.fractal/interface.c
Modified:
grass/trunk/doc/raster/r.example/main.c
grass/trunk/general/g.region/main.c
grass/trunk/imagery/i.cca/main.c
grass/trunk/imagery/i.fft/main.c
grass/trunk/imagery/i.ifft/main.c
grass/trunk/imagery/i.zc/main.c
grass/trunk/raster/r.average/main.c
grass/trunk/raster/r.bitpattern/main.c
grass/trunk/raster/r.buffer/main.c
grass/trunk/raster/r.clump/main.c
grass/trunk/raster/r.cost/main.c
grass/trunk/raster/r.in.ascii/main.c
grass/trunk/raster/r.in.gdal/main.c
grass/trunk/raster/r.in.mat/main.c
grass/trunk/raster/r.kappa/main.c
grass/trunk/raster/r.los/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.random.cells/init.c
grass/trunk/raster/r.random.surface/init.c
grass/trunk/raster/r.random.surface/local_proto.h
grass/trunk/raster/r.random.surface/main.c
grass/trunk/raster/r.random.surface/ransurf.h
grass/trunk/raster/r.random/main.c
grass/trunk/raster/r.reclass/main.c
grass/trunk/raster/r.recode/main.c
grass/trunk/raster/r.resample/main.c
grass/trunk/raster/r.rescale.eq/main.c
grass/trunk/raster/r.rescale/main.c
grass/trunk/raster/r.slope.aspect/opennew.c
grass/trunk/raster/r.surf.fractal/main.c
grass/trunk/raster/r.surf.gauss/main.c
grass/trunk/raster/r.surf.idw/main.c
grass/trunk/raster/r.surf.idw2/main.c
grass/trunk/raster/r.surf.random/main.c
grass/trunk/raster/r.texture/main.c
grass/trunk/raster/r.to.rast3/main.c
grass/trunk/raster/r.to.rast3elev/main.c
grass/trunk/raster/r.walk/main.c
grass/trunk/raster/r.water.outlet/legal.c
grass/trunk/raster/r.water.outlet/main.c
grass/trunk/raster/r.watershed/ram/Gwater.h
grass/trunk/raster/r.watershed/ram/init_vars.c
grass/trunk/raster/r.watershed/seg/Gwater.h
grass/trunk/raster/r.watershed/seg/init_vars.c
grass/trunk/raster/wildfire/r.ros/main.c
grass/trunk/raster/wildfire/r.spread/main.c
grass/trunk/raster/wildfire/r.spreadpath/main.c
grass/trunk/raster3d/r3.cross.rast/main.c
grass/trunk/raster3d/r3.mkdspf/r3_find.c
grass/trunk/raster3d/r3.showdspf/r3_find.c
grass/trunk/raster3d/r3.to.rast/main.c
grass/trunk/swig/perl/R_slope_aspect/r_slope_aspect/opennew.c
grass/trunk/vector/v.edit/main.c
grass/trunk/vector/v.in.ogr/main.c
grass/trunk/vector/v.kernel/main.c
grass/trunk/vector/v.surf.idw/main.c
grass/trunk/vector/v.to.rast3/main.c
Log:
G_legal_filename() is for files, not maps
Modified: grass/trunk/doc/raster/r.example/main.c
===================================================================
--- grass/trunk/doc/raster/r.example/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/doc/raster/r.example/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -110,10 +110,6 @@
if (mapset == NULL)
G_fatal_error(_("Raster map <%s> not found"), name);
- if (G_legal_filename(result) < 0)
- G_fatal_error(_("<%s> is an illegal file name"), result);
-
-
/* determine the inputmap type (CELL/FCELL/DCELL) */
data_type = G_raster_map_type(name, mapset);
Modified: grass/trunk/general/g.region/main.c
===================================================================
--- grass/trunk/general/g.region/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/general/g.region/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -778,8 +778,6 @@
/* save= */
if ((name = parm.save->answer)) {
- if (G_legal_filename(name) < 0)
- G_fatal_error(_("<%s> is an illegal region name"), name);
G_copy(&temp_window, &window, sizeof(window));
adjust_window(&temp_window, 0, 0, 0);
if (G__put_window(&temp_window, "windows", name) < 0)
Modified: grass/trunk/imagery/i.cca/main.c
===================================================================
--- grass/trunk/imagery/i.cca/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/imagery/i.cca/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -103,18 +103,6 @@
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
- if (G_legal_filename(grp_opt->answer) < 0)
- G_fatal_error(_("Illegal group name <%s>"), grp_opt->answer);
-
- if (G_legal_filename(subgrp_opt->answer) < 0)
- G_fatal_error(_("Illegal subgroup name <%s>"), subgrp_opt->answer);
-
- if (G_legal_filename(sig_opt->answer) < 0)
- G_fatal_error(_("Illegal signature file name <%s>"), sig_opt->answer);
-
- if (G_legal_filename(out_opt->answer) < 0)
- G_fatal_error(_("Illegal output file name <%s>"), out_opt->answer);
-
/* check group, subgroup */
I_init_group_ref(&refs);
if (I_find_group(grp_opt->answer) <= 0)
Modified: grass/trunk/imagery/i.fft/main.c
===================================================================
--- grass/trunk/imagery/i.fft/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/imagery/i.fft/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -125,15 +125,6 @@
G_warning(_("Raster MASK found, consider to remove "
"(see man-page). Will continue..."));
-
- /* check command line args for validity */
- if (G_legal_filename(Cellmap_real) < 0)
- G_fatal_error(_("Illegal file name for real part: %s"), Cellmap_real);
-
- if (G_legal_filename(Cellmap_imag) < 0)
- G_fatal_error(_("Illegal file name for imaginary part: %s"),
- Cellmap_imag);
-
sscanf(op4->answer, "%d", &Range);
if (Range <= 0)
G_fatal_error(_("Range less than or equal to zero not allowed."));
Modified: grass/trunk/imagery/i.ifft/main.c
===================================================================
--- grass/trunk/imagery/i.ifft/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/imagery/i.ifft/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -102,10 +102,6 @@
imagmapset)) == NULL)
G_fatal_error(_("Unable to open imaginary-image in the cell_misc directory.\nInput map probably wasn't created by i.fft"));
- /* check command line args for validity */
- if (G_legal_filename(Cellmap_orig) < 0)
- G_fatal_error(_("<%s> is an illegal file name"), Cellmap_orig);
-
/* get and compare the original window data */
get_orig_window(&orig_wind, realmapset, imagmapset);
Modified: grass/trunk/imagery/i.zc/main.c
===================================================================
--- grass/trunk/imagery/i.zc/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/imagery/i.zc/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -107,10 +107,6 @@
if (inputfd < 0)
exit(EXIT_FAILURE);
- /* check command line args for validity */
- if (G_legal_filename(output_map->answer) < 0)
- G_fatal_error(_("<%s> is an illegal file name"), output_map->answer);
-
sscanf(threshold->answer, "%1lf", &Thresh);
if (Thresh <= 0.0)
G_fatal_error(_("Threshold less than or equal to zero not allowed"));
Modified: grass/trunk/raster/r.average/main.c
===================================================================
--- grass/trunk/raster/r.average/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/r.average/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -74,9 +74,6 @@
if (!(mapset = G_find_cell(covermap->answer, "")))
G_fatal_error(_("Raster map <%s> not found"), covermap->answer);
- if (G_legal_filename(outputmap->answer) < 0)
- G_fatal_error(_("<%s> is an illegal file name"), outputmap->answer);
-
if ((usecats = flag_c->answer)) {
if (G_read_cats(covermap->answer, mapset, &cats) < 0)
G_fatal_error(_("Error reading category file for <%s>"),
Modified: grass/trunk/raster/r.bitpattern/main.c
===================================================================
--- grass/trunk/raster/r.bitpattern/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/r.bitpattern/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -100,9 +100,6 @@
if (mapset == NULL)
G_fatal_error(_("Raster map <%s> not found"), name);
- if (G_legal_filename(result) < 0)
- G_fatal_error(_("<%s> is an illegal file name"), result);
-
/*if Gispf() error */
if ((infd = G_open_cell_old(name, mapset)) < 0)
G_fatal_error(_("Unable to open raster map <%s>"), name);
Modified: grass/trunk/raster/r.buffer/main.c
===================================================================
--- grass/trunk/raster/r.buffer/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/r.buffer/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -99,9 +99,6 @@
if (mapset == NULL)
G_fatal_error(_("Raster map <%s> not found"), input);
- if (G_legal_filename(output) < 0)
- G_fatal_error(_("<%s> is an illegal file name"), output);
-
/* parse units */
if (opt4->answer == NULL)
units = "meters";
Modified: grass/trunk/raster/r.clump/main.c
===================================================================
--- grass/trunk/raster/r.clump/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/r.clump/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -72,9 +72,6 @@
if (!mapset)
G_fatal_error(_("Raster map <%s> not found"), INPUT);
- if (G_legal_filename(OUTPUT) < 0)
- G_fatal_error(_("<%s> is an illegal file name"), OUTPUT);
-
in_fd = G_open_cell_old(name, mapset);
if (in_fd < 0)
G_fatal_error(_("Unable to open raster map <%s>"), INPUT);
Modified: grass/trunk/raster/r.cost/main.c
===================================================================
--- grass/trunk/raster/r.cost/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/r.cost/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -316,11 +316,6 @@
if (cost_mapset == NULL)
G_fatal_error(_("Raster map <%s> not found"), cost_layer);
- /* Check if specified output layer name is legal */
-
- if (G_legal_filename(cum_cost_layer) < 0)
- G_fatal_error(_("<%s> is an illegal file name"), cum_cost_layer);
-
/* Find number of rows and columns in window */
nrows = G_window_rows();
Modified: grass/trunk/raster/r.in.ascii/main.c
===================================================================
--- grass/trunk/raster/r.in.ascii/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/r.in.ascii/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -199,8 +199,6 @@
rast_ptr = G_allocate_raster_buf(data_type);
rast = rast_ptr;
- if (G_legal_filename(output) < 0)
- G_fatal_error(_("<%s> is an illegal file name"), output);
cf = G_open_raster_new(output, data_type);
if (cf < 0)
G_fatal_error(_("Unable to create raster map <%s>"), output);
Modified: grass/trunk/raster/r.in.gdal/main.c
===================================================================
--- grass/trunk/raster/r.in.gdal/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/r.in.gdal/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -195,17 +195,12 @@
exit(EXIT_SUCCESS);
}
- if (!input) {
+ if (!input)
G_fatal_error(_("Required parameter <%s> not set"), parm.input->key);
- }
- if (!output) {
+ if (!output)
G_fatal_error(_("Name for output raster map not specified"));
- }
- if (G_legal_filename(output) < 0)
- G_fatal_error(_("<%s> is an illegal file name"), output);
-
if (!parm.outloc->answer) { /* Check if the map exists */
if (G_find_cell2(output, G_mapset())) {
if (overwrite)
Modified: grass/trunk/raster/r.in.mat/main.c
===================================================================
--- grass/trunk/raster/r.in.mat/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/r.in.mat/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -368,8 +368,6 @@
}
G_strip(map_name); /* remove leading and trailing whitespace */
- if (G_legal_filename(map_name) != 1)
- G_fatal_error(_("<%s> is an illegal file name"), map_name);
/* set region info */
Modified: grass/trunk/raster/r.kappa/main.c
===================================================================
--- grass/trunk/raster/r.kappa/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/r.kappa/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -95,15 +95,7 @@
for (i = 0; i < 2; i++)
layer(maps[i]);
- if (parms.output->answer) {
- output = parms.output->answer;
- if (G_legal_filename(output) < 0) {
- G_fatal_error(_("Illegal output file name <%s>"),
- parms.output->answer);
- }
- }
- else
- output = NULL;
+ output = parms.output->answer;
title = parms.titles->answer;
Modified: grass/trunk/raster/r.los/main.c
===================================================================
--- grass/trunk/raster/r.los/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/r.los/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -174,10 +174,6 @@
G_fatal_error(_("Raster map <%s> not found"), patt_layer);
}
- /* check if specified output layer name is legal */
- if (G_legal_filename(out_layer) < 0)
- G_fatal_error(_("<%s> is an illegal file name"), out_layer);
-
/* read header info for elevation layer */
if (G_get_cellhd(elev_layer, old_mapset, &cellhd_elev) < 0)
G_fatal_error(_("[%s]: Cannot read map header"), elev_layer);
Modified: grass/trunk/raster/r.median/main.c
===================================================================
--- grass/trunk/raster/r.median/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/r.median/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -73,8 +73,7 @@
cover_mapset = G_find_cell2(covermap, "");
if (cover_mapset == NULL)
G_fatal_error(_("Raster map <%s> not found"), covermap);
- if (G_legal_filename(outmap) < 0)
- G_fatal_error(_("<%s> is an illegal file name"), outmap);
+
if (strcmp(G_mapset(), base_mapset) == 0 && strcmp(basemap, outmap) == 0)
G_fatal_error(_("Base map and output map <%s> must be different"),
outmap);
Modified: grass/trunk/raster/r.mode/main.c
===================================================================
--- grass/trunk/raster/r.mode/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/r.mode/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -90,9 +90,7 @@
if (cover_mapset == NULL) {
G_fatal_error(_("%s: cover raster map not found"), covermap);
}
- if (G_legal_filename(outmap) < 0) {
- G_fatal_error(_("<%s> is an illegal file name"), outmap);
- }
+
if (strcmp(G_mapset(), base_mapset) == 0 && strcmp(basemap, outmap) == 0) {
G_fatal_error(_("%s: base map and output map must be different"),
outmap);
Modified: grass/trunk/raster/r.neighbors/main.c
===================================================================
--- grass/trunk/raster/r.neighbors/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/r.neighbors/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -176,9 +176,6 @@
G_fatal_error(_("Raster map <%s> not found"), p);
}
p = ncb.newcell.name = parm.output->answer;
- if (G_legal_filename(p) < 0) {
- G_fatal_error(_("<%s> is an illegal file name"), p);
- }
ncb.newcell.mapset = G_mapset();
if (!flag.align->answer) {
Modified: grass/trunk/raster/r.random/main.c
===================================================================
--- grass/trunk/raster/r.random/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/r.random/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -136,16 +136,6 @@
G_fatal_error(_("Note: one (or both) of %s and %s must be specified"),
parm.raster->key, parm.sites->key);
- if (myState.outraster)
- if (G_legal_filename(myState.outraster) < 0)
- G_fatal_error(_("<%s> is an illegal file name"),
- myState.outraster);
-
- if (myState.outvector)
- if (G_legal_filename(myState.outvector) < 0)
- G_fatal_error(_("<%s> is an illegal file name"),
- myState.outvector);
-
/* look for n[%] */
percent = has_percent(parm.npoints->answer);
if (percent) {
Modified: grass/trunk/raster/r.random.cells/init.c
===================================================================
--- grass/trunk/raster/r.random.cells/init.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/r.random.cells/init.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -13,7 +13,6 @@
/* function prototypes */
static int comp_array(const void *p1, const void *p2);
-static void IsLegal(char *Name);
void Init(int argc, char **argv)
@@ -98,13 +97,6 @@
CellCount = Rs * Cs;
}
- if (!Output->answer) {
- G_fatal_error("There should be an output map");
- }
- else {
- IsLegal(Output->answer);
- }
-
sscanf(Distance->answer, "%lf", &MaxDist);
if (MaxDist < 0.0)
G_fatal_error("distance must be >= 0.0");
@@ -157,10 +149,3 @@
return (0);
}
-
-static void IsLegal(char *Name)
-{
- if (G_legal_filename(Name) == -1)
- G_fatal_error("%s: map name [%s] not legal for GRASS",
- G_program_name(), Name);
-}
Modified: grass/trunk/raster/r.random.surface/init.c
===================================================================
--- grass/trunk/raster/r.random.surface/init.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/r.random.surface/init.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -15,17 +15,9 @@
#include "local_proto.h"
-/* function prototypes */
-static void IsLegal(char *Name);
-
-void Init(int argc, char **argv)
+void Init(void)
{
- struct Option *Output;
-
- /* struct Option *TheoryS; */
- struct Option *range_high_stuff;
- struct Option *SeedStuff;
struct Cell_head Region;
int row, col, i, j, NumWeight, NumDist, NumExp;
char *Name, *Number, String[80];
@@ -34,69 +26,6 @@
FUNCTION(Init);
- Output = G_define_option();
- Output->key = "output";
- Output->type = TYPE_STRING;
- Output->required = YES;
- Output->multiple = YES;
- Output->description = "Names of the resulting maps";
- Output->gisprompt = "new,cell,raster";
-
- /*
- TheoryS = G_define_option() ;
- TheoryS->key = "theoretical_correlogram";
- TheoryS->type = TYPE_STRING;
- TheoryS->required = NO;
- TheoryS->multiple = NO;
- TheoryS->description = "Name of the resulting theoretical correlogram map";
- TheoryS->gisprompt = "new,cell,raster" ;
- */
-
- Distance = G_define_option();
- Distance->key = "distance";
- Distance->type = TYPE_DOUBLE;
- Distance->required = NO;
- Distance->multiple = NO;
- Distance->description =
- "Input value: max. distance of spatial correlation (value >= 0.0, default [0.0])";
-
- Exponent = G_define_option();
- Exponent->key = "exponent";
- Exponent->type = TYPE_DOUBLE;
- Exponent->multiple = NO;
- Exponent->required = NO;
- Exponent->description =
- "Input value: distance decay exponent (value > 0.0), default [1.0])";
-
- Weight = G_define_option();
- Weight->key = "flat";
- Weight->type = TYPE_DOUBLE;
- Weight->multiple = NO;
- Weight->required = NO;
- Weight->description =
- "Input value: distance filter remains flat before beginning exponent, default [0.0]";
-
- SeedStuff = G_define_option();
- SeedStuff->key = "seed";
- SeedStuff->type = TYPE_INTEGER;
- SeedStuff->required = NO;
- SeedStuff->description =
- "Input value: random seed (SEED_MIN >= value >= SEED_MAX), default [random]";
-
- range_high_stuff = G_define_option();
- range_high_stuff->key = "high";
- range_high_stuff->type = TYPE_INTEGER;
- range_high_stuff->required = NO;
- range_high_stuff->description =
- "Input value: maximum cell value of distribution, default [255]";
-
- Uniform = G_define_flag();
- Uniform->key = 'u';
- Uniform->description = "Uniformly distributed cell values";
-
- if (G_parser(argc, argv))
- exit(EXIT_FAILURE);
-
Rs = G_window_rows();
Cs = G_window_cols();
Surface = (double **)G_malloc(Rs * sizeof(double *));
@@ -153,7 +82,6 @@
NumMaps = 0;
OutNames = (char **)G_malloc(sizeof(char *));
for (i = 0; (Name = Output->answers[i]); i++) {
- IsLegal(Name);
for (j = i - 1; j >= 0; j--) {
if (strcmp(OutNames[j], Name) == 0)
G_fatal_error
@@ -170,12 +98,6 @@
G_fatal_error("%s: requires an output map", G_program_name());
Theory = 0;
- /*
- TheoryName = TheoryS->answer;
- if (G_legal_filename (TheoryName) != -1) {
- Theory++;
- }
- */
NumSeeds = 0;
Seeds = (int *)G_malloc(NumMaps * sizeof(int));
if (!SeedStuff->answers) {
@@ -412,10 +334,3 @@
AllMaxDist *= 2.0;
}
-
-static void IsLegal(char *Name)
-{
- if (G_legal_filename(Name) == -1)
- G_fatal_error("%s: map name [%s] not legal for GRASS",
- G_program_name(), Name);
-}
Modified: grass/trunk/raster/r.random.surface/local_proto.h
===================================================================
--- grass/trunk/raster/r.random.surface/local_proto.h 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/r.random.surface/local_proto.h 2008-08-16 16:08:08 UTC (rev 32820)
@@ -28,7 +28,7 @@
void GenNorm(void);
/* init.c */
-void Init(int argc, char **argv);
+void Init(void);
/* makebigf.c */
void MakeBigF(void);
Modified: grass/trunk/raster/r.random.surface/main.c
===================================================================
--- grass/trunk/raster/r.random.surface/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/r.random.surface/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -42,14 +42,15 @@
char Buf[240], **OutNames, *TheoryName, *Mapset;
struct Flag *Uniform;
- /* please, remove before GRASS 7 released */
struct Option *Distance, *Exponent, *Weight;
+struct Option *Output;
+struct Option *range_high_stuff;
+struct Option *SeedStuff;
int main(int argc, char **argv)
{
struct GModule *module;
int DoMap, DoFilter, MapSeed;
- double ran1();
FUNCTION(main);
@@ -60,7 +61,59 @@
module->description =
_("Generates random surface(s) with spatial dependence.");
- Init(argc, argv);
+ Output = G_define_option();
+ Output->key = "output";
+ Output->type = TYPE_STRING;
+ Output->required = YES;
+ Output->multiple = YES;
+ Output->description = "Names of the resulting maps";
+ Output->gisprompt = "new,cell,raster";
+
+ Distance = G_define_option();
+ Distance->key = "distance";
+ Distance->type = TYPE_DOUBLE;
+ Distance->required = NO;
+ Distance->multiple = NO;
+ Distance->description =
+ "Input value: max. distance of spatial correlation (value >= 0.0, default [0.0])";
+
+ Exponent = G_define_option();
+ Exponent->key = "exponent";
+ Exponent->type = TYPE_DOUBLE;
+ Exponent->multiple = NO;
+ Exponent->required = NO;
+ Exponent->description =
+ "Input value: distance decay exponent (value > 0.0), default [1.0])";
+
+ Weight = G_define_option();
+ Weight->key = "flat";
+ Weight->type = TYPE_DOUBLE;
+ Weight->multiple = NO;
+ Weight->required = NO;
+ Weight->description =
+ "Input value: distance filter remains flat before beginning exponent, default [0.0]";
+
+ SeedStuff = G_define_option();
+ SeedStuff->key = "seed";
+ SeedStuff->type = TYPE_INTEGER;
+ SeedStuff->required = NO;
+ SeedStuff->description =
+ "Input value: random seed (SEED_MIN >= value >= SEED_MAX), default [random]";
+
+ range_high_stuff = G_define_option();
+ range_high_stuff->key = "high";
+ range_high_stuff->type = TYPE_INTEGER;
+ range_high_stuff->required = NO;
+ range_high_stuff->description =
+ "Input value: maximum cell value of distribution, default [255]";
+
+ Uniform = G_define_flag();
+ Uniform->key = 'u';
+ Uniform->description = "Uniformly distributed cell values";
+
+ if (G_parser(argc, argv))
+ exit(EXIT_FAILURE);
+
if (Uniform->answer)
GenNorm();
CalcSD();
Modified: grass/trunk/raster/r.random.surface/ransurf.h
===================================================================
--- grass/trunk/raster/r.random.surface/ransurf.h 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/r.random.surface/ransurf.h 2008-08-16 16:08:08 UTC (rev 32820)
@@ -50,6 +50,9 @@
/* please, remove before GRASS 7 released */
extern struct Flag *Verbose;
extern struct Option *Distance, *Exponent, *Weight;
+extern struct Option *Output;
+extern struct Option *range_high_stuff;
+extern struct Option *SeedStuff;
#ifdef DEBUG
#define INDX(a,b) (printf("(a)[%d]:%lf ",(b),(a)[(b)]))
Modified: grass/trunk/raster/r.reclass/main.c
===================================================================
--- grass/trunk/raster/r.reclass/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/r.reclass/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -77,9 +77,6 @@
if (old_mapset == NULL)
G_fatal_error(_("Raster map <%s> not found"), parm.input->answer);
- if (G_legal_filename(parm.output->answer) < 0)
- G_fatal_error(_("<%s> is an illegal file name"), parm.output->answer);
-
if (strcmp(parm.input->answer, parm.output->answer) == 0 &&
strcmp(old_mapset, G_mapset()) == 0)
G_fatal_error(_("Input map can NOT be the same as output map"));
Modified: grass/trunk/raster/r.recode/main.c
===================================================================
--- grass/trunk/raster/r.recode/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/r.recode/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -90,9 +90,6 @@
if (mapset == NULL)
G_fatal_error(_("Raster map <%s> not found"), name);
- if (G_legal_filename(result) < 0)
- G_fatal_error(_("<%s> is an illegal file name"), result);
-
if (strcmp(name, result) == 0 && strcmp(mapset, G_mapset()) == 0)
G_fatal_error(_("Input map can NOT be the same as output map"));
Modified: grass/trunk/raster/r.resample/main.c
===================================================================
--- grass/trunk/raster/r.resample/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/r.resample/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -82,9 +82,6 @@
if (mapset == NULL)
G_fatal_error(_("Raster map <%s> not found"), name);
- if (G_legal_filename(result) < 0)
- G_fatal_error("<%s> is an illegal file name", result);
-
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;
Modified: grass/trunk/raster/r.rescale/main.c
===================================================================
--- grass/trunk/raster/r.rescale/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/r.rescale/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -94,10 +94,6 @@
sprintf(buf, "%s - not found\n", old_name);
G_fatal_error(buf);
}
- if (G_legal_filename(new_name) < 0) {
- sprintf(buf, "%s - illegal map name\n", new_name);
- G_fatal_error(buf);
- }
if (parm.from->answer) {
sscanf(parm.from->answers[0], "%ld", &old_min);
Modified: grass/trunk/raster/r.rescale.eq/main.c
===================================================================
--- grass/trunk/raster/r.rescale.eq/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/r.rescale.eq/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -98,10 +98,6 @@
sprintf(buf, "%s - not found\n", old_name);
G_fatal_error(buf);
}
- if (G_legal_filename(new_name) < 0) {
- sprintf(buf, "%s - illegal map name\n", new_name);
- G_fatal_error(buf);
- }
get_stats(old_name, mapset, &statf);
if (parm.from->answer) {
Modified: grass/trunk/raster/r.slope.aspect/opennew.c
===================================================================
--- grass/trunk/raster/r.slope.aspect/opennew.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/r.slope.aspect/opennew.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -7,9 +7,6 @@
{
int fd;
- if (G_legal_filename(name) < 0)
- G_fatal_error(_("<%s> is an illegal file name"), name);
-
if (wr_type < 0) /* default fp type */
fd = G_open_fp_cell_new(name);
else
Deleted: grass/trunk/raster/r.surf.fractal/interface.c
===================================================================
--- grass/trunk/raster/r.surf.fractal/interface.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/r.surf.fractal/interface.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -1,111 +0,0 @@
-
-/****************************************************************************/
-
-/*** Function to get input from user and check files can be opened ***/
-
-/*** ***/
-
-/*** Jo Wood, V1.0, 13th September 1994 ***/
-
-/****************************************************************************/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include "frac.h"
-#include <grass/gis.h>
-#include <grass/glocale.h>
-
-int interface(int argc, /* Number of command line arguments */
- char *argv[] /* Contents of command line arguments. */
- )
-{
-
- /*---------------------------------------------------------------------*/
- /* INITIALISE */
-
- /*---------------------------------------------------------------------*/
-
- struct GModule *module;
- struct Option *rast_out; /* Structure for output raster */
- struct Option *frac_dim; /* Fractal dimension of surface. */
- struct Option *num_images; /* Number of images to produce. */
-
- G_gisinit(argv[0]); /* Link with GRASS interface. */
-
- module = G_define_module();
- module->keywords = _("raster");
- module->description =
- _("Creates a fractal surface of a given fractal dimension.");
-
- /*---------------------------------------------------------------------*/
- /* SET PARSER OPTIONS */
-
- /*---------------------------------------------------------------------*/
-
- rast_out = G_define_option();
- frac_dim = G_define_option();
- num_images = G_define_option();
-
- /* Each option needs a 'key' (short description),
- a 'description` (a longer one),
- a 'type' (eg intiger, or string),
- and an indication whether manditory or not */
-
- rast_out->key = "out";
- rast_out->description = _("Name of fractal surface raster layer");
- rast_out->type = TYPE_STRING;
- rast_out->required = YES;
-
- frac_dim->key = "d";
- frac_dim->description = _("Fractal dimension of surface (2 < D < 3)");
- frac_dim->type = TYPE_DOUBLE;
- frac_dim->required = NO;
- frac_dim->answer = "2.05";
-
- num_images->key = "n";
- num_images->description = _("Number of intermediate images to produce");
- num_images->type = TYPE_INTEGER;
- num_images->required = NO;
- num_images->answer = "0";
-
- if (G_parser(argc, argv)) /* Performs the prompting for */
- exit(EXIT_FAILURE); /* keyboard input. */
-
- rast_out_name = rast_out->answer;
- sscanf(frac_dim->answer, "%lf", &H);
- H = 3.0 - H;
- Steps = atoi(num_images->answer) + 1;
-
- G_message(_("Steps=%d"), Steps);
-
- /*--------------------------------------------------------------------*/
- /* CHECK OUTPUT RASTER FILE DOES NOT EXIST */
-
- /*--------------------------------------------------------------------*/
-
- mapset_out = G_mapset(); /* Set output to current mapset. */
-
- if (G_legal_filename(rast_out_name) == '\0') {
- G_fatal_error(_("<%s> is an illegal file name"), rast_out_name);
- }
-
- /*--------------------------------------------------------------------*/
- /* CHECK FRACTAL DIMENSION IS WITHIN LIMITS */
-
- /*--------------------------------------------------------------------*/
-
- if ((H <= 0) || (H >= 1)) {
- G_fatal_error(_("Fractal dimension of [%.2lf] must be between 2 and 3."),
- 3.0 - H);
- }
-
-
- /*--------------------------------------------------------------------*/
- /* MAKE SURE NUMBER OF IMAGES <= NUMBER OF FOURIER COEFF. */
-
- /*--------------------------------------------------------------------*/
-
- /* TODO */
-
- return 0;
-}
Modified: grass/trunk/raster/r.surf.fractal/main.c
===================================================================
--- grass/trunk/raster/r.surf.fractal/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/r.surf.fractal/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -12,6 +12,7 @@
*
*****************************************************************************/
+#include <grass/glocale.h>
#include "frac.h"
char
@@ -26,8 +27,61 @@
int main(int argc, char *argv[])
{
+ struct GModule *module;
+ struct Option *rast_out; /* Structure for output raster */
+ struct Option *frac_dim; /* Fractal dimension of surface. */
+ struct Option *num_images; /* Number of images to produce. */
- interface(argc, argv);
+ G_gisinit(argv[0]); /* Link with GRASS interface. */
+
+ module = G_define_module();
+ module->keywords = _("raster");
+ module->description =
+ _("Creates a fractal surface of a given fractal dimension.");
+
+ rast_out = G_define_option();
+ rast_out->key = "out";
+ rast_out->description = _("Name of fractal surface raster layer");
+ rast_out->type = TYPE_STRING;
+ rast_out->required = YES;
+
+ frac_dim = G_define_option();
+ frac_dim->key = "d";
+ frac_dim->description = _("Fractal dimension of surface (2 < D < 3)");
+ frac_dim->type = TYPE_DOUBLE;
+ frac_dim->required = NO;
+ frac_dim->answer = "2.05";
+
+ num_images = G_define_option();
+ num_images->key = "n";
+ num_images->description = _("Number of intermediate images to produce");
+ num_images->type = TYPE_INTEGER;
+ num_images->required = NO;
+ num_images->answer = "0";
+
+ if (G_parser(argc, argv)) /* Performs the prompting for */
+ exit(EXIT_FAILURE); /* keyboard input. */
+
+ rast_out_name = rast_out->answer;
+ sscanf(frac_dim->answer, "%lf", &H);
+ H = 3.0 - H;
+ Steps = atoi(num_images->answer) + 1;
+
+ G_message(_("Steps=%d"), Steps);
+
+ mapset_out = G_mapset(); /* Set output to current mapset. */
+
+
+ /*--------------------------------------------------------------------*/
+ /* CHECK FRACTAL DIMENSION IS WITHIN LIMITS */
+
+ /*--------------------------------------------------------------------*/
+
+ if ((H <= 0) || (H >= 1)) {
+ G_fatal_error(_("Fractal dimension of [%.2lf] must be between 2 and 3."),
+ 3.0 - H);
+ }
+
process();
return EXIT_SUCCESS;
Modified: grass/trunk/raster/r.surf.gauss/main.c
===================================================================
--- grass/trunk/raster/r.surf.gauss/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/r.surf.gauss/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -72,10 +72,6 @@
sscanf(mean->answer, "%lf", &gauss_mean);
sscanf(sigma->answer, "%lf", &gauss_sigma);
- /****** CHECK THE CELL FILE (OUT) DOES NOT ALREADY EXIST******/
- if (G_legal_filename(out->answer) == '\0')
- G_fatal_error(_("<%s> is an illegal file name"), out->answer);
-
/****** CREATE THE RANDOM CELL FILE ******/
gaussurf(out->answer, gauss_mean, gauss_sigma);
Modified: grass/trunk/raster/r.surf.idw/main.c
===================================================================
--- grass/trunk/raster/r.surf.idw/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/r.surf.idw/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -143,10 +143,6 @@
if (layer_mapset == NULL)
G_fatal_error(_("Raster map <%s> not found"), input);
- /* check if specified output layer name is legal */
- if (G_legal_filename(output) < 0)
- G_fatal_error(_("<%s> is an illegal file name"), output);
-
/* find number of rows and columns in window */
nrows = G_window_rows();
ncols = G_window_cols();
Modified: grass/trunk/raster/r.surf.idw2/main.c
===================================================================
--- grass/trunk/raster/r.surf.idw2/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/r.surf.idw2/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -79,9 +79,6 @@
if ((G_projection() == PROJECTION_LL))
G_fatal_error(_("Lat/long databases not supported by r.surf.idw2. Use r.surf.idw instead!"));
- if (G_legal_filename(parm.output->answer) < 0)
- G_fatal_error(_("<%s> is an illegal file name"), parm.output->answer);
-
if (sscanf(parm.npoints->answer, "%d", &search_points) != 1 ||
search_points < 1)
G_fatal_error(_("%s=%s - illegal number of interpolation points"),
Modified: grass/trunk/raster/r.surf.random/main.c
===================================================================
--- grass/trunk/raster/r.surf.random/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/r.surf.random/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -69,10 +69,6 @@
exit(EXIT_FAILURE); /* Returns a 0 if sucessful */
- if (G_legal_filename(out->answer) != 1)
- G_fatal_error("Illegal file name. Please try another.");
-
-
randsurf(out->answer, atoi(min->answer), atoi(max->answer),
i_flag->answer);
Modified: grass/trunk/raster/r.texture/main.c
===================================================================
--- grass/trunk/raster/r.texture/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/r.texture/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -212,9 +212,6 @@
if (mapset == NULL)
G_fatal_error(_("Raster map <%s> not found"), name);
- if (G_legal_filename(result) < 0)
- G_fatal_error(_("<%s> is an illegal file name"), result);
-
if ((infd = G_open_cell_old(name, mapset)) < 0)
G_fatal_error(_("Unable to open raster map <%s>"), name);
Modified: grass/trunk/raster/r.to.rast3/main.c
===================================================================
--- grass/trunk/raster/r.to.rast3/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/r.to.rast3/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -235,10 +235,6 @@
if (fd == NULL)
fatal_error(map, NULL, 0, _("Out of memory"));
- if (G_legal_filename(param.output->answer) < 0)
- fatal_error(map, NULL, 0, _("Illegal output file name"));
-
-
mapset = NULL;
name = NULL;
Modified: grass/trunk/raster/r.to.rast3elev/main.c
===================================================================
--- grass/trunk/raster/r.to.rast3elev/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/r.to.rast3elev/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -468,10 +468,6 @@
G_set_window(&window2d);
}
- if (G_legal_filename(param.output->answer) < 0)
- G3d_fatalError(_("<%s> is an illegal file name"),
- param.output->answer);
-
G_debug(2, "Open 3d raster map %s", param.output->answer);
/*open G3D output map */
Modified: grass/trunk/raster/r.walk/main.c
===================================================================
--- grass/trunk/raster/r.walk/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/r.walk/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -538,11 +538,6 @@
if (cost_mapset == NULL)
G_fatal_error(_("Raster map <%s> not found"), cost_layer);
- /* Check if specified output layer name is legal */
-
- if (G_legal_filename(cum_cost_layer) < 0)
- G_fatal_error(_("<%s> is an illegal file name"), cum_cost_layer);
-
/* Find number of rows and columns in window */
nrows = G_window_rows();
Modified: grass/trunk/raster/r.water.outlet/legal.c
===================================================================
--- grass/trunk/raster/r.water.outlet/legal.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/r.water.outlet/legal.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -2,18 +2,6 @@
#include <grass/gis.h>
#include <grass/glocale.h>
-int do_legal(char *file_name)
-{
- char *buf;
-
- if (G_legal_filename(file_name) == -1) {
- G_asprintf(&buf, _("<%s> is an illegal file name"), file_name);
- G_fatal_error(buf);
- }
-
- return 0;
-}
-
char *do_exist(char *file_name)
{
char *buf, *file_mapset;
Modified: grass/trunk/raster/r.water.outlet/main.c
===================================================================
--- grass/trunk/raster/r.water.outlet/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/r.water.outlet/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -125,7 +125,7 @@
dr_f = ba_f = N_f = E_f = errr = 0;
drain_mapset = do_exist(drain_name);
- do_legal(basin_name);
+
nrows = G_window_rows();
ncols = G_window_cols();
total = nrows * ncols;
Modified: grass/trunk/raster/r.watershed/ram/Gwater.h
===================================================================
--- grass/trunk/raster/r.watershed/ram/Gwater.h 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/r.watershed/ram/Gwater.h 2008-08-16 16:08:08 UTC (rev 32820)
@@ -99,7 +99,6 @@
/* init_vars.c */
int init_vars(int, char *[]);
-int do_legal(char *);
char *do_exist(char *);
/* no_stream.c */
Modified: grass/trunk/raster/r.watershed/ram/init_vars.c
===================================================================
--- grass/trunk/raster/r.watershed/ram/init_vars.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/r.watershed/ram/init_vars.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -83,20 +83,6 @@
tot_parts++;
G_message(_("SECTION 1a (of %1d): Initiating Memory."), tot_parts);
this_mapset = G_mapset();
- if (asp_flag)
- do_legal(asp_name);
- if (bas_flag)
- do_legal(bas_name);
- if (seg_flag)
- do_legal(seg_name);
- if (haf_flag)
- do_legal(haf_name);
- if (sl_flag)
- do_legal(sl_name);
- if (sg_flag)
- do_legal(sg_name);
- if (ls_flag)
- do_legal(ls_name);
if (sl_flag || sg_flag || ls_flag)
er_flag = 1;
ele_mapset = do_exist(ele_name);
@@ -382,14 +368,6 @@
return 0;
}
-int do_legal(char *file_name)
-{
- if (G_legal_filename(file_name) == -1)
- G_fatal_error(_("<%s> is an illegal file name"), file_name);
-
- return 0;
-}
-
char *do_exist(char *file_name)
{
char *file_mapset = G_find_cell2(file_name, "");
Modified: grass/trunk/raster/r.watershed/seg/Gwater.h
===================================================================
--- grass/trunk/raster/r.watershed/seg/Gwater.h 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/r.watershed/seg/Gwater.h 2008-08-16 16:08:08 UTC (rev 32820)
@@ -92,7 +92,6 @@
/* init_vars.c */
int init_vars(int, char *[]);
-int do_legal(char *);
char *do_exist(char *);
/* no_stream.c */
Modified: grass/trunk/raster/r.watershed/seg/init_vars.c
===================================================================
--- grass/trunk/raster/r.watershed/seg/init_vars.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/r.watershed/seg/init_vars.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -10,8 +10,7 @@
SHORT r, c;
int fd, num_cseg_total, num_cseg, num_cseg_bytes;
CELL *buf, alt_value, wat_value, asp_value, worked_value;
- extern FILE *fopen();
- char MASK_flag, *do_exist();
+ char MASK_flag;
G_gisinit(argv[0]);
ele_flag = wat_flag = asp_flag = pit_flag = run_flag = ril_flag = 0;
@@ -89,20 +88,6 @@
tot_parts);
this_mapset = G_mapset();
- if (asp_flag)
- do_legal(asp_name);
- if (bas_flag)
- do_legal(bas_name);
- if (seg_flag)
- do_legal(seg_name);
- if (haf_flag)
- do_legal(haf_name);
- if (sl_flag)
- do_legal(sl_name);
- if (sg_flag)
- do_legal(sg_name);
- if (ls_flag)
- do_legal(ls_name);
if (sl_flag || sg_flag || ls_flag)
er_flag = 1;
ele_mapset = do_exist(ele_name);
@@ -411,14 +396,6 @@
return 0;
}
-int do_legal(char *file_name)
-{
- if (G_legal_filename(file_name) == -1)
- G_fatal_error(_("<%s> is an illegal file name"), file_name);
-
- return 0;
-}
-
char *do_exist(char *file_name)
{
char *file_mapset = G_find_cell2(file_name, "");
Modified: grass/trunk/raster/wildfire/r.ros/main.c
===================================================================
--- grass/trunk/raster/wildfire/r.ros/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/wildfire/r.ros/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -410,10 +410,6 @@
}
}
- /* Check if specified output layer name IS LEGAL */
- if (G_legal_filename(parm.output->answer) < 0)
- G_fatal_error("%s - illegal name", parm.output->answer);
-
/*assign names of the three output ROS layers */
sprintf(name_base, "%s.base", parm.output->answer);
sprintf(name_max, "%s.max", parm.output->answer);
Modified: grass/trunk/raster/wildfire/r.spread/main.c
===================================================================
--- grass/trunk/raster/wildfire/r.spread/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/wildfire/r.spread/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -337,9 +337,7 @@
/* Get database window parameters */
if (G_get_window(&window) < 0) {
- sprintf(buf, "can't read current window parameters");
- G_fatal_error(buf);
- exit(EXIT_FAILURE);
+ G_fatal_error("can't read current window parameters");
}
/* find number of rows and columns in window */
@@ -359,136 +357,64 @@
/* Check if input layers exists in data base */
if (G_find_cell2(max_layer, "") == NULL) {
- sprintf(buf, "Raster map <%s> not found", max_layer);
- G_fatal_error(buf);
- exit(EXIT_FAILURE);
+ G_fatal_error("Raster map <%s> not found", max_layer);
}
if (G_find_cell2(dir_layer, "") == NULL) {
- sprintf(buf, _("Raster map <%s> not found"), dir_layer);
- G_fatal_error(buf);
- exit(EXIT_FAILURE);
+ G_fatal_error(_("Raster map <%s> not found"), dir_layer);
}
if (G_find_cell2(base_layer, "") == NULL) {
- sprintf(buf, _("Raster map <%s> not found"), base_layer);
- G_fatal_error(buf);
- exit(EXIT_FAILURE);
+ G_fatal_error(_("Raster map <%s> not found"), base_layer);
}
if (G_find_cell2(start_layer, "") == NULL) {
- sprintf(buf, _("Raster map <%s> not found"), start_layer);
- G_fatal_error(buf);
- exit(EXIT_FAILURE);
+ G_fatal_error(_("Raster map <%s> not found"), start_layer);
}
if (spotting) {
if (G_find_cell2(spotdist_layer, "") == NULL) {
- sprintf(buf, _("Raster map <%s> not found"), spotdist_layer);
- G_fatal_error(buf);
- exit(EXIT_FAILURE);
+ G_fatal_error(_("Raster map <%s> not found"), spotdist_layer);
}
if (G_find_cell2(velocity_layer, "") == NULL) {
- sprintf(buf, _("Raster map <%s> not found"), velocity_layer);
- G_fatal_error(buf);
- exit(EXIT_FAILURE);
+ G_fatal_error(_("Raster map <%s> not found"), velocity_layer);
}
if (G_find_cell2(mois_layer, "") == NULL) {
- sprintf(buf, _("Raster map <%s> not found"), mois_layer);
- G_fatal_error(buf);
- exit(EXIT_FAILURE);
+ G_fatal_error(_("Raster map <%s> not found"), mois_layer);
}
}
-
- /* Check if specified output layer names ARE LEGAL or EXISTS */
-
- if (G_legal_filename(out_layer) < 0) {
- sprintf(buf, _("<%s> is an illegal file name"), out_layer);
- G_fatal_error(buf);
- exit(EXIT_FAILURE);
- }
- if (G_find_cell2(out_layer, G_mapset())) {
- sprintf(buf,
- _("Raster map <%s> already exists in mapset <%s>, select another name"),
- out_layer, G_mapset());
- G_fatal_error(buf);
- exit(EXIT_FAILURE);
- }
-
- if (x_out) {
- if (G_legal_filename(x_out_layer) < 0) {
- sprintf(buf, _("<%s> is an illegal file name"), x_out_layer);
- G_fatal_error(buf);
- exit(EXIT_FAILURE);
- }
- if (G_find_cell2(x_out_layer, G_mapset())) {
- sprintf(buf,
- _("Raster map <%s> already exists in mapset <%s>, select another name"),
- x_out_layer, G_mapset());
- G_fatal_error(buf);
- exit(EXIT_FAILURE);
- }
- }
-
- if (y_out) {
- if (G_legal_filename(y_out_layer) < 0) {
- sprintf(buf, _("<%s> is an illegal file name"), y_out_layer);
- G_fatal_error(buf);
- exit(EXIT_FAILURE);
- }
- if (G_find_cell2(y_out_layer, G_mapset())) {
- sprintf(buf,
- _("Raster map <%s> already exists in mapset <%s>, select another name"),
- y_out_layer, G_mapset());
- G_fatal_error(buf);
- exit(EXIT_FAILURE);
- }
- }
-
/* Open input cell layers for reading */
max_fd = G_open_cell_old(max_layer, G_find_cell2(max_layer, ""));
if (max_fd < 0) {
- sprintf(buf, _("Unable to open raster map <%s>"), max_layer);
- G_fatal_error(buf);
- exit(EXIT_FAILURE);
+ G_fatal_error(_("Unable to open raster map <%s>"), max_layer);
}
dir_fd = G_open_cell_old(dir_layer, G_find_cell2(dir_layer, ""));
if (dir_fd < 0) {
- sprintf(buf, _("Unable to open raster map <%s>"), dir_layer);
- G_fatal_error(buf);
- exit(EXIT_FAILURE);
+ G_fatal_error(_("Unable to open raster map <%s>"), dir_layer);
}
base_fd = G_open_cell_old(base_layer, G_find_cell2(base_layer, ""));
if (base_fd < 0) {
- sprintf(buf, _("Unable to open raster map <%s>"), base_layer);
- G_fatal_error(buf);
- exit(EXIT_FAILURE);
+ G_fatal_error(_("Unable to open raster map <%s>"), base_layer);
}
if (spotting) {
spotdist_fd =
G_open_cell_old(spotdist_layer, G_find_cell2(spotdist_layer, ""));
if (spotdist_fd < 0) {
- sprintf(buf, _("Unable to open raster map <%s>"), spotdist_layer);
- G_fatal_error(buf);
- exit(EXIT_FAILURE);
+ G_fatal_error(_("Unable to open raster map <%s>"), spotdist_layer);
}
velocity_fd =
G_open_cell_old(velocity_layer, G_find_cell2(velocity_layer, ""));
if (velocity_fd < 0) {
- sprintf(buf, _("Unable to open raster map <%s>"), velocity_layer);
- G_fatal_error(buf);
- exit(EXIT_FAILURE);
+ G_fatal_error(_("Unable to open raster map <%s>"), velocity_layer);
}
mois_fd = G_open_cell_old(mois_layer, G_find_cell2(mois_layer, ""));
if (mois_fd < 0) {
- sprintf(buf, _("Unable to open raster map <%s>"), mois_layer);
- G_fatal_error(buf);
- exit(EXIT_FAILURE);
+ G_fatal_error(_("Unable to open raster map <%s>"), mois_layer);
}
}
@@ -558,9 +484,7 @@
start_fd = G_open_cell_old(start_layer, G_find_cell2(start_layer, ""));
if (start_fd < 0) {
- sprintf(buf, _("Unable to open raster map <%s>"), start_layer);
- G_fatal_error(buf);
- exit(EXIT_FAILURE);
+ G_fatal_error(_("Unable to open raster map <%s>"), start_layer);
}
G_read_range(start_layer, G_find_file("cell", start_layer, ""), &range);
Modified: grass/trunk/raster/wildfire/r.spreadpath/main.c
===================================================================
--- grass/trunk/raster/wildfire/r.spreadpath/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster/wildfire/r.spreadpath/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -274,13 +274,6 @@
else
flag = 3; /* output layer does not previously exist */
-
- /* Check if specified output layer name is legal */
- if (flag == 3) {
- if (G_legal_filename(path_layer) < 0)
- G_fatal_error("%s - illegal name", path_layer);
- }
-
/* If the output layer containing the starting positions */
/* create a linked list of of them */
if (flag == 1) {
Modified: grass/trunk/raster3d/r3.cross.rast/main.c
===================================================================
--- grass/trunk/raster3d/r3.cross.rast/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster3d/r3.cross.rast/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -344,10 +344,6 @@
/**********************/
- /*Filename check for output map */
- if (G_legal_filename(param.output->answer) < 0)
- fatal_error(map, elevfd, -1, _("Illegal output file name"));
-
if (G_find_cell2(param.output->answer, ""))
G_message(_("Output map already exists. Will be overwritten!"));
Modified: grass/trunk/raster3d/r3.mkdspf/r3_find.c
===================================================================
--- grass/trunk/raster3d/r3.mkdspf/r3_find.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster3d/r3.mkdspf/r3_find.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -30,9 +30,6 @@
/* return NULL on error: otherwise returns dspout */
char *check_get_any_dspname(char *dspf, char *g3f, char *mset)
{
- if (!G_legal_filename(dspf))
- return (NULL);
-
if (!G_find_grid3(g3f, ""))
G_fatal_error("[%s] 3D raster map not found", g3f);
Modified: grass/trunk/raster3d/r3.showdspf/r3_find.c
===================================================================
--- grass/trunk/raster3d/r3.showdspf/r3_find.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster3d/r3.showdspf/r3_find.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -35,9 +35,6 @@
char element[200], question[200];
static char dspout[200];
- if (!G_legal_filename(dspf))
- return (NULL);
-
if (!G_find_grid3(g3f, "")) {
fprintf(stderr, "[%s] 3D raster map not found\n", g3f);
return (NULL);
Modified: grass/trunk/raster3d/r3.to.rast/main.c
===================================================================
--- grass/trunk/raster3d/r3.to.rast/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/raster3d/r3.to.rast/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -298,9 +298,6 @@
if (fd == NULL)
fatal_error(map, NULL, 0, _("Out of memory"));
- if (G_legal_filename(param.output->answer) < 0)
- fatal_error(map, NULL, 0, _("Illegal output file name"));
-
G_message(_("Creating %i raster maps"), region.depths);
/*Loop over all output maps! open */
Modified: grass/trunk/swig/perl/R_slope_aspect/r_slope_aspect/opennew.c
===================================================================
--- grass/trunk/swig/perl/R_slope_aspect/r_slope_aspect/opennew.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/swig/perl/R_slope_aspect/r_slope_aspect/opennew.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -7,9 +7,6 @@
{
int fd;
- if (G_legal_filename(name) < 0)
- G_fatal_error(_("<%s> is an illegal file name"), name);
-
if (wr_type < 0) /* default fp type */
fd = G_open_fp_cell_new(name);
else
Modified: grass/trunk/vector/v.edit/main.c
===================================================================
--- grass/trunk/vector/v.edit/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/vector/v.edit/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -82,11 +82,6 @@
if (action_mode == MODE_CREATE) {
int overwrite;
- if (G_legal_filename(params.map->answer) == -1) {
- G_fatal_error(_("<%s> is an illegal file name"),
- params.map->answer);
- }
-
overwrite = G_check_overwrite(argc, argv);
if (G_find_vector2(params.map->answer, G_mapset())) {
if (!overwrite)
Modified: grass/trunk/vector/v.in.ogr/main.c
===================================================================
--- grass/trunk/vector/v.in.ogr/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/vector/v.in.ogr/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -327,9 +327,6 @@
G_fatal_error(_("Required parameter <%s> not set"), out_opt->key);
}
- if (G_legal_filename(out_opt->answer) < 0)
- G_fatal_error(_("<%s> is an illegal file name"), out_opt->answer);
-
if (!outloc_opt->answer) { /* Check if the map exists */
if (G_find_vector2(out_opt->answer, G_mapset())) {
if (overwrite)
Modified: grass/trunk/vector/v.kernel/main.c
===================================================================
--- grass/trunk/vector/v.kernel/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/vector/v.kernel/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -246,10 +246,6 @@
else {
/* check and open the name of output map */
if (!flag_q->answer) {
- if (G_legal_filename(out_opt->answer) < 0)
- G_fatal_error(_("<%s> is an illegal file name"),
- out_opt->answer);
-
G_set_fp_type(DCELL_TYPE);
if ((fdout = G_open_raster_new(out_opt->answer, DCELL_TYPE)) < 0)
G_fatal_error(_("Unable to create raster map <%s>"),
Modified: grass/trunk/vector/v.surf.idw/main.c
===================================================================
--- grass/trunk/vector/v.surf.idw/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/vector/v.surf.idw/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -119,9 +119,6 @@
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
- if (G_legal_filename(parm.output->answer) < 0)
- G_fatal_error(_("<%s> is an illegal file name"), parm.output->answer);
-
if (sscanf(parm.npoints->answer, "%d", &search_points) != 1 ||
search_points < 1)
G_fatal_error(_("%s=%s - illegal number of interpolation points"),
Modified: grass/trunk/vector/v.to.rast3/main.c
===================================================================
--- grass/trunk/vector/v.to.rast3/main.c 2008-08-16 16:05:36 UTC (rev 32819)
+++ grass/trunk/vector/v.to.rast3/main.c 2008-08-16 16:08:08 UTC (rev 32820)
@@ -65,9 +65,6 @@
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
- if (G_legal_filename(out_opt->answer) < 0)
- G_fatal_error(_("<%s> is an illegal file name"), out_opt->answer);
-
G3d_getWindow(®ion);
G3d_readWindow(®ion, NULL);
More information about the grass-commit
mailing list