[GRASS-SVN] r63830 - in grass/trunk: include/defs lib/db/dbmi_base lib/db/dbmi_client lib/db/dbmi_driver lib/display lib/gis lib/temporal/lib lib/vector/Vlib lib/vector/diglib
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Dec 29 10:09:10 PST 2014
Author: martinl
Date: 2014-12-29 10:09:10 -0800 (Mon, 29 Dec 2014)
New Revision: 63830
Modified:
grass/trunk/include/defs/gis.h
grass/trunk/lib/db/dbmi_base/connect.c
grass/trunk/lib/db/dbmi_base/default_name.c
grass/trunk/lib/db/dbmi_client/start.c
grass/trunk/lib/db/dbmi_driver/driver.c
grass/trunk/lib/display/r_raster.c
grass/trunk/lib/gis/debug.c
grass/trunk/lib/gis/env.c
grass/trunk/lib/gis/make_loc.c
grass/trunk/lib/gis/make_mapset.c
grass/trunk/lib/gis/mapset.c
grass/trunk/lib/gis/overwrite.c
grass/trunk/lib/gis/parser.c
grass/trunk/lib/temporal/lib/connect.c
grass/trunk/lib/vector/Vlib/intersect.c
grass/trunk/lib/vector/Vlib/intersect2.c
grass/trunk/lib/vector/Vlib/sindex.c
grass/trunk/lib/vector/diglib/file.c
grass/trunk/lib/vector/diglib/plus_area.c
Log:
libgis: G__getenv() -> G_getenv_nofatal()
G__getenv2() -> G_getenv_nofatal2()
G__setenv() -> G_setenv_nogisrc()
G__setenv2() -> G_setenv_nogisrc2()
Modified: grass/trunk/include/defs/gis.h
===================================================================
--- grass/trunk/include/defs/gis.h 2014-12-29 17:12:57 UTC (rev 63829)
+++ grass/trunk/include/defs/gis.h 2014-12-29 18:09:10 UTC (rev 63830)
@@ -210,12 +210,12 @@
void G_init_env(void);
const char *G_getenv(const char *);
const char *G_getenv2(const char *, int);
-const char *G__getenv(const char *);
-const char *G__getenv2(const char *, int);
+const char *G_getenv_nofatal(const char *);
+const char *G_getenv_nofatal2(const char *, int);
void G_setenv(const char *, const char *);
void G_setenv2(const char *, const char *, int);
-void G__setenv(const char *, const char *);
-void G__setenv2(const char *, const char *, int);
+void G_setenv_nogisrc(const char *, const char *);
+void G_setenv_nogisrc2(const char *, const char *, int);
void G_unsetenv(const char *);
void G_unsetenv2(const char *, int);
void G__write_env(void);
Modified: grass/trunk/lib/db/dbmi_base/connect.c
===================================================================
--- grass/trunk/lib/db/dbmi_base/connect.c 2014-12-29 17:12:57 UTC (rev 63829)
+++ grass/trunk/lib/db/dbmi_base/connect.c 2014-12-29 18:09:10 UTC (rev 63830)
@@ -70,21 +70,21 @@
{
G_zero(connection, sizeof(dbConnection));
- connection->driverName = (char *)G__getenv2("DB_DRIVER", G_VAR_MAPSET);
- connection->databaseName = (char *)G__getenv2("DB_DATABASE", G_VAR_MAPSET);
+ connection->driverName = (char *)G_getenv_nofatal2("DB_DRIVER", G_VAR_MAPSET);
+ connection->databaseName = (char *)G_getenv_nofatal2("DB_DATABASE", G_VAR_MAPSET);
if (connection->driverName == NULL ||
connection->databaseName == NULL)
return DB_FAILED;
- connection->schemaName = (char *)G__getenv2("DB_SCHEMA", G_VAR_MAPSET);
- connection->group = (char *)G__getenv2("DB_GROUP", G_VAR_MAPSET);
+ connection->schemaName = (char *)G_getenv_nofatal2("DB_SCHEMA", G_VAR_MAPSET);
+ connection->group = (char *)G_getenv_nofatal2("DB_GROUP", G_VAR_MAPSET);
/* below commented due to new mechanism: see db_get_login()
- connection->hostName = G__getenv("DB_HOST");
- connection->location = G__getenv("DB_LOCATION");
- connection->user = G__getenv("DB_USER");
- connection->password = G__getenv("DB_PASSWORD");
+ connection->hostName = G_getenv_nofatal("DB_HOST");
+ connection->location = G_getenv_nofatal("DB_LOCATION");
+ connection->user = G_getenv_nofatal("DB_USER");
+ connection->password = G_getenv_nofatal("DB_PASSWORD");
*/
/* try to get user/password */
Modified: grass/trunk/lib/db/dbmi_base/default_name.c
===================================================================
--- grass/trunk/lib/db/dbmi_base/default_name.c 2014-12-29 17:12:57 UTC (rev 63829)
+++ grass/trunk/lib/db/dbmi_base/default_name.c 2014-12-29 18:09:10 UTC (rev 63830)
@@ -28,7 +28,7 @@
{
const char *drv;
- if ((drv = G__getenv2("DB_DRIVER", G_VAR_MAPSET)))
+ if ((drv = G_getenv_nofatal2("DB_DRIVER", G_VAR_MAPSET)))
return G_store(drv);
return NULL;
@@ -44,7 +44,7 @@
{
const char *drv;
- if ((drv = G__getenv2("DB_DATABASE", G_VAR_MAPSET)))
+ if ((drv = G_getenv_nofatal2("DB_DATABASE", G_VAR_MAPSET)))
return G_store(drv);
return NULL;
@@ -60,7 +60,7 @@
{
const char *sch;
- if ((sch = G__getenv2("DB_SCHEMA", G_VAR_MAPSET)))
+ if ((sch = G_getenv_nofatal2("DB_SCHEMA", G_VAR_MAPSET)))
return G_store(sch);
return NULL;
@@ -76,7 +76,7 @@
{
const char *gr;
- if ((gr = G__getenv2("DB_GROUP", G_VAR_MAPSET)))
+ if ((gr = G_getenv_nofatal2("DB_GROUP", G_VAR_MAPSET)))
return G_store(gr);
return NULL;
Modified: grass/trunk/lib/db/dbmi_client/start.c
===================================================================
--- grass/trunk/lib/db/dbmi_client/start.c 2014-12-29 17:12:57 UTC (rev 63829)
+++ grass/trunk/lib/db/dbmi_client/start.c 2014-12-29 18:09:10 UTC (rev 63830)
@@ -64,16 +64,16 @@
sprintf(ebuf, "%d", G_GISRC_MODE_MEMORY);
G_putenv("GRASS_DB_DRIVER_GISRC_MODE", ebuf); /* to tell driver that it must read variables */
- if (G__getenv("DEBUG")) {
- G_putenv("DEBUG", G__getenv("DEBUG"));
+ if (G_getenv_nofatal("DEBUG")) {
+ G_putenv("DEBUG", G_getenv_nofatal("DEBUG"));
}
else {
G_putenv("DEBUG", "0");
}
- G_putenv("GISDBASE", G__getenv("GISDBASE"));
- G_putenv("LOCATION_NAME", G__getenv("LOCATION_NAME"));
- G_putenv("MAPSET", G__getenv("MAPSET"));
+ G_putenv("GISDBASE", G_getenv_nofatal("GISDBASE"));
+ G_putenv("LOCATION_NAME", G_getenv_nofatal("LOCATION_NAME"));
+ G_putenv("MAPSET", G_getenv_nofatal("MAPSET"));
}
else {
/* Warning: GISRC_MODE_MEMORY _must_ be set to G_GISRC_MODE_FILE, because the module can be
Modified: grass/trunk/lib/db/dbmi_driver/driver.c
===================================================================
--- grass/trunk/lib/db/dbmi_driver/driver.c 2014-12-29 17:12:57 UTC (rev 63829)
+++ grass/trunk/lib/db/dbmi_driver/driver.c 2014-12-29 18:09:10 UTC (rev 63830)
@@ -53,10 +53,10 @@
if (mode == G_GISRC_MODE_MEMORY) {
G_set_gisrc_mode(G_GISRC_MODE_MEMORY);
- G__setenv("DEBUG", getenv("DEBUG"));
- G__setenv("GISDBASE", getenv("GISDBASE"));
- G__setenv("LOCATION_NAME", getenv("LOCATION_NAME"));
- G__setenv("MAPSET", getenv("MAPSET"));
+ G_setenv_nogisrc("DEBUG", getenv("DEBUG"));
+ G_setenv_nogisrc("GISDBASE", getenv("GISDBASE"));
+ G_setenv_nogisrc("LOCATION_NAME", getenv("LOCATION_NAME"));
+ G_setenv_nogisrc("MAPSET", getenv("MAPSET"));
G_debug(3, "Driver GISDBASE set to '%s'", G_getenv("GISDBASE"));
}
}
Modified: grass/trunk/lib/display/r_raster.c
===================================================================
--- grass/trunk/lib/display/r_raster.c 2014-12-29 17:12:57 UTC (rev 63829)
+++ grass/trunk/lib/display/r_raster.c 2014-12-29 18:09:10 UTC (rev 63830)
@@ -112,7 +112,7 @@
G_debug(1, "D_open_driver():");
p = getenv("GRASS_RENDER_IMMEDIATE");
- m = G__getenv("MONITOR");
+ m = G_getenv_nofatal("MONITOR");
if (m && G_strncasecmp(m, "wx", 2) == 0) {
/* wx monitors always use GRASS_RENDER_IMMEDIATE. */
@@ -131,14 +131,14 @@
env = NULL;
G_asprintf(&env, "MONITOR_%s_MAPFILE", u_m);
- v = G__getenv(env);
+ v = G_getenv_nofatal(env);
p = m;
if (v)
G_putenv("GRASS_RENDER_FILE", v);
G_asprintf(&env, "MONITOR_%s_ENVFILE", u_m);
- v = G__getenv(env);
+ v = G_getenv_nofatal(env);
if (v)
read_env_file(v);
}
@@ -209,7 +209,7 @@
G_debug(1, "D_save_command(): %s", cmd);
- mon_name = G__getenv("MONITOR");
+ mon_name = G_getenv_nofatal("MONITOR");
if (!mon_name || /* if no monitor selected */
/* or wx monitor selected and display commands called by the monitor */
(G_strncasecmp(mon_name, "wx", 2) == 0 &&
@@ -221,7 +221,7 @@
env = NULL;
G_asprintf(&env, "MONITOR_%s_CMDFILE", u_mon_name);
- mon_cmd = G__getenv(env);
+ mon_cmd = G_getenv_nofatal(env);
if (!mon_cmd)
return 0;
Modified: grass/trunk/lib/gis/debug.c
===================================================================
--- grass/trunk/lib/gis/debug.c 2014-12-29 17:12:57 UTC (rev 63829)
+++ grass/trunk/lib/gis/debug.c 2014-12-29 18:09:10 UTC (rev 63830)
@@ -31,7 +31,7 @@
if (G_is_initialized(&initialized))
return;
- lstr = G__getenv("DEBUG");
+ lstr = G_getenv_nofatal("DEBUG");
if (lstr != NULL)
grass_debug_level = atoi(lstr);
Modified: grass/trunk/lib/gis/env.c
===================================================================
--- grass/trunk/lib/gis/env.c 2014-12-29 17:12:57 UTC (rev 63829)
+++ grass/trunk/lib/gis/env.c 2014-12-29 18:09:10 UTC (rev 63830)
@@ -335,7 +335,7 @@
*/
const char *G_getenv(const char *name)
{
- const char *value = G__getenv(name);
+ const char *value = G_getenv_nofatal(name);
if (value)
return value;
@@ -361,7 +361,7 @@
*/
const char *G_getenv2(const char *name, int loc)
{
- const char *value = G__getenv2(name, loc);
+ const char *value = G_getenv_nofatal2(name, loc);
if (value)
return value;
@@ -378,7 +378,7 @@
\return char pointer to value for name
\return NULL if name not set
*/
-const char *G__getenv(const char *name)
+const char *G_getenv_nofatal(const char *name)
{
if (strcmp(name, "GISBASE") == 0)
return getenv(name);
@@ -397,7 +397,7 @@
\return char pointer to value for name
\return NULL if name not set
*/
-const char *G__getenv2(const char *name, int loc)
+const char *G_getenv_nofatal2(const char *name, int loc)
{
if (strcmp(name, "GISBASE") == 0)
return getenv(name);
@@ -445,7 +445,7 @@
\param name variable name
\param value variable value
*/
-void G__setenv(const char *name, const char *value)
+void G_setenv_nogisrc(const char *name, const char *value)
{
read_env(G_VAR_GISRC);
set_env(name, value, G_VAR_GISRC);
@@ -458,7 +458,7 @@
\param value variable value
\param loc location (G_VAR_GISRC, G_VAR_MAPSET)
*/
-void G__setenv2(const char *name, const char *value, int loc)
+void G_setenv_nogisrc2(const char *name, const char *value, int loc)
{
read_env(loc);
set_env(name, value, loc);
Modified: grass/trunk/lib/gis/make_loc.c
===================================================================
--- grass/trunk/lib/gis/make_loc.c 2014-12-29 17:12:57 UTC (rev 63829)
+++ grass/trunk/lib/gis/make_loc.c 2014-12-29 18:09:10 UTC (rev 63830)
@@ -71,8 +71,8 @@
}
/* make these the new current location and mapset */
- G__setenv("LOCATION_NAME", location_name);
- G__setenv("MAPSET", "PERMANENT");
+ G_setenv_nogisrc("LOCATION_NAME", location_name);
+ G_setenv_nogisrc("MAPSET", "PERMANENT");
/* Create the default, and current window files */
G_put_element_window(wind, "", "DEFAULT_WIND");
Modified: grass/trunk/lib/gis/make_mapset.c
===================================================================
--- grass/trunk/lib/gis/make_mapset.c 2014-12-29 17:12:57 UTC (rev 63829)
+++ grass/trunk/lib/gis/make_mapset.c 2014-12-29 18:09:10 UTC (rev 63830)
@@ -74,13 +74,13 @@
G_create_alt_env();
/* Get PERMANENT default window */
- G__setenv("GISDBASE", gisdbase_name);
- G__setenv("LOCATION", location_name);
- G__setenv("MAPSET", "PERMANENT");
+ G_setenv_nogisrc("GISDBASE", gisdbase_name);
+ G_setenv_nogisrc("LOCATION", location_name);
+ G_setenv_nogisrc("MAPSET", "PERMANENT");
G_get_default_window(&default_window);
/* Change to the new mapset */
- G__setenv("MAPSET", mapset_name);
+ G_setenv_nogisrc("MAPSET", mapset_name);
/* Copy default window/regions to new mapset */
G_put_element_window(&default_window, "", "WIND");
Modified: grass/trunk/lib/gis/mapset.c
===================================================================
--- grass/trunk/lib/gis/mapset.c 2014-12-29 17:12:57 UTC (rev 63829)
+++ grass/trunk/lib/gis/mapset.c 2014-12-29 18:09:10 UTC (rev 63830)
@@ -50,7 +50,7 @@
*/
const char *G__mapset(void)
{
- return G__getenv("MAPSET");
+ return G_getenv_nofatal("MAPSET");
}
/*!
Modified: grass/trunk/lib/gis/overwrite.c
===================================================================
--- grass/trunk/lib/gis/overwrite.c 2014-12-29 17:12:57 UTC (rev 63829)
+++ grass/trunk/lib/gis/overwrite.c 2014-12-29 18:09:10 UTC (rev 63830)
@@ -37,7 +37,7 @@
int overwrite;
overwrite = 0;
- if ((overstr = G__getenv("OVERWRITE"))) {
+ if ((overstr = G_getenv_nofatal("OVERWRITE"))) {
overwrite = atoi(overstr);
}
@@ -59,7 +59,7 @@
}
}
- G__setenv("OVERWRITE", "1");
+ G_setenv_nogisrc("OVERWRITE", "1");
return overwrite;
}
Modified: grass/trunk/lib/gis/parser.c
===================================================================
--- grass/trunk/lib/gis/parser.c 2014-12-29 17:12:57 UTC (rev 63829)
+++ grass/trunk/lib/gis/parser.c 2014-12-29 18:09:10 UTC (rev 63830)
@@ -1424,7 +1424,7 @@
over = 0;
/* Check the GRASS OVERWRITE variable */
- if ((overstr = G__getenv("OVERWRITE"))) {
+ if ((overstr = G_getenv_nofatal("OVERWRITE"))) {
over = atoi(overstr);
}
Modified: grass/trunk/lib/temporal/lib/connect.c
===================================================================
--- grass/trunk/lib/temporal/lib/connect.c 2014-12-29 17:12:57 UTC (rev 63829)
+++ grass/trunk/lib/temporal/lib/connect.c 2014-12-29 18:09:10 UTC (rev 63830)
@@ -25,7 +25,7 @@
{
const char *drv;
- if ((drv = G__getenv2("TGISDB_DRIVER", G_VAR_MAPSET)))
+ if ((drv = G_getenv_nofatal2("TGISDB_DRIVER", G_VAR_MAPSET)))
return G_store(drv);
return NULL;
@@ -41,7 +41,7 @@
{
const char *drv;
- if ((drv = G__getenv2("TGISDB_DATABASE", G_VAR_MAPSET)))
+ if ((drv = G_getenv_nofatal2("TGISDB_DATABASE", G_VAR_MAPSET)))
return G_store(drv);
return NULL;
@@ -78,8 +78,8 @@
{
G_zero(connection, sizeof(dbConnection));
- connection->driverName = (char *)G__getenv2("TGISDB_DRIVER", G_VAR_MAPSET);
- connection->databaseName = (char *)G__getenv2("TGISDB_DATABASE", G_VAR_MAPSET);
+ connection->driverName = (char *)G_getenv_nofatal2("TGISDB_DRIVER", G_VAR_MAPSET);
+ connection->databaseName = (char *)G_getenv_nofatal2("TGISDB_DATABASE", G_VAR_MAPSET);
return DB_OK;
}
@@ -91,8 +91,8 @@
{
const char *val = NULL;
char *ret_val = NULL;;
- const char *gisdbase = G__getenv("GISDBASE");
- const char *location = G__getenv("LOCATION_NAME");
+ const char *gisdbase = G_getenv_nofatal("GISDBASE");
+ const char *location = G_getenv_nofatal("LOCATION_NAME");
int ret;
ret = G__mapset_permissions2(gisdbase, location, mapset);
@@ -110,16 +110,16 @@
}
G_create_alt_env();
- G__setenv("GISDBASE", gisdbase);
- G__setenv("LOCATION_NAME", location);
- G__setenv("MAPSET", mapset);
+ G_setenv_nogisrc("GISDBASE", gisdbase);
+ G_setenv_nogisrc("LOCATION_NAME", location);
+ G_setenv_nogisrc("MAPSET", mapset);
G__read_mapset_env();
if(contype == DATABASE_NAME) {
- if ((val = G__getenv2("TGISDB_DATABASE", G_VAR_MAPSET)))
+ if ((val = G_getenv_nofatal2("TGISDB_DATABASE", G_VAR_MAPSET)))
ret_val = G_store(val);
} else if(contype == DRIVER_NAME) {
- if ((val = G__getenv2("TGISDB_DRIVER", G_VAR_MAPSET)))
+ if ((val = G_getenv_nofatal2("TGISDB_DRIVER", G_VAR_MAPSET)))
ret_val = G_store(val);
}
Modified: grass/trunk/lib/vector/Vlib/intersect.c
===================================================================
--- grass/trunk/lib/vector/Vlib/intersect.c 2014-12-29 17:12:57 UTC (rev 63829)
+++ grass/trunk/lib/vector/Vlib/intersect.c 2014-12-29 18:09:10 UTC (rev 63830)
@@ -579,7 +579,7 @@
struct bound_box box, abbox;
if (debug_level == -1) {
- const char *dstr = G__getenv("DEBUG");
+ const char *dstr = G_getenv_nofatal("DEBUG");
if (dstr != NULL)
debug_level = atoi(dstr);
Modified: grass/trunk/lib/vector/Vlib/intersect2.c
===================================================================
--- grass/trunk/lib/vector/Vlib/intersect2.c 2014-12-29 17:12:57 UTC (rev 63829)
+++ grass/trunk/lib/vector/Vlib/intersect2.c 2014-12-29 18:09:10 UTC (rev 63830)
@@ -586,7 +586,7 @@
int same = 0;
if (debug_level == -1) {
- const char *dstr = G__getenv("DEBUG");
+ const char *dstr = G_getenv_nofatal("DEBUG");
if (dstr != NULL)
debug_level = atoi(dstr);
Modified: grass/trunk/lib/vector/Vlib/sindex.c
===================================================================
--- grass/trunk/lib/vector/Vlib/sindex.c 2014-12-29 17:12:57 UTC (rev 63829)
+++ grass/trunk/lib/vector/Vlib/sindex.c 2014-12-29 18:09:10 UTC (rev 63830)
@@ -129,7 +129,7 @@
static int debug_level = -1;
if (debug_level == -1) {
- const char *dstr = G__getenv("DEBUG");
+ const char *dstr = G_getenv_nofatal("DEBUG");
if (dstr != NULL)
debug_level = atoi(dstr);
Modified: grass/trunk/lib/vector/diglib/file.c
===================================================================
--- grass/trunk/lib/vector/diglib/file.c 2014-12-29 17:12:57 UTC (rev 63829)
+++ grass/trunk/lib/vector/diglib/file.c 2014-12-29 18:09:10 UTC (rev 63830)
@@ -200,7 +200,7 @@
/* Get mode */
mode = GV_MEMORY_NEVER;
- cmode = G__getenv("GV_MEMORY");
+ cmode = G_getenv_nofatal("GV_MEMORY");
if (cmode != NULL) {
if (G_strcasecmp(cmode, "ALWAYS") == 0)
mode = GV_MEMORY_ALWAYS;
Modified: grass/trunk/lib/vector/diglib/plus_area.c
===================================================================
--- grass/trunk/lib/vector/diglib/plus_area.c 2014-12-29 17:12:57 UTC (rev 63829)
+++ grass/trunk/lib/vector/diglib/plus_area.c 2014-12-29 18:09:10 UTC (rev 63830)
@@ -62,7 +62,7 @@
int node;
if (debug_level == -1) {
- const char *dstr = G__getenv("DEBUG");
+ const char *dstr = G_getenv_nofatal("DEBUG");
if (dstr != NULL)
debug_level = atoi(dstr);
@@ -260,7 +260,7 @@
G_debug(3, "dig_area_add_isle(): area = %d isle = %d", area, isle);
if (debug_level == -1) {
- const char *dstr = G__getenv("DEBUG");
+ const char *dstr = G_getenv_nofatal("DEBUG");
if (dstr != NULL)
debug_level = atoi(dstr);
@@ -472,7 +472,7 @@
struct P_line *Line;
if (debug_level == -1) {
- const char *dstr = G__getenv("DEBUG");
+ const char *dstr = G_getenv_nofatal("DEBUG");
if (dstr != NULL)
debug_level = atoi(dstr);
More information about the grass-commit
mailing list