join_argv Function

public function join_argv(i1, i2) result(s)

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).

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: i1

Inclusive range of argv indices to join.

integer, intent(in) :: i2

Inclusive range of argv indices to join.

Return Value character(len=:), allocatable


Calls

proc~~join_argv~~CallsGraph proc~join_argv join_argv proc~get_arg get_arg proc~join_argv->proc~get_arg proc~needs_quotes needs_quotes proc~join_argv->proc~needs_quotes proc~quote_arg quote_arg proc~join_argv->proc~quote_arg proc~is_windows_os is_windows_os proc~quote_arg->proc~is_windows_os get_os_type get_os_type proc~is_windows_os->get_os_type

Called by

proc~~join_argv~~CalledByGraph proc~join_argv join_argv proc~parse_cli parse_cli proc~parse_cli->proc~join_argv proc~parse_cli_config parse_cli_config proc~parse_cli_config->proc~parse_cli

Source Code

   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