	.title	r$cvtf
;+
;	this routine converts the file spec found in the FNB pointed
;	to by r1 into the buffer pointed to by r0.  r0 is left pointing
;	at the next free location in the buffer.  All blanks are squeezed
;	out of the name
;
;	all other registers remain constant across the call
;-
ap=%5
	.psect	$r.rod,con,ro,rel,lcl,d
	.enabl	lc
fmtfil:	.asciz	"%3r.%r;%o"
	.even
	.dsabl	lc
	.psect	$r.roi,con,ro,rel,lcl,i
	.enabl	lsb
r$cvtf::
	call	r$savr			; save r0-r5
	mov	r1,r2			; address of version number
	add	#n.fver,r2
	mov	r2,-(sp)
	mov	r1,r2			; address of file type
	add	#n.ftyp,r2
	mov	r2,-(sp)
	mov	r1,r2			; address of file name
	add	#n.fnam,r2
	mov	r2,-(sp)
	mov	#fmtfil,-(sp)		; address of format string
	mov	r0,-(sp)		; address of user buffer
	clr	-(sp)			; dummy arg count
	mov	sp,ap			; set up arg pointer
	call	sprint			; format name
	add	#12.,sp			; clean up stack
	mov	r0,r1			; starting address - squeeze blanks
10$:
	movb	(r1)+,r2		; get next char
	beq	20$			; done
	cmpb	r2,#' 			; BLANK?
	beq	10$			; YES
	movb	r2,(r0)+		; copy into lower portion of buffer
	br	10$			; do again
20$:
	clrb	(r0)			; EOS
	mov	r0,2(sp)		; saved r0
	return
	.end
