Show
Ignore:
Timestamp:
10/14/06 07:22:10 (6 years ago)
Author:
mschaber
Message:

sanitized usage info output on loader/dumper

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/loader/shp2pgsql.c

    r2512 r2513  
    107107void CreateTable(void); 
    108108void CreateIndex(void); 
    109 void usage(char *me, int exitcode); 
     109void usage(char *me, int exitcode, FILE* out); 
    110110void InsertPoint(void); 
    111111void InsertPointWKT(void); 
     
    382382         * Parse command line 
    383383         */ 
    384         if ( ! ParseCmdline(ARGC, ARGV) ) usage(ARGV[0], 2); 
     384        if ( ! ParseCmdline(ARGC, ARGV) ) usage(ARGV[0], 2, stderr); 
    385385 
    386386        /* 
     
    732732 
    733733void 
    734 usage(char *me, int exitcode) 
    735 { 
    736         fprintf(stderr, "RCSID: %s RELEASE: %s\n", rcsid, POSTGIS_VERSION); 
    737         fprintf(stderr, "USAGE: %s [<options>] <shapefile> [<schema>.]<table>\n", me); 
    738         fprintf(stderr, "\n"); 
    739         fprintf(stderr, "OPTIONS:\n"); 
    740         fprintf(stderr, "  -s <srid>  Set the SRID field. If not specified it defaults to -1.\n"); 
    741         fprintf(stderr, "\n"); 
    742         fprintf(stderr, "  (-d|a|c|p) These are mutually exclusive options:\n"); 
    743         fprintf(stderr, "      -d  Drops the table, then recreates it and populates\n"); 
    744         fprintf(stderr, "          it with current shape file data.\n"); 
    745         fprintf(stderr, "      -a  Appends shape file into current table, must be\n"); 
    746         fprintf(stderr, "          exactly the same table schema.\n"); 
    747         fprintf(stderr, "      -c  Creates a new table and populates it, this is the\n"); 
    748         fprintf(stderr, "          default if you do not specify any options.\n"); 
    749         fprintf(stderr, "      -p  Prepare mode, only creates the table\n"); 
    750         fprintf(stderr, "\n"); 
    751         fprintf(stderr, "  -g <geometry_column> Specify the name of the geometry column\n"); 
    752         fprintf(stderr, "     (mostly useful in append mode).\n"); 
    753         fprintf(stderr, "\n"); 
    754         fprintf(stderr, "  -D  Use postgresql dump format (defaults to sql insert\n"); 
    755         fprintf(stderr, "      statments.\n"); 
    756         fprintf(stderr, "\n"); 
    757         fprintf(stderr, "  -k  Keep postgresql identifiers case.\n"); 
    758         fprintf(stderr, "\n"); 
    759         fprintf(stderr, "  -i  Use int4 type for all integer dbf fields.\n"); 
    760         fprintf(stderr, "\n"); 
    761         fprintf(stderr, "  -I  Create a GiST index on the geometry column.\n"); 
    762         fprintf(stderr, "\n"); 
    763         fprintf(stderr, "  -S  Generate simple geometries instead of MULTI geometries.\n"); 
    764         fprintf(stderr, "\n"); 
    765         fprintf(stderr, "  -w  Use wkt format (for postgis-0.x support - drops M - drifts coordinates).\n"); 
     734usage(char *me, int exitcode, FILE* out) 
     735{ 
     736        fprintf(out, "RCSID: %s RELEASE: %s\n", rcsid, POSTGIS_VERSION); 
     737        fprintf(out, "USAGE: %s [<options>] <shapefile> [<schema>.]<table>\n", me); 
     738        fprintf(out, "OPTIONS:\n"); 
     739        fprintf(out, "  -s <srid>  Set the SRID field. If not specified it defaults to -1.\n"); 
     740        fprintf(out, "  (-d|a|c|p) These are mutually exclusive options:\n"); 
     741        fprintf(out, "      -d  Drops the table, then recreates it and populates\n"); 
     742        fprintf(out, "          it with current shape file data.\n"); 
     743        fprintf(out, "      -a  Appends shape file into current table, must be\n"); 
     744        fprintf(out, "          exactly the same table schema.\n"); 
     745        fprintf(out, "      -c  Creates a new table and populates it, this is the\n"); 
     746        fprintf(out, "          default if you do not specify any options.\n"); 
     747        fprintf(out, "      -p  Prepare mode, only creates the table.\n"); 
     748        fprintf(out, "  -g <geometry_column> Specify the name of the geometry column\n"); 
     749        fprintf(out, "     (mostly useful in append mode).\n"); 
     750        fprintf(out, "  -D  Use postgresql dump format (defaults to sql insert statments.\n"); 
     751        fprintf(out, "  -k  Keep postgresql identifiers case.\n"); 
     752        fprintf(out, "  -i  Use int4 type for all integer dbf fields.\n"); 
     753        fprintf(out, "  -I  Create a GiST index on the geometry column.\n"); 
     754        fprintf(out, "  -S  Generate simple geometries instead of MULTI geometries.\n"); 
     755        fprintf(out, "  -w  Use wkt format (for postgis-0.x support - drops M - drifts coordinates).\n"); 
    766756#ifdef USE_ICONV 
    767         fprintf(stderr, "\n"); 
    768         fprintf(stderr, "  -W <encoding> Specify the character encoding of Shape's\n"); 
    769         fprintf(stderr, "     attribute column. (default : \"ASCII\")\n"); 
     757        fprintf(out, "  -W <encoding> Specify the character encoding of Shape's\n"); 
     758        fprintf(out, "     attribute column. (default : \"ASCII\")\n"); 
    770759#endif 
    771         fprintf(stderr, "\n"); 
    772         fprintf(stderr, "  -N <policy> Specify NULL geometries handling policy (insert,skip,abort)\n"); 
     760        fprintf(out, "  -N <policy> Specify NULL geometries handling policy (insert,skip,abort)\n"); 
     761        fprintf(out, "  -? Display this help screen\n"); 
    773762        exit (exitcode); 
    774763} 
     
    12791268        extern char *optarg; 
    12801269        extern int optind; 
     1270 
     1271        if ( ARGC == 1 ) { 
     1272                usage(ARGV[0], 0, stdout); 
     1273        } 
    12811274 
    12821275        while ((c = getopt(ARGC, ARGV, "kcdapDs:Sg:iW:wIN:")) != EOF){ 
     
    13551348                    break; 
    13561349               case '?': 
     1350                    usage(ARGV[0], 0, stdout);  
    13571351               default:               
    13581352                return 0;