implicit real(a-h,o-z) character*80 dir character*80 fname logical askif,have call find_unit(lun) write(6,'(A,$)') ' try gplot_dpk.ini...' inquire(FILE='gplot_dpk.ini',EXIST=have,ACCESS=fname) write(6,*) ' Try here: ',have,fname(1:20) open(lun,FILE='gplot_dpk.ini',STATUS='OLD',ERR=10) close(lun) write(6,'(A)') ' found!' call gplot_setup('gplot_dpk.ini') 10 write(6,'(A,$)') ' ~/gplot_dpk.ini...' call getenv('HOME',dir) len=index(dir,' ')-1 fname=dir(1:len)//'/gplot_dpk.ini ' !note trailing blank len=index(fname,' ')-1 inquire(FILE=fname(1:len),EXIST=have,ACCESS=dir) write(6,*) ' Try here: ',have,' ',dir(1:20) open(lun,FILE='~/gplot_dpk.ini',STATUS='OLD',ERR=11) close(lin) write(6,'(A)') ' found!' call gplot_setup('~/gplot_dpk.ini') 11 call getenv('TRIUMF_FONTS',dir) len=index(dir,' ')-1 fname=dir(1:len)//'/gplot_dpk.ini ' !note trailing blank len=index(fname,' ')-1 write(6,'(1X,A,$)') fname(1:len) open(lun,FILE=fname(1:len),STATUS='OLD',ERR=12) close(lun) write(6,'(A)') ' found!' call gplot_setup(fname(1:len)) goto 1 12 write(6,'(/,A)') ' ***Warning*** initialization file not found' call gplot_setup('~/gplot_dpk.ini') call transparent_mode(0) 1 if(askif(' should we stop? @')) stop goto 1 end C===================================================================== C C...ASKIF... C C...Short Logical Function to get .TRUE. or .FALSE. result as C a Y or N answer to the Character QUESTION, terminated by '@' C LOGICAL FUNCTION ASKIF (STRING) character*80 STRING character*1 CHAR,YESU,ESL,NOU,NOL,BLNK,EOL DATA YESU/'Y'/,YESL/'y'/,NOU/'N'/,NOL/'n'/,BLNK/' '/,EOL/'@'/ C--------------------------------------------------------------------< NCH = INDEX(STRING,EOL) IF(NCH.GT.0) WRITE(6,'(A,$)') STRING(1:NCH-1) CHAR=BLNK 1000 READ(5,'(A1)') CHAR IF (CHAR .EQ. 'Y' .OR. CHAR .EQ. 'y') THEN ASKIF = .TRUE. RETURN ELSE IF (CHAR.EQ.' ' .OR. CHAR.EQ.'n' .OR. CHAR.EQ.'N') THEN ASKIF = .FALSE. RETURN END IF WRITE (6,'(A,$)') 'Please answer Y or N: ' GO TO 1000 END