1972_stuff/s1/frag61

Find at most related files.
including files from this version of Unix.

testing = 0
/
/	command interpreter for form letter editor
/
/
/
command:
	sys	intr; inter
	jsr	pc,initl
	mov	sp,spi
loop:
	mov	spi,sp
	mov	$buffer,r2
	clr	r4
	clr	iflag
1:
	jsr	pc,tfiget
	cmpb	$' ,r0
	beq	1f
	cmpb	$'\n,r0
	bne	2f
	clrb	(r2)
	br	4f
2:
	movb	r0,(r2)+
	br	1b
1:
	clrb	(r2)
	mov	$argc,r3
3:
	mov	$arg,r2
2:
	jsr	pc,tfiget
	cmpb	$' ,r0
	beq	1f
	cmpb	$'\n,r0
	beq	1f
	movb	r0,(r2)+
	br	2b
1:
	clrb	(r2)+
	inc	r4
1:
	movb	-(r2),sv
	cmp	r2,$arg
	blos	1f
	movb	-(r2),-(sp)
	movb	sv,1(sp)
	cmp	r2,$arg
	bhi	1b
	mov	sp,(r3)+
	br	2f
1:
	clrb	-(sp)
	movb	sv,1(sp)
	mov	sp,(r3)
	add	$1,(r3)+
2:
	cmpb	r0,$'\n
	bne	3b
1:
	mov	-(r3),-(sp)
	cmp	r3,$argc
	bhi	1b
4:
	mov	r4,-(sp)
3:
	clr	r0
	mov	$tabl,r4
2:
	mov	(r4)+,r1
	cmp	r4,$tend
	bhi	error
	add	$2,r0
	mov	$buffer,r2
1:
	cmpb	(r1)+,(r2)+
	bne	2b
	tstb	(r1)
	bne	1b
	tstb	(r2)
	bne	2b
	sub	$2,r0
	add	$jtable,r0
	clr	vflag
	clr	qflag
	jmp	*(r0)
/
error:
	mov	$1,r0
	sys	write; err; 2
	br	loop
/
/
tabl: c1; c2; c3; c4; c5; c6; c7; c8; 
tend:	0
c1:	<n\0>
c2:	<p\0>
c3:	<e\0>
c4:	<d\0>
c5:	<m\0>
c6:	<fin\0>
c7:	<q\0>
c8:	<c\0>
err:	<?\n>
endt:	.even
jtable: list; listf; ed; remove; rename;  fin; q; memck;
spi:	.=.+2
sv:	.=.+2
r4,-(sp)
3:
	clr	r0
	mov	$tabl,r4
2:
	mov	(r4)+,r1
	cmp	r4,$tend
	bhi	error
	add	$2,r0
	mov	$buffer,r2
1:
	cmpb	(r1)+,(r2)+
	bne	2b
	tstb	(r1)
	bne	1b
	tstb	(r2)
	bne	2b
	sub	$2,r0
	add	$jtable,r0
	clr	vflag
	clr	qflag
	jmp	*(r0)
/
error:
	mov	$1,r0
	sys	write; err; 2
	br	loop
/
/
tabl: c1; c2; c3; c4; c5; c6; c7; c8; 
tend:	0
c1:	<n\0>
c2:	<p\0>
c3:	/
/
ed:
	mov	(sp)+,r3
	ble	error
econ:
	sys	stat; ftemp; buffer
	bec	2f
	sys	creat; ftemp; 17
	mov	r0,tmpw
	sys	open; ftemp; 0
	mov	r0,tmpr
	br	1f
2:
	cmpb	$'z,ftemp+9.
	bne	2f
	mov	$1,r0
	sys	write; erm; 23.
	jmp	loop
2:
	incb	ftemp+9.
	br	econ
1:
	mov	(sp),r0
	jsr	pc,getspq
	bes	3f
	mov	r0,r4
	mov	r2,r1
	jsr	pc,rewind
	mov	$buffer,r2
1:
	jsr	pc,getchar
	bes	1f
	movb	r0,(r2)+
	br	1b
1:
	movb	$'\n,(r2)+
	jsr	pc,output
	mov	r4,r1
	jsr	pc,rewind
2:
	mov	$buffer,r2
1:
	jsr	pc,getchar
	bes	1f
	movb	r0,(r2)+
	cmp	r2,$bufend
	blo	1b
	mov	tmpw,r0
	sys	write; buffer; 512.
	br	2b
1:
	sub	$buffer,r2
	beq	4f
	mov	r2,0f
	mov	tmpw,r0
	sys	write; buffer; 0:..
4:
	tst	iflag
	beq	1f
	mov	tmpw,r0
	sys	close
	mov	tmpr,r0
	sys	close
	sys	unlink; ftemp
	jmp	loop
1:
	mov	tmpw,r0
	sys	close
	sys	fork
	br	5f
	mov	r1,-(sp)
	sys	wait
	sys	intr; inter
	mov	(sp)+,r1
	mov	a(r1),w(r1)
2:
	mov	tmpr,r0
	sys	read; buffer; 512.
	tst	r0
	beq	2f
	add	$buffer,r0
	mov	r0,bufend
	mov	$buffer,r2
1:
	movb	(r2)+,r0
	jsr	pc,putchar
	cmp	r2,bufend
	blo	1b
	br	2b
2:
	mov	tmpr,r0
	sys	close
	sys	unlink; ftemp
	tst	iflag
	beq	1f
	jmp	loop
1:
	tst	qflag
	bgt	1f
	tst	(sp)+
	dec	r3
	bgt	1f
	jmp	loop
1:	jmp	econ
	jmp	loop
3:
	mov	(sp),r2
	mov	$2,r0
	jsr	pc,allocate
1:
	tstb	(r2)
	beq	1f
	movb	(r2)+,r0
	jsr	pc,putchar
	br	1b
1:
	mov	r1,r0
	mov	asmem,r1
	jsr	pc,putword
	mov	$2,r0
	jsr	pc,allocate
	mov	r1,r0
	mov	asmem,r1
	jsr	pc,putword
	mov	r0,r1
	br	4b
5:
	mov	$2,r0
1:
	sys	close
	inc	r0
	cmp	r0,$10.
	blo	1b
	sys	exec; edd; eda
	sys	exit
eda:	edd; ftemp; 0
edd