Lines Matching full:option

63  * Returns the name of the long option that matches the character @a c.
66 * @return The name of the long option that matches @a c, or "NULL".
86 * Issues a fatal error for an option parsing failure.
88 * @param c The character for the failing option.
89 * @param str Either the string for the failing option, or the invalid
90 * option.
91 * @param use_short True if the short option should be used for error printing,
114 * Returns the type of the long option that matches @a c.
117 * @return The type of the long option as an integer, or -1 if none.
137 * Parses a short option.
138 * @param o The option parser.
140 * @return The character for the short option, or -1 if none left.
147 const char* option = o->argv[o->optind];
154 // Get the next option.
155 option += o->subopt + 1;
156 o->optopt = option[0];
159 type = bc_opt_type(longopts, option[0]);
168 // Check for invalid option and barf if so.
174 str[0] = option[0];
177 bc_opt_error(BC_ERR_FATAL_OPTION, option[0], str, true);
187 if (option[1]) o->subopt += 1;
195 ret = (int) option[0];
205 bc_opt_error(BC_ERR_FATAL_OPTION, option[0],
206 bc_opt_longopt(longopts, option[0]), true);
221 if (option[1]) o->optarg = option + 1;
231 bc_opt_error(BC_ERR_FATAL_OPTION_NO_ARG, option[0],
232 bc_opt_longopt(longopts, option[0]), true);
235 ret = (int) option[0];
245 * Ensures that a long option argument matches a long option name, regardless of
248 * @param option The command-line argument.
249 * @return True if @a option matches @a name, false otherwise.
252 bc_opt_longoptsMatch(const char* name, const char* option)
254 const char* a = option;
271 * Returns a pointer to the argument of a long option, or NULL if it not in the
273 * @param option The option to find the argument of.
274 * @return A pointer to the argument of the option, or NULL if none.
277 bc_opt_longoptsArg(const char* option)
280 for (; *option && *option != '='; ++option)
285 if (*option == '=') return option + 1;
293 const char* option;
299 option = o->argv[o->optind];
300 if (option == NULL) return -1;
302 empty = !strcmp(option, "");
307 // If the option is just a "--".
308 if (BC_OPT_ISDASHDASH(option))
314 // Parse a short option.
315 else if (BC_OPT_ISSHORTOPT(option)) return bc_opt_parseShort(o, longopts);
316 // If the option is not long at this point, we are done.
317 else if (!BC_OPT_ISLONGOPT(option)) return -1;
323 // Skip "--" at beginning of the option.
324 option += 2;
333 if (bc_opt_longoptsMatch(name, option))
337 // Get the option char and the argument.
339 arg = bc_opt_longoptsArg(option);
341 // Error if the option is invalid..
377 // If we reach this point, the option is invalid.
378 bc_opt_error(BC_ERR_FATAL_OPTION, 0, option, false);