

	title KERBOO - boot kermit to remote system on dialout

comment ~

This program can be used to send a small file across a tty: line
to another 20.  The protocol is to send a character, then wait
for its echo before sending the next character.  Here is a scenario:

Assume computer X is connected to TTY11:, and we have a job already
logged in on it.

@telnet tty 11
 Trying... Open
X>
X>copy tty: piggy.mac
 TTY: => PIGGY.MAC

^^C (back from telnet)
Connection closed
@kerboo.exe
KERBOO here, booting kermit file to remote 20 via TTY
TTY file: TTY11:
Kermit file: piggy.mac
[Confirm to log to TTY]
.
.
.

(and etc...)

~

	search monsym,macsym,cmd
	.require mac:cmd,mac:macrel

t1==1
t2==2
t3==3
t4==4
p==17

start:	RESET
	move p,[iowd pdlsiz,pdl]
	call cmdini
	tmsg <KERBOO here, booting kermit to remote 20 via TTY
>
	prompt (TTY file: )
	movei t1,[flddb. .cmofi,cm%sdh,,<TTY designator for output>]
	call cfield
	movem t2,outjfn
	prompt (Kermit file: )
	movei t1,[flddb. .cmifi,cm%sdh,,<file to send>,<ker:piggy.mac.0>]
	call cfield
	movem t2,injfn
	prompt ([Confirm to log to tty])
	movei t1,[flddb. .cmcfm]
	call rflde
	 skipa t1,[.nulio]
	movei t1,.priou
	movem t1,lgjfn
	move t1,injfn
	movx t2,of%rd+fld(7,of%bsz)
	OPENF
	 erjmp jserr0
	move t1,outjfn
	movx t2,of%wr+of%rd+fld(7,of%bsz)
	OPENF
	 erjmp jserr0
loop:	move t1,injfn
	BIN
	 erjmp dun
	cain t2,.chlfd		; don't send line feeds, they are echoed
	 jrst [ move t1,lgjfn
		BOUT%
		 erjmp jserr0
		jrst loop ]
	move t1,outjfn
	BOUT
	 erjmp jserr0
	move t1,lgjfn
	BOUT
	 erjmp jserr0
loop1:	move t1,outjfn
	BIN			; read character just sent...
	 erjmp jserr0
	cain t2,.chcrt		; was it a CR?
	 jrst loop1		; yes, read in LF
	cain t2,.chcns		; control S?
	 jrst [ tmsg (read control S
)
		jrst loop1 ]	; go for control-Q
	jrst loop		; else send next character...

dun:	tmsg <

All Done...
>
	HALTF%
	jrst .-1

pdlsiz==100
pdl:	block pdlsiz

outjfn:	block 1
injfn:	block 1
lgjfn:	block 1
	cmdstg


	end start

