# FILE HOUSEKEEPING OPERATIONS
cvtbl (r10),r3 #attempt to rewind only if stdin
bneq l3301 # and no name is given
bicw2 $EOF+EOLN,stdin+FUNIT
bisw2 $SYNC+FREAD,FUNIT(r6)
bisw2 $EOF+FWRITE,FUNIT(r6)
bbc $fWRITE,FUNIT(r7),l3302
cvtbl (r10)+,r3 #r3 has filename length
movl r3,r6 #r6 has stack length
addl3 r3,sp,r1 #r1 pts to end of name
cmpb -(r1),$blank #delete trailing blanks
bneq l3306 #(note: could use "spanc" here)
movl sp,_file #remove file
movl _file,sp #recover filename