c=========================================================== c Test program for subroutine 'dvfrom'. c c Program expects one argument which is the filename c to be passed to 'dvfrom' c=========================================================== program tdvfrom implicit none c----------------------------------------------------------- c The integer function 'iargc' returns the number of c arguments supplied to the program. It is c automatically available to all Fortran programs on c most Unix systems, as is 'getarg' (see below). c----------------------------------------------------------- integer iargc, indlnb integer maxn parameter ( maxn = 100 000 ) real*8 v(maxn) integer n character*256 fname c----------------------------------------------------------- c Unless exactly one argument is supplied, print usage c message and exit. c----------------------------------------------------------- if( iargc() .ne. 1 ) then write(0,*) 'usage: tdvfrom ' write(0,*) write(0,*) ' Use ''tdvfrom -'' to read ', & 'from standard input' stop end if c----------------------------------------------------------- c The subroutine 'getarg' (Unix) takes 2 arguments. c The first is an integer input argument specifying c which argument is to be fetched, the second is c a character output argument which, on return, c contains the fetched argument. c c Get the filename. c----------------------------------------------------------- call getarg(1,fname) c----------------------------------------------------------- c Call the routine ... c----------------------------------------------------------- call dvfrom(fname,v,n,maxn) c----------------------------------------------------------- c ... and report how many numbers were read. c----------------------------------------------------------- write(0,*) 'tdvfrom: ', n, ' read from '// & fname(1:indlnb(fname)) stop end