[GRASS-SVN] r54961 - in grass/trunk: db/db.select raster/r.category raster/r.what vector/v.to.db
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Feb 6 10:08:02 PST 2013
Author: martinl
Date: 2013-02-06 10:08:02 -0800 (Wed, 06 Feb 2013)
New Revision: 54961
Modified:
grass/trunk/db/db.select/main.c
grass/trunk/raster/r.category/main.c
grass/trunk/raster/r.what/main.c
grass/trunk/vector/v.to.db/global.h
grass/trunk/vector/v.to.db/report.c
Log:
update modules which are using G_option_to_separator() to support multi-character separators
@todo change rest of modules which have separator as one of the options to use G_option_to_separator()
Modified: grass/trunk/db/db.select/main.c
===================================================================
--- grass/trunk/db/db.select/main.c 2013-02-06 18:04:38 UTC (rev 54960)
+++ grass/trunk/db/db.select/main.c 2013-02-06 18:08:02 UTC (rev 54961)
@@ -27,7 +27,7 @@
#include "local_proto.h"
struct {
- char *driver, *database, *table, *sql, fs, vs, *nv, *input, *output;
+ char *driver, *database, *table, *sql, *fs, *vs, *nv, *input, *output;
int c, d, h, test_only;
} parms;
@@ -141,7 +141,7 @@
for (col = 0; col < ncols; col++) {
column = db_get_table_column(table, col);
if (col)
- fprintf(stdout, "%c", parms.fs);
+ fprintf(stdout, "%s", parms.fs);
fprintf(stdout, "%s", db_get_column_name(column));
}
fprintf(stdout, "\n");
@@ -159,9 +159,9 @@
value = db_get_column_value(column);
db_convert_column_value_to_string(column, &value_string);
if (parms.c && !parms.h)
- fprintf(stdout, "%s%c", db_get_column_name(column), parms.fs);
+ fprintf(stdout, "%s%s", db_get_column_name(column), parms.fs);
if (col && parms.h)
- fprintf(stdout, "%c", parms.fs);
+ fprintf(stdout, "%s", parms.fs);
if (parms.nv && db_test_value_isnull(value))
fprintf(stdout, "%s", parms.nv);
else
@@ -172,7 +172,7 @@
if (parms.h)
fprintf(stdout, "\n");
else if (parms.vs)
- fprintf(stdout, "%c\n", parms.vs);
+ fprintf(stdout, "%s\n", parms.vs);
}
return OK;
Modified: grass/trunk/raster/r.category/main.c
===================================================================
--- grass/trunk/raster/r.category/main.c 2013-02-06 18:04:38 UTC (rev 54960)
+++ grass/trunk/raster/r.category/main.c 2013-02-06 18:08:02 UTC (rev 54961)
@@ -25,14 +25,14 @@
#include <grass/glocale.h>
#include "local_proto.h"
-static char fs = '\t';
static struct Categories cats;
+static char *fs;
-
int main(int argc, char *argv[])
{
const char *name;
const char *mapset;
+
long x, y;
double dx;
RASTER_MAP_TYPE map_type;
@@ -287,7 +287,7 @@
char *label;
G_squeeze(label = Rast_get_c_cat((CELL *) &x, &cats));
- fprintf(stdout, "%ld%c%s\n", x, fs, label);
+ fprintf(stdout, "%ld%s%s\n", x, fs, label);
return 0;
}
@@ -301,7 +301,7 @@
G_squeeze(label = Rast_get_d_cat(&dtmp, &cats));
sprintf(tmp, "%.10f", x);
G_trim_decimal(tmp);
- fprintf(stdout, "%s%c%s\n", tmp, fs, label);
+ fprintf(stdout, "%s%s%s\n", tmp, fs, label);
return 0;
}
Modified: grass/trunk/raster/r.what/main.c
===================================================================
--- grass/trunk/raster/r.what/main.c 2013-02-06 18:04:38 UTC (rev 54960)
+++ grass/trunk/raster/r.what/main.c 2013-02-06 18:08:02 UTC (rev 54961)
@@ -75,7 +75,7 @@
struct _flg {
struct Flag *label, *cache, *cat_int, *color, *header;
} flg;
- char fs;
+ char *fs;
int Cache_size;
int done = FALSE;
int point, point_cnt;
@@ -230,19 +230,19 @@
/* print header row */
if(flg.header->answer) {
- fprintf(stdout, "easting%cnorthing%csite_name", fs, fs);
+ fprintf(stdout, "easting%snorthing%ssite_name", fs, fs);
ptr = opt.input->answers;
for (; *ptr != NULL; ptr++) {
char name[GNAME_MAX];
strcpy(name, *ptr);
- fprintf(stdout, "%c%s", fs, name);
+ fprintf(stdout, "%s%s", fs, name);
if (flg.label->answer)
- fprintf(stdout, "%c%s_label", fs, name);
+ fprintf(stdout, "%s%s_label", fs, name);
if (flg.color->answer)
- fprintf(stdout, "%c%s_color", fs, name);
+ fprintf(stdout, "%s%s_color", fs, name);
}
fprintf(stdout, "\n");
@@ -427,29 +427,29 @@
cache[point].col, cache[point].row);
- fprintf(stdout, "%s%c%s%c%s", cache[point].east_buf, fs,
+ fprintf(stdout, "%s%s%s%s%s", cache[point].east_buf, fs,
cache[point].north_buf, fs, cache[point].lab_buf);
for (i = 0; i < nfiles; i++) {
if (out_type[i] == CELL_TYPE) {
if (Rast_is_c_null_value(&cache[point].value[i])) {
- fprintf(stdout, "%c%s", fs, null_str);
+ fprintf(stdout, "%s%s", fs, null_str);
if (flg.label->answer)
- fprintf(stdout, "%c", fs);
+ fprintf(stdout, "%s", fs);
if (flg.color->answer)
- fprintf(stdout, "%c", fs);
+ fprintf(stdout, "%s", fs);
continue;
}
- fprintf(stdout, "%c%ld", fs, (long)cache[point].value[i]);
+ fprintf(stdout, "%s%ld", fs, (long)cache[point].value[i]);
}
else { /* FCELL or DCELL */
if (Rast_is_d_null_value(&cache[point].dvalue[i])) {
- fprintf(stdout, "%c%s", fs, null_str);
+ fprintf(stdout, "%s%s", fs, null_str);
if (flg.label->answer)
- fprintf(stdout, "%c", fs);
+ fprintf(stdout, "%s", fs);
if (flg.color->answer)
- fprintf(stdout, "%c", fs);
+ fprintf(stdout, "%s", fs);
continue;
}
if (out_type[i] == FCELL_TYPE)
@@ -457,13 +457,13 @@
else /* DCELL */
sprintf(tmp_buf, "%.15g", cache[point].dvalue[i]);
G_trim_decimal(tmp_buf); /* not needed with %g? */
- fprintf(stdout, "%c%s", fs, tmp_buf);
+ fprintf(stdout, "%s%s", fs, tmp_buf);
}
if (flg.label->answer)
- fprintf(stdout, "%c%s", fs,
+ fprintf(stdout, "%s%s", fs,
Rast_get_c_cat(&(cache[point].value[i]), &cats[i]));
if (flg.color->answer)
- fprintf(stdout, "%c%s", fs, cache[point].clr_buf[i]);
+ fprintf(stdout, "%s%s", fs, cache[point].clr_buf[i]);
}
fprintf(stdout, "\n");
}
Modified: grass/trunk/vector/v.to.db/global.h
===================================================================
--- grass/trunk/vector/v.to.db/global.h 2013-02-06 18:04:38 UTC (rev 54960)
+++ grass/trunk/vector/v.to.db/global.h 2013-02-06 18:08:02 UTC (rev 54961)
@@ -31,7 +31,7 @@
int total; /* print totals */
int units;
int qfield; /* query field */
- char fs;
+ char *fs;
};
extern struct options options;
Modified: grass/trunk/vector/v.to.db/report.c
===================================================================
--- grass/trunk/vector/v.to.db/report.c 2013-02-06 18:04:38 UTC (rev 54960)
+++ grass/trunk/vector/v.to.db/report.c 2013-02-06 18:08:02 UTC (rev 54961)
@@ -25,9 +25,9 @@
case O_COUNT:
if (options.print) {
if (G_verbose() > G_verbose_min())
- fprintf(stdout, "cat%ccount\n", options.fs);
+ fprintf(stdout, "cat%scount\n", options.fs);
for (i = 0; i < vstat.rcat; i++)
- fprintf(stdout, "%d%c%d\n", Values[i].cat, options.fs, Values[i].count1);
+ fprintf(stdout, "%d%s%d\n", Values[i].cat, options.fs, Values[i].count1);
}
if (options.total) {
int sum = 0;
@@ -35,16 +35,16 @@
for (i = 0; i < vstat.rcat; i++) {
sum += Values[i].count1;
}
- fprintf(stdout, "total count%c%d\n", options.fs, sum);
+ fprintf(stdout, "total count%s%d\n", options.fs, sum);
}
break;
case O_AREA:
if (options.print) {
if (G_verbose() > G_verbose_min())
- fprintf(stdout, "cat%carea\n", options.fs);
+ fprintf(stdout, "cat%sarea\n", options.fs);
for (i = 0; i < vstat.rcat; i++)
- fprintf(stdout, "%d%c%.15g\n", Values[i].cat, options.fs, Values[i].d1);
+ fprintf(stdout, "%d%s%.15g\n", Values[i].cat, options.fs, Values[i].d1);
}
if (options.total) {
double sum = 0.0;
@@ -52,30 +52,30 @@
for (i = 0; i < vstat.rcat; i++) {
sum += Values[i].d1;
}
- fprintf(stdout, "total area%c%.15g\n", options.fs, sum);
+ fprintf(stdout, "total area%s%.15g\n", options.fs, sum);
}
break;
case O_COMPACT:
if (G_verbose() > G_verbose_min())
- fprintf(stdout, "cat%ccompact\n", options.fs);
+ fprintf(stdout, "cat%scompact\n", options.fs);
for (i = 0; i < vstat.rcat; i++)
- fprintf(stdout, "%d%c%.15g\n", Values[i].cat, options.fs, Values[i].d1);
+ fprintf(stdout, "%d%s%.15g\n", Values[i].cat, options.fs, Values[i].d1);
break;
case O_PERIMETER:
if (G_verbose() > G_verbose_min())
- fprintf(stdout, "cat%cperimeter\n", options.fs);
+ fprintf(stdout, "cat%sperimeter\n", options.fs);
for (i = 0; i < vstat.rcat; i++)
- fprintf(stdout, "%d%c%.15g\n", Values[i].cat, options.fs, Values[i].d1);
+ fprintf(stdout, "%d%s%.15g\n", Values[i].cat, options.fs, Values[i].d1);
break;
case O_LENGTH:
if (options.print) {
if (G_verbose() > G_verbose_min())
- fprintf(stdout, "cat%clength\n", options.fs);
+ fprintf(stdout, "cat%slength\n", options.fs);
for (i = 0; i < vstat.rcat; i++)
- fprintf(stdout, "%d%c%.15g\n", Values[i].cat, options.fs, Values[i].d1);
+ fprintf(stdout, "%d%s%.15g\n", Values[i].cat, options.fs, Values[i].d1);
}
if (options.total) {
double sum = 0.0;
@@ -83,38 +83,38 @@
for (i = 0; i < vstat.rcat; i++) {
sum += Values[i].d1;
}
- fprintf(stdout, "total length%c%.15g\n", options.fs, sum);
+ fprintf(stdout, "total length%s%.15g\n", options.fs, sum);
}
break;
case O_SLOPE:
if (G_verbose() > G_verbose_min())
- fprintf(stdout, "cat%cslope\n", options.fs);
+ fprintf(stdout, "cat%sslope\n", options.fs);
for (i = 0; i < vstat.rcat; i++)
- fprintf(stdout, "%d%c%.15g\n", Values[i].cat, options.fs, Values[i].d1);
+ fprintf(stdout, "%d%s%.15g\n", Values[i].cat, options.fs, Values[i].d1);
break;
case O_SINUOUS:
if (G_verbose() > G_verbose_min())
- fprintf(stdout, "cat%csinuous\n", options.fs);
+ fprintf(stdout, "cat%ssinuous\n", options.fs);
for (i = 0; i < vstat.rcat; i++)
- fprintf(stdout, "%d%c%.15g\n", Values[i].cat, options.fs, Values[i].d1);
+ fprintf(stdout, "%d%s%.15g\n", Values[i].cat, options.fs, Values[i].d1);
break;
case O_COOR:
case O_START:
case O_END:
if (G_verbose() > G_verbose_min())
- fprintf(stdout, "cat%cx%cy%cz\n", options.fs, options.fs, options.fs);
+ fprintf(stdout, "cat%sx%sy%sz\n", options.fs, options.fs, options.fs);
for (i = 0; i < vstat.rcat; i++) {
if (Values[i].count1 == 1)
- fprintf(stdout, "%d%c%.15g%c%.15g%c%.15g\n", Values[i].cat, options.fs,
+ fprintf(stdout, "%d%s%.15g%s%.15g%s%.15g\n", Values[i].cat, options.fs,
Values[i].d1, options.fs, Values[i].d2, options.fs, Values[i].d3);
}
break;
case O_SIDES:
if (G_verbose() > G_verbose_min())
- fprintf(stdout, "cat%cleft%cright\n", options.fs, options.fs);
+ fprintf(stdout, "cat%sleft%sright\n", options.fs, options.fs);
for (i = 0; i < vstat.rcat; i++) {
if (Values[i].count1 == 1) {
if (Values[i].i1 >= 0)
@@ -145,13 +145,13 @@
sprintf(right, "-");
}
- fprintf(stdout, "%d%c%s%c%s\n", Values[i].cat, options.fs, left, options.fs, right);
+ fprintf(stdout, "%d%s%s%s%s\n", Values[i].cat, options.fs, left, options.fs, right);
}
break;
case O_QUERY:
if (G_verbose() > G_verbose_min())
- fprintf(stdout, "cat%cquery\n", options.fs);
+ fprintf(stdout, "cat%squery\n", options.fs);
for (i = 0; i < vstat.rcat; i++) {
if (Values[i].null) {
fprintf(stdout, "%d|-\n", Values[i].cat);
@@ -159,13 +159,13 @@
else {
switch (vstat.qtype) {
case (DB_C_TYPE_INT):
- fprintf(stdout, "%d%c%d\n", Values[i].cat, options.fs, Values[i].i1);
+ fprintf(stdout, "%d%s%d\n", Values[i].cat, options.fs, Values[i].i1);
break;
case (DB_C_TYPE_DOUBLE):
- fprintf(stdout, "%d%c%15g\n", Values[i].cat, options.fs, Values[i].d1);
+ fprintf(stdout, "%d%s%15g\n", Values[i].cat, options.fs, Values[i].d1);
break;
case (DB_C_TYPE_STRING):
- fprintf(stdout, "%d%c%s\n", Values[i].cat, options.fs, Values[i].str1);
+ fprintf(stdout, "%d%s%s\n", Values[i].cat, options.fs, Values[i].str1);
break;
}
}
@@ -173,9 +173,9 @@
break;
case O_AZIMUTH:
if (G_verbose() > G_verbose_min())
- fprintf(stdout, "cat%cazimuth\n", options.fs);
+ fprintf(stdout, "cat%sazimuth\n", options.fs);
for (i = 0; i < vstat.rcat; i++)
- fprintf(stdout, "%d%c%.15g\n", Values[i].cat, options.fs, Values[i].d1);
+ fprintf(stdout, "%d%s%.15g\n", Values[i].cat, options.fs, Values[i].d1);
break;
}
More information about the grass-commit
mailing list