Restructure the command parsing loops so the mode commands only parse the mode options
This commit is contained in:
parent
c291ec65b4
commit
0dff3b2ca9
5 changed files with 49 additions and 52 deletions
30
src/main.f90
30
src/main.f90
|
@ -17,8 +17,8 @@ program main
|
|||
use io
|
||||
|
||||
|
||||
integer :: arg_num
|
||||
character(len=100) :: mode
|
||||
integer :: i, end_mode_arg, arg_num
|
||||
character(len=100) :: argument
|
||||
|
||||
!Call initialization functions
|
||||
call lattice_init
|
||||
|
@ -29,13 +29,29 @@ program main
|
|||
|
||||
!Determine if a mode is being used and what it is. The first argument has to be the mode
|
||||
!if a mode is being used
|
||||
call get_command_argument(1, mode)
|
||||
call get_command_argument(1, argument)
|
||||
|
||||
mode = trim(adjustl(mode))
|
||||
if (mode(1:2) == '--') then
|
||||
call call_mode(arg_num, mode)
|
||||
argument = trim(adjustl(argument))
|
||||
if (argument(1:2) == '--') then
|
||||
call call_mode(end_mode_arg, argument)
|
||||
end if
|
||||
|
||||
!Finish by writing the files
|
||||
!Now we loop through all of the arguments and check for passed options or for a filename to be written out
|
||||
do i = end_mode_arg-1, arg_num
|
||||
call get_command_argument(i, argument)
|
||||
|
||||
!Check to see if a filename was passed
|
||||
if(scan(argument,'.',.true.) > 0) then
|
||||
call get_out_file(argument)
|
||||
end if
|
||||
end do
|
||||
|
||||
!Check to make sure a file was passed to be written out and then write out
|
||||
! Before building do a check on the file
|
||||
if (outfilenum == 0) then
|
||||
argument = 'none'
|
||||
call get_out_file(argument)
|
||||
end if
|
||||
call write_out
|
||||
|
||||
end program main
|
Loading…
Add table
Add a link
Reference in a new issue