diff options
Diffstat (limited to 'driver.f90')
-rw-r--r-- | driver.f90 | 27 |
1 files changed, 22 insertions, 5 deletions
@@ -28,7 +28,7 @@ implicit none logical::verbose logical::notes integer::i, j, retcode - character(len=:), pointer::filename, arg + character(len=:), pointer::filename, arg, outname if(command_argument_count() < 1) then call usage() @@ -39,7 +39,9 @@ implicit none verbose = .false. notes = .false. filename => null() - do i = 1, command_argument_count() + outname => null() + i = 1 + do while(i <= command_argument_count()) call get_command_argument(i, length=j) allocate(character(len=j)::arg) @@ -51,6 +53,12 @@ implicit none else if(arg == "-v") then verbose = .true. + else if(arg == "-o") then + i = i + 1 + call get_command_argument(i, length=j) + allocate(character(len=j)::outname) + call get_command_argument(i, value=outname) + else filename => arg arg => null() @@ -62,6 +70,8 @@ implicit none arg => null() end if + i = i + 1 + end do if(verbose) then @@ -76,7 +86,13 @@ implicit none call presentation%parse() if((.not. notes) .or. presentation%has_notes()) then - write(*, '(A)') presentation%to_text(notes_only=notes) + if(associated(outname)) then + open(newunit=j, file=outname, action="write", status="unknown") + write(j, '(A)') presentation%to_text(notes_only=notes) + close(j) + else + write(*, '(A)') presentation%to_text(notes_only=notes) + end if else call maybe_print(verbose, "No slide notes found in "//filename) retcode = 1 @@ -115,8 +131,9 @@ contains Print *, " " Print *, "Options:" Print *, " " - Print *, " -n Extract notes instead of slide contents" - Print *, " -v Be somewhat verbose, probably not enough to be interesting" + Print *, " -o <filename> Write output to specified filename instead of console" + Print *, " -n Extract notes instead of slide contents" + Print *, " -v Be somewhat verbose, probably not enough to be interesting" Print *, " " Print *, "Output is printed to standard out" Print *, " " |