From: Sandro Santilli Date: Fri, 8 Jul 2016 16:37:58 +0000 (+0000) Subject: Added end-of-options flag '--' to shp2pgsql-cli arguments parser X-Git-Tag: 2.3.0beta1~49 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d1f34811c53162dc3dbdc726bb9c8d04ea62bc8a;p=postgis Added end-of-options flag '--' to shp2pgsql-cli arguments parser Patch by Jörg Habenicht git-svn-id: http://svn.osgeo.org/postgis/trunk@14993 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/loader/shp2pgsql-cli.c b/loader/shp2pgsql-cli.c index 8abc0af5d..d753b3b01 100644 --- a/loader/shp2pgsql-cli.c +++ b/loader/shp2pgsql-cli.c @@ -64,6 +64,7 @@ usage() printf(_( " -X Specify the tablespace for the table's indexes.\n" " This applies to the primary key, and the spatial index if\n" " the -I flag is used.\n" )); + printf(_( " -- End of options. Use this for unusual file names starting with '-' \n" )); printf(_( " -? Display this help screen.\n" )); } @@ -95,8 +96,12 @@ main (int argc, char **argv) set_loader_config_defaults(config); /* Keep the flag list alphabetic so it's easy to see what's left. */ - while ((c = pgis_getopt(argc, argv, "acdeg:ikm:nps:t:wDGIN:ST:W:X:")) != EOF) + while ((c = pgis_getopt(argc, argv, "-acdeg:ikm:nps:t:wDGIN:ST:W:X:")) != EOF) { + // can not do this inside the switch case + if ('-' == c) + break; + switch (c) { case 'c':