consume_cli_arg Subroutine

public pure subroutine consume_cli_arg(arg, arg_len, nml_file, cortex_uri, attached)

Dispatch one parsed CLI token onto the worker-CLI state.

get_command_argument returns arg_len as the argument's TRUE length, which can exceed the fixed arg buffer for an over-long argument; the length is therefore clamped to len(arg) before any substring is taken so arg(17:arg_len) / arg(1:arg_len) can never index past the buffer (an out-of-bounds read otherwise). An over-long value is truncated to the buffer rather than overflowing it. Factored out of resolve_cli so the clamp is exercised directly by the runtime-check (bounds) gate.

               `len(arg)`); the routine clamps it internally to
               `len(arg)` before slicing — callers pass it as-is.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: arg

The argument buffer as filled by get_command_argument.

integer, intent(in) :: arg_len

The argument's reported TRUE length (may exceed

character(len=*), intent(inout) :: nml_file

Updated in place with a positional namelist path.

character(len=*), intent(inout) :: cortex_uri

Updated in place with a positional namelist path. Updated in place with a --cortex-socket= value.

logical, intent(inout) :: attached

Set .true. iff a --cortex-socket= token was seen.