#! /bin/sh
#
#  Copyright (C) 1997  Dimitrios P. Bouras
#
#   This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#   For author contact information, look in the README file.
 
# First setup all variables passed on from pppd
#-----------------------------------------------
interface=$1
device=$2
speed=$3
localIP=$4
remoteIP=$5
ipparam=$6
 
# Then parse the ipparam argument string passed on from xisp
#------------------------------------------------------------
pipefname=`echo $ipparam | sed -e 's/\:.*$//'`
temp=`echo $ipparam | sed -e 's/^[^:]*\://'`
ISPname=`echo $temp | sed -e 's/\:.*$//'`
temp=`echo $temp | sed -e 's/^[^:]*\://'`
DNS1=`echo $temp | sed -e 's/\:.*$//'`
DNS2=`echo $temp | sed -e 's/^.*\://'`

# Add lines in /etc/resolv.conf for the DNS entries passed from xisp
#--------------------------------------------------------------------
if [ "$DNS1"x != x ]; then
	echo "nameserver	$DNS1	# xisp primary DNS line" >> /etc/resolv.conf
	echo "Primary DNS: $DNS1" >> $pipefname 2>&1
fi
if [ "$DNS2"x != x ]; then
	echo "nameserver	$DNS2	# xisp secondary DNS line" >> /etc/resolv.conf
	echo "Secondary DNS: $DNS2" >> $pipefname 2>&1
fi

# The ISPname variable can now be used to carry out global and/or
# ISP-specific tasks like downloading mail and/or news. The folowing
# statements are examples. Modify them to best suit your needs.
# Note that for output to appear in the xisp browser window, all
# commands must end with the '>> $pipefname 2>&1' output redirection.
#---------------------------------------------------------------------

# echo "Interface $interface is now UP" >> $pipefname 2>&1
# echo "On $device at $speed Baud" >> $pipefname 2>&1
# echo "Local IP: $localIP" >> $pipefname 2>&1
# echo "Remote IP: $remoteIP" >> $pipefname 2>&1

case $ISPname in

	'My First Provider')
		echo "Provider 1" >> $pipefname 2>&1
		;;

	'My Second Provider')
		echo "Provider 2" >> $pipefname 2>&1
		;;

	*)
		;;
esac

