#!/bin/sh

##################################################################################
# BWGOR_1.0a                                                                     #
# Badcat's Web and GOpher Reader. GNU/GPL 03/28/05 Chris                         #
# I made this for the better half (Badcat) as a sort of fetch (or curl or dump)  #
# and translate/ read utility or routine.                                        #
# You will have to modify paths and perhaps which programs you use.              #
# I use xmessage (FreeBSD XFree86) to view in.                                   #
# vilistextum (http://bhaak.dyndns.org/vilistetxum/) to translate html > txt.    #
# cURL (http://curl.haxx.se/ ) to grab web pages.                                #
# lynx (http://lynx.browser.org) to -dump because curl's gopher ability is broke.#
# xv for image viewing.                                                          #
# xmms (http://www.xmms.org) for audio and video.                                #
# ee for editing BWGOR.sh from itself.                                           #
# You can add and subtract as you like, make a long button bar with just html    #
# links if you would like.                                                       #
##################################################################################

  while [ : ]
  do
#change to your w file path
  xmessage -file  /path/to/file/w -buttons HOME,URL,SEARCH,GOPHER,IMAGE,AUDIO,NEWS,WEATHER,EDIT,QUIT  -geometry -0+0
    button=$?

#enter a homepage url.

  if [ $button = 101 ] ; then
    curl -A Bwgor -o - home.com  > z.html;
    vilistextum -l -c z.html z;
    xmessage -file z -buttons RETURN -geometry -0+0



  elif [ $button = 102 ] ; then echo enter a url;
    read URL;
    curl -A Bwgor -o - $URL  > z.html;
    vilistextum -l -c z.html z;
    xmessage -file z -buttons RETURN -geometry -0+0

#set to search google

  elif [ $button = 103 ] ; then echo enter search;
    read SEARCH;
    curl -A Bwgor -o - http://www.google.com/search?q=$SEARCH > z.html
    vilistextum -l -c z.html z;
    xmessage -file z -buttons RETURN -geometry -0+0



  elif [ $button = 104 ] ; then echo enter gopher;
    read GOPHER;
    lynx -dump $GOPHER > z
    xmessage -file z -buttons RETURN -geometry -0+0

#enter your viewer if xv isnt what you want

  elif [ $button = 105 ] ; then echo enter image url;
    read IMAGE;
    lynx -dump  $IMAGE > z
    xv z

#enter your audio player if xmms is not what you want

  elif [ $button = 106 ] ; then echo enter audio url;
    read AUDIO;
    lynx -dump  $AUDIO > z
    xmms z

#enter in a news url below

  elif [ $button = 107 ] ; then
    lynx -dump http://yournews.com > z
    xmessage -file z -buttons RETURN -geometry -0+0

#enter a weather url below

  elif [ $button = 108 ] ; then
  lynx -dump http://yourweatherurl.com > z
  xmessage -file z -buttons RETURN -geometry -0+0

#editor and path

  elif [ $button = 109 ] ; then
  ee /your/path/to/bwgor.sh

  else
  break

  fi
  done