Skip to content

Commit

Permalink
Added an iostat=status variable to read the options
Browse files Browse the repository at this point in the history
  • Loading branch information
vmagnin committed Oct 30, 2021
1 parent 8c4500c commit 1d04499
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/taptempo.f90
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ subroutine print_options


subroutine manage_command_line
integer :: i, nb
integer :: i, nb, status
character(len=100) :: args

nb = command_argument_count()
Expand All @@ -63,22 +63,26 @@ subroutine manage_command_line
case("-p", "--precision")
i = i + 1
call get_command_argument(i, value=args)
read(args, *) p
read(args, *, iostat=status) p
if (status > 0) print '(A)', "Problem with -p: the default value will be used"
p = max(0, min(p, 5)) ! 0 <= p <= 5
case("-r", "--reset-time")
i = i + 1
call get_command_argument(i, value=args)
read(args, *) r
read(args, *, iostat=status) r
if (status > 0) print '(A)', "Problem with -r: the default value will be used"
case("-s", "--sample-size")
i = i + 1
call get_command_argument(i, value=args)
read(args, *) s
read(args, *, iostat=status) s
if (status > 0) print '(A)', "Problem with -s: the default value will be used"
s = max(2, s)
case("-v", "--version")
call print_version()
stop
end select
end do
print *, p,r,s
end subroutine manage_command_line


Expand Down

0 comments on commit 1d04499

Please sign in to comment.