	.title	rdelet	Delete a file
	.ident	"V02.00"
;+
; Index		Delete a file
;
; Usage
;
;	rdelet(fsb, fsb_size, options)
;	char *fsb;	/* Address of fsb */
;	int  fsb_size;	/* size of fsb (bytes) */
;	char *options;  /* String of options */
;
; Description
;
;	rdelet() attempts to delete the file specified in the fsb.
;	rdelet() returns 1 if the delete was successful and 0 if an
;	error occurred. An error may occur if the file is locked or
;	is currently connected to another record stream.
;
; 	Options:
;	     w - wait until all streams are disconnected
;		 then delete
;	     m - mark file for delete on final stream
;		 disconnect
;-
; Edit History
; 18-Oct-82 TTC		Rework of old CS library
;

	.MCALL	FSDEF$
	FSDEF$

	.psect	c$strn
;
; Delete options.
;
wait:	.asciz	"w"
mark:	.asciz	"m"
	.even

	.psect	c$data

delopt:	.word	wait,	O.WAI
	.word	mark,	O.DEL
	.word	0

	.psect	c$code
rdelet::
	mov	6(sp),r0		; r0 --> list of passed options
	mov	#delopt,r1		; r1 --> option table
	call	option			; check options
	tst	r0			; error?
	beq	10$			; (Yes)
	mov	#FS.DEL,fsqio+q.iofn	; Function: FS.DIS
	mov	#fsqio+q.iopl,r0	; r0 --> qio param list for prmclr
	call	prmclr			; Clear parameter list
	mov	2(sp),fsqio+q.iopl+2	; Parameter #2: Address of fsb
	mov	4(sp),fsqio+q.iopl+4	; Parameter #3: Size of fsb
	mov	r1,fsqio+q.iopl+12	; Parameter #6: Incl-or of opts
	call	.xqiow			; execute qiow
	mov	#1,r0			; Assume successful, r0 = 1
	cmp	$dsw,#is.suc		; How'd it go
	blo	10$
	cmpb	f.iosb,#is.suc
	beq	20$
10$:	clr	r0			; Branch here if error, r0 = 0
20$:	return
	.end
