From: Sandro Santilli Date: Sat, 25 May 2013 16:58:13 +0000 (+0000) Subject: Cleanly handle unsupported switches X-Git-Tag: 2.1.0beta3~33 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d7d5f9609f52ee071947407a045b92304a27eea9;p=postgis Cleanly handle unsupported switches git-svn-id: http://svn.osgeo.org/postgis/trunk@11499 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/utils/postgis_restore.pl.in b/utils/postgis_restore.pl.in index c14626b2a..1ee1c6180 100755 --- a/utils/postgis_restore.pl.in +++ b/utils/postgis_restore.pl.in @@ -59,14 +59,20 @@ my $SRID_MAXIMUM = @SRID_MAXIMUM@; my $SRID_USER_MAXIMUM = @SRID_USER_MAXIMUM@; while (@ARGV && $ARGV[0] =~ /-/) { - if ( $ARGV[0] eq '-v' ) { + my $arg = shift(@ARGV); + if ( $arg eq '-v' ) { $DEBUG = 1; - shift(@ARGV); } - elsif ( $ARGV[0] eq '-s' ) { - shift(@ARGV); + elsif ( $arg eq '-s' ) { $POSTGIS_SCHEMA = shift(@ARGV); } + elsif ( $arg eq '--' ) { + last; + } + else { + print STDERR "Unknown switch " . $arg; + die $usage; + } } die $usage if (@ARGV < 1);