]> granicus.if.org Git - postgis/commitdiff
Added end-of-options flag '--' to shp2pgsql-cli arguments parser
authorSandro Santilli <strk@keybit.net>
Fri, 8 Jul 2016 16:37:58 +0000 (16:37 +0000)
committerSandro Santilli <strk@keybit.net>
Fri, 8 Jul 2016 16:37:58 +0000 (16:37 +0000)
Patch by Jörg Habenicht <jh@mwerk.net>

git-svn-id: http://svn.osgeo.org/postgis/trunk@14993 b70326c6-7e19-0410-871a-916f4a2858ee

loader/shp2pgsql-cli.c

index 8abc0af5d3a2cba66d06e64c52e3b77467a4f566..d753b3b01e5315303dbbc32cc025999117d99fa8 100644 (file)
@@ -64,6 +64,7 @@ usage()
        printf(_( "  -X <tablespace> 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':