[comp.sources.misc] v16i059: ECU async comm package rev 3.0, Part35/35

wht@n4hgf.uucp (Warren Tucker) (01/06/91)

Submitted-by: wht@n4hgf.uucp (Warren Tucker)
Posting-number: Volume 16, Issue 59
Archive-name: ecu3/part35

---- Cut Here and feed the following to sh ----
#!/bin/sh
# This is part 35 of ecu3
if touch 2>&1 | fgrep 'amc' > /dev/null
 then TOUCH=touch
 else TOUCH=true
fi
# ============= models/nonansikeys ==============
if test ! -d 'models'; then
    echo 'x - creating directory models'
    mkdir 'models'
fi
echo 'x - extracting models/nonansikeys (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'models/nonansikeys' &&
X#+------------------------------------------------------------------------
X# ECU 3.0 nonansikeys
X#
X# This file contains mapping information to convert non-ANSI
X# keyboard function keys to an internal ECU function key
X# representation
X# 
X# The format of an entry is shown below in the 'ansilike' example (used
X# to ansilike ECU from the console by defining an ansi terminal type
X# nevertheless equivalent to ansi).
X# 
X# The first line(s) in a terminal keyboard description begin in
X# column 1 and contain the terminal types (a la $TERM) for which
X# the keyboard description are valid.  The example entry contains
X# several references to terminal types containing the substring
X# 'ansi'.  These are included only as an example of one keyboard
X# description servicing multiple terminal types.
X# 
X# ECU determines whether a terminal meets the ansi vs.  ANSI
X# distinction by searching for 'ansi' in the $TERM environment
X# variable (without regard to case: 'AnSi' will match as well as
X# 'ansi').  If your keyboard matches the ANSI specification even
X# though your $TERM environment variable does not contain 'ansi'
X# (such as 'sun'), then you may add the terminal type to the 'ansilike'
X# entry rather than create a separate entry.
X# 
X# Following the "first lines" are key definition entries, each
X# preceded by at least one tab or space.  Each entry is composed of
X# three fields delimited by commas.  The first field of an entry is
X# the internal ECU function key name and must be chosen from the
X# following strings (with no regard to case): "F1", "F2", "F3",
X# "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", "Home",
X# "End", "PgUp", "PgDn", "CUP", "CUL", "CU5", "CUR" and "CUD" The
X# second field contains the name of the key as it appears on the
X# non-ANSI keyboard (such as "F16" for End on the Wyse 60).  The
X# third field is a description of the character sequence generated
X# by the non-ANSI keyboard when the chosen key is pressed; it is a
X# string of one or more tokens separated by spaces or tabs.
X# The tokens are described in full in the ECU manual sections titled
X# "Function Key Recognition" and "Function Key Mapping."
X# 
X#-------------------------------------------------------------------------
X#+:EDITS:
X#:12-20-1990-23:50-wht@n4hgf-"correct" wyse entry
X#:12-18-1990-19:43-wht@n4hgf-add xterm and wy60
X#:12-02-1990-13:34-wht@n4hgf-creation
X
X#+-------------------------------------------------------------------
X#   testing/example
X#--------------------------------------------------------------------
Xansilike
Xansi
Xmsdos
Xdos
Xdosansi
Xtest
X    F1:F1:          esc [ M 
X    F2:F2:          esc [ N 
X    F3:F3:          esc [ O 
X    F4:F4:          esc [ P 
X    F5:F5:          esc [ Q 
X    F6:F6:          esc [ R 
X    F7:F7:          esc [ S 
X    F8:F8:          esc [ T 
X    F9:F9:          esc [ U 
X    F10:F10:        esc [ V 
X    F11:F11:        esc [ W 
X    F12:F12:        esc [ X 
X    Home:Home:      esc [ H 
X    End:End:        esc [ F 
X    PgUp:PgUp:      esc [ I 
X    PgDn:PgDn:      esc [ G 
X    CUU:CUU:        esc [ A 
X    CUL:CUL:        esc [ D 
X    CU5:CU5:        esc [ E 
X    CUR:CUR:        esc [ C 
X    CUD:CUD:        esc [ B 
X    Ins:Ins:        esc [ L
X    BkTab:BackTab:  esc [ Z
X
X#+-------------------------------------------------------------------
X#   SCO ODT 1.0 console xterm (as released, unmodified)
X#--------------------------------------------------------------------
Xxterm
X    F1:F1:          esc [ 1 1 ~
X    F2:F1:          esc [ 1 2 ~
X    F3:F1:          esc [ 1 3 ~
X    F4:F1:          esc [ 1 4 ~
X    F5:F1:          esc [ 1 5 ~
X    F6:F1:          esc [ 1 7 ~
X    F7:F1:          esc [ 1 8 ~
X    F8:F1:          esc [ 1 9 ~
X    F9:F1:          esc [ 2 0 ~
X    F10:F10:        esc [ 2 1 ~
X#   F11:F11:        esc [ 2 3 ~   # decomitted to provide a BkTab
X#   F12:F12:        esc [ 2 4 ~   # decomitted to provide a BkTab
X    Home:Home:      esc [ 8 ~
X    End:End:        esc [ 7 ~
X    PgUp:PgUp:      esc [ 5 ~
X    PgDn:PgDn:      esc [ 6 ~
X    CUU:CUU:        esc [ A 
X    CUL:CUL:        esc [ D 
X#   CU5:CU5:        esc [ 8 ~     # same as HOME unfortunately
X    CU5:F11:        esc [ 2 3 ~
X    CUR:CUR:        esc [ C 
X    CUD:CUD:        esc [ B 
X    Ins:Ins:        esc [ 2 ~
X#   BkTab:BackTab:  tab           # same as TAB unfortunately
X    BkTab:F12:      esc [ 2 4 ~
X
X
X#+-------------------------------------------------------------------
X#    Wyse 60 Native Mode (no reprogrammed function keys)
X#    (matching the keyboard tops I have, anyway)
X#
X# The following is for native mode Wyse 60 with no function keys
X# programmed for emitting alternate sequences.  This is such a
X# nice terminal in so many ways.  Too bad they cocked up the left
X# and down function keys by making them indistinguishable from
X# backspace and newline. You may wish to study the SCO /etc/termcap
X# 'wy60ak' entry for a way around this.
X#--------------------------------------------------------------------
Xwyse60
Xwy60
Xwy60-43
X    F1:F1:          soh @ cr
X    F2:F1:          soh A cr
X    F3:F1:          soh B cr
X    F4:F1:          soh C cr
X    F5:F1:          soh D cr
X    F6:F1:          soh E cr
X    F7:F1:          soh F cr
X    F8:F1:          soh G cr
X    F9:F1:          soh H cr
X    F10:F10:        soh I cr
X    F11:F11:        soh J cr
X    F12:F12:        soh K cr
X    Home:Home:      rs
X    PgUp:PrevPg:    esc J
X    PgDn:NextPg:    esc K
X    CUU:CUU:        vt
X#   CUL:CUL:        bs            # not useful (for reference only)
X#   CU5:CU5: 
X    CUR:CUR:        ff
X    CUD:CUD:        nl # use only if you NEVER need to send a line feed
X    BkTab:F14:      soh M cr
X    Ins:InsChar:    esc Q
X    End:Send:       esc 7
SHAR_EOF
$TOUCH -am 1221233690 'models/nonansikeys' &&
chmod 0644 models/nonansikeys ||
echo 'restore of models/nonansikeys failed'
Wc_c="`wc -c < 'models/nonansikeys'`"
test 5679 -eq "$Wc_c" ||
	echo 'models/nonansikeys: original size 5679, current size' "$Wc_c"
# ============= models/oneline.ep ==============
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
$TOUCH -am 0507232990 'models/oneline.ep' &&
chmod 0644 models/oneline.ep ||
echo 'restore of models/oneline.ep failed'
Wc_c="`wc -c < 'models/oneline.ep'`"
test 877 -eq "$Wc_c" ||
	echo 'models/oneline.ep: original size 877, current size' "$Wc_c"
# ============= models/opuslogin.ep ==============
echo 'x - extracting models/opuslogin.ep (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'models/opuslogin.ep' &&
X#  CHK=0xE753
X#+-----------------------------------------------------------------
X#  opuslogin.ep - ecu OPUS BBS login procedure
X#  wht%n4hgf@gatech.edu
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
$TOUCH -am 1222003490 'models/opuslogin.ep' &&
chmod 0644 models/opuslogin.ep ||
echo 'restore of models/opuslogin.ep failed'
Wc_c="`wc -c < 'models/opuslogin.ep'`"
test 2086 -eq "$Wc_c" ||
	echo 'models/opuslogin.ep: original size 2086, current size' "$Wc_c"
# ============= models/p.ep ==============
echo 'x - extracting models/p.ep (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'models/p.ep' &&
X#  CHK=0x8848
X#+---------------------------------------------------------
X# p.eq - colorful, selective ps -aux on remote BSD 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 'ps -aux'
X	lookfor '\n' 40
X	$s0 = ''
X	whilei 1==1
X	{
X		lgets $s00 $itimeout 5 '\n'
X		ifi $i0 == 0 continue
X		$itimeout = 20
X		ifi %instr($s0,'% ') >= 0 break	# prompt ends it
X		color cyan
X		ifi %instr($s0,'getty') >= 0 continue
X		ifi %instr($s0,'/etc') >= 0 continue
X		ifi %instr($s0,'rlogin') >= 0 continue
X		ifi %instr($s0,'biod') >= 0 continue
X		ifi %instr($s0,'csh') >= 0 continue
X		ifi %instr($s0,'/usr/lib') >= 0 continue
X		ifi %instr($s0,' i29 ') > 0 color green
X		ifi %instr($s0,' i13 ') > 0 color red
X		ifi %instr($s0,'cma') == 0 color yellow
X		ifi %instr($s0,'gfp') == 0 color lt_blue
X		ifi %instr($s0,'jts') == 0 color lt_blue
X		ifi %instr($s0,'UUCP') >= 0 color red
X		ifi %instr($s0,'uu') >= 0 color red
X		echo $s0
X	}
X	icolor $icolor
X	send ''
X
SHAR_EOF
$TOUCH -am 0507232990 'models/p.ep' &&
chmod 0640 models/p.ep ||
echo 'restore of models/p.ep failed'
Wc_c="`wc -c < 'models/p.ep'`"
test 1110 -eq "$Wc_c" ||
	echo 'models/p.ep: original size 1110, current size' "$Wc_c"
# ============= models/phone ==============
echo 'x - extracting models/phone (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'models/phone' &&
X#ECUPHONE
X# when saving this file, ECU will preserve commented lines
X#sco2:1(408)425-3502::2400:N:sosco uucp
Xalphacm:1(714)821-9671::2400:N:alphacm rotary 1
Xnavobs:1(202)653-0351::1200:N:Naval Observatory Time
Xsco:1(408)426-9495::2400:N:SCO Tech Services (SOS)
SHAR_EOF
$TOUCH -am 0815215990 'models/phone' &&
chmod 0644 models/phone ||
echo 'restore of models/phone failed'
Wc_c="`wc -c < 'models/phone'`"
test 261 -eq "$Wc_c" ||
	echo 'models/phone: original size 261, current size' "$Wc_c"
# ============= models/phrases ==============
echo 'x - extracting models/phrases (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'models/phrases' &&
Xstty:stty intr ^C kill ^U erase ^H^r
Xmail-csh:mail emory\!tridom\!n4hgf\!wht^r
Xmail-sh:mail emory!tridom!n4hgf!wht^r
SHAR_EOF
$TOUCH -am 1103164089 'models/phrases' &&
chmod 0604 models/phrases ||
echo 'restore of models/phrases failed'
Wc_c="`wc -c < 'models/phrases'`"
test 117 -eq "$Wc_c" ||
	echo 'models/phrases: original size 117, current size' "$Wc_c"
# ============= models/ps.ep ==============
echo 'x - extracting models/ps.ep (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'models/ps.ep' &&
X#  CHK=0xDA50
X#+------------------------------------------------------
X# ps.eq - another colorful ps example
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,'root') == 0 color yellow
X		echo $s0
X	}
X	icolor $icolor
X	send ''
X
SHAR_EOF
$TOUCH -am 1222003590 'models/ps.ep' &&
chmod 0644 models/ps.ep ||
echo 'restore of models/ps.ep failed'
Wc_c="`wc -c < 'models/ps.ep'`"
test 895 -eq "$Wc_c" ||
	echo 'models/ps.ep: original size 895, current size' "$Wc_c"
# ============= models/put_ecu.ep ==============
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
$TOUCH -am 0507232990 'models/put_ecu.ep' &&
chmod 0644 models/put_ecu.ep ||
echo 'restore of models/put_ecu.ep failed'
Wc_c="`wc -c < 'models/put_ecu.ep'`"
test 1963 -eq "$Wc_c" ||
	echo 'models/put_ecu.ep: original size 1963, current size' "$Wc_c"
# ============= models/root.ep ==============
echo 'x - extracting models/root.ep (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'models/root.ep' &&
X#  CHK=0x067D
X#+----------------------------------------------
X# su-root.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 lt_blue black
X	echo -n 'remote root password? '
X	color black black
X	$s0 = %cgets
X	icolor $icsave
X	do 'su' 'root' $s0
X	$s0 = ''		# forget password
X	lookfor '% ' 100 # swallow prompt
X	send 'source ~wht/.cshrc'
SHAR_EOF
$TOUCH -am 1222003590 'models/root.ep' &&
chmod 0644 models/root.ep ||
echo 'restore of models/root.ep failed'
Wc_c="`wc -c < 'models/root.ep'`"
test 503 -eq "$Wc_c" ||
	echo 'models/root.ep: original size 503, current size' "$Wc_c"
# ============= models/rz_update.ep ==============
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
$TOUCH -am 0507232990 'models/rz_update.ep' &&
chmod 0644 models/rz_update.ep ||
echo 'restore of models/rz_update.ep failed'
Wc_c="`wc -c < 'models/rz_update.ep'`"
test 4983 -eq "$Wc_c" ||
	echo 'models/rz_update.ep: original size 4983, current size' "$Wc_c"
# ============= models/scm.ep ==============
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' 'secret'
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
$TOUCH -am 1222003690 'models/scm.ep' &&
chmod 0644 models/scm.ep ||
echo 'restore of models/scm.ep failed'
Wc_c="`wc -c < 'models/scm.ep'`"
test 643 -eq "$Wc_c" ||
	echo 'models/scm.ep: original size 643, current size' "$Wc_c"
# ============= models/senddate.ep ==============
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
$TOUCH -am 0507232990 'models/senddate.ep' &&
chmod 0644 models/senddate.ep ||
echo 'restore of models/senddate.ep failed'
Wc_c="`wc -c < 'models/senddate.ep'`"
test 557 -eq "$Wc_c" ||
	echo 'models/senddate.ep: original size 557, current size' "$Wc_c"
# ============= models/sf_test.ep ==============
echo 'x - extracting models/sf_test.ep (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'models/sf_test.ep' &&
X#--------------------------------------------------------------------
X# sf_test.ep - test various string functions
X#
X#Sample execution:
X#% ecu -p sf_test
X#
X# ecu x3.00.05.00-386u by wht@n4hgf (pid 5890)
X# 
X# procedure is sf_test run on Mon 08-13-1990 at 15:39:17 (19:39 UTC)
X# username is "wht"
X# current directory is "/u1/src/ecu/models"
X# 
X# %instr('abcdefabcdefghi','def') = 3
X# %rinstr('abcdefabcdefghi','def') = 9
X# 
X# %basename('/u1/src/src/foo.c','.c') = "/u1/src/src/foo"
X# %basename('foo.c','.c') = "foo"
X# %basename('foo.c','.x') = "foo.c"
X# 
X# %dirpart('/u1/src/src/foo.c') = "/u1/src/src"
X# %dirpart('foo.c') = "foo.c"
X# %dirpart('/usr') = ""
X# 
X# %filepart('/u1/src/src/foo.c') = "foo.c"
X# %filepart('foo.c') = "foo.c"
X# 
X# %envvar('HZ') = "100"
X# %envvar('HOME') = "/u9/wht"
X# %envvar('FOOBARTZHUMMER') = ""
X# 
X# errno 1 = "Not owner"
X# 5678 seconds is "01:34:38"
X# mode 105755 is "-rwsr-xr-t"
X# [procedure finished]
X# 
X# 
X# [no line attached by initial procedure]
X# [press ESC to exit or SPACE for setup menu]
X# 
X#--------------------------------------------------------------------
X
X	echo ''
X	echo -n 'procedure is '+%argv(0)+' run on '+%day+' '+%date
X	echo ' at '+%times+' ('+%timez+' UTC)'
X	echo 'username is "'+%logname+'"'
X	echo 'current directory is "'+%dir+'"'
X
X	echo ''
X	echo -n '%instr(\'abcdefabcdefghi\',\'def\') = '
X	echo %itos(%instr('abcdefabcdefghi','def'))
X
X	echo -n '%rinstr(\'abcdefabcdefghi\',\'def\') = '
X	echo %itos(%rinstr('abcdefabcdefghi','def'))
X
X	echo ''
X	echo -n '%basename(\'/u1/src/src/foo.c\',\'.c\') = '
X	echo '"'+%basename('/u1/src/src/foo.c','.c')+'"'
X
X	echo -n '%basename(\'foo.c\',\'.c\') = '
X	echo '"'+%basename('foo.c','.c')+'"'
X
X	echo -n '%basename(\'foo.c\',\'.x\') = '
X	echo '"'+%basename('foo.c','.x')+'"'
X
X	echo ''
X	echo -n '%dirpart(\'/u1/src/src/foo.c\') = '
X	echo '"'+%dirpart('/u1/src/src/foo.c')+'"'
X
X	echo -n '%dirpart(\'foo.c\') = '
X	echo '"'+%dirpart('foo.c')+'"'
X
X	echo -n '%dirpart(\'/usr\') = '
X	echo '"'+%dirpart('/usr')+'"'
X
X	echo ''
X	echo -n '%filepart(\'/u1/src/src/foo.c\') = '
X	echo '"'+%filepart('/u1/src/src/foo.c')+'"'
X
X	echo -n '%filepart(\'foo.c\') = '
X	echo '"'+%filepart('/u1/src/src/foo.c')+'"'
X
X	echo ''
X	echo '%envvar(\'HZ\') = "'+%envvar('HZ')+'"'
X	echo '%envvar(\'HOME\') = "'+%envvar('HOME')+'"'
X	echo '%envvar(\'FOOBARTZHUMMER\') = "'+%envvar('FOOBARTZHUMMER')+'"'
X
X	echo ''
X	echo 'errno 1 = "'+%errstr(1)+'"'
X	echo '5678 seconds is "'+%etime(5678)+'"'
X	echo 'mode 105755 is "'+%fmodestr(0105755)+'"'
SHAR_EOF
$TOUCH -am 0813170590 'models/sf_test.ep' &&
chmod 0644 models/sf_test.ep ||
echo 'restore of models/sf_test.ep failed'
Wc_c="`wc -c < 'models/sf_test.ep'`"
test 2489 -eq "$Wc_c" ||
	echo 'models/sf_test.ep: original size 2489, current size' "$Wc_c"
# ============= models/su.ep ==============
echo 'x - extracting models/su.ep (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'models/su.ep' &&
X#  CHK=0x120D
X#+---------------------------------------------------------
X# su.ep - switch user at remote
X# wht%n4hgf@gatech.edu
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
$TOUCH -am 0507233390 'models/su.ep' &&
chmod 0644 models/su.ep ||
echo 'restore of models/su.ep failed'
Wc_c="`wc -c < 'models/su.ep'`"
test 1465 -eq "$Wc_c" ||
	echo 'models/su.ep: original size 1465, current size' "$Wc_c"
# ============= models/sysname.ep ==============
echo 'x - extracting models/sysname.ep (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'models/sysname.ep' &&
X#-----------------------------------------------------------
X# sysname.ep - procedure to call UNIX-like system 'sysname'
X#
X# CONFIDENTIAL - This function should be chmod 0600 because
X# it contains a password which you probably don't want to be
X# common knowledge.
X#
X# This procedure calls 'unixlogin.ep' to do the hard work.
X#-----------------------------------------------------------
X
X    mkvar $s_pwd(20)    # local variable preserves password
X    $s_pwd = 'password' # security by disappearing when the
X                        # procedure terminates
X
X#   also, by keeping the password text off the following line,
X#   the password will not be displayed if you abort (interrupt)
X#   the procedure
X
X    do 'unixlogin' %argv(0) 'username' $s_pwd 'ansi-or-whatever'
SHAR_EOF
$TOUCH -am 0815180890 'models/sysname.ep' &&
chmod 0640 models/sysname.ep ||
echo 'restore of models/sysname.ep failed'
Wc_c="`wc -c < 'models/sysname.ep'`"
test 766 -eq "$Wc_c" ||
	echo 'models/sysname.ep: original size 766, current size' "$Wc_c"
# ============= models/sz_update.ep ==============
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
$TOUCH -am 0507232990 'models/sz_update.ep' &&
chmod 0644 models/sz_update.ep ||
echo 'restore of models/sz_update.ep failed'
Wc_c="`wc -c < 'models/sz_update.ep'`"
test 4479 -eq "$Wc_c" ||
	echo 'models/sz_update.ep: original size 4479, current size' "$Wc_c"
# ============= models/szall.ep ==============
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
$TOUCH -am 0507232990 'models/szall.ep' &&
chmod 0644 models/szall.ep ||
echo 'restore of models/szall.ep failed'
Wc_c="`wc -c < 'models/szall.ep'`"
test 127 -eq "$Wc_c" ||
	echo 'models/szall.ep: original size 127, current size' "$Wc_c"
# ============= models/tty1a.mi ==============
echo 'x - extracting models/tty1a.mi (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'models/tty1a.mi' &&
X#  CHK=0x10FF
X#+-----------------------------------------------------------------
X#  tty1a.mi - Microcom AX/9624c
X#  Copyright 1989 Warren H. Tucker, III. All Rights Reserved
X#------------------------------------------------------------------
X#+:EDITS:*/
X#:11-03-1989-16:21-wht------ unet2 -----
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
$TOUCH -am 1103162189 'models/tty1a.mi' &&
chmod 0644 models/tty1a.mi ||
echo 'restore of models/tty1a.mi failed'
Wc_c="`wc -c < 'models/tty1a.mi'`"
test 495 -eq "$Wc_c" ||
	echo 'models/tty1a.mi: original size 495, current size' "$Wc_c"
# ============= models/tty2d.mi ==============
echo 'x - extracting models/tty2d.mi (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'models/tty2d.mi' &&
X#  CHK=0xFA63
X#+-----------------------------------------------------------------
X#  tty2d.mi - USR Courier 2400
X#  Copyright 1989 Warren H. Tucker, III. All Rights Reserved
X#------------------------------------------------------------------
X#+:EDITS:*/
X#:11-03-1989-16:21-wht------ unet2 -----
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
$TOUCH -am 1103162189 'models/tty2d.mi' &&
chmod 0644 models/tty2d.mi ||
echo 'restore of models/tty2d.mi failed'
Wc_c="`wc -c < 'models/tty2d.mi'`"
test 446 -eq "$Wc_c" ||
	echo 'models/tty2d.mi: original size 446, current size' "$Wc_c"
# ============= models/unixlogin.ep ==============
echo 'x - extracting models/unixlogin.ep (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'models/unixlogin.ep' &&
X#  CHK=0xE6DC
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-12-1990-14:05-wht@n4hgf-use expresp
X#:07-11-1989-16:55-wht-get cmd became lgets
X#:07-09-1989-23:50-wht-add breaks
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	mkvar $s_2048(2048) # handle bigger login big motd
X
X	$i_csave = %colors
X	$i_ltimeout = 30 # 3 seconds wait for first login prompt
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 SORRY
X	}
X	mkvar $i_breaks
X	ifi %argc > 5 $i_breaks = %stoi(%argv(5))
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		send ''
X		goto SEND_BREAKS
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
X# send breaks?
XSEND_BREAKS
X	ifi $i_breaks > 0
X	{
X		color blue; echo 'sending up to '+%itos($i_breaks)+' break(s) to remote'
X		nap 30
X		whilei $i_breaks > 0
X		{
X			color magenta; echo 'BREAK'
X			lbreak
X			expresp '~t[8]gin:'
X			ifi $i0 == 0
X				break;
X			nap 30
X			$i_breaks = $i_breaks - 1
X		}
X		flush
X	}
X
X# get login prompt from remote UNIX system: "login: "
XGET_LOGIN_PROMPT
X	$i_retries = 3
XGET_LOGIN_PROMPT_RETRY
X	ifi $i_retries <= 0
X	{
X		color red; echo '\ncannot seem to get in with these credentials'
X		goto SORRY
X	}
X	color blue; echo 'looking for login prompt'
X	color white
X	expresp -v '~t[8]gin:--~t[5]gin:--gin:--gin:'
X	ifi $i0 > 0
X	{
X		color red; echo '\nfailed to get login prompt'
X		goto SORRY
X	}
X	icolor $i_csave
X
X# give username to remote
XSEND_USERNAME
X	nap 3 # system not always ready when it says
X	send %argv(2)
X
X# get password prompt: "Password:" 
XGET_PASSWORD_PROMPT
X	color white
X	lookfor -e 'word:' 50
X	ifi $i0 != 1		# did not find 'Password: '
X	{
X		send ''
X		gotob GET_LOGIN_PROMPT_RETRY
X	}
X
X# send the password
X	nap 3 # system not always ready when it says
X	send %argv(3)
X	icolor $i_csave
X
X# get term type prompt "TERM = (ansi) "
X# also handle incorect login retry and 'Sorry' hangup indication
XGET_TERMTYPE_PROMPT
X	ifs %argv(4) == ''	# if no term type, don't wait for prompt
X	{
X		$i0 = 0			# return good status
X		goto SETCOLOR_AND_RETURN_STATUS
X	}
X	lgets -re $s_2048 100 50 ') '
X	ifi %instr($s_2048,'Sorry') > 0 hangup;goto SORRY
X	ifi %instr($s_2048,'incorrect') > 0		# exhausted retry?
X	{
X		set $i_retries=$i_retries-1
X		ifi $i_retries > 0 goto SEND_USERNAME
X		goto SORRY
X	}
X# send terminal type
X	ifi %instr($s_2048,'TERM') < 0
X		lookfor -e ') ' 30
X	send %argv(4)
X	lookfor -e '\n' 50
X	set $i0=0
X	goto SETCOLOR_AND_RETURN_STATUS
X
X# procedure failed
XSORRY
X	set $i0=1
X
XSETCOLOR_AND_RETURN_STATUS
X	icolor $i_csave
X	ifi $i0 == 0 ifi %conn !=0 prompt %rname+' >'
X	return $i0
X
X# vi:set tabstop=4 shiftwidth=4:
SHAR_EOF
$TOUCH -am 0712142290 'models/unixlogin.ep' &&
chmod 0640 models/unixlogin.ep ||
echo 'restore of models/unixlogin.ep failed'
Wc_c="`wc -c < 'models/unixlogin.ep'`"
test 3689 -eq "$Wc_c" ||
	echo 'models/unixlogin.ep: original size 3689, current size' "$Wc_c"
# ============= zgcc ==============
echo 'x - extracting zgcc (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'zgcc' &&
X#!/bin/csh
X#zgcc -- build prototyping "LINT_ARGS"
Xecho C sources in $1';' result file $2
Xunset noclobber
Xrm -f zg.t
Xif (-e /unix)
X	echo 'building old-style prototypes for XENIX compiler compatibility'
X	echo 'unnamed struct/union as parameter warning probably about FILE :-('
Xendif
X# -dos switch is used since MSC5 pass 1 hangs with -Zg per SCO
X# since at least 5/89
Xforeach i(`cat $1`)
Xif (-e /unix)
X	cc -dos -DBUILDING_LINT_ARGS -Zg $argv[3-] $i | mkoldproto > zg1.t
Xelse
X	cc -DBUILDING_LINT_ARGS -Zg $argv[3-] $i > zg1.t
Xendif
Xsort zg1.t > zg2.t
Xecho '/*' $i '*/' >> zg.t
Xcat zg2.t >> zg.t
Xend
Xafterlint zg.t $2
Xrm -f zg.t zg?.t
Xecho Output in $2
SHAR_EOF
$TOUCH -am 1128184090 'zgcc' &&
chmod 0755 zgcc ||
echo 'restore of zgcc failed'
Wc_c="`wc -c < 'zgcc'`"
test 649 -eq "$Wc_c" ||
	echo 'zgcc: original size 649, current size' "$Wc_c"
# ============= mkoldproto.l ==============
echo 'x - extracting mkoldproto.l (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'mkoldproto.l' &&
X/* CHK=0x5793 */
X%{
Xchar *rev = "1.00";
X/*+-------------------------------------------------------------------------
X	mkoldproto.c.{l,c} - make "old" style prototypes from "new" kind
X
Xcc -Zg source.c | mkproto > lint_args.h
X
Xtakes prototypes of the style
Xvoid change_report(char *original);
Xand emits
Xvoid change_report(char *);
XThe UNIX V compiler makes the new kind, accepts the old and new kind,
Xbut there are a lot of compilers which don't like the new kind.
X
XWarning, this program will make mush out of "old" style prototypes
Xfed to it.
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:11-27-1989-18:31-wht-creation */
X
Xint verbose = 0;
X
X/*+-------------------------------------------------------------------------
X	change_report(original)
X--------------------------------------------------------------------------*/
Xvoid
Xchange_report(original)
Xchar *original;
X{
X	fputs("fixing: ",stderr);
X	while(*original)
X	{
X		if((*original >= ' ') && (*original <= '~'))
X			fputc(*original,stderr);
X		else
X			fprintf(stderr,"<%02x>",*original);
X		original++;
X	}
X	fputs("\n",stderr);
X}	/* end of change_report */
X
X
X/*+-------------------------------------------------------------------------
X	main(argc,argv,envp)
X--------------------------------------------------------------------------*/
Xmain(argc,argv,envp)
Xint argc;
Xchar **argv;
Xchar **envp;
X{
Xregister int itmp;
Xregister int iargv;
Xint fileiargv = 0;
X
X	if(argc > 1)
X	{
X		for(iargv = 1; iargv < argc; iargv++)
X		{
X			if(argv[iargv][0] == '-')
X			{
X				switch(itmp = (argv[iargv][1]))
X				{
X					case 'v':
X						verbose = 1;
X						break;
X					default:
X						break;
X				}
X			}
X			else
X			{
X				if(yyin != stdin)
X				{
X					fprintf(stderr,"only 1 filename, please\n");
X					exit(1);
X				}
X				if( (yyin = fopen(argv[iargv],"r")) == NULL)
X				{
X					perror(argv[iargv]);
X					exit(1);
X				}
X				fileiargv = iargv;
X			}
X		}
X	}
X
X	if(verbose && fileiargv)
X		fprintf(stderr,"%s:\n",argv[fileiargv]);
X
X	yylex();
X
X	exit(0);
X}	/* end of main */
X
X/* vi: set tabstop=4 shiftwidth=4: */
X%}
XW			[ \t]
XSTRING		\"([^"\n]|\\\")*\"
XOPCHARS		["'+-*/=|!&%^?><:\]]
XIDENT		[a-zA-Z0-9_]+
XU			"unsigned"
XI			"int"
XL			"long"
XS			"short"
XC			"char"
XR			"register"
XST			"static"
XI8			"INT8"
XI16			"INT16"
XI32			"INT32"
XUN_ST		("union "|"struct "){IDENT}
XDECLTAB1	({I}|{C}|{S}|{L}|{U}|{R}|{ST}|{I8}|{I16}|{I32}|{UN_ST})[\t]{IDENT}
XDECLTAB2	({I}|{C}|{S}|{L}|{U}|{R}|{ST}|{I8}|{I16}|{I32}|{UN_ST})[\t ][\t ]+{IDENT}
X%START	COMMENT PREPROC
X%%
X<PREPROC>.*\n							{ECHO;
X										 BEGIN 0;
X										}
X^"#"									{
X										ECHO;
X										BEGIN PREPROC;
X										}
X<COMMENT>([^*\n]|"*"+[^*/\n])*			ECHO;
X<COMMENT>([^*\n]|"*"+[^*/\n])*"*"*"*/"	{ECHO;
X										 BEGIN 0;
X										}
X<COMMENT>.|\n							ECHO;
X"/*"				{
X						ECHO;
X						BEGIN COMMENT;
X					}
X"extern  "			{
X						;
X					}
X"* "				{
X						fprintf(yyout,"*");
X					}
X{IDENT}","			{
X					register char *cptr = yytext + yyleng - 1;
X						if(verbose)
X							change_report(yytext);
X						while((*cptr != '\t') && (*cptr != ' ') && (*cptr != '*'))
X							*cptr-- = 0;
X						fprintf(yyout,",",yytext);
X					}
X{IDENT}")"			{
X					register char *cptr = yytext + yyleng - 1;
X						if(verbose)
X							change_report(yytext);
X						while((*cptr != '\t') && (*cptr != ' ') && (*cptr != '*'))
X							*cptr-- = 0;
X						fprintf(yyout,")",yytext);
X					}
X{STRING}			ECHO;
X"'"."'"				ECHO;
X.|\n				ECHO;
X
SHAR_EOF
$TOUCH -am 1127134189 'mkoldproto.l' &&
chmod 0644 mkoldproto.l ||
echo 'restore of mkoldproto.l failed'
Wc_c="`wc -c < 'mkoldproto.l'`"
test 3418 -eq "$Wc_c" ||
	echo 'mkoldproto.l: original size 3418, current size' "$Wc_c"
exit 0
--------------------------------------------------------------------
Warren Tucker, TuckerWare emory!n4hgf!wht or wht@n4hgf.Mt-Park.GA.US
Hacker Extraordinaire  d' async PADs,  pods,  proteins and protocols

exit 0 # Just in case...
-- 
Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
Sterling Software, IMD           UUCP:     uunet!sparky!kent
Phone:    (402) 291-8300         FAX:      (402) 291-4362
Please send comp.sources.misc-related mail to kent@uunet.uu.net.