#!/bin/sh
#
# Wrapper to set environment variables then exec the real zapper.
# The reasons for this are twofold:
#	- for some reason squid doesn't preserve the original environment
#	  when you do a restart (or SIGHUP)
#	- to avoid having to hack the squid startup script (if you have
#	  a presupplied one, such as ships with some linux distributions)
#
# Install in the same directory you put the zapper (just for convenience) and
# hack the pathnames below to suit.
# Note that you can skip this script and run the zapper with no environment
# settings at all and it will work fine; the variables are all set here merely
# for completeness so that customisation is easy for you.
#	- Cameron Simpson <cs@zip.com.au> 21apr2000
#

zapper=@@PREFIX@@/libexec/squid_redirect
   
. /etc/adzap.conf

export ZAP_MODE ZAP_BASE ZAP_BASE_SSL ZAP_PREMATCH ZAP_POSTMATCH ZAP_MATCH ZAP_NO_CHANGE
export STUBURL_AD STUBURL_ADSSL STUBURL_ADJS STUBURL_ADHTML STUBURL_ADMP3 \
	STUBURL_ADPOPUP STUBURL_ADSWF STUBURL_COUNTER STUBURL_COUNTERJS \
	STUBURL_COUNTERHTML STUBURL_WEBBUG STUBURL_WEBBUGJS STUBURL_WEBBUGHTML \
	STUBURL_PRINT STUBURL_ADHTMLTEXT STUBURL_ADJSTEXT

# Here, having arranged the environment, we exec the real zapper.
# If you're chaining redirectors then comment out the direct exec below and
# uncomment (and adjust) the exec of zapchain which takes care of running
# multiple redirections.

exec "$zapper"
# exec /path/to/zapchain "$zapper" /path/to/another/eg/squirm
