libsim  Versione6.3.0

◆ optionparser_add_c()

subroutine optionparser_add_c ( type(optionparser), intent(inout)  this,
character(len=*), intent(in)  short_opt,
character(len=*), intent(in)  long_opt,
character(len=*), target  dest,
character(len=*), optional  default,
character(len=*), optional  help,
logical, intent(in), optional  isopt 
)

Add a new option with a character type argument.

When parsing will be performed, if the requested option is encountered, its corresponding compulsory argument will be copied into the provided destination, truncating it if it is too long. An optional default value can be provided for the destination. Please use the generic optionparser_add method rather than this particular method.

Parametri
[in,out]thisoptionparser object
[in]short_optthe short option (may be empty)
[in]long_optthe long option (may be empty)
destthe destination of the option parse result
defaultthe default value to give to dest if option is not found
helpthe help message that will be formatted and pretty-printed on screen
[in]isoptif provided and .TRUE. the argument is considered optional

Definizione alla linea 1118 del file optionparser_class.F90.

1118  status = max(option_found(this%options%array(j), optarg), &
1119  status)
1120  ELSE
1121  status = optionparser_err
1122  CALL l4f_log(l4f_error, &
1123  'in optionparser, option '''//trim(arg)//''' requires an argument')
1124  ENDIF
1125  ENDIF
1126  CASE(1) ! optional
1127  IF (len_trim(arg) > 2) THEN
1128  optarg = arg(3:)
1129  ELSE
1130  IF (i < iargc()) THEN
1131  CALL getarg(i+1, optarg)
1132  IF (optarg(1:1) == '-') THEN
1133  optarg = cmiss ! refused
1134  ELSE
1135  i=i+1 ! accepted
1136  ENDIF
1137  ELSE
1138  optarg = cmiss ! refused
1139  ENDIF
1140  ENDIF
1141  status = max(option_found(this%options%array(j), optarg), &
1142  status)
1143  CASE(0)
1144  status = max(option_found(this%options%array(j)), &
1145  status)
1146  END SELECT
1147  EXIT find_shortopt
1148  ENDIF
1149  ENDDO find_shortopt
1150  IF (j > this%options%arraysize) THEN
1151  status = optionparser_err
1152  CALL l4f_log(l4f_error, &
1153  'in optionparser, option '''//trim(arg)//''' not valid')
1154  ENDIF
1155  ELSE ! unrecognized = end of options
1156  EXIT
1157  ENDIF

Generated with Doxygen.