]> granicus.if.org Git - postgis/commitdiff
Cleanly handle unsupported switches
authorSandro Santilli <strk@keybit.net>
Sat, 25 May 2013 16:58:13 +0000 (16:58 +0000)
committerSandro Santilli <strk@keybit.net>
Sat, 25 May 2013 16:58:13 +0000 (16:58 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@11499 b70326c6-7e19-0410-871a-916f4a2858ee

utils/postgis_restore.pl.in

index c14626b2af810724f40c2f1369435c5950747c68..1ee1c6180e78fc23b05c628acb449dc258445e6e 100755 (executable)
@@ -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);