#!/usr/bin/expect # /usr/local/bin/d3 -- 29 Jul 1999 # Copyright 1999-2001 Steve Kostecke # # 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. # see http://www.fsf.org/copyleft/gpl.html for more information. # Description: This expect script will log the user into D3 if # their D3 username and password is stored in ~./pickrc (see the # _config_file variable). This file must be readable only be the # user (0600). # # Config file format: # # set user D3-USERNAME # set password D3-PASSWORD # This Expect script is based on script which was originally generated # by autoexpect on Thu Jul 29 13:02:56 1999. # Expect and autoexpect were both written by Don Libes, NIST. set home [glob ~] set _default_config_file $home/.pickrc set _config_file $_default_config_file set d3 /usr/bin/d3 set force_conservative 1 ;# set to 1 to force conservative mode even if ;# script wasn't run conservatively originally if {$force_conservative} { set send_slow {1 .1} proc send {ignore arg} { sleep .1 exp_send -s -- $arg } } if [file exists $_config_file] { if 1==[string compare 00600 [file attributes $_config_file -permissions]] { puts "$_config_file is world readable.\nPermissions must be 0600." exit 1 } # uplevel allows user to set global variables if [catch {source $_config_file} msg] { puts "error reading $_config_file\n$msg" exit 1 } } else {set _manual_login 1} log_user 0 spawn $d3 if ![info exists _manual_login] { match_max 100000 expect "Connected to Virtual Machine 'pick0:LINUX'." send -- "\r" expect "Enter your user id: " send -- "$user\r" expect "user password:" send -- "$password\r" } log_user 1 interact .