[GRASS-SVN] r38436 - in grass/branches/develbranch_6: display/d.mon/cmd general/g.mapsets lib/db/dbmi_base raster/r.topmodel raster/r.watershed/front raster/r.watershed/shed

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jul 16 08:32:56 EDT 2009


Author: marisn
Date: 2009-07-16 08:32:55 -0400 (Thu, 16 Jul 2009)
New Revision: 38436

Modified:
   grass/branches/develbranch_6/display/d.mon/cmd/main.c
   grass/branches/develbranch_6/general/g.mapsets/g.mapsets.tcl
   grass/branches/develbranch_6/lib/db/dbmi_base/dbmscap.c
   grass/branches/develbranch_6/raster/r.topmodel/misc.c
   grass/branches/develbranch_6/raster/r.watershed/front/main.c
   grass/branches/develbranch_6/raster/r.watershed/shed/com_line.c
Log:
Quote GISBASE to allow spaces in it

Modified: grass/branches/develbranch_6/display/d.mon/cmd/main.c
===================================================================
--- grass/branches/develbranch_6/display/d.mon/cmd/main.c	2009-07-16 11:00:51 UTC (rev 38435)
+++ grass/branches/develbranch_6/display/d.mon/cmd/main.c	2009-07-16 12:32:55 UTC (rev 38436)
@@ -152,6 +152,6 @@
 {
     char command[1024];
 
-    sprintf(command, "%s/etc/mon.%s %s", G_gisbase(), pgm, name);
+    sprintf(command, "\"%s/etc/mon.%s\" %s", G_gisbase(), pgm, name);
     return system(command);
 }

Modified: grass/branches/develbranch_6/general/g.mapsets/g.mapsets.tcl
===================================================================
--- grass/branches/develbranch_6/general/g.mapsets/g.mapsets.tcl	2009-07-16 11:00:51 UTC (rev 38435)
+++ grass/branches/develbranch_6/general/g.mapsets/g.mapsets.tcl	2009-07-16 12:32:55 UTC (rev 38436)
@@ -5,7 +5,7 @@
 # Put current mapset and PERMANENT at the top of the list, mapsets are later written to SEARCH_PATH
 # and searched in this order
 
-lappend auto_path $env(GISBASE)/bwidget
+lappend auto_path "$env(GISBASE)/bwidget"
 package require -exact BWidget 1.2.1
 
 set env(GISDBASE) [exec g.gisenv get=GISDBASE]
@@ -13,7 +13,7 @@
 set env(MAPSET) [exec g.gisenv get=MAPSET]
 
 # Include the select dialog code because it defines scroll bindings
-source $env(GISBASE)/etc/gtcltk/select.tcl
+source "$env(GISBASE)/etc/gtcltk/select.tcl"
 
 proc set_mapsets { } {
     global ms_ch ms_name nms

Modified: grass/branches/develbranch_6/lib/db/dbmi_base/dbmscap.c
===================================================================
--- grass/branches/develbranch_6/lib/db/dbmi_base/dbmscap.c	2009-07-16 11:00:51 UTC (rev 38435)
+++ grass/branches/develbranch_6/lib/db/dbmi_base/dbmscap.c	2009-07-16 12:32:55 UTC (rev 38436)
@@ -172,11 +172,11 @@
 	name = G_str_replace(ent->d_name, ".exe", "");
 
 #ifdef __MINGW32__
-	dirpath = G_malloc(strlen("\\driver\\db\\")
+	dirpath = G_malloc(strlen("\"\\driver\\db\\\"")
 			   + strlen(G_gisbase()) + strlen(ent->d_name) + 1);
-	sprintf(dirpath, "%s\\driver\\db\\%s", G_gisbase(), ent->d_name);
+	sprintf(dirpath, "\"%s\\driver\\db\\%s\"", G_gisbase(), ent->d_name);
 #else
-	G_asprintf(&dirpath, "%s/driver/db/%s", G_gisbase(), ent->d_name);
+	G_asprintf(&dirpath, "\"%s/driver/db/%s\"", G_gisbase(), ent->d_name);
 #endif
 	add_entry(&list, name, dirpath, "");
 	G_free(name);

Modified: grass/branches/develbranch_6/raster/r.topmodel/misc.c
===================================================================
--- grass/branches/develbranch_6/raster/r.topmodel/misc.c	2009-07-16 11:00:51 UTC (rev 38435)
+++ grass/branches/develbranch_6/raster/r.topmodel/misc.c	2009-07-16 12:32:55 UTC (rev 38436)
@@ -37,7 +37,7 @@
     }
 
     if (hdmap) {
-	sprintf(buf, "%s/bin/g.region rast=%s --quiet", gisbase, hdmap);
+	sprintf(buf, "\"%s/bin/g.region\" rast=%s --quiet", gisbase, hdmap);
 	G_message("g.region rast=%s ... ", hdmap);
 
 	if (run(buf))
@@ -48,7 +48,7 @@
 
 void depressionless(void)
 {
-    sprintf(buf, "%s/bin/r.fill.dir "
+    sprintf(buf, "\"%s/bin/r.fill.dir\" "
 	    "input=%s elev=%s dir=%s type=grass --quiet",
 	    gisbase, map.elev, map.fill, map.dir);
     G_message("r.fill.dir input=%s elev=%s dir=%s type=grass ... ",
@@ -68,7 +68,7 @@
 {
     /* be quiet */
 /*    G_putenv("GRASS_VERBOSE", "0");   how to unset in a cross-platform way afterwards? */
-    sprintf(buf, "%s/bin/r.mapcalc "
+    sprintf(buf, "\"%s/bin/r.mapcalc\" "
 	    "'%s = if(%s == 0 || isnull(%s), null(), %s)'",
 	    gisbase, map.belev, map.basin, map.basin, map.elev);
 
@@ -86,7 +86,7 @@
 void top_index(void)
 {
     if (map.belev) {
-	sprintf(buf, "%s/bin/r.topidx "
+	sprintf(buf, "\"%s/bin/r.topidx\" "
 		"input=%s output=%s --quiet",
 		gisbase, map.belev, map.topidx);
 	G_message("r.topidx input=%s output=%s ... ", map.belev, map.topidx);
@@ -96,7 +96,7 @@
     }
 
     if (map.topidx) {
-	sprintf(buf, "%s/bin/r.stats -Anc "
+	sprintf(buf, "\"%s/bin/r.stats\" -Anc "
 		"input=%s nsteps=%d > %s",
 		gisbase, map.topidx, misc.nidxclass, file.idxstats);
 	G_message("r.stats -Anc input=%s nsteps=%d > %s ... ",

Modified: grass/branches/develbranch_6/raster/r.watershed/front/main.c
===================================================================
--- grass/branches/develbranch_6/raster/r.watershed/front/main.c	2009-07-16 11:00:51 UTC (rev 38435)
+++ grass/branches/develbranch_6/raster/r.watershed/front/main.c	2009-07-16 12:32:55 UTC (rev 38436)
@@ -264,12 +264,12 @@
     }
 
     /* Build command line */
-    sprintf(command, "%s/etc/", G_gisbase());
+    sprintf(command, "\"%s/etc/", G_gisbase());
 
     if (flag_seg->answer)
-	strcat(command, "r.watershed.seg");
+	strcat(command, "r.watershed.seg\"");
     else
-	strcat(command, "r.watershed.ram");
+	strcat(command, "r.watershed.ram\"");
 
     if (!flag_mfd->answer) {
 	strcat(command, " -s");

Modified: grass/branches/develbranch_6/raster/r.watershed/shed/com_line.c
===================================================================
--- grass/branches/develbranch_6/raster/r.watershed/shed/com_line.c	2009-07-16 11:00:51 UTC (rev 38435)
+++ grass/branches/develbranch_6/raster/r.watershed/shed/com_line.c	2009-07-16 12:32:55 UTC (rev 38436)
@@ -44,7 +44,7 @@
 	input->com_line_ram = (char *)G_calloc(400, sizeof(char));
 	prog_name = G_store(RAM_NAME);
 	sprintf(input->com_line_ram,
-		"%s/etc/water/%s", G_getenv("GISBASE"), RAM_NAME);
+		"\"%s/etc/water/%s\"", G_getenv("GISBASE"), RAM_NAME);
 	fprintf(stderr,
 		"\nIf there is not enough ram for the fast mode (%s) to run,\n",
 		RAM_NAME);
@@ -53,7 +53,7 @@
 	    input->slow = 1;
 	    input->com_line_seg = (char *)G_calloc(400, sizeof(char));
 	    sprintf(input->com_line_seg,
-		    "%s/etc/water/%s", G_getenv("GISBASE"), SEG_NAME);
+		    "\"%s/etc/water/%s\"", G_getenv("GISBASE"), SEG_NAME);
 	}
     }
     else {
@@ -61,7 +61,7 @@
 	prog_name = G_store(SEG_NAME);
 	input->com_line_seg = (char *)G_calloc(400, sizeof(char));
 	sprintf(input->com_line_seg,
-		"%s/etc/water/%s", G_getenv("GISBASE"), SEG_NAME);
+		"\"%s/etc/water/%s\"", G_getenv("GISBASE"), SEG_NAME);
     }
 
     G_message(_("\nIf you hit <return> by itself for the next question, this"));



More information about the grass-commit mailing list