anchor.diff:        PARAMETER (pi=4.0d0*datan(1.0d0),r2d=1.8d2/pi,radius=6371.0d0)
         REAL*8 lon1,lat1,lon2,lat2,dist,az,cmdin(4)
         CHARACTER*30 ifile,ofile
  -      INTEGER c,p,input
  -      LOGICAL ex
  +      INTEGER c,p,input,i
  +      LOGICAL ex,debug
   
   C----
   C Parse command line and read options
   C----
  -      call gcmdln(ifile,ofile,c,cmdin,p)
  +      call gcmdln(ifile,ofile,c,cmdin,p,debug)
   
   C----
   C Check inputs are valid
   C----
  +      if (debug) then
  +          write(0,*) 'Checking input values'
  +          write(0,*) 'Command line flag: ',c
  +          write(0,*) 'Input file: ',trim(ifile)
  +          write(0,*) 'Output file: ',trim(ofile)
  +      endif
         if (c.eq.1) goto 103
         if (ifile.eq.'none') then
             write(*,*) '!! Error: Input lon1 lat1 lon2 lat2 file ',
  
positive.code: 
  C----------------------------------------------------------------------C
  
        SUBROUTINE gcmdln(ifile,ofile,c,cmdin,p)
        IMPLICIT NONE
        CHARACTER*30 ifile,ofile,tag
        INTEGER i,narg,c,p
        REAL*8 cmdin(4)
        ifile = 'none'
        ofile = 'none'
        c = 0
        p = 1
        narg = iargc()
  
negative.code:           endif
            goto 901
    902 continue
        if (debug) then
            write(0,*) 'Debugging output turned on in gcmdln'
            write(0,*) 'Leaving gcmdln'
        endif
        RETURN
        END
  
  