-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathargument.f95
39 lines (35 loc) · 1.19 KB
/
argument.f95
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
program main
implicit none
character(len=*), parameter :: VERSION = '1.0'
character(len=32) :: arg
integer :: i
do i = 1, command_argument_count()
call get_command_argument(i, arg)
select case (arg)
case ('-v', '--version')
print '(2a)', 'version ', VERSION
stop
case ('-h', '--help')
call print_help()
stop
case ('-t','--t')
print '(2a, /)', 'unrecognised command-line option: ', arg
call data_type()
stop
case default
print '(2a, /)', 'unrecognised command-line option: ', arg
call print_help()
stop
end select
end do
contains
subroutine print_help()
print '(a, /)', 'command-line options:'
print '(a)', ' -v, --version print version information and exit'
print '(a, /)', ' -h, --help print usage information and exit'
end subroutine print_help
subroutine data_type()
print '(a,/)','command-line statement:'
print*,1+2
end subroutine
end program main