/
/ Get String.
/
 
	.globl	gets
	.globl	fgets

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

/
/ 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	__cret
