subroutine strtok(str_in,str_o1,str_o2,FS) c c split a character string str_in at the first occurrance of c the field separator FS into the first token str_o1 and a remainder c str_o2 c originally written by Fortunat Kind, modified by a.tento c character str_in*(*), str_o1*(*), str_o2*(*) character*1 FS c integer sep_index, beg_index, stop_index, m, i, jj c c m = len(str_in) do 1 i = 1, m beg_index = i if ( str_in(i:i) .ne. ' ' ) goto 2 1 continue goto 10 2 continue c do 3 i = beg_index+1, m sep_index = i if ( str_in(i:i) .eq. FS ) goto 4 3 continue goto 10 4 continue c jj = m - sep_index do 5 i = 1, jj stop_index = m + 1 - i if ( str_in(stop_index:stop_index) .ne. ' ' ) goto 6 5 continue 6 continue c str_o1=str_in(beg_index:sep_index-1) str_o2=str_in(sep_index+1:stop_index) c return c c 10 str_o1=str_in str_o2='' c return c c end