does_flag_exist Function

private pure function does_flag_exist(arg, flag_list) result(res)

Arguments

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

Return Value logical


Source Code

   pure function does_flag_exist(arg, flag_list) result(res)
      implicit none
      character(*), intent(in) :: arg
      type(flag_t), intent(in) :: flag_list(:)
      logical :: res
      integer :: i
      res = .false.

      do i = lbound(flag_list, dim=1), ubound(flag_list, dim=1)
         res = res &
                  .or. trim(arg) == trim(flag_list(i)%short_f) &
                  .or. trim(arg) == trim(flag_list(i)%long_f)
         if (res) return
      end do
   end function does_flag_exist