#!/bin/bash

# KMSelf Fri Dec  7 18:13:31 PST 2001

# This program may be distributed without restrictions.
# NO WARRANTY.

# A w3m wrapper to allow no-argument startup.

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin
realw3m=/usr/bin/w3m	# Actually, a wrapper itself <g>

# This is for my WMaker root menu binding -- we want bash as our shell:
export SHELL=/bin/bash

arg=""	# initialize

# Only subs if no args given and env doesn't say otherwise
if [ $# -eq 0 -a \( -z "$HTTP_HOME" -a -z "$WWW_HOME" \) ]; then

    # DEBUG: echo "No args, hunting the wumpus"

    for arg in \
        $HOME/.w3m/bookmark.html \
	$HOME/.galeon/bookmarks.xml \
        $HOME/.netscape/bookmarks.html \
	$HOME/.netscape/bookmarks.html 
    do
	if [ -f $arg ]; then
	    # DEBUG: echo "arg set to: $arg"
	    break 
	fi
    done;
else
    : # DEBUG: echo "Args: $#"
fi

$realw3m $arg $@
