! Copyright (C) GFD Dennou Club, 2000.  All rights reserved
! コマンドライン引数の取得 - gt_argtable.f90 参照

subroutine GtArgGetC(ord, value, default)
    use dc_string
    use sysdep, only: SysdepArgGet
    use gt_argtable, only: BuildArgTable, argind_table, argind_count
    implicit none
    integer, intent(in):: ord
    character(len = *), intent(out):: value
    character(len = *), intent(in), optional:: default
    integer:: i
continue
    call BuildArgTable
    if (ord > argind_count) then
        value = default
    else
        i = ord
        if (ord /= 0) i = argind_table(abs(ord))
        call SysdepArgGet(i, value)
    endif
end subroutine

subroutine GtArgGetV(ord, value, default)
    use dc_string
    use dc_types, only: string
    use sysdep, only: SysdepArgGet
    use gt_argtable, only: BuildArgTable, argind_table, argind_count
    implicit none
    integer, intent(in):: ord
    type(VSTRING), intent(out):: value
    character(len = *), intent(in), optional:: default
    character(len = STRING):: buffer
    integer:: i
continue
    call BuildArgTable
    if (ord > argind_count) then
        value = default
    else
        i = ord
        if (ord /= 0) i = argind_table(abs(ord))
        call SysdepArgGet(i, buffer)
        value = trim(buffer)
    endif
end subroutine
