C+
C NAME:
C	iDir2File
C PURPOSE:
C	Convert a directory name to a file name
C CATEGORY:
C	Environment
C CALLING SEQUENCE:
	function iDir2File(cDir,cFile)
C INPUTS:
C	cDir		character*(*)	Directory name to be converted
C OUTPUTS:
C	cFile		character*(*)	File name after conversion
C	iDir2File	integer		# useful characters in cFile
C CALLS:
C	iSetFileSpec, iGetFileSpec, iGetParentDirectory, Str2StrSet, Str2Str
C	iGetDirectoryFragment
C SEE ALSO:
C	iFile2Dir
C INCLUDE:
	include		'dirspec.h'
	include		'filparts.h'
	include		'str2str_inc.h'
C PROCEDURE:
C	On VMS convert from
C		UD1:[PHICK.SOFT.EXE]    to UD1:[PHICK.SOFT]EXE.DIR to 
C	On Unix convert from
C		/home/phick/soft/exe/   to /home/phick/soft/exe
C	On DOS convert from
C		C:\home\phick\soft\exe\ to C:\home\phick\soft\exe
C
C	Failure occurs:
C	If either file name or file type have non-zero length (except for . in file type)
C	If there is no parent directory ??????
C MODIFICATION HISTORY:
C	JUL-2000, Paul Hick (UCSD; pphick@ucsd.edu)
C-
	    character	cFile*(*)
	    character	cDir*(*)

	character	cNam*80
	integer		Str2Str
	integer		Str2StrSet
	
	iDir2File = 0
	I = iSetFileSpec(cDir)

	I = iGetFileSpec(FIL__NAME,FIL__TYPE,cNam)
	if (I .gt. 1) then		! No name and type permitted (other than .)
	    cFile = ' '

	else
	    I = iGetParentDirectory(cFile)
	    if (cFile(:iNoWhere) .ne. cNoWhere) then

		iStr = Str2StrSet(STR__TRIM)

		I = I+iGetDirectoryFragment(3,cFile(I+1:))
		I = I+Str2Str(cDirExt,cFile(I+1:))

		iStr = Str2StrSet(iStr)

	 	iDir2File = I
	    end if
	end if

	return
	end
