[pisa-src] r944 - trunk/tools

  • From: Diego Biurrun <diego@xxxxxxxxxx>
  • To: pisa-src@xxxxxxxxxxxxx
  • Date: Fri, 04 Sep 2009 18:47:29 +0200

Author: biurrun
Date: Fri Sep  4 18:47:29 2009
New Revision: 944

Log:
Error out with an appropriate message when unknown parameters are passed.

Modified:
   trunk/tools/switch-ip

Modified: trunk/tools/switch-ip
==============================================================================
--- trunk/tools/switch-ip       Fri Sep  4 18:39:24 2009        (r943)
+++ trunk/tools/switch-ip       Fri Sep  4 18:47:29 2009        (r944)
@@ -118,12 +118,7 @@
     exit 1
 fi
 
-optarr=($(getopt -o 'hi:' --long 
'myip1:,myip2:,apip1:,apip2:,apssid1:,apssid2:,apmac1:,apmac2:,udhcpc,route_extra_cmd,nowep,help'
 -- "$@"))
-
-if [ $? != 0 ]; then
-    usage
-    exit 1
-fi
+optarr=$(getopt -o 'hi:' --long 
'myip1:,myip2:,apip1:,apip2:,apssid1:,apssid2:,apmac1:,apmac2:,udhcpc,route_extra_cmd,nowep,help'
 -- "$@")
 
 i=0
 while true; do
@@ -189,7 +184,11 @@
             USEWEPKEYS=0;
             i=$(($i+1));;
         -- ) i=$(($i+1)); break;;
-        * ) usage; exit 1;;
+        * )
+            echo "Unknown parameter"
+            usage
+            exit 1
+            ;;
     esac
 done
 

Other related posts:

  • » [pisa-src] r944 - trunk/tools - Diego Biurrun