/
/ PDP-11 C.
/ Stdio.
/
/ Get String.
/
 
	.globl	gets
	.globl	fgets

/
/ char *gets(buf);
/ char *fgets(buf, ioptr);
/ char buf[];
/ FILE *ioptr;
/
 
gets:	jsr	r0,_save
	mov	stdin,r4
	br	0f
 
fgets:	jsr	r0,_save
	mov	14(r5),r4
	call	_ckiov

/
/ This is the common code.
/ The pointer is now in r3. It should
/ never have been in r1.
/

0:	mov	12(r5),r3

0:	call	_getc
	cmp	r0,$-1
	beq	0f
	cmp	r0,$12
	beq	0f
	movb	r0,(r3)+
	br	0b
 
0:	clrb	(r3)
	cmp	r0,$-1
	bne	0f
	clr	r0
	br	1f

0:	mov	12(r5),r0

1:	jmp	_ret
