comments to subroutine parse
This commit is contained in:
parent
2ae363a80d
commit
350f3d9123
1 changed files with 12 additions and 10 deletions
|
|
@ -16,18 +16,23 @@
|
|||
SUBROUTINE parse
|
||||
CHARACTER(100) :: num1char
|
||||
|
||||
!First, make sure the right number of inputs have been provided
|
||||
! Good. One command line argument provided.
|
||||
IF(COMMAND_ARGUMENT_COUNT().EQ.1)THEN
|
||||
CALL GET_COMMAND_ARGUMENT(1,num1char) !first, read in the two values
|
||||
CALL GET_COMMAND_ARGUMENT(1,num1char)
|
||||
|
||||
! Bad. No command line argument provided. Print help message.
|
||||
ELSE IF(COMMAND_ARGUMENT_COUNT().EQ.0)THEN
|
||||
WRITE(*,*)'ERROR, NO COMMAND-LINE ARGUMENT'
|
||||
num1char = "-h"
|
||||
|
||||
! Bad. Multiple command line arguments provided. Print help message.
|
||||
ELSE
|
||||
WRITE(*,*)'ERROR, TOO MANY COMMAND-LINE ARGUMENTS(MORE THAN ONE). STOPPING'
|
||||
STOP
|
||||
WRITE(*,*)'ERROR, TOO MANY COMMAND-LINE ARGUMENTS( > 2 )'
|
||||
num1char = "-h"
|
||||
ENDIF
|
||||
|
||||
|
||||
! Option or STDIN
|
||||
IF(num1char(1:1) == "-") THEN
|
||||
|
||||
if(num1char=="-h") then
|
||||
|
|
@ -39,27 +44,24 @@
|
|||
write(*,'(a)') ""
|
||||
write(*,'(a)') "optional arguments:"
|
||||
write(*,'(a)') " -h show this help message and exit"
|
||||
|
||||
stop
|
||||
|
||||
else if (num1char=="-") then
|
||||
read_stdin = .true.
|
||||
|
||||
else
|
||||
WRITE(*,*)'ERROR, UNSUPPORTED OPTION ', trim(num1char), '. STOPPING'
|
||||
STOP
|
||||
end if
|
||||
|
||||
ELSE
|
||||
|
||||
END IF
|
||||
|
||||
|
||||
|
||||
|
||||
IF(read_stdin)THEN
|
||||
WRITE(*,*) "Read from STDIN"
|
||||
ELSE
|
||||
itape_name = num1char
|
||||
WRITE(*,*) "Read from " // num1char
|
||||
WRITE(*,*) "Read from file " // num1char
|
||||
END IF
|
||||
|
||||
END SUBROUTINE parse
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue