libsim Versione 7.2.4
|
◆ optionparser_add_c()
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.
Definizione alla linea 1092 del file optionparser_class.F90. 1093 END SELECT
1094 EXIT find_longopt
1095 ENDIF
1096 ENDDO find_longopt
1097 IF (j > this%options%arraysize) THEN
1098 status = optionparser_err
1099 CALL l4f_log(l4f_error, &
1100 'in optionparser, option '''//trim(arg)//''' not valid')
1101 ENDIF
1102 ELSE IF (arg(1:1) == '-') THEN ! short option
1103 find_shortopt: DO j = 1, this%options%arraysize
1104 IF (this%options%array(j)%short_opt == arg(2:2)) THEN ! found option
1105 SELECT CASE(this%options%array(j)%need_arg)
1106 CASE(2) ! compulsory
1107 IF (len_trim(arg) > 2) THEN
1108 optarg = arg(3:)
1109 status = max(option_found(this%options%array(j), optarg), &
1110 status)
1111 ELSE
1112 IF (i < iargc()) THEN
1113 i=i+1
1114 CALL getarg(i, optarg)
1115 status = max(option_found(this%options%array(j), optarg), &
1116 status)
1117 ELSE
1118 status = optionparser_err
1119 CALL l4f_log(l4f_error, &
1120 'in optionparser, option '''//trim(arg)//''' requires an argument')
1121 ENDIF
1122 ENDIF
1123 CASE(1) ! optional
1124 IF (len_trim(arg) > 2) THEN
1125 optarg = arg(3:)
1126 ELSE
1127 IF (i < iargc()) THEN
1128 CALL getarg(i+1, optarg)
1129 IF (optarg(1:1) == '-') THEN
|