c c------------------------------------------------------------------ c Begin file /home/sting/foster/lib/tail.f c------------------------------------------------------------------ c subroutine tail(path,file) c c Given path, return tail part (i.e., file name) c character*(*) path,file c lenpath = lenstr(path) write(6,"('tail: lenpath=',i3)") lenpath if (lenpath.le.0) then write(6,"('tail: lenpath=',i3,' (path is all blanks)', + ' -- returning a single blank')") lenpath file = ' ' return endif islash = 0 ix = 1 do i=1,lenpath if (path(i:i).eq.'/') then islash = 1 else if (islash.gt.0) then ix = i islash = 0 endif endif enddo file = path(ix:lenpath) write(6,"('tail: ix=',i3,' lenpath=',i3,' returning file=$', + a,'$')") ix,lenpath,file return end c ccccccccccccccccccccccccccccccccccccccccccc c function lenstr(str) character*(*) str c c Return index to last non-blank char in str c length = len(str) do i=length,1,-1 if (str(i:i).ne.' ') then lenstr = i return endif enddo lenstr = 1 return end