view gcc/testsuite/gfortran.fortran-torture/execute/getarg_1.f90 @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 84e7813d76e9
children
line wrap: on
line source

! Check that getarg does somethig sensible.
program getarg_1
  CHARACTER*10 ARGS, ARGS2
  INTEGER*4 I
  INTEGER*2 I2
  I = 0
  CALL GETARG(I,ARGS)
  ! This should return the invoking command.  The actual value depends 
  ! on the OS, but a blank string is wrong no matter what.
  ! ??? What about deep embedded systems?

  I2 = 0
  CALL GETARG(I2,ARGS2)
  if (args2.ne.args) STOP 1

  if (args.eq.'') STOP 2
  I = 1
  CALL GETARG(I,ARGS)
  if (args.ne.'') STOP 3
  I = -1
  CALL GETARG(I,ARGS)
  if (args.ne.'') STOP 4
  ! Assume we won't have been called with more that 4 args.
  I = 4
  CALL GETARG(I,ARGS)
  if (args.ne.'') STOP 5
  I = 1000
  CALL GETARG(I,ARGS)
  if (args.ne.'') STOP 6
end