...
This commit is contained in:
parent
82a7b04a9b
commit
c611f0076b
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
.vscode/
|
||||
build/
|
||||
16
Makefile
Normal file
16
Makefile
Normal file
@ -0,0 +1,16 @@
|
||||
FC=gfortran
|
||||
BUILD_DIR=build
|
||||
SRC_DIR=src
|
||||
|
||||
.phony: all main clean always
|
||||
|
||||
all: always main
|
||||
|
||||
main:
|
||||
$(FC) $(SRC_DIR)/main.f90 -o $(BUILD_DIR)/fcc
|
||||
|
||||
always:
|
||||
mkdir -p $(BUILD_DIR)
|
||||
|
||||
clean:
|
||||
rm -rf $(BUILD_DIR)
|
||||
3
examples/ret2.c
Normal file
3
examples/ret2.c
Normal file
@ -0,0 +1,3 @@
|
||||
int main() {
|
||||
return 2;
|
||||
}
|
||||
24
src/main.f90
Normal file
24
src/main.f90
Normal file
@ -0,0 +1,24 @@
|
||||
program main
|
||||
use f90getopt
|
||||
implicit none
|
||||
character(len=*), parameter :: VERSION = '1.0'
|
||||
integer :: attempts = 1
|
||||
type(option_s) :: opts(2)
|
||||
|
||||
opts(1) = option_s('attempts', .true., 'a')
|
||||
opts(2) = option_s('version', .false., 'v')
|
||||
|
||||
do
|
||||
select case (getopt('a:v', opts))
|
||||
case (char(0))
|
||||
exit
|
||||
case ('g')
|
||||
read (optarg, '(i3)') attempts
|
||||
case ('v')
|
||||
print '(a, f3.1)', 'version ', VERSION
|
||||
stop
|
||||
end select
|
||||
end do
|
||||
|
||||
print '(a, i3)', 'number of attempts: ', attempts
|
||||
end program main
|
||||
Loading…
x
Reference in New Issue
Block a user