+# get subcommand
+COMMAND="$1"
+[ "$COMMAND" ] || failure "Type '$PGRM help' for usage."
+shift
+
+# unset option variables
+unset KEY_LENGTH
+unset KEY_EXPIRE
+unset REVOKER
+unset DOMAIN
+unset TRUST
+unset DEPTH
+
+# get options for key generation and add-certifier functions
+TEMP=$(getopt -o l:e:r:n:t:d: -l length:,expire:,revoker:,domain:,trust:,depth: -n "$PGRM" -- "$@")
+
+if [ $? != 0 ] ; then
+ usage
+ exit 1
+fi
+
+# Note the quotes around `$TEMP': they are essential!
+eval set -- "$TEMP"
+
+while true ; do
+ case "$1" in
+ -l|--length)
+ KEY_LENGTH="$2"
+ shift 2
+ ;;
+ -e|--expire)
+ KEY_EXPIRE="$2"
+ shift 2
+ ;;
+ -r|--revoker)
+ REVOKER="$2"
+ shift 2
+ ;;
+ -n|--domain)
+ DOMAIN="$2"
+ shift 2
+ ;;
+ -t|--trust)
+ TRUST="$2"
+ shift 2
+ ;;
+ -d|--depth)
+ DEPTH="$2"
+ shift 2
+ ;;
+ --)
+ shift
+ ;;
+ *)
+ break
+ ;;
+ esac
+done
+