2008-08-07 18:22:05 +04:00
|
|
|
#!/bin/sh
|
|
|
|
|
2008-08-22 20:40:18 +04:00
|
|
|
help_dir="@ededocdir@/manual"
|
2008-08-07 18:22:05 +04:00
|
|
|
browser_list="firefox mozilla konqueror opera navigator dillo"
|
|
|
|
|
2008-08-10 21:44:25 +04:00
|
|
|
program="ehelp"
|
2008-08-07 18:22:05 +04:00
|
|
|
url=""
|
|
|
|
|
|
|
|
if [ "$1" = "--help" ]; then
|
2008-08-10 21:44:25 +04:00
|
|
|
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
|
2008-08-07 18:22:05 +04:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$1" = "--titles" ]; then
|
|
|
|
echo "Known titles:"
|
|
|
|
|
2008-08-10 21:44:25 +04:00
|
|
|
content=`ls $help_dir/ | sort -f`
|
2008-08-07 18:22:05 +04:00
|
|
|
for c in $content; do
|
2008-08-10 21:44:25 +04:00
|
|
|
# show only files (readable), stripping extension
|
|
|
|
[ -r "$help_dir/$c" ] && echo " " $c | sed 's/\.html//g'
|
2008-08-07 18:22:05 +04:00
|
|
|
done
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$1" ]; then
|
|
|
|
url="$help_dir/index.html"
|
|
|
|
else
|
|
|
|
url="$help_dir/$1.html"
|
2008-08-10 21:44:25 +04:00
|
|
|
if [ ! -r "$url" ]; then
|
|
|
|
echo "Unable to open $1. Going to start page..."
|
2008-08-07 18:22:05 +04:00
|
|
|
url="$help_dir/index.html"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2008-08-10 21:44:25 +04:00
|
|
|
# let browser knows it is a file
|
2008-08-07 18:22:05 +04:00
|
|
|
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
|
2008-08-10 21:44:25 +04:00
|
|
|
xmessage -title "$program error" -center -buttons "Close" -file - <<EOF
|
|
|
|
Failed to find any of known browsers!
|
2008-08-07 18:22:05 +04:00
|
|
|
|
|
|
|
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
|
2008-08-10 21:44:25 +04:00
|
|
|
xmessage -title "$program error" -center -buttons "Close" -file - <<EOF
|
|
|
|
Unable to run '$BROWSER'!
|
2008-08-07 18:22:05 +04:00
|
|
|
|
|
|
|
Please check if program path is correct or
|
|
|
|
adjust BROWSER environment variable pointing
|
|
|
|
to the correct binary
|
|
|
|
EOF
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
exit 0
|