ede/ehelp/ehelp.in
Sanel Zukan ae122e1885 Relaxed EXEMODE jam sets
Let manual be installed in docsdir
jam will also create ehelp from ehelp.in setting correct location
Fixed a typo with RMDIR_UNSAFE so Cleandir can work now
Added CopyDir rule
Added missing linking libraries for capone
2008-08-22 16:40:18 +00:00

83 lines
1.6 KiB
Bash

#!/bin/sh
help_dir="@ededocdir@/manual"
browser_list="firefox mozilla konqueror opera navigator dillo"
program="ehelp"
url=""
if [ "$1" = "--help" ]; then
cat <<EOF
Usage: $program [OPTIONS] [TITLE]
Display EDE Manual in the web browser
Options:
--help Show this help
--titles Show known titles
Example:
$program evoke - display evoke help
EOF
exit 1
fi
if [ "$1" = "--titles" ]; then
echo "Known titles:"
content=`ls $help_dir/ | sort -f`
for c in $content; do
# show only files (readable), stripping extension
[ -r "$help_dir/$c" ] && echo " " $c | sed 's/\.html//g'
done
exit 0
fi
if [ -z "$1" ]; then
url="$help_dir/index.html"
else
url="$help_dir/$1.html"
if [ ! -r "$url" ]; then
echo "Unable to open $1. Going to start page..."
url="$help_dir/index.html"
fi
fi
# let browser knows it is a file
url="file://$url"
# try to find browser
if [ -z "$BROWSER" ]; then
for i in $browser_list; do
if which $i > /dev/null 2>&1; then
BROWSER="$i"
break;
fi
done
fi
if [ -z $BROWSER ]; then
xmessage -title "$program error" -center -buttons "Close" -file - <<EOF
Failed to find any of known browsers!
If you thing that I made mistake, please try to set
BROWSER environment variable with full path pointing
to the browser binary
EOF
exit 1
fi
# run browser
$BROWSER $url
if [ $? -ne 0 ]; then
xmessage -title "$program error" -center -buttons "Close" -file - <<EOF
Unable to run '$BROWSER'!
Please check if program path is correct or
adjust BROWSER environment variable pointing
to the correct binary
EOF
exit 1
fi
exit 0