Index: trunk/psconfig/psconfig.sh
===================================================================
--- trunk/psconfig/psconfig.sh	(revision 11738)
+++ trunk/psconfig/psconfig.sh	(revision 11739)
@@ -2,70 +2,57 @@
 # this file is sourced using the command 'psconfig'
 
-# list the current settings 
-if ($#argv == 0) then
-  if (! $?PSCONFDIR) echo "PSCONFDIR is not set : run psconfig with an argument to setup"
-  if (! $?PSVERSION) echo "PSVERSION is not set : run psconfig with an argument to setup"
-  if (! $?ARCH)      echo "ARCH is not set : run psconfig with an argument to setup"
-  echo $PSCONFDIR : $PSVERSION : $ARCH 
-  echo "psconfig --help for additional info"
-  exit 2
-endif
-
-# show usage information
-if ("$argv[1]" == "--help") then
-  echo "psconfig: set or show the current pslib configuration information"
-  echo "USAGE: psconfig (version) : set configuration to specified version"
-  echo "       psconfig --bin     : return the current path"
-  echo "       psconfig --libs    : return the current library path"
-  echo "       psconfig --list    : list currently availabe configuration versions"
-  echo "       psconfig --help    : this listing"
-  echo " use ~/.psconfigrc to set PSCONFDIR as desired"
-  exit 0
-endif
-
-# list the defined psconfig versions
-if ("$argv[1]" == "--list") then
-  /bin/ls $PSCONFDIR | grep -v "\<man\>" | grep -v "\<share\>" | awk -v dir=$PSCONFDIR -F. '{printf "%s : %-10s : %s\n", dir, $1, $2}'
-  exit 0
-endif
-
-# list the defined psconfig versions
-if ("$argv[1]" == "--prefix") then
-  echo $PSCONFDIR/$PSVERSION.$ARCH
-  exit 0
-endif
-
-# list the defined psconfig versions
-if ("$argv[1]" == "--libs") then
-  echo $PSCONFDIR/$PSVERSION.$ARCH/lib
-  exit 0
-endif
-
-# list the defined psconfig versions
-if ("$argv[1]" == "--bin") then
-  echo $PSCONFDIR/$PSVERSION.$ARCH/bin
-  exit 0
-endif
-
 # list the defined psconfig versions
 set show_configure = 0
-if ("$argv[1]" == "--psconfigure") then
-  set show_configure = 1
-  shift
-endif
-
-# list the defined psconfig versions
 set show_autogen = 0
-if ("$argv[1]" == "--psautogen") then
-  set show_autogen = 1
-  shift
-endif
-
-# list the defined psconfig versions
-set show_psperlbuild = 0
-if ("$argv[1]" == "--psperlbuild") then
-  set show_psperlbuild = 1
-  shift
-endif
+set show_perlbuild = 0
+set args = ""
+while ($#argv) 
+  switch ($argv[1])
+    case --help:
+      goto help;
+
+    case --list:
+      /bin/ls $PSCONFDIR | grep -v "\<man\>" | grep -v "\<share\>" | awk -v dir=$PSCONFDIR -F. '{printf "%s : %-10s : %s\n", dir, $1, $2}'
+      exit 0
+      breaksw
+
+    case --prefix:
+      echo $PSCONFDIR/$PSVERSION.$ARCH
+      exit 0
+      breaksw
+
+    case --libs:
+      echo $PSCONFDIR/$PSVERSION.$ARCH/lib
+      exit 0
+      breaksw
+
+    case --bin
+      echo $PSCONFDIR/$PSVERSION.$ARCH/bin
+      exit 0
+      breaksw
+
+    case --psconfigure:
+      set show_configure = 1
+      shift
+      breaksw;   
+    case --psautogen:
+      set show_autogen = 1
+      shift
+      breaksw;
+    case --psperlbuild:
+      set show_perlbuild = 1
+      shift
+      breaksw;
+    case -*:
+      echo "unknown option $1"
+      goto help;
+    default:
+      set args=($args $1);
+      shift
+      breaksw;
+  endsw
+end
+if ($#args != 1) goto usage
+if ("$args" == "") goto usage
 
 # make this configurable by the user
@@ -77,5 +64,5 @@
 endif
 
-setenv PSVERSION $argv[1]
+setenv PSVERSION $args[1]
 
 if ($?LD_LIBRARY_PATH == 0) setenv LD_LIBRARY_PATH
@@ -290,2 +277,22 @@
   exit 0
 endif
+
+exit 0
+
+usage:
+  if (! $?PSCONFDIR) echo "PSCONFDIR is not set : run psconfig with an argument to setup"
+  if (! $?PSVERSION) echo "PSVERSION is not set : run psconfig with an argument to setup"
+  if (! $?ARCH)      echo "ARCH is not set : run psconfig with an argument to setup"
+  echo $PSCONFDIR : $PSVERSION : $ARCH 
+  echo "psconfig --help for additional info"
+  exit 2
+
+help:
+  echo "psconfig: set or show the current pslib configuration information"
+  echo "USAGE: psconfig (version) : set configuration to specified version"
+  echo "       psconfig --bin     : return the current path"
+  echo "       psconfig --libs    : return the current library path"
+  echo "       psconfig --list    : list currently availabe configuration versions"
+  echo "       psconfig --help    : this listing"
+  echo " use ~/.psconfigrc to set PSCONFDIR as desired"
+  exit 1
