ecu - SCO XENIX V/{2,3}86 Extended CU part 46/47

Warren Tucker wht at tridom.uucp
Thu Oct 12 05:22:03 AEST 1989


---- Cut Here and unpack ----
#!/bin/sh
# this is part 46 of a multipart archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file models/f.ep continued
#
CurArch=46
if test ! -r s2_seq_.tmp
then echo "Please unpack part 1 first!"
     exit 1; fi
( read Scheck
  if test "$Scheck" != $CurArch
  then echo "Please unpack part $Scheck next!"
       exit 1;
  else exit 0; fi
) < s2_seq_.tmp || exit 1
echo "x - Continuing file models/f.ep"
sed 's/^X//' << 'SHAR_EOF' >> models/f.ep
X#+------------------------------------------------------
X# f.eq - multi-color finger for remote system
X#-------------------------------------------------------
X#+:EDITS:*/
X#:07-11-1989-16:55-wht-get cmd became lgets
X#:06-30-1989-18:53-wht-creation
X
X	mkvar $icolor; $icolor = %colors
X	mkvar $itimeout; $itimeout = 50
X	send %argv(0)
X	lookfor '\n' 40
X	$s0 = ''
X	whilei 1==1
X	{
X		lgets $s00 $itimeout 5 '\n'
X		$itimeout = 20
X		color cyan
X		ifi %instr($s0,'% ') >= 0 break
X		ifi %instr($s0,'Login') == 0 color gray
X		ifi %instr($s0,' i29 ') > 0 color red
X		ifi %instr($s0,' i13 ') > 0 color green
X		ifi %instr($s0,'cma') == 0 color yellow
X		echo $s0
X	}
X	icolor $icolor
X	send ''
X
SHAR_EOF
echo "File models/f.ep is complete"
chmod 0644 models/f.ep || echo "restore of models/f.ep fails"
echo "x - extracting models/file_test.ep (Text)"
sed 's/^X//' << 'SHAR_EOF' > models/file_test.ep &&
X#  CHK=0xA2AF
X#------------------------------------------------------------
X#  ftst.ep - test ecu procedure file functions
X#------------------------------------------------------------
X
X ptrace off         # turn off trace mode
X fdel 'ftst.log'    # kill any previous file
X plog 'ftst.log'    # turn on logging
X
X echo ''
X echo 'ftst '+%date+' '+%time
X echo ''
X
X ptrace on                  # turn on trace mode
X
X set $s10 = '/tmp/ftst.tmp' # temp file name
X fdel $s10                  # test proc trace warning
X fopen -w 0 $s10            # open file 0 for write
X set i0=%ftell(0)           # should produce 0
X fputs 0 'abcdefghijk'      # put a line in the file
X set i0=%ftell(0)           # should produce 12
X fclose 0 n                 # close the file
X
X fopen -r 0 $s10    # open again for reading
X fgets 0 $s0        # should produce 'abcdefghijk'
X fseek 0 0          # rewind to read again
X fgets 0 $s0        # should produce 'abcdefghijk'
X fgets 0 $s0        # should produce null string
X set $i0=%fmode(0)  # test file mode function
X fclose 0           # close the file
X
X fchmod 'rw-rw-r-x' $s10 # set mode using string
X set $i0=%fmode($s10)
X
X fchmod 0777 $s10        # set mode using constant
X set $i0=%fmode($s10)
X
X ptrace off              # show file attributes
X echo ''
X echo -n $s10+' has '+%itos(%fsize($s10),06d)
X echo    ' (0x'+%itos(%fsize($s10),x  )+') bytes'
X echo 'accessed '+%edate(%fatime($s10))
X echo 'modified '+%edate(%fmtime($s10))
X echo ''
X ptrace on
X
X # demonstrate "is directory", "is character",
X # "is regular file" functions
X set i0=%isdir($s10),i1=%ischr($s10),i2=%isreg($s10)
X
X fdel $s10 # should say 'deleted'
X ptrace off
X plog off
SHAR_EOF
chmod 0644 models/file_test.ep || echo "restore of models/file_test.ep fails"
echo "x - extracting models/frame_test.ep (Text)"
sed 's/^X//' << 'SHAR_EOF' > models/frame_test.ep &&
X#  CHK=0xAB0B
X
X	set $i0 = 10
XLABEL
X	ifi $i0 > 0
X	{
X		set $i0,$i0=$i0-1
X		ifi $i0 = 5
X		{
X			echo 'nesting works!'
X		}
X		else ifi $i0 == 4
X		{
X			echo 'else works!'
X		}
X		goto LABEL
X	}
X
X	set $s0 = ''
X	whiles $s0 != 'aaaaa'
X	{
X		set $s0=$s0+'a'
X		ifs $s0 == 'aaaa' break
X		else echo '$s0=\''+$s0+'\''
X	}
X
X	echo 'done!'
SHAR_EOF
chmod 0644 models/frame_test.ep || echo "restore of models/frame_test.ep fails"
echo "x - extracting models/goto_test.ep (Text)"
sed 's/^X//' << 'SHAR_EOF' > models/goto_test.ep &&
X#  CHK=0x4C3F
X# goto_test.ep
X#+:EDITS:
X#:06-07-1989-22:31-wht-creation
X	echo '... TRY1 goto test'; goto TRY1
X	echo '... TRY1 goto failed'
X	return
X
XBACK1	echo '... gotob succeeded'
X	gotob COMP
X
XTRY1	echo '... TRY1 goto succeeded'
X	gotob BACK1
X
XCOMP	echo '... COMPuted goto test'; set $s0='COMP'+'UTED',$s0
X	goto $s0
X	echo '... COMP failed'
X	return
X
XCOMPUTED
X	echo '... computed goto worked'
X	echo '... test complete'
X	return
X
X# vi:set tabstop=8:
SHAR_EOF
chmod 0644 models/goto_test.ep || echo "restore of models/goto_test.ep fails"
echo "x - extracting models/hub.ep (Text)"
sed 's/^X//' << 'SHAR_EOF' > models/hub.ep &&
X#  CHK=0x5BDE
X#---------------------------------------------
X# hub.ep
X#---------------------------------------------
X#+:EDITS:
X#:09-09-1989-16:49-wht-creation
X
X	system 'vidi v80x25'
X	ptrace on
X	fkey 'stratus'
X	ptrace off
X	send 'biff n;mesg n;telnet stratus'
X	lookfor -e 'login  ' 200
X	lookfor -e '\n'
X	send 'login atl -module %tridom_hub#m2'
X	lookfor -e 'word?' 100
X	send 'notunix'
X	lookfor -e 'ready  ' 200
X	lookfor -e '\n'
X	send 'stp -terminal_type vt100'
X	lookfor -e 'ready  ' 200
X	lookfor -e '\n'
X	send 'call_thru -slave_id vt100_a1'
X	lookfor -e 'Password:' 200
X	send 'hub'
X	nap 20
X	send -n 'n'+%chr(0x1B)+'OM'
X	echo '\n'
SHAR_EOF
chmod 0644 models/hub.ep || echo "restore of models/hub.ep fails"
echo "x - extracting models/keys (Text)"
sed 's/^X//' << 'SHAR_EOF' > models/keys &&
Xstratus
X	F1:F1:esc O q
X	F2:F2:esc O r
X	F3:F3:esc O s
X	F4:F4:esc O t
X	F5:F5:esc O u
X	F6:F6:esc O v
X	F7:F7:esc O w
X	F8:status:dc4
X	F9:no status:nl
X	F10:redisp:esc O y
X	F11:redisp:syn
X	PGDN:cancel:esc O Q
X	END:enter:esc O M
X	PGUP:dispform:esc O R
X	CUU:^:dle
X	CUD:v:so
X	CUL:<:stx
X	CUR:>:ack
Xtridom
X	PGUP:fg:f g ^M
X	PGDN:^Z:^Z
Xremecu
X	F1:Home:0xC8
X	F2:End:0xC6
SHAR_EOF
chmod 0644 models/keys || echo "restore of models/keys fails"
echo "x - extracting models/lookfortest.ep (Text)"
sed 's/^X//' << 'SHAR_EOF' > models/lookfortest.ep &&
X#  CHK=0xFA5C
X# lookfor_test.ep (needs a modem already attached)
X
X	send 'ate0q1'
X	nap 20
X	flush
X
X	send 'at'
X
X	lookfor 'OK'
X	ifi $i0 == 1 echo '... got false success'; return
X	ifi $i0 <> 0 echo '... got illogical result';set $i0;return
X	echo '... got good result for failure to read'
X
X	send 'ate1q0'
X
X	lookfor -e 'OK'+%chr(0x0D)+%chr(0x0A) 20
X	ifi $i0 == 0 echo '... got false failure'; return
X	ifi $i0 <> 1 echo '... got illogical result';set $i0;return
X	echo '... got good result for read'
X
X
X
X# vi: set tabstop=8:
SHAR_EOF
chmod 0644 models/lookfortest.ep || echo "restore of models/lookfortest.ep fails"
echo "x - extracting models/mkdir.ep (Text)"
sed 's/^X//' << 'SHAR_EOF' > models/mkdir.ep &&
X#  CHK=0x91D9
X system 'mkdir '+%argv(1)
SHAR_EOF
chmod 0644 models/mkdir.ep || echo "restore of models/mkdir.ep fails"
echo "x - extracting models/oneline.ep (Text)"
sed 's/^X//' << 'SHAR_EOF' > models/oneline.ep &&
X#  CHK=0xF093
X#--------------------------------------------------------------
X# oneline.ep
X#
X# send command in $s0, expecting a one line response
X# and a csh prompt ending in '% '
X#
X# returns: $s0 = one line response in $s0 if success
X#          $i0 = 1 if success, else 0
X#--------------------------------------------------------------
X#+:EDITS:*/
X#:07-11-1989-16:55-wht-get cmd became lgets
X#:06-28-1989-19:36-wht-use named variables
X#:06-25-1989-13:56-wht-new do command syntax
X#:06-25-1989-12:33-wht-new if/while syntax
X#:06-22-1989-13:30-wht-creation
X
X	mkvar $icsave; $icsave = %colors
X	color gray
X	send $s0						# send command
X	lookfor -e %chr(0x0A) 50		# scan command echo
X	ifi $i0 == 0 icolor $i2;return	# if not found, return
X	lgets -e $s0 500 5 '\n'			# get one line response
X	lookfor '% ' 50					# get prompt, don't echo
X	# $i0 = 1 if prompt, else 0
X	icolor $icsave
SHAR_EOF
chmod 0644 models/oneline.ep || echo "restore of models/oneline.ep fails"
echo "x - extracting models/opuslogin.ep (Text)"
sed 's/^X//' << 'SHAR_EOF' > models/opuslogin.ep &&
X#  CHK=0xD695
X#+-----------------------------------------------------------------
X#  opuslogin.ep - ecu UNIX login procedure
X#  Copyright 1989 Warren H. Tucker, III. All Rights Reserved
X#
X# %argv(1) = remote name
X# %argv(2) = first name
X# %argv(3) = last name
X# %argv(4) = password
X#+-----------------------------------------------------------------
X#+:EDITS:*/
X#:07-11-1989-16:55-wht-get cmd became lgets
X#:06-28-1989-19:36-wht-use named variables
X#:06-25-1989-13:56-wht-new do command syntax
X#:06-25-1989-12:33-wht-new if/while syntax
X#:06-23-1989-19:46-wht-improved hayes dialer reduces need to report dial fail
X#:06-19-1989-22:50-wht-use while and if statements
X#:06-14-1989-15:58-wht-add login capability when already connected
X#:06-11-1989-23:37-wht-creation
X
X	mkvar $i_csave,$i_ltimeout,$i_retries
X
X	$i_csave = %colors
X	$i_retries=3
X
X	color red;    echo -n '\nauto-logon to '
X	color yellow; echo -n %argv(1)
X	color red;    echo    ' on '+%date+' at '+%time+'\n'
X
X	ifi %argc != 5	# not enough args
X	{
X		color red
X		echo %argv(0)+' needs 5 arguments (got '+%itos(%argc)+')'
X		goto SORRY1
X	}
X
X	ifi %conn == 0 goto DIAL
X
X	ifs %rname == %argv(1)
X	{
X		color brown;  echo -n 'already connected to '
X		color yellow; echo    %rname
X		goto GET_LOGIN_PROMPT_RETRY
X	}
X
XHANGUP
X	ifi %conn <> 0 echo 'hanging up on '+%rname; hangup
X
XDIAL
X	color green
X	dial %argv(1); set $i1=$i0 #save dial result in $i1
X	ifi $i1 == 2 color red; echo 'interrupted'; goto SORRY
X	ifi $i1 != 0 goto SORRY
X
XTEST_MODEM_RESULT
X	ifs $s0 != 'CONNECT '+%itos(%baud)
X		color yellow; echo 'baud rate mismatch ... retrying'; goto HANGUP
X
X# give name to remote
X	lookfor -e 'FIRST name: ' 150
X	send %argv(2)
X	lookfor -e 'LAST name: ' 150
X	send %argv(3)
X
X	lookfor -e '[Y,n]? ' 40
X	send 'Y'
X
X	lookfor -e 'Password: ' 80
X	send %argv(4)
X	lookfor -e '\n'
X	set $i0=0
X	goto SETCOLOR_AND_RETURN_STATUS
X
X# procedure failed
XSORRY
X	echo ''
X	color red
X	echo '....... sorry'
X	set $i0=0
X	goto SETCOLOR_AND_RETURN_STATUS
X
XSORRY1
X	echo ''
X	color red
X	echo '....... sorry'
X	set $i0=1
X
XSETCOLOR_AND_RETURN_STATUS
X	icolor $i_csave
X	return $i0
X
X# vi:set tabstop=4 shiftwidth=4:
SHAR_EOF
chmod 0644 models/opuslogin.ep || echo "restore of models/opuslogin.ep fails"
echo "x - extracting models/phone (Text)"
sed 's/^X//' << 'SHAR_EOF' > models/phone &&
X#navobs:1(202)653-0351::1200:N:Naval Observatory Time
Xalpha1:1(714)821-9671::2400:N:alphacm rotary 1
Xalpha2:1(714)821-9672::2400:N:alphacm rotary 2
Xkermit:1(419)537-4411::1200:E:Kermit
Xsco:1(408)426-9495::2400:N:SCO Tech Services (SOS)
Xsco2:1(408)425-3502::2400:N:sosco uucp?
SHAR_EOF
chmod 0644 models/phone || echo "restore of models/phone fails"
echo "x - extracting models/phrases (Text)"
sed 's/^X//' << 'SHAR_EOF' > models/phrases &&
Xsane:source ~wht/.cshrc^r
Xstty:stty intr ^C kill ^U erase ^H^r
Xls:login lab^r
Xpw:notunix^r
Xstp:stp -terminal_type vt100^r
Xcncs:cncs^r
SHAR_EOF
chmod 0604 models/phrases || echo "restore of models/phrases fails"
echo "x - extracting models/ps.ep (Text)"
sed 's/^X//' << 'SHAR_EOF' > models/ps.ep &&
X#  CHK=0xDA50
X#+------------------------------------------------------
X# p.eq
X#-------------------------------------------------------
X#+:EDITS:*/
X#:07-11-1989-16:55-wht-get cmd became lgets
X#:06-30-1989-18:53-wht-creation
X
X	mkvar $icolor; $icolor = %colors
X	send %argv(0)+' '+%argv(1)+' '+%argv(2)
X	lookfor '\n' 40
X	$s0 = ''
X	whilei 1==1
X	{
X		lgets $s0 60 60 '\n'
X		color cyan
X		ifi %instr($s0,'(getty)' >= 0 continue
X		else ifi %instr($s0,'(tcsh)' >= 0 continue
X		else ifi %instr($s0,'(csh)' >= 0 continue
X		else ifi %instr($s0,'(sh)' >= 0 continue
X		else ifi %instr($s0,'/etc/init' >= 0 continue
X		else ifi %instr($s0,'% ') >= 0 break
X		else ifi %instr($s0,'USER') == 0 color gray
X		else ifi %instr($s0,' i29 ') > 0 color red
X		else ifi %instr($s0,' i13 ') > 0 color green
X		else ifi %instr($s0,'cma') == 0 color yellow
X		echo $s0
X	}
X	icolor $icolor
X	send ''
X
SHAR_EOF
chmod 0644 models/ps.ep || echo "restore of models/ps.ep fails"
echo "x - extracting models/put_ecu.ep (Text)"
sed 's/^X//' << 'SHAR_EOF' > models/put_ecu.ep &&
X#  CHK=0x6289
X#--------------------------------------------------------------
X# put_ecu.ep - update remote copy of ecu sources
X#--------------------------------------------------------------
X#+:EDITS:*/
X#:07-11-1989-16:55-wht-get cmd became lgets
X#:06-28-1989-19:36-wht-use named variables
X#:06-25-1989-14:28-wht-use rz_update
X
X	$s10 = %rname
X	ifi %instr($s10,'tridom') == 0
X		$s10 = 'tridom'
X
X	ifs $s10 == 'tridom'
X	{
X		$s0 = '/u3/sd/wht/src/ecu'
X		$s1 = '/u1/src/ecu' 
X		$s2 = '`ff \'*.c\' \'*.h\' Makefile \'*.ep\' \'.mi\' \'*.txt\' \'*.man\'` xsel386/*'
X		$s3 = 'wht'
X		goto CALL_SZ_UPDATE
X	}
X	else ifs $s10== 'ki4xo'
X	{
X		$s0 = '/user/wht/src/ecu'
X		$s1 = '/u1/src/ecu' 
X		$s2 = '{.,z}/{Makefile,*.{c,h}} `ff \'*.ep\' \'.mi\' \'*.man\'` xsel386/*'
X		$s3 = 'wht'
X		goto CALL_SZ_UPDATE
X	}
X	else ifs $s10== 'coke-jsm'
X	{
X		$i39=%colors
X		color red; echo '\n\nHAVE YOU MADE A NO-SELECT VERSION???????\n\n'
X		mkvar $s_rpwd(20)
X		echo -n 'root password? ' ; $s_rpwd = %cgets
X		icolor $i39
X		$s0 = '/usr/wht/bin'
X		$s1 = '/u1/src/ecu'
X		$s2 = 'ecu'
X		$s3 = 'wht'
X		do 'sz_update' $s0  $s1 $s2 $s3 %argv(0)
X		lookfor '% ' 40
X		$s0 = '/usr/wht/bin'
X		$s1 = '/usr/wht/bin'
X		$s2 = 'ecusz ecurz ecusea'
X		$s3 = 'wht'
X		do 'sz_update' $s0  $s1 $s2 $s3 %argv(0)
X		lookfor '% ' 40
X		$s0 = '/usr/wht'
X		$s1 = '/u1/src/ecu/doc'
X		$s2 = '*.man'
X		$s3 = 'wht'
X		do 'sz_update' $s0  $s1 $s2 $s3 %argv(0)
X		lookfor '% ' 40
X		$s0 = '/usr/wht/.ecu'
X		$s1 = '/u1/src/ecu/models'
X		$s2 = '*'
X		$s3 = 'wht'
X		do 'sz_update' $s0  $s1 $s2 $s3 %argv(0)
X		lookfor '% ' 40
X		$s0 = '/usr/lib/ecu'
X		$s1 = $s0
X		$s2 = '*'
X		$s3 = ''
X		do 'su-csh' 'root' $s_rpwd
X		do 'sz_update' $s0  $s1 $s2 $s3 %argv(0)
X		send -e 'chmod u+s /usr/lib/ecu/ecuungetty'
X		send %chr(0x04)
X		return
X	}
X	else echo 'not to '+$s10+' you don\'t'
X
X# $s0 = remote directory
X# $s1 = local directory
X# $s2 = file list
X# $s3 = necessary username on remote system
XCALL_SZ_UPDATE
X	do 'sz_update' $s0  $s1 $s2 $s3 %argv(0)
SHAR_EOF
chmod 0644 models/put_ecu.ep || echo "restore of models/put_ecu.ep fails"
echo "x - extracting models/rz_update.ep (Text)"
sed 's/^X//' << 'SHAR_EOF' > models/rz_update.ep &&
X#  CHK=0x3514
X#--------------------------------------------------------------
X# rz_update.ep - update local directory
X#
X# parameters:
X# %argv(1) = remote directory to copy from
X# %argv(2) = local directory to copy to
X# %argv(3) = file list to get
X# %argv(4) = remote username needed, if any, else null
X#            if %argv(4) not null, 'su_'+%argv(4)+".ep" must
X#            exist to su to remote
X# %argv(5)   name of superior procedure
X#
X#--------------------------------------------------------------
X#+:EDITS:*/
X#:07-11-1989-16:55-wht-get cmd became lgets
X#:06-28-1989-19:36-wht-use named variables
X#:06-25-1989-13:56-wht-new do command syntax
X#:06-25-1989-12:33-wht-new if/while syntax
X#:06-22-1989-13:30-wht-creation
X
X# variable usage
X	mkvar $i_csave			# color settings at entry to procedure
X	mkvar $i_rtnval			# return code
X	mkvar $i_suflag			# true if su occurred
X	mkvar $s_origdir(128)	# original working directory
X	mkvar $s_rdir(128)		# remote directory we started with
X	mkvar $s_ruser(16)		# remote username we started with before su
X	mkvar $s_xtitle(64)		# title for xfer
X
X	$i_csave=%colors # get colors at entry
X
X	$s_xtitle = 'Connected to '+%rname
X	ifs %argv(5) != ''
X		$s_xtitle = $s_xtitle+' - procedure '+%argv(5)
X
X# check to make sure we are connected
X	ifi %conn == 0
X	{
X		color red; echo 'not connected to anyone!'
X		goto SORRY
X	}
X	color lt_blue;  echo 'Connected to '+%rname
X
X# save local current directory and change to target
X	$s_origdir=%dir
X	color brown
X	ifs $s_origdir == %argv(2)
X		echo -n 'local directory already '
X	else 
X	{
X		cd %argv(2)
X		echo -n 'local directory set to '
X	}
X	color yellow; echo %dir
X
X# make sure remote username ok
X	ifs %argv(4) == '' goto REMOTE_CD # if any remote username
X	do 'bsd_uname'			# get $s0=username
X	ifi $i0 == 0 goto SORRY	# test failure
X	$s_ruser = $s0			# save original remote username
X	ifs $s0 != %argv(4)
X	{						# need to su
X		color brown
X		echo -n 'remote username '
X		color yellow
X		echo -n $s0
X		color brown
X		echo ' ... su to '+%argv(4)+' now'
X		color gray
X		do 'su_'+%argv(4)	# call proc, which calls su.ep
X		lookfor '% ' 50		# su leaves prompt in buffer: swallow
X		do 'bsd_uname'		# make sure we su'd
X		ifi $i0 == 0 goto SORRY
X		ifs $s0 != %argv(4)	# failed to su?
X		{
X			color red;echo 'su to '+%argv(4)+' failed'
X			goto SORRY
X		}
X		$i_suflag = 1		# remember we su'd
X	}	# now we are proper username on remote
X
X# establish proper remote working directory
XREMOTE_CD
X	color gray
X	$s0 = 'pwd';do 'oneline'	# save old remote ...
X	$s_rdir = $s0				# ... directory in $s_rdir
X	ifs $s_rdir != %argv(1)		# if cd needed, do it
X	{
X		send 'cd '+%argv(1)		# remote cd
X		lookfor -e '\n' 50		# echo command
X		lookfor '% ' 50			# swallow prompt
X		$s0 = 'pwd'
X		do 'oneline'			# make sure we got there
X		ifs $s0 != %argv(1)		# dir change failed
X		{
X			color red;echo 'remote cd failed'
X			goto SORRY;
X		}
X	}
X	color brown;  echo -n 'remote directory '
X	color yellow; echo -n %argv(1)
X	color brown;  echo    ' ... starting transfer now'
X
X# transfer files
X	color lt_blue
X	send 'sz -n -f '+%argv(3)
X	lookfor -e '\n' 50	# echo remote command
X	ifi $i0 == 0		# command failed?
X	{
X		color red; echo 'sz command failed or garbled echo'
X		goto SORRY
X	}
X	color brown
X	echo 'waiting for sz to start'
X	nap 10
X	color gray
X#	$s5 = '**'+%chr(0x18)+'B'	# ZMODEM header
X	lgets $s0 150 10 '\n'		# wait 15 secs for start
X	ifi %instr($s0,'rz') < 0	# check for 'rz' startup from remote
X	{
X		color white;
X		echo '\n'+$s0+'\n'
X		color red
X		echo 'sz protocol failure or trigger garbled'
X		goto SORRY
X	}
X	icolor $i_csave				# restore colors at entry
X	rz -l $s_xtitle
X	ifi $i0 != 0	# whoops
X	{
X		color red; echo -n '\nTRANSFER FAILED ... '
X		ifi $i0 == 0x100 echo 'interrupt'
X		ifi $i0 != 0x100 echo 'termination status '+%itos($i0,04d)
X		goto SORRY
X	}
X	lookfor '% ' 50				# swallow prompt
X	goto RETURN
X
XSORRY # whoops
X	color red;echo 'rz_update failed ... sorry'
X	$i_rtnval = 1				# return error
X
XRETURN
X	echo ''
X	color brown;  echo -n 'remote user name '
X	color yellow
X	ifi $i_suflag != 0			# we su'd
X	{
X		send -n %chr(0x04)  	# will force a new prompt from remote
X		echo -n $s_ruser
X		color brown;  echo ' restored (sent ^D to '+%argv(4)+' shell)'
X		lookfor '% ' 50			# swallow prompt
X	}
X	else
X		color brown;  echo 'unchanged'
X
X	ifs $s_rdir != %argv(1)		# if we did a remote cd
X	{
X		send 'cd '+$s_rdir		# restore original
X		lookfor '\n'
X		color brown;  echo -n 'remote working directory '
X		color yellow; echo -n $s_rdir
X		color brown;  echo    ' restored'
X	}
X	else
X	{
X		send ''				# spark a prompt
X		color brown;  echo -n 'remote working directory '
X		color yellow; echo -n $s_rdir
X		color brown;  echo    ' unchanged'
X	}
X
X	ifs $s_origdir != %dir	# restore original directory
X	{
X		cd $s_origdir
X		color brown;  echo -n 'local working directory '
X		color yellow; echo -n $s_origdir
X		color brown;  echo    ' restored'
X	}
X
X	icolor $i_csave		# restore colors at entry
X	echo ''
X	return $i_rtnval	# return selected error code (bomb procedure if error)
SHAR_EOF
chmod 0644 models/rz_update.ep || echo "restore of models/rz_update.ep fails"
echo "x - extracting models/scm.ep (Text)"
sed 's/^X//' << 'SHAR_EOF' > models/scm.ep &&
X#  CHK=0x01CA
X#+------------------------------------------------------------
X# scm.ep - goto scm and use wht .cshrc
X#-------------------------------------------------------------
X#+:EDITS:*/
X#:07-11-1989-16:55-wht-get cmd became lgets
X#:06-28-1989-19:36-wht-use named variables
X#:06-26-1989-19:25-wht-working with su.ep - no longer secret
X
X	mkvar icsave; $icsave = %colors
X	do 'su' 'scm' 'newtools'
X	lookfor '% ' 70		# swallow prompt left by su.ep
X	color gray
X	send 'source ~wht/.cshrc'
X	lookfor -e '\n' 70
X	ifs %argv(1) != '.'
X	{
X		lookfor '% ' 70		# swallow prompt
X		send 'cd'
X		lookfor -e '\n' 50	# send 'cd', swallow echo
X	}
X	icolor $icsave
SHAR_EOF
chmod 0644 models/scm.ep || echo "restore of models/scm.ep fails"
echo "x - extracting models/senddate.ep (Text)"
sed 's/^X//' << 'SHAR_EOF' > models/senddate.ep &&
X#  CHK=0x067D
X#+----------------------------------------------
X# senddate.ep
X#-----------------------------------------------
X#+:EDITS:*/
X#:07-11-1989-16:55-wht-get cmd became lgets
X#:06-28-1989-19:36-wht-use named variables
X#:06-27-1989-17:02-wht-working
X
X	mkvar icsave;$icsave = %colors
X	color blue
X	echo -n 'remote root password? '
X	color black
X	$s0 = %cgets
X	icolor $icsave
X	do 'su' 'root' $s0
X	$s0 = ''		# forget password
X	lookfor '% ' 50 # swallow prompt
X	send 'date'
X	lookfor -e '% ' 50
X	system -l 'senddate'
X	lookfor -e quiet 20
X	send -n %chr(0x04)
SHAR_EOF
chmod 0644 models/senddate.ep || echo "restore of models/senddate.ep fails"
echo "x - extracting models/su.ep (Text)"
sed 's/^X//' << 'SHAR_EOF' > models/su.ep &&
X#  CHK=0x4626
X#+---------------------------------------------------------
X# su.ep - switch user at remote
X# Copyright 1989 Warren H. Tucker, III. All Rights Reserved
X#
X# do su 'username' 'password' ['.']
X#
X# expects new user to be running csh
X#----------------------------------------------------------
X#+:EDITS:*/
X#:07-11-1989-16:55-wht-get cmd became lgets
X#:06-28-1989-19:36-wht-use named variables
X#:06-27-1989-12:43-wht-"get prompt" message was wrong
X#:06-25-1989-13:56-wht-new do command syntax
X#:06-25-1989-12:33-wht-new if/while syntax
X#:06-16-1989-18:12-wht-creation
X
X	mkvar icsave; $icsave = %colors
X
X	color gray
X	send 'su '+%argv(1)
X	lookfor -e 'word:' 70
X	ifi $i0 == 0
X	{
X		color red;echo 'su: failed to get password prompt'
X		icolor $icsave; return 1
X	}
X	send %argv(2); lookfor '\n' 50	# send password
X	echo ''
X	lgets $s0 70 5 '\n'
X	ifi %instr($s0,'Sorry') >= 0
X	{
X		color red;echo 'su: remote said "Sorry"'
X		icolor $icsave; return 1
X	}
X	nap 5						# wait .5 sec
X	send 'set prompt="% "'		# set '% ' as prompt
X	lookfor '\n' 20				# swallow echo of set command
X	lookfor '% ' 60				# look for new prompt
X	ifi $i0 == 0
X	{
X		color lt_red
X		echo 'timeout on prompt ... system may be slow ... waiting 5 more secs'
X		color gray
X		lookfor '% ' 50				# look for new prompt
X	}
X	ifi $i0 == 0
X	{
X		color red;echo 'su: failed to "get prompt" echo'
X		icolor $icsave; return 2
X	}
X	ifs %argv(3) == '.'
X		send 'source ~wht/.cshrc'
X	else
X		send ''; lookfor '\n' 50	# kick off another prompt
X	icolor $icsave
SHAR_EOF
chmod 0644 models/su.ep || echo "restore of models/su.ep fails"
echo "x - extracting models/sz_update.ep (Text)"
sed 's/^X//' << 'SHAR_EOF' > models/sz_update.ep &&
X#  CHK=0x4068
X#--------------------------------------------------------------
X# sz_update.ep - update local directory
X#
X# parameters:
X# %argv(1) = remote directory to copy to
X# %argv(2) = local directory to copy from
X# %argv(3) = file list to send
X# %argv(4) = remote username needed, if any, else null
X#            if %argv(4) not null, 'su_'+%argv(4)+".ep" must
X#            exist to su to remote
X# %argv(5)   name of superior procedure
X#
X#--------------------------------------------------------------
X#+:EDITS:*/
X#:07-11-1989-16:55-wht-get cmd became lgets
X#:06-28-1989-19:36-wht-use named variables
X#:06-25-1989-13:56-wht-new do command syntax
X#:06-25-1989-12:33-wht-new if/while syntax
X#:06-22-1989-13:30-wht-creation
X
X# variable usage
X	mkvar $i_csave			# color settings at entry to procedure
X	mkvar $i_suflag			# true if su occurred
X	mkvar $i_rtnflag		# return code
X	mkvar $s_origdir(128)	# original working directory
X	mkvar $s_ruser(16)		# remote username we started with before su
X	mkvar $s_rdir(128)		# remote directory we started with
X	mkvar $s_xtitle(64)		# title for xfer
X
X	$i_csave=%colors # get colors at entry
X
X	$s_xtitle = 'Connected to '+%rname
X	ifs %argv(5) != ''
X		$s_xtitle = $s_xtitle+' - procedure '+%argv(5)
X
X# check to make sure we are connected
X	ifi %conn == 0
X	{
X		color red; echo 'not connected to anyone!'
X		goto SORRY
X	}
X	color lt_blue;  echo 'Connected to '+%rname
X
X# save local current directory and change to target
X	$s_origdir=%dir
X	color brown
X	ifs $s_origdir == %argv(2)
X		echo -n 'local directory already '
X	else 
X	{
X		cd %argv(2)
X		echo -n 'local directory set to '
X	}
X	color yellow; echo %dir
X
X# make sure remote username ok
X	ifs %argv(4) == '' goto REMOTE_CD # if any remote username
X	do 'bsd_uname'			# get $s0=username
X	ifi $i0 == 0 goto SORRY	# test failure
X	$s_ruser = $s0			# save original remote username
X	ifs $s0 != %argv(4)
X	{						# need to su
X		color brown
X		echo -n 'remote username '
X		color yellow
X		echo -n $s0
X		color brown
X		echo ' ... su to '+%argv(4)+' now'
X		color gray
X		do 'su_'+%argv(4)	# call proc, which calls su.ep
X		lookfor '% ' 50		# su leaves prompt in buffer: swallow
X		do 'bsd_uname'		# make sure we su'd
X		ifi $i0 == 0 goto SORRY
X		ifs $s0 != %argv(4)	# failed to su?
X		{
X			color red;echo 'su to '+%argv(4)+' failed'
X			goto SORRY
X		}
X		$i_suflag = 1		#remember we su'd
X	}	# now we are proper username on remote
X
X# establish proper remote working directory
XREMOTE_CD
X	color gray
X	$s0 = 'pwd';do 'oneline'	# save old remote ...
X	$s_rdir = $s0				# ... directory in $s_rdir
X	ifs $s_rdir != %argv(1)		# if cd needed, do it
X	{
X		send 'cd '+%argv(1)		# remote cd
X		lookfor -e '\n' 50		# echo command
X		lookfor '% ' 50			# swallow prompt
X		$s0 = 'pwd'
X		do 'oneline'			# make sure we got there
X		ifs $s0 != %argv(1)		# dir change failed
X		{
X			color red;echo 'remote cd failed'
X			goto SORRY;
X		}
X	}
X	color brown;  echo -n 'remote directory '
X	color yellow; echo    %argv(1)
X
X# transfer files
X	color lt_blue
X	echo 'sz -n -f '+%argv(3)
X	icolor $i_csave				# restore colors at entry
X	sz -nfl $s_xtitle %argv(3)
X	ifi $i0 != 0				# whoops
X	{
X		color red; echo -n '\nTRANSFER FAILED ... '
X		ifi $i0 == 0x100 echo 'interrupt'
X		ifi $i0 != 0x100 echo 'termination status '+%itos($i0,04d)
X		goto SORRY
X	}
X	lookfor '% ' 50				# swallow prompt
X	goto RETURN
X
XSORRY # whoops
X	color red;echo 'sz_update failed ... sorry'
X	$i_rtnflag = 1	# return error
X
XRETURN
X	echo ''
X	color brown;  echo -n 'remote user name '
X	color yellow
X	ifi $i_suflag != 0			# we su'd
X	{
X		send -n %chr(0x04)		# will force a new prompt from remote
X		echo -n $s_ruser
X		color brown;  echo ' restored (sent ^D to '+%argv(4)+' shell)'
X		lookfor '% ' 50			# swallow prompt
X	}
X	else
X		color brown;  echo 'unchanged'
X
X	ifs $s_rdir != %argv(1)		# if we did a remote cd
X	{
X		send 'cd '+$s_rdir		# restore original
X		lookfor '\n'
X		color brown;  echo -n 'remote working directory '
X		color yellow; echo -n $s_rdir
X		color brown;  echo    ' restored'
X	}
X	else
X	{
X		send ''	# spark a prompt
X		color brown;  echo -n 'remote working directory '
X		color yellow; echo -n $s_rdir
X		color brown;  echo    ' unchanged'
X	}
X
X	color brown;  echo -n 'local working directory '
X	color yellow; echo -n $s_origdir
X	color brown
X	ifs $s_origdir != %dir	# restore original directory
X	{
X		cd $s_origdir
X		echo    ' restored'
X	}
X	else
X		echo ' unchanged'
X
X	icolor $i_csave		# restore colors at entry
X	echo ''
X	return $i_rtnflag	# return selected error code (bomb procedure if error)
SHAR_EOF
chmod 0644 models/sz_update.ep || echo "restore of models/sz_update.ep fails"
echo "x - extracting models/szall.ep (Text)"
sed 's/^X//' << 'SHAR_EOF' > models/szall.ep &&
X#  CHK=0xE67C
X
X	do 'put_mpad1'
X	lookfor '% ' 40
X	do 'put_kdir12'
X	lookfor '% ' 40
X	do 'put_sim'
X	lookfor '% ' 40
X	do 'put_ecu'
SHAR_EOF
chmod 0644 models/szall.ep || echo "restore of models/szall.ep fails"
echo "x - extracting models/tty1a.mi (Text)"
sed 's/^X//' << 'SHAR_EOF' > models/tty1a.mi &&
X#  CHK=0xF537
X#+-----------------------------------------------------------------
X#  tty1a.mi - Microcom AX/9624c
X#  Copyright 1989 Warren H. Tucker, III. All Rights Reserved
X#------------------------------------------------------------------
X#+:EDITS:
X#:07-02-1989-20:51-wht-beef up init
X#:06-17-1989-22:02-wht-creation
X
Xinit_>2400:atq0e1v1x4s0=0s2=43s7=30\q1\x1\n3
Xinit_default:atq0e1v1x4s0=0s2=43s7=30\q0\x0\n0
Xdial_default:atdt
Xautoanswer:atq1s0=1
SHAR_EOF
chmod 0644 models/tty1a.mi || echo "restore of models/tty1a.mi fails"
echo "x - extracting models/tty2d.mi (Text)"
sed 's/^X//' << 'SHAR_EOF' > models/tty2d.mi &&
X#  CHK=0x61EF
X#+-----------------------------------------------------------------
X#  tty2d.mi - USR Courier 2400
X#  Copyright 1989 Warren H. Tucker, III. All Rights Reserved
X#------------------------------------------------------------------
X#+:EDITS:
X#:07-02-1989-20:51-wht-beef up init
X#:06-17-1989-22:02-wht-creation
X
Xinit_default:atq0e1v1x4s0=0s2=43s7=30s11=47
Xdial_default:atdt
Xautoanswer:atq1s0=1
SHAR_EOF
chmod 0644 models/tty2d.mi || echo "restore of models/tty2d.mi fails"
echo "x - extracting models/unixlogin.ep (Text)"
sed 's/^X//' << 'SHAR_EOF' > models/unixlogin.ep &&
X#  CHK=0x8ADC
X#+-----------------------------------------------------------------
X#  unixlogin.ep - ecu UNIX login procedure
X#  Copyright 1989 Warren H. Tucker, III. All Rights Reserved
X#
X# %argv(1) = remote name
X# %argv(2) = user name
X# %argv(3) = password
X# %argv(4) = term type
X# %argv(5) = optional number of breaks needed
X#+-----------------------------------------------------------------
X#+:EDITS:*/
X#:07-11-1989-16:55-wht-get cmd became lgets
SHAR_EOF
echo "End of part 46"
echo "File models/unixlogin.ep is continued in part 47"
echo "47" > s2_seq_.tmp
exit 0
-- 
-------------------------------------------------------------------
Warren Tucker, Tridom Corporation       ...!gatech!emory!tridom!wht 
Ker-au'-lo-phon.  An 8-foot partial flue-stop, having metal pipes
surmounted by adjustable rings, and with a hole bored near the top
of each pipe, producing a soft and "reedy" tone.



More information about the Alt.sources mailing list