[GRASS-SVN] r34735 - in grass/trunk/vector: v.db.connect v.lrs/v.lrs.create v.lrs/v.lrs.label v.lrs/v.lrs.segment v.lrs/v.lrs.where

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Dec 4 22:51:59 EST 2008


Author: glynn
Date: 2008-12-04 22:51:58 -0500 (Thu, 04 Dec 2008)
New Revision: 34735

Modified:
   grass/trunk/vector/v.db.connect/main.c
   grass/trunk/vector/v.lrs/v.lrs.create/main.c
   grass/trunk/vector/v.lrs/v.lrs.label/main.c
   grass/trunk/vector/v.lrs/v.lrs.segment/main.c
   grass/trunk/vector/v.lrs/v.lrs.where/main.c
Log:
Clean-up wrt db_get_default_*


Modified: grass/trunk/vector/v.db.connect/main.c
===================================================================
--- grass/trunk/vector/v.db.connect/main.c	2008-12-05 03:50:53 UTC (rev 34734)
+++ grass/trunk/vector/v.db.connect/main.c	2008-12-05 03:51:58 UTC (rev 34735)
@@ -42,7 +42,6 @@
     struct field_info *fi;
     int field, ret, num_dblinks, i, ncols, col;
     struct Map_info Map;
-    char *drv, *db;
 
     /* set up the options and flags for the command line parser */
 
@@ -55,12 +54,10 @@
 
     dbdriver = G_define_standard_option(G_OPT_DB_DRIVER);
     dbdriver->options = db_list_drivers();
-    if ((drv = G__getenv2("DB_DRIVER", G_VAR_MAPSET)))
-	dbdriver->answer = G_store(drv);
+    dbdriver->answer = db_get_default_driver_name();
 
     dbdatabase = G_define_standard_option(G_OPT_DB_DATABASE);
-    if ((db = G__getenv2("DB_DATABASE", G_VAR_MAPSET)))
-	dbdatabase->answer = G_store(db);
+    dbdatabase->answer = db_get_default_database_name();
 
     dbtable = G_define_standard_option(G_OPT_DB_TABLE);
 

Modified: grass/trunk/vector/v.lrs/v.lrs.create/main.c
===================================================================
--- grass/trunk/vector/v.lrs/v.lrs.create/main.c	2008-12-05 03:50:53 UTC (rev 34734)
+++ grass/trunk/vector/v.lrs/v.lrs.create/main.c	2008-12-05 03:51:58 UTC (rev 34735)
@@ -101,7 +101,6 @@
     struct GModule *module;
     const char *mapset;
     char buf[2000];
-    const char *drv, *db;
     struct Map_info In, Out, PMap, EMap;
     struct line_cats *LCats, *PCats;
     struct line_pnts *LPoints, *L2Points, *PPoints;
@@ -204,16 +203,15 @@
     driver_opt->type = TYPE_STRING;
     driver_opt->required = NO;
     driver_opt->description = _("Driver name for reference system table");
-    if ((drv = db_get_default_driver_name()))
-	driver_opt->answer = drv;
+    driver_opt->options = db_list_drivers();
+    driver_opt->answer = db_get_default_driver_name();
 
     database_opt = G_define_option();
     database_opt->key = "rsdatabase";
     database_opt->type = TYPE_STRING;
     database_opt->required = NO;
     database_opt->description = _("Database name for reference system table");
-    if ((db = db_get_default_database_name()))
-	database_opt->answer = db;
+    database_opt->answer = db_get_default_database_name();
 
     table_opt = G_define_option();
     table_opt->key = "rstable";

Modified: grass/trunk/vector/v.lrs/v.lrs.label/main.c
===================================================================
--- grass/trunk/vector/v.lrs/v.lrs.label/main.c	2008-12-05 03:50:53 UTC (rev 34734)
+++ grass/trunk/vector/v.lrs/v.lrs.label/main.c	2008-12-05 03:51:58 UTC (rev 34735)
@@ -80,7 +80,6 @@
     struct GModule *module;
     const char *mapset;
     char buf[2000];
-    const char *drv, *db;
     struct Map_info In, Out;
     struct line_cats *LCats, *SCats;
     struct line_pnts *LPoints, *SPoints;
@@ -121,16 +120,15 @@
     driver_opt->type = TYPE_STRING;
     driver_opt->required = NO;
     driver_opt->description = _("Driver name for reference system table");
-    if ((drv = db_get_default_driver_name()))
-	driver_opt->answer = drv;
+    driver_opt->options = db_list_drivers();
+    driver_opt->answer = db_get_default_driver_name();
 
     database_opt = G_define_option();
     database_opt->key = "rsdatabase";
     database_opt->type = TYPE_STRING;
     database_opt->required = NO;
     database_opt->description = _("Database name for reference system table");
-    if ((db = db_get_default_database_name()))
-	database_opt->answer = db;
+    database_opt->answer = db_get_default_database_name();
 
     table_opt = G_define_option();
     table_opt->key = "rstable";

Modified: grass/trunk/vector/v.lrs/v.lrs.segment/main.c
===================================================================
--- grass/trunk/vector/v.lrs/v.lrs.segment/main.c	2008-12-05 03:50:53 UTC (rev 34734)
+++ grass/trunk/vector/v.lrs/v.lrs.segment/main.c	2008-12-05 03:51:58 UTC (rev 34735)
@@ -57,7 +57,6 @@
     struct GModule *module;
     const char *mapset;
     char buf[2000];
-    const char *drv, *db;
     struct Map_info In, Out;
     struct line_cats *LCats, *SCats;
     struct line_pnts *LPoints, *SPoints, *PlPoints;
@@ -90,16 +89,15 @@
     driver_opt->type = TYPE_STRING;
     driver_opt->required = NO;
     driver_opt->description = _("Driver name for reference system table");
-    if ((drv = db_get_default_driver_name()))
-	driver_opt->answer = drv;
+    driver_opt->options = db_list_drivers();
+    driver_opt->answer = db_get_default_driver_name();
 
     database_opt = G_define_option();
     database_opt->key = "rsdatabase";
     database_opt->type = TYPE_STRING;
     database_opt->required = NO;
     database_opt->description = _("Database name for reference system table");
-    if ((db = db_get_default_database_name()))
-	database_opt->answer = db;
+    database_opt->answer = db_get_default_database_name();
 
     table_opt = G_define_option();
     table_opt->key = "rstable";

Modified: grass/trunk/vector/v.lrs/v.lrs.where/main.c
===================================================================
--- grass/trunk/vector/v.lrs/v.lrs.where/main.c	2008-12-05 03:50:53 UTC (rev 34734)
+++ grass/trunk/vector/v.lrs/v.lrs.where/main.c	2008-12-05 03:51:58 UTC (rev 34735)
@@ -44,7 +44,6 @@
     struct Option *driver_opt, *database_opt, *table_opt, *thresh_opt;
     struct GModule *module;
     const char *mapset;
-    const char *drv, *db;
     struct Map_info LMap, PMap;
     struct line_cats *LCats, *PCats;
     struct line_pnts *LPoints, *PPoints;
@@ -83,16 +82,15 @@
     driver_opt->type = TYPE_STRING;
     driver_opt->required = NO;
     driver_opt->description = _("Driver name for reference system table");
-    if ((drv = db_get_default_driver_name()))
-	driver_opt->answer = drv;
+    driver_opt->options = db_list_drivers();
+    driver_opt->answer = db_get_default_driver_name();
 
     database_opt = G_define_option();
     database_opt->key = "rsdatabase";
     database_opt->type = TYPE_STRING;
     database_opt->required = NO;
     database_opt->description = _("Database name for reference system table");
-    if ((db = db_get_default_database_name()))
-	database_opt->answer = db;
+    database_opt->answer = db_get_default_database_name();
 
     table_opt = G_define_option();
     table_opt->key = "rstable";



More information about the grass-commit mailing list