#! /etc/fw/cisco/expect -f
#
# Copyright (c) 1993-1996 CheckPoint Software Technologies Ltd.
# All Rights Reserved
#
# THIS IS AN UNPUBLISHED PROPRIETARY SOURCE CODE OF CHECKPOINT SOFTWARE
# TECHNOLOGIES LTD. The copyright notice above does not evidence any actual
# or intended publication of such source code.
#
# $Header: /fw/cvs/fw-1/cisco/fwciscologin.exp,v 1.5.2.1 1996/04/11 09:36:05 yoav Exp $
#

proc login {args} {
	global password
	global enablepass

	expect	{*Password:*} {} \
		timeout {timedout waiting for password prompt}
	# ugly!
	system sleep 1
	send ${password}\r
	expect {*Password:*}	{send_error "Bad password.\n"; exit 1} \
		{*>}		{} \
		timeout		{timedout waiting for login prompt}

	if {[llength $args]} {
		send enable\r
		expect {*Password:*}	{} \
			timeout	{timedout waiting for enable password prompt}
		# ugly!
		system sleep 1
		send [lindex $args 0]\r
		expect {*#}	{} \
		   {*Password:*} {send_error "Wrong enable password.\n"; exit 1} \
		   timeout	{timedout waiting for enabled prompt}
	}
}
	
