[GRASS-SVN] r61345 - in grass/branches/releasebranch_7_0/vector: v.db.connect v.out.ascii v.rectify v.vect.stats
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Jul 22 14:45:53 PDT 2014
Author: neteler
Date: 2014-07-22 14:45:53 -0700 (Tue, 22 Jul 2014)
New Revision: 61345
Modified:
grass/branches/releasebranch_7_0/vector/v.db.connect/main.c
grass/branches/releasebranch_7_0/vector/v.out.ascii/args.c
grass/branches/releasebranch_7_0/vector/v.rectify/main.c
grass/branches/releasebranch_7_0/vector/v.vect.stats/main.c
Log:
v.rectify, v.vect.stats, v.out.ascii, v.db.connect: use G_option_to_separator() (backport from trunk)
Modified: grass/branches/releasebranch_7_0/vector/v.db.connect/main.c
===================================================================
--- grass/branches/releasebranch_7_0/vector/v.db.connect/main.c 2014-07-22 21:45:13 UTC (rev 61344)
+++ grass/branches/releasebranch_7_0/vector/v.db.connect/main.c 2014-07-22 21:45:53 UTC (rev 61345)
@@ -44,6 +44,7 @@
int field, ret, num_dblinks, i, ncols, col;
char *fieldname;
struct Map_info Map;
+ char *sep;
/* set up the options and flags for the command line parser */
@@ -142,6 +143,8 @@
}
G_debug(1, "layer number %d, layer name %s", field, fieldname);
+ sep = G_option_to_separator(sep_opt);
+
if (print->answer && shell_print->answer)
G_fatal_error(_("Please choose only one print style"));
@@ -176,9 +179,6 @@
G_fatal_error(_("Database connection not defined"));
if (shell_print->answer) {
- const char *sep = sep_opt->answer;
- if (!sep)
- sep = "|";
if (fi->name)
fprintf(stdout, "%d/%s%s%s%s%s%s%s%s%s\n",
fi->number, fi->name, sep,
Modified: grass/branches/releasebranch_7_0/vector/v.out.ascii/args.c
===================================================================
--- grass/branches/releasebranch_7_0/vector/v.out.ascii/args.c 2014-07-22 21:45:13 UTC (rev 61344)
+++ grass/branches/releasebranch_7_0/vector/v.out.ascii/args.c 2014-07-22 21:45:53 UTC (rev 61345)
@@ -107,18 +107,10 @@
*format = GV_ASCII_FORMAT_WKT;
if (sscanf(dp_opt->answer, "%d", dp) != 1)
G_fatal_error(_("Failed to interpret 'dp' parameter as an integer"));
+
/* the field separator */
- if (strcmp(delim_opt->answer, "\\t") == 0)
- *delim = G_store("\t");
- else if (strcmp(delim_opt->answer, "tab") == 0)
- *delim = G_store("\t");
- else if (strcmp(delim_opt->answer, "space") == 0)
- *delim = G_store(" ");
- else if (strcmp(delim_opt->answer, "comma") == 0)
- *delim = G_store(",");
- else
- *delim = G_store(delim_opt->answer);
-
+ *delim = G_option_to_separator(delim_opt);
+
*field = G_store(field_opt->answer);
*type = Vect_option_to_types(type_opt);
if (*type & GV_AREA) {
Modified: grass/branches/releasebranch_7_0/vector/v.rectify/main.c
===================================================================
--- grass/branches/releasebranch_7_0/vector/v.rectify/main.c 2014-07-22 21:45:13 UTC (rev 61344)
+++ grass/branches/releasebranch_7_0/vector/v.rectify/main.c 2014-07-22 21:45:53 UTC (rev 61345)
@@ -157,21 +157,8 @@
orthorot = ortho->answer;
- if (print_rms->answer) {
- if (sep->answer) {
- rms_sep = sep->answer;
- if (strcmp(rms_sep, "\\t") == 0)
- rms_sep = "\t";
- if (strcmp(rms_sep, "tab") == 0)
- rms_sep = "\t";
- if (strcmp(rms_sep, "space") == 0)
- rms_sep = " ";
- if (strcmp(rms_sep, "comma") == 0)
- rms_sep = ",";
- }
- else
- rms_sep = "|";
- }
+ if (print_rms->answer)
+ rms_sep = G_option_to_separator(sep);
else
rms_sep = NULL;
Modified: grass/branches/releasebranch_7_0/vector/v.vect.stats/main.c
===================================================================
--- grass/branches/releasebranch_7_0/vector/v.vect.stats/main.c 2014-07-22 21:45:13 UTC (rev 61344)
+++ grass/branches/releasebranch_7_0/vector/v.vect.stats/main.c 2014-07-22 21:45:53 UTC (rev 61345)
@@ -93,7 +93,7 @@
*stats_column_opt, /* area column for stats result */
*fs_opt; /* field separator for printed output */
struct Flag *print_flag;
- char fs[2];
+ char *fs;
struct Map_info PIn, AIn;
int point_type, point_field, area_field;
struct line_pnts *Points;
@@ -215,22 +215,11 @@
point_field = atoi(point_field_opt->answer);
area_field = atoi(area_field_opt->answer);
- strcpy(fs, " ");
- if (print_flag->answer) {
+ if (print_flag->answer)
/* get field separator */
- if (fs_opt->answer) {
- if (strcmp(fs_opt->answer, "space") == 0)
- *fs = ' ';
- else if (strcmp(fs_opt->answer, "tab") == 0)
- *fs = '\t';
- else if (strcmp(fs_opt->answer, "\\t") == 0)
- *fs = '\t';
- else
- *fs = *fs_opt->answer;
- }
- else
- *fs = '|';
- }
+ fs = G_option_to_separator(fs_opt);
+ else
+ fs = NULL;
/* check for stats */
if (method_opt->answer) {
More information about the grass-commit
mailing list