	subroutine FileName( Fname , Source, TwoPage )

	character*5 Fname
	character*80 Line,TmpLine
	character*1 Blank, Quote, Separators
	integer*2 Pntr(2,7), WordLength(7), NumWords, Error, KeyBoard
	Logical*1 Source, TwoPage

	integer*2 I
	character*3 Switch

c	Functions
c	---------

	integer*2 SysLun


	data Blank,Quote/ ' ','"'/

	KeyBoard = SysLun( 'KeyBoard' )

	Separators = '/'

	Source = .true.
	TwoPage = .false.
	Fname = ' '

	TmpLine=' '
	Line= ' '

	call GetCmd( TmpLine )

	Line = 'Fpaint'//TmpLine

	call CvtToUpCase( Line )


	call Parse( LINE , BLANK , QUOTE , Separators ,
     1   7 , PNTR , WORDLENGTH , NUMWORDS , ERROR )



C --	if first word is 'R', 'RUN', or 'RU' then promtp for filename.

	  if( Line(Pntr(1,1):Pntr(2,1)) .eq. 'FPAINTR' .or.
     1       Line(Pntr(1,1):Pntr(2,1)) .eq. 'FPAINTRUN' .or.
     1       Line(Pntr(1,1):Pntr(2,1)) .eq. 'FPAINTRU') then
	   call ClrScr
	   call DsplyVersion
	   call OutString( 'Filename:')
	   read(KeyBoard,10) Fname
	   return
	end if



c--
c Parse the switches and the filename
c--
	I = 2
100	continue
	if( I .le. NumWords ) then

	  if( Line(Pntr(1,I):Pntr(2,I)) .eq. '/' .and.
     1       I .lt. NumWords ) then
	    I = I + 1
	    Switch = Line(Pntr(1,I):Pntr(2,I))
 	    call CvtToUpCase( Switch )
	    if( Switch .eq. 'NOS' ) then
	      Source = .false.
	    else if( Switch .eq. '2' ) then
	      TwoPage = .true.
	    end if

	  else
	    Fname(1:5)=Line(Pntr(1,I):Pntr(2,I))

	  end if

	  I = I + 1
	  goto 100

	end if

	if ( Fname .eq. ' ' ) then
	   call ClrScr
	   call DsplyVersion
	   call OutString( 'Filename:')
	   read(KeyBoard,10) Fname
10	   format(a)
	end if

	end


	subroutine DsplyVersion

	character*6 Version
	character*2 CrLf
	integer*2 L1

c--
c functions

	integer*2 Length


	CrLf(1:1) = char(13)
	CrLf(2:2) = char(10)

	call GetVersion( Version )
	L1 = Length( Version )
	if( L1 .eq. 0 ) L1 = 1
	call OutString( '[Fpaint version ' )
	call OutString( Version(1:L1) )
	call OutString( ']' )
	call OutString( CrLf )

	end

