X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/distorted-keys/blobdiff_plain/53263601059e92d94b931e5444a0b53f7ea7027f..e787e19c99a9df4f49ac77237c58d43df3829e9f:/keys.in diff --git a/keys.in b/keys.in index 357651f..2676d56 100755 --- a/keys.in +++ b/keys.in @@ -7,98 +7,44 @@ ###----- Licensing notice --------------------------------------------------- ### -### This program is free software; you can redistribute it and/or modify +### This file is part of the distorted.org.uk key management suite. +### +### distorted-keys is free software; you can redistribute it and/or modify ### it under the terms of the GNU General Public License as published by ### the Free Software Foundation; either version 2 of the License, or ### (at your option) any later version. ### -### This program is distributed in the hope that it will be useful, +### distorted-keys is distributed in the hope that it will be useful, ### but WITHOUT ANY WARRANTY; without even the implied warranty of ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ### GNU General Public License for more details. ### ### You should have received a copy of the GNU General Public License -### along with this program; if not, write to the Free Software Foundation, +### along with distorted-keys; if not, write to the Free Software Foundation, ### Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. set -e - -quis=${0##*/} -PACKAGE=@PACKAGE@ -VERSION=@VERSION@ - -: ${KEYS=@pkgconfdir@} +: ${ETC=@pkgconfdir@} +: ${KEYS=@pkgstatedir@} : ${KEYSLIB=@pkglibdir@} -export KEYS KEYSLIB +export ETC KEYS KEYSLIB -###-------------------------------------------------------------------------- -### Help. +. "$KEYSLIB"/keyfunc.sh usage="usage: $quis COMMAND [ARGUMENTS ...]" +prefix=keys -version () { - echo "$PACKAGE version $VERSION" -} - -help () { - rc=0 - version - case $# in - 0) - cat <&2 "$quis: unrecognized command \`$i'" - rc=1 - continue - elif ! KEYS_HELP=t "$KEYSLIB"/"$i"; then - rc=1 - fi - done - ;; - esac - return $rc -} - -###-------------------------------------------------------------------------- -### Command dispatch. - +## Parse options. while getopts "hv" opt; do case "$opt" in - h) help; exit ;; + h) cmd_help; exit ;; v) version; exit ;; - *) echo >&2 "$usage"; exit 1 ;; + *) usage_err ;; esac done -shift $((OPTIND - 1)) - -case $# in 0) echo >&2 "$usage"; exit 1 ;; esac -cmd=$1; shift -case "$cmd" in help) help "$@"; exit ;; esac -if [ ! -x "$KEYSLIB"/"$cmd" ]; then - echo >&2 "$quis: unrecognized command \`$cmd'" - exit 1 -fi +shift $(( $OPTIND - 1 )) -unset KEYS_HELP -exec "$KEYSLIB"/"$cmd" "$@" +## Dispatch. +dispatch "$@" ###----- That's all, folks --------------------------------------------------