#!/bin/sh
##
##  jargon -- Trivial OpenPKG Jargon File Frontend
##  Copyright (c) 2002-2003 Ralf S. Engelschall <rse@engelschall.com> 
##

w3m="@l_prefix@/bin/w3m"
jarg="@l_prefix@/libexec/jargon/jarg"
html="@l_prefix@/share/jargon/jargon.html"

if [ ".$1" = ".-h" ]; then
    echo "jargon                  - browse the whole jargon file"
    echo "jargon baz              - displays entry for keyword 'baz'"
    echo "jargon -d bar           - displays all entries whose keywords contain 'bar'"
    echo "jargon -f [maxlines]    - give a random jargon fortune"
    echo "jargon -l foo           - lists all keywords containing 'foo'"
    exit 0
elif [ ".$1" = . ]; then
    exec $w3m $html
elif [ ".$1" = ".-f" ]; then
    shift
    exec $jarg -f ${1+"$@"}
elif [ ".$1" = ".-l" -a ".$2" != . ]; then
    shift
    exec $jarg -l "$@"
elif [ ".$1" = ".-d" -a ".$2" != . ]; then
    shift
    exec $jarg -d "$@"
else
    exec $jarg "$@"
fi

