anchor.diff:    !! CHARACTER :: c
     INTEGER :: nstp, ipos, idigit, l1, l2
   
  -!! Size of compare.dat grid
  -  WRITE(6,'(A)') 'Enter directory 1 : '
  -  READ(5,*) dir1
  -
  -  WRITE(6,'(A)') 'Enter directory 2 : '
  -  READ(5,*) dir2
  -
  -  WRITE(6,'(A)') 'Enter directory for results (directory must exist) : '
  -  READ(5,*) dir3
  -
  -  WRITE(6,'(A)') 'Enter Frame number to compare : '
  -  READ(5,*) iframe
  +  INTEGER :: num_args, ix
  +  CHARACTER(len=12), DIMENSION(:), ALLOCATABLE :: args
  +
  +  num_args = COMMAND_ARGUMENT_COUNT()
  +  ALLOCATE(args(num_args))  ! I've omitted checking the return status of the allocation
  +
  +  IF (num_args > 0) THEN
  +     !! Read from the command line
  +     DO ix = 1, num_args
  +        CALL GET_COMMAND_ARGUMENT(ix,args(ix))
  +     END DO
  +
  +     dir1 = TRIM('save_proc')//TRIM(args(1))
  +     dir2 = TRIM('save_proc')//TRIM(args(2))
  +     dir3 = TRIM('compare')
  +     READ(args(3),*) iframe
  +  ELSE
  +
  +     !! Size of compare.dat grid
  +     WRITE(6,'(A)') 'Enter directory 1 : '
  +     READ(5,*) dir1
  +
  +     WRITE(6,'(A)') 'Enter directory 2 : '
  +     READ(5,*) dir2
  +
  +     WRITE(6,'(A)') 'Enter directory for results (directory must exist) : '
  +     READ(5,*) dir3
  +
  +     WRITE(6,'(A)') 'Enter Frame number to compare : '
  +     READ(5,*) iframe
  +  END IF
   
     !! OPEN(10,file='compare_results.dat')
     !! READ(10,*) iframe
  
positive.code:           e24.16,'    dx', /, &
            e24.16,'    dy',/)
  
    IF (mfields .GT. 10) THEN
       !!        # Format statement 109 below will not work.
       WRITE(6,'(A,A)') 'Warning (out2.f) : mfields > 5; ', &
            'change format statement 109.'
       STOP
    ENDIF
  
negative.code:   CLOSE(20)
  
    WRITE(6,*) ' '
    DO m = 1,meqn
       WRITE(6,150) global_max(m), m, grid_max(m)
    ENDDO
  
    WRITE(6,*) ' '
    OPEN(30,file=dir3_fname3)
    DO m = 1,meqn
       WRITE(30,150) global_max(m), m, grid_max(m)
    ENDDO
    WRITE(30,*) ' '
  
    DO n = 0,ngrids-1
       WRITE(30,'(I5,10E16.4)') n, (max_grids(n,m),m=1,meqn)
    ENDDO
    CLOSE(30)
  130 FORMAT(E30.16,'     ',A)
  140 FORMAT(I30,   '     ',A)
  150 FORMAT(E30.16, '     occurs in field',I5,' on grid ',I5)
  
    RETURN
  100 WRITE(6,*) 'Could not open file ', dir1_fname1
  200 WRITE(6,*) 'Could not open file ', dir2_fname1
  
  END PROGRAM compare_files
  
  
  SUBROUTINE write_tfile(iframe,time,meqn,ngrids,dir3)
    IMPLICIT NONE
  
    INTEGER :: iframe,meqn,ngrids,maux
    CHARACTER(100) :: dir3, dir3_fname1, dir3_fname2
    CHARACTER(10) :: fname1
    CHARACTER(10) :: fname2
  