Join a range of argv entries into a single command-line string.
Each token is quoted when needed, using quote_arg(); quoting rules are
platform-dependent (Windows vs POSIX).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | i1 |
Inclusive range of argv indices to join. |
||
| integer, | intent(in) | :: | i2 |
Inclusive range of argv indices to join. |
function join_argv(i1, i2) result(s) integer, intent(in) :: i1, i2 !! Inclusive range of argv indices to join. character(len=:), allocatable :: s character(len=:), allocatable :: a integer :: i s = "" do i = i1, i2 a = get_arg(i) if (len_trim(a) == 0) cycle if (needs_quotes(a)) then s = s // quote_arg(a) // " " else s = s // trim(a) // " " end if end do s = trim(s) end function join_argv