4 fail () { echo >&2 "$prog: $1"; exit 2; }
5 usage () { echo "usage: $prog [CONF]"; }
8 while getopts "h" opt; do
14 shift $(( $OPTIND - 1 ))
15 case $# in 0) op=query ;; 1) op=set conf=$1 ;; *) bogus=t ;; esac
16 case $bogus in t) usage >&2; exit 2 ;; esac
21 if ! [ -L passwd ]; then link=bogus
22 else link=$(readlink passwd)
25 passwd.*) conf=${link#passwd.} ;;
26 *) fail "\`~/.disorder/passwd' not a link to \`passwd.CONF'" ;;
31 if ! [ -f "passwd.$conf" ]; then fail "no config \`passwd.$conf'"; fi
32 ln -sf "passwd.$conf" passwd