[GRASS-SVN] r51116 - grass/trunk/vector/v.external.out
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Mar 19 19:58:34 EDT 2012
Author: martinl
Date: 2012-03-19 16:58:34 -0700 (Mon, 19 Mar 2012)
New Revision: 51116
Modified:
grass/trunk/vector/v.external.out/main.c
Log:
v.external.out: be friendly, ignored 'PG:' prefix for PostGIS format
Modified: grass/trunk/vector/v.external.out/main.c
===================================================================
--- grass/trunk/vector/v.external.out/main.c 2012-03-19 21:39:40 UTC (rev 51115)
+++ grass/trunk/vector/v.external.out/main.c 2012-03-19 23:58:34 UTC (rev 51116)
@@ -63,9 +63,27 @@
if (options.format->answer)
check_format(options.format->answer);
- if (options.dsn->answer)
- make_link(options.dsn->answer, options.format->answer,
+ if (options.dsn->answer) {
+ char *dsn;
+
+ /* be friendly, ignored 'PG:' prefix for PostGIS format */
+ if (strcmp(options.format->answer, "PostGIS") == 0 &&
+ G_strncasecmp(options.dsn->answer, "PG:", 3) == 0) {
+ int i, length;
+
+ length = strlen(options.dsn->answer);
+ dsn = (char *) G_malloc(length - 3);
+ for (i = 3; i < length; i++)
+ dsn[i-3] = options.dsn->answer[i];
+ dsn[length-3] = '\0';
+ }
+ else {
+ dsn = G_store(options.dsn->answer);
+ }
+
+ make_link(dsn, options.format->answer,
options.opts->answer, options.opts->answers);
+ }
if (flags.p->answer || flags.g->answer) {
print_status(flags.g->answer ? 1 : 0);
More information about the grass-commit
mailing list