#!/bin/bash

. ./setvars

for param in $*; do
	PARAMS="$PARAMS $param"
done;

# startadsl is lauched manually. If the modem is not operational,
# the script is immediately stopped
if ! $EAGLE_STAT | grep -q "$OPER_STR" ; then
	echo -e "$NOT_OPER_MSG"
	exit 1
fi

fctStartAdsl $PARAMS
RES=$?

if [ $RES == 1 ] ; then
	echo -e $ALREADY_MSG
	exit 1
fi
if [ $RES == 2 ] ; then
	echo -e $CANT_SYNC_MSG
	exit 1
fi
if [ $RES == 3 ] ; then
	echo -e $PPPD_ERR_MSG
	exit 1
fi
if [ $RES == 4 ] ; then
	echo -e $LOCK_MSG
	exit 1
fi
