#!/bin/sh
# RCSID = $Id: ha-setup,v 1.1.1.2 1999/02/25 16:42:55 siebert Exp $
#
# Set up an analyzer configuration for http-analyze.
#
# Copyright 1998 by Stefan Stapelberg, RENT-A-GURU(TM)
#

# Define the central library directory.
: ${HA_LIBDIR:=/usr/local/lib/http-analyze}

# How to suppress newline in echo: -n or \c
#n="-n"
c="\c"

#
# Prompt user
#
prompt() {
	answer=''
	if [ $# -eq 3 ]; then
		echo $n "$1 ($2) [$3]: $c" 1>&2; read answer
		case $answer in '') answer="$3";; esac
	elif [ $# -eq 2 -a "$2" != "-" ]; then
		echo $n "$1 [$2]: $c" 1>&2; read answer
		case $answer in '') answer="$2";; esac
	elif [ "$2" = "-" ]; then
		echo $n "$1: $c" 1>&2; read answer
	else
		until [ -n "$answer" ]; do
			echo $n "$1: $c" 1>&2; read answer
			[ -z "$answer" ] &&
				echo "invalid input, please try again\n" 1>&2
		done
	fi
	echo "$answer"
	return
}

#
# Check for required files in HA_LIBDIR
#
getlibdir() {
	if [ "$1" ]; then
		[ -s "$1/3Dlogo.wrl.gz" -a -s "$1/btn/RAG_sb.gif" ] && libd="$1"
	else
		if [ -s files/3Dlogo.wrl.gz -a -s files/btn/RAG_sb.gif ]; then
			libd=files
		elif [ -s 3Dlogo.wrl.gz -a -s btn/RAG_sb.gif ]; then
			libd=.
		elif [ -s $HA_LIBDIR/3Dlogo.wrl.gz -a -s $HA_LIBDIR/btn/RAG_sb.gif ]; then
			libd=$HA_LIBDIR
		fi
	fi
	echo "$libd"
	return
}

#
# Check for output directory, create it if necessary.
#
outputdir() {
	odir=`prompt "Name of the HTML output directory"`
	[ -d "$odir" ] || { \
		ans=`prompt "Directory $odir doesn't exist, create it" y/n y`;
		case $ans in y|Y) mkdir $odir || exit 1 ;; esac; }

	echo "$odir"
	return
}

#
# Install required files in an output directory.
#
copybtn() {
	odir="$1"
	ldir=`getlibdir`
	ldir=`prompt "Directory containing required files (3D*, btn/*)" $ldir`

	# check for required files, exit on failure
	case `getlibdir "$ldir"` in
	   '')	echo "Required files not found, did you install" \
		     "them in directory '$ldir'?" 1>&2; exit 1
		;;

	   /*)	ans=''
		until [ -n "$ans" ]; do
			ans=`prompt "Create symlinks (s) or copy files (c)" s`
			case $ans in
			  's')	ln -s $ldir/3D* $ldir/btn $odir || { \
				    echo "Couldn't create symlinks - check permissions" 1>&2; exit 1; }
				echo "\nSymlinks to the required files have been created in $odir" 1>&2
				;;
			  'c')	[ -d "$odir/btn" ] || mkdir $odir/btn
				(cp $ldir/3D* $odir && cp $ldir/btn/* $odir/btn) || { \
				    echo "Couldn't copy required files - check permissions" 1>&2; exit 1; }
				echo "\nRequired files have been copied into $odir" 1>&2
				;;
			  *)	echo "Invalid answer, please try again" 1>&2
				ans='' ;;	
			esac
		done
		;;

	  *)	[ -d "$odir/btn" ] || mkdir $odir/btn
		(cp $ldir/3D* $odir && cp $ldir/btn/* $odir/btn) || { \
		    echo "Couldn't copy required files - check permissions" 1>&2; exit 1; }
		echo "\nRequired files have been copied into $odir" 1>&2
		;;
	esac
	return
}

bugreport() {
	TMPFILE=/tmp/hacall$$.html

	cat <<-HERE
	http-analyze bug report
	-----------------------

	The script creates a bug report form in the file '$TMPFILE'
	and starts a browser with the name of this file as an argument.

	HERE

	VINFO=`http-analyze -V 2>&1`

	[ -s "$HA_LIBDIR/bugreport.html" ] || {
		echo "Couldn't find the file $HA_LIBDIR/bugreport.html."
		echo "Did you install it using a \"make install\"?"
		exit 1
	}
	[ -n "$VINFO" ] && eval "`echo \"$VINFO\" |
		sed -n -e 's/^\(http-analyze [^ ]*\) (\([^)]*\)).*$/VERSION=\"\1\" PLATFORM=\"\2\"/p' \
		 -e 's/^Registered for \(.*\) (\([^)]*\))/CUSTOMER=\"\1\" REGID=\"\2\"/p'`"

	CUSTOMER=`echo "$CUSTOMER" |
		  sed -e 's/&/\\\&amp;/g' -e 's/\"/\\\&quot;/g' \
		      -e 's/</\\\&lt;/g' -e 's/>/\\\&gt;/g'`

	sed -e "s/\${DEF_VERSION}/${VERSION:+VALUE=\"$VERSION\"}/" \
	    -e "s/\${DEF_PLATFORM}/${PLATFORM:+VALUE=\"$PLATFORM\"}/" \
	    -e "s/\${DEF_CUSTOMER}/${CUSTOMER:+VALUE=\"$CUSTOMER\"}/" \
	    -e "s/\${DEF_REGID}/${REGID:+VALUE=\"$REGID\"}/" \
	    -e '/^<CAPTION>$/,/^<\/CAPTION>$/d' $HA_LIBDIR/bugreport.html >$TMPFILE

	echo "The script now starts a browser with this filename as argument.\n"
	browser=`prompt "Start which browser" netscape`

	echo "Starting $browser with file $TMPFILE"
	if [ "X$browser" = "Xnetscape" ]; then
		$browser -remote "openURL(file:$TMPFILE)" 2>/dev/null ||
		$browser file:$TMPFILE &
	else
		$browser file:$TMPFILE &
	fi
	return
}

brand() {
	cat <<-\HERE
	http-analyze branding
	---------------------

	You will be asked for the registration information (company name,
	registration ID) and for the names of the two registration images
	sent to you by email. The images will replace the "unregistered"
	buttons present in the source distribution which you downloaded
	from our web site. You can install those images at a central
	location (for example, in HA_LIBDIR/btn, where HA_LIBDIR usually is
	`/usr/local/lib/http-analyze') or in an `OutputDir/btn' directory.
	
	To share the required files among all virtual web servers, install them
	in a central directory (by default, they are copied into HA_LIBDIR/btn,
	where HA_LIBDIR is `/usr/local/lib/http-analyze'). Then use symbolic
	links in the web server's statistics output directory for the required
	files and the buttons subdirectory.  Make sure your web server follows
	symbolic links; this often has to be enabled first!
	
	HERE
	
	company=`prompt "Please enter your company name"`
	regid=`prompt "Please enter your registration ID"`

	btnw=`prompt "Name of first registration image" free-netstore_sw.gif`
	btnb=`prompt "Name of second registration image" free-netstore_sb.gif`
	[ -f "$btnw" -a -f "$btnb" ] || { \
		echo "Couldn't find the registration images," \
		     "check files and permissions ..." 1>&2; exit 1; }

	btndir=`prompt "Install registration images in" $HA_LIBDIR/btn`
	[ -w "$btndir" ] || { \
		echo "Can't write into $btndir," \
		"check permissions ..." 1>&2; exit 1; }

	# brand the software
	http-analyze -r "$company" "$regid" || { \
		echo "Couldn't succesfully brand the analyzer" \
		     "(exit status $?)." 1>&2; exit 1; }

	# copy registration images
	cp $btnw $btndir/netstore_sw.gif &&
	  cp $btnb $btndir/netstore_sb.gif &&
	  echo "Images successfully installed in $btndir."

	return
}

#
# Install required files into a statistics directory.
#
instbtn() {
	cat <<-\HERE
	Install required files for http-analyze
	---------------------------------------

	This script copies the required files (3D*, btn/*) into the statistics
	output directory used by http-analyze. Make sure that you copy the correct
	images into the statistics directory (the images that came with your
	registration information in the registered version).
	
	First, enter the name of the HTML output directory (for example,
	/usr/www/stats). The 'btn' subdirectory will be created automaically
	if it does not exist already.

	HERE

	outdir=`outputdir`

	cat <<-\HERE

	Now enter the name of the directory containing the required files.
	This is either a central directory (HA_LIBDIR) where you did install
	the files and buttons directory (like /usr/local/lib/http-analyze)
	or the subdirectory 'files' in the directory where you unpacked the
	source/binary distribution of http-analyze.

	HERE

	copybtn "$outdir"
	return
}

#
# Set up an analyzer configuration.
#
setup() {
	host=`hostname 2>/dev/null`
	[ -z "$host" ] && host=`uname -n`
	[ -z "$host" ] && host=www.unknown.dom

	cat <<-\HERE
	Setup http-analyze configuration
	--------------------------------
	
	This script helps you to set up an analyzer configuration for use of
	http-analyze with a virtual web server. It creates the output directory,
	installs the required files and buttons in this output directory, and
	lets you define default settings of a configuration file.
	
	First, enter the name of a HTML output directory which will be used for
	the statistics report. This directory should be either a subdirectory
	under your web server's document root or another directory which may
	be reached through your web server in some way.
	
	HERE

	outdir=`outputdir`

	cat <<-\HERE
	
	Now enter the name of the directory containing the required files.
	This is either a central directory (HA_LIBDIR) where you did install
	the files and buttons directory (like /usr/local/lib/http-analyze)
	or the subdirectory 'files' in the directory where you unpacked the
	source/binary distribution of http-analyze.
	
	HERE

	copybtn "$outdir"

	cat <<-\HERE
	
	Next, enter the name of the configuration file. This file should be
	placed outside your server's document root either inside a central
	directory (for example, /usr/local/lib/http-analyze) or in a web
	server specific subdirectory (i.e. /usr/www/lib/http-analyze.conf).
	
	HERE
	config=`prompt "Name of the configuration file"`
	if [ -s "$config" ]; then
		mv $config ${config}.old || { \
			echo "Couldn't back up $config, check permissions" 1>&2; exit 1; }
	fi
	TMPFILE="/tmp/ha-setup.$$"
	trap 'rm -f $TMPFILE; exit' 2 3 15

	cat <<-\HERE

	Now enter the full qualified domain name of the web server,
	for example "foo.bar.com".

	HERE

	genname=`prompt "Name of the web server" "$host"`
	srvname="ServerName	$genname"

	cat <<-\HERE

	Now enter the web server's URL which is to be used as a prefix in
	hotlinks.  For example, if the server name is '$host',
	the corresponding URL would be 'http://$host/'.
	If you leave the server's URL empty, hypertext links in statistics
	reports will reference pages on the server the report is located on.

	HERE

	srvurl=`prompt "Corresponding server URL" -`
	if [ -z "$srvurl" ]; then
		srvurl="#ServerURL	http://$genname/"
	else
		srvurl="ServerURL	$srvurl"
	fi

	cat <<-HERE >$TMPFILE
	#
	# Sample configuration file for http-analyze
	#
	# Entries are separated by one or more tabulators.
	# Values may be overwritten by command line options.

	# Registration ID (all versions)
	#RegInfo	Personal Edition	Registration-ID

	# Customer logos (commercial version only)
	# One (W) for use on white background, one (B) for black background.
	# Second field is name of logo, third is URL to link to (if any).
	#CustLogoW	btn/RAG_sw.gif		http://www.rent-a-guru.de/
	#CustLogoB	btn/RAG_sb.gif		http://www.rent-a-guru.de/

	# The name of your server (defaults to the local hostname).
	# Must be a full qualified domain name (FQDN) here, not an URL.
	$srvname

	# The prefix to use in URLs for hotlinks. Needed only if the
	# statistics report is hosted on another server than the pages
	# listed in the report. If the protocol specifier is not given,
	# 'http' is assumed. Trailing slashes are removed.
	$srvurl

	# Other (virtual) names for this host. If no protocol specifier
	# (http, https) is specified explicitely, http-analyze creates
	# two entries per name, one with the \`http' and another one with
	# the \`https' protocol specifier. Either the ServerURL or the
	# ServerName is added automatically to this list, whichever
	# is defined. No additional protocols are added for the latter
	# two except the 'http' default. Trailing slashes are removed.
	#
	#VirtualNames	https://www.mycompany.com
	#VirtualNames	http://www.customer.com,http://customer.com

	HERE

	cat <<-\HERE

	If this setup is for a software-virtual server, you can restrict
	analysis to this server by specifying the subdirectory where the
	documents for this virtual server are located. For example, if the
	virtual server's URL http://www.customer.com/ is mapped to the
	subdirectory '/customer/', specify the URL '/customer/' as the
	Document Root for the virtual web server.  If you configure a
	"real" web server, just hit RETURN now.

	HERE
	virtdir=`prompt "Document Root of virtual server" -`

	if [ -z "$virtdir" ]; then
		virtdir="#DocRoot	/~customer/
#DocRoot	www.customer.com"
	else
		virtdir="DocRoot		$virtdir"
	fi

	cat <<-HERE >>$TMPFILE
	# The name of a virtual server document root. If defined,
	# http-analyze restricts analysis to the given document root.
	# If the name is prefixed by a \`!', analysis takes place for
	# all directories except this subdirctory.  If docroot does
	# not start with a slash ('/'), it is interpreted as the name
	# of a virtual server, which is matched against the (normally
	# unused) second field of a logfile entry.  Intented for use
	# with (software-) virtual servers with a separate Document
	# Root or for which the hostname is recorded in the second
	# field of a logfile entry.
	$virtdir

	HERE

	cat <<-\HERE

	The next setting will be used as the web server's logfile if no
	filename is explicitely given at invocation of the analyzer. If
	you leave the default logfile name undefined, the analyzer will
	read it's standard input if no filename is given.

	HERE

	logfile=`prompt "Name of the default logfile" -`
	if [ -z "$logfile" ]; then
		logfile="#LogFile	/usr/ns-home/www.foo.com/logs/access"
	else
		logfile="LogFile	$logfile"
	fi

	cat <<-HERE >>$TMPFILE
	# The name of the default logfile to be used if none given
	# at invocation of http-analyze.
	$logfile
	
	# The format of the logfile:
	#	auto	Automatically determine format (default)
	#	clf	Common Logfile Format (CLF)
	#	dlf	Combined Logfile Format (CLF + Referrer + UserAgent)
	#	elf	Extended Logfile Format (CLF + UserAgent + Referrer)
	#
	#LogFormat	auto
	
	# The default mode of operation now is full statistics ("monthly") mode.
	#DefaultMode	monthly

	# The name of the directory where the output files of the statistics
	# report are to be created.
	OutputDir	$outdir

	# The name of a private directory where detailed lists are to be placed.
	# Must be a subdirectory of OutputDir and may contain no slashes. Note
	# that you have to set up server authentication if you want to protect
	# those lists. http-analyze just creates the detailed list of URLs, sites,
	# agents and referrers in this subdirectory. See the online documentation
	# for an example.
	#PrivateDir	lists
	
	HERE

	cat <<-\HERE

	Now enter the name(s) of additional directory index file which are
	later reduced to the URL for the subdirectory (for example, 'home.html',
	'Welcome.html' or any other filename you have defined in your web server's
	configuration file. Note that 'index.html' is pre-defined already. To
	specify more than one name, use commas to separate them. If you use
	no index files other than 'index.html', just hit RETURN.

	HERE

	homepage=`prompt "Additional directory index filenames" -`
	if [ -z "$homepage" ]; then
		homepage="#IndexFiles	/Welcome.html,/home.html"
	else
		homepage="IndexFiles	$homepage"
	fi

	cat <<-HERE >>$TMPFILE
	# Alternate names for directory index files other than "index.html".
	# Note: The leading slash is important!
	$homepage

	# Skip all URLs which required authentication. By default, such URLs
	# are handled just like all other URLs. Setting AuthURL to Off, No,
	# None, False, or 0 causes the analyzer to skip those private URLs
	# in the logfile.
	#AuthURL	No

	# Don't strip CGI arguments in the overview and detailed list of URLs.
	# This should be left undefined unless the documents are created
	# dynamically by a CGI script. Valid values for StripCGI are: Off, No,
	# None, False, 0 to not strip CGI arguments or any other value to have
	# the analyzer remove them as in the previous version.
	#StripCGI	No

	HERE

	cat <<-\HERE

	In order to be able to compute pageviews correctly, the analyzer needs
	to know which files are to be rated as documents, so you must define
	the suffixes of such text files. For example, pageview suffixes are
	often '.shtml', '.text' and '.htm'. The suffix '.html' is pre-defined
	already. If you use no text files with suffixes other than '.html',
	just hit RETURN at the following question. If you want to suppress
	pageviews ratings, enter 'none' here.
	
	HERE

	pageview=`prompt "Additional pageview suffixes" -`
	if [ -z "$pageview" ]; then
		pageview="#PageView	.shtml,.text,.htm,/cgi-bin/"
	elif [ "$pageview" = "none" ]; then
		pageview="#PageView	.shtml,.text,.htm,/cgi-bin/"
		suppress="Pageviews"
	else
		pageview="PageView	$pageview"
	fi

	cat <<-HERE >>$TMPFILE
	# Definitions for Pageviews: If the value starts with a slash (/),
	# it defines the prefix of an URL which is counted as s pageview
	# if hit. If it does not start with a slash, it defines the suffix
	# of such an URL. In the latter case, the analyzer prepends a dot
	# to the suffix automatically for backward compatibility. Use this
	# directive to specify alternate suffixes for text files other than
	# ".html" (which is added automatically) and to specify prefixes
	# of documents served by CGI scripts (for example: /cgi-bin/).
	$pageview

	HERE

	cat <<-\HERE

	For accounting user sessions, the analyzer will count all accesses
	from the same host as one session only during a certain time-window.
	In previous versions, the session value did correspond to "sites"
	and used a time-window of one day. To keep this default, just hit
	RETURN.  Examples: 30 Minutes, 4 Hours, 2 Days.
	
	HERE

	usession=`prompt "User session time-window" -`
	if [ -z "$usession" ]; then
		usession="#Session	30 Minutes"
	else
		usession="Session	$usession"
	fi

	cat <<-\HERE

	The noise level is a watermark which causes the analyzer to
	collect all URLs, sites, agents, and referrer URLs with hits
	below this level under the "Noise" entry in the overviews and
	detailed lists. This reduces the file size for large reports
	by a significant amount. Useful values are 5 to 50 depending
	on the total number of accesses.

	HERE

	noiselvl=`prompt "Noise level" -`
	if [ -z "$noiselvl" ]; then
		noiselvl="#NoiseLevel	7"
	else
		noiselvl="NoiseLevel	$noiselvl"
	fi

	cat <<-HERE >>$TMPFILE
	# Time-window for accounting user sessions (default: 24 hours).
	# Use t[icks], s[econds], m[inutes], h[ours] or d[ays] after
	# the number as a scaling unit.
	$usession
	
	# Noise level: suppress details about all items with hits below
	# this level in order to keep the size of reports manageable.
	$noiselvl
	
	# The title to display in the statistics reports.
	#ReportTitle	Access Statistics for MyCompany
	
	# The name of a file containing all valid domains.
	# You may add top-level domains with up to 6 characters
	# in length. See the included file TLD for an example.
	#TLDFile	/usr/local/lib/http-analyze/TLD
	#
	# If TLDFile is set to \`none', no country list is produced in the summary.
	#TLDFile	none
	
	# The name of the VRML prolog file for yearly models.
	# For use on graphic workstations only!
	#VRMLProlog	3Dprolog.wrl
	
	# Font faces and sizes. HeadFont and HeadSize are used for headers,
	# while TextFont and TextSize are used for normal text. ListSize (the
	# former FontSize directive) is the size of the preformatted text in
	# the detailed lists. SmallSize is the size used for small text like
	# percentages following the actual numbers, etc.
	#
	# Valid values for the font face directives are the names of standard
	# fonts or the keyword "default" to let the navigator choose a font.
	#
	# Note that for backward compatibility with 2.01, the hardcoded
	# default for HeadFont is a sans serif font, while the default
	# for TextFont is the navigator's default for a serif font.
	# To have http-analyze use the navigator's default font for
	# headings, set HeadFont to the string "default", which turns
	# off the hard-coded initialization.
	# To have http-analyze use the same serifless fonts for headings and
	# regular text, set TextFont to the list of serifless fonts shown below.
	#
	#HeadFont	Helvetica,Arial,Geneva,sans-serif
	#TextFont	Helvetica,Arial,Geneva,sans-serif
	#HeadSize	3
	#TextSize	2
	#ListSize	2
	#SmallSize	1
	
	# The Prefix to output after the header section (if defined, it must
	# include the <BODY> tag). If the string starts with a slash, it is
	# taken as the name of a file containing the HTML code.
	#HTMLPrefix	<BODY BGCOLOR="#FFFFFF">
	#HTMLPrefix	/usr/www/lib/header.templ
	
	# The Trailer to output at the end of a page, immediately before the
	# copyright note. If the string starts with a slash, it is taken as
	# the name of a file containing the HTML code.
	#HTMLTrailer	<A HREF="/staff/">Back</A> to the internal server
	#HTMLTrailer	/usr/www/lib/trailer.templ
	
	# Suppress certain parts of the summary.
	#Suppress	AVLoad,URLs,URLList,Code404,Sites,RSites,SiteList
	#Suppress	Agents,AgentList,Referrer,ReferList,Country
	#Suppress	AuthReq,Pageviews,Graphics,Hotlinks,Interpol
	$suppress
	HERE

	cat <<-\HERE >>$TMPFILE
	# The number of URLs, sites and agents in the "top N" lists. If set
	# to zero, the appropriate parts of the summary will be supressed.
	#TopURLs	30
	#LeastURLs	5
	#TopSites	30
	#TopAgents	30
	#TopRefers	30
	#TopDays	7
	#TopHours	24
	#TopMinutes	5
	#TopSeconds	5
	
	# The size of the navigation frame in pixels.
	#NavigFrame	120
	
	# The type of the 3D window:
	# extern (new window) or intern (inside frame).
	#3DWindow	extern
	
	# The size of the 3D window in pixels (width x height).
	#3DWinSize	520x420
	
	# The size of the navigation window in pixels (width x height).
	#NavWinSize	420x190
	
	#
	# List of sites and URLs to ignore or hide.
	# Format:
	#	HideURL <tab> URL <tab> DESC
	#	HideSys <tab> HOST <tab> DESC [TLD]
	#
	#	URL is the file's URL relative to SrvUrl:DocRoot
	#	HOST is a full qualified domain name
	#	DESC is the new category this item is hidden under
	#
	# The URL/hostname may either begin or end with a `*'
	# wildcard. There is only one wildcard allowed. The `*'
	# must be the first or very last character of the string.
	# Inside the string, a `*' is taken literal.
	#
	# If the URL doesn't start with a `*', the first character
	# must be a slash (`/').
	#
	# If desc begins with the character `[', the item is not
	# shown in any of the "Top Ten" lists.
	#

	# Ignore this hostnames. Increases processing time by a
	# significant amount, so keep this list small or don't
	# use it at all if speed is a concern.
	#IgnSys	*.foo.com

	# Ignore this files. Increases processing time by a
	# significant amount, so keep this list small or don't
	# use it at all if speed is a concern.
	#IgnURL	*.gif,*.jpg,*jpeg

	# Hide this hostnames. May be used to map local IP numbers
	# to hostnames. See the online documentation for examples.
	#HideSys	*.myname.com		MYCOMPANY
	#HideSys	192.168.1.*		UNRESOLVED.IP [COM]
	#HideSys	local.host		LOCAL.NETWORK [COM]

	# Hide this files, suppress them in Top Ten lists.
	#HideURL	*.map			[All image maps]
	#HideURL	*.class			[All java applets]
	#HideURL	/robots.txt		[Robot control file]

	# Hide this files and directories.
	#HideURL	/content.html		Foo Table of Content
	#HideURL	/help.html		Foo Help
	#HideURL	/search*		Foo Search
	
	#HideURL	/stats/*		Foo Access Statistics
	#HideURL	/news/*			Foo News
	#HideURL	/services/*		Foo Services
	#HideURL	/cgi-bin/*		CGI scripts
	
	# Browser types to be added to the browser list.
	# Needed for a certain browser type whose vendor
	# still can't spell it's name correctly.
	HideAgent	Mozilla/4.0 (compatible; MSIE 4.	MSIE 4.*
	HideAgent	Mozilla/3.0 (compatible; MSIE 4.	MSIE 4.*
	HideAgent	Mozilla/3.0 (compatible; MSIE 3.	MSIE 3.*
	HideAgent	Mozilla/2.0 (compatible;		MSIE 2.*
	HideAgent	Mozilla/1.22 (compatible; MSIE 2.	MSIE 2.*

	# Referrers to be added to the referrer list. If a string in
	# square brackets is given, this is the CGI parameter which
	# specifies the search key for search engines.
	HideRefer	http://www.yahoo.com/			Yahoo
	HideRefer	http://av.yahoo.com/			Yahoo [p=]
	HideRefer	http://search.yahoo.com/		Yahoo [p=]
	HideRefer	http://search.yahoo.de/			Yahoo (DE) [p=]
	HideRefer	http://av.yahoo.de/			Yahoo (DE) [p=]
	HideRefer	http://search.yahoo.co.uk/		Yahoo (UK) [p=]
	HideRefer	http://av.yahoo.co.uk/			Yahoo (UK) [p=]
	HideRefer	http://www.lycos.com/			Lycos [cat=]
	HideRefer	http://lycospro.lycos.com/		Lycos [query=]
	HideRefer	http://www-att.lycos.com/		Lycos [query=]
	HideRefer	http://www.lycos.de/			Lycos (DE) [query=]
	HideRefer	http://www.altavista.digital.com/	AltaVista [q=]
	HideRefer	http://ie4.altavista.digital.com/	AltaVista [q=]
	HideRefer	http://altavista.digital.com/		AltaVista [q=]
	HideRefer	http://www.webcrawler.com/		WebCrawler [searchText=]
	HideRefer	http://webcrawler.com/			WebCrawler [searchText=]
	HideRefer	http://www.metacrawler.com/		MetaCrawler [general=]
	HideRefer	http://search1.metacrawler.com/		MetaCrawler [general=]
	HideRefer	http://search2.metacrawler.com/		MetaCrawler [general=]
	HideRefer	http://search3.metacrawler.com/		MetaCrawler [general=]
	HideRefer	http://search4.metacrawler.com/		MetaCrawler [general=]
	HideRefer	http://www.altavista.telia.com/		Telia [q=]
	HideRefer	http://altavista.telia.com/		Telia [q=]
	HideRefer	http://www.web.de/			Web.DE [su=]
	HideRefer	http://web.de/				Web.DE [su=]
	HideRefer	http://www.infoseek.com/		InfoSeek [qt=]
	HideRefer	http://www.search.com/			Search.Com [QUERY=]
	HideRefer	http://netfind.aol.com/			AOL Search [search=]
	HideRefer	http://www.excite.com/			Excite [search=]
	HideRefer	http://www.search.hotbot.com/		HotBot [MT=]
	HideRefer	http://www.askjeeves.com/		Ask Jeeves [ask=]
	HideRefer	http://www.dino-online.de/		Dino Online [query=]
	HideRefer	http://www.fireball.de/			Fireball [q=]

	# Mock domains to be added to the Country list.
	#AddDomain	.myname.com		MYCOMPANY
	#AddDomain	.compuserve.com		Compuserve
	#AddDomain	.dtag.de		T-Online
	#AddDomain	.aol.com		AOL

	HERE

	ans=`prompt "Do you want to edit the configuration file" y/n n`
	case $ans in
	  y|Y)	${VISUAL:-vi}  $TMPFILE ;;
	esac

	mv $TMPFILE $config || exit 1
	echo "Configuration file $config successfully installed." 1>&2
	return
}

#
# Process command line arguments
#
while [ $# -gt 0 ]; do
	case $1 in
	  -b)	BUTTONDIR=$2 ;;
	  *)	break ;;
	esac
	shift
done

cat <<\HERE
http-analyze setup
------------------

1) Set up an analyzer configuration for a virtual web server
2) Install the required files in a statistics output directory
3) Brand your copy of http-analyze with the registration ID
4) Submit a bug report
5) Exit

HERE

ans=`prompt "Please select a function" 1-5 1`

case $ans in
  1)	setup ;;
  2)	instbtn ;;
  3)	brand ;;
  4)	bugreport ;;
  5)	echo "Bye." 1>&2 ;;
esac
exit 0



