Go to the source code of this file.
|
int | fe_getopt (int argc, char *const *argv, const char *shortopts) |
|
int | fe_getopt_long (int argc, char *const *argv, const char *shortopts, const struct fe_option *longopts, int *longind) |
|
int | fe_getopt_long_only (int argc, char *const *argv, const char *shortopts, const struct fe_option *longopts, int *longind) |
|
int | _fe_getopt_internal (int argc, char *const *argv, const char *shortopts, const struct fe_option *longopts, int *longind, int long_only) |
|
Definition at line 78 of file fegetopt.h.
Data Fields |
const char * |
arg_name |
|
int |
has_arg |
|
const char * |
help |
|
char * |
name |
|
int |
set |
|
feOptType |
type |
|
int |
val |
|
void * |
value |
|
#define optional_argument 2 |
#define required_argument 1 |
Enumerator |
---|
feOptUntyped |
|
feOptBool |
|
feOptInt |
|
feOptString |
|
Definition at line 77 of file fegetopt.h.
int _fe_getopt_internal |
( |
int |
argc, |
|
|
char *const * |
argv, |
|
|
const char * |
shortopts, |
|
|
const struct fe_option * |
longopts, |
|
|
int * |
longind, |
|
|
int |
long_only |
|
) |
| |
Definition at line 327 of file fegetopt.c.
352 if (optstring[0] ==
'-')
357 else if (optstring[0] ==
'+')
415 if (fe_optind == argc)
427 if ((argv[fe_optind][0] !=
'-' || argv[fe_optind][1] ==
'\0')
430 || argv[fe_optind][0] !=
'+' || argv[fe_optind][1] ==
'\0')
448 && ((argv[fe_optind][0] ==
'-' 449 && (argv[fe_optind][1] ==
'-' || long_only))
462 while (*s && *s !=
'=')
466 for (p = longopts, option_index = 0; p->
name;
474 indfound = option_index;
478 else if (pfound ==
NULL)
482 indfound = option_index;
492 fprintf (stderr,
"%s: option `%s' is ambiguous\n",
493 argv[0], argv[fe_optind]);
501 option_index = indfound;
513 if (argv[fe_optind - 1][1] ==
'-')
516 "%s: option `--%s' doesn't allow an argument\n",
517 argv[0], pfound->
name);
521 "%s: option `%c%s' doesn't allow an argument\n",
522 argv[0], argv[fe_optind - 1][0], pfound->
name);
530 if (fe_optind < argc)
535 fprintf (stderr,
"%s: option `%s' requires an argument\n",
536 argv[0], argv[fe_optind - 1]);
538 return optstring[0] ==
':' ?
':' :
BAD_OPTION;
543 *longind = option_index;
550 if (!long_only || argv[fe_optind][1] ==
'-' 552 || argv[fe_optind][0] ==
'+' 558 if (argv[fe_optind][1] ==
'-')
560 fprintf (stderr,
"%s: unrecognized option `--%s'\n",
564 fprintf (stderr,
"%s: unrecognized option `%c%s'\n",
565 argv[0], argv[fe_optind][0],
nextchar);
577 const char *temp =
my_index (optstring, c);
583 if (temp ==
NULL || c ==
':')
588 if (c < 040 || c >= 0177)
589 fprintf (stderr,
"%s: unrecognized option, character code 0%o\n",
592 fprintf (stderr,
"%s: unrecognized option `-%c'\n", argv[0], c);
595 fprintf (stderr,
"%s: illegal option -- %c\n", argv[0], c);
625 else if (fe_optind == argc)
630 fprintf (stderr,
"%s: option `-%c' requires an argument\n",
634 fprintf (stderr,
"%s: option requires an argument -- %c\n",
639 if (optstring[0] ==
':')
const CanonicalForm int s
static void exchange(char **argv)
static const char * my_index(const char *str, int chr)
static unsigned my_strlen(const char *str)
int fe_getopt |
( |
int |
argc, |
|
|
char *const * |
argv, |
|
|
const char * |
shortopts |
|
) |
| |
Definition at line 655 of file fegetopt.c.
int _fe_getopt_internal(int argc, char *const *argv, const char *optstring, const struct fe_option *longopts, int *longind, int long_only)
int fe_getopt_long |
( |
int |
argc, |
|
|
char *const * |
argv, |
|
|
const char * |
shortopts, |
|
|
const struct fe_option * |
longopts, |
|
|
int * |
longind |
|
) |
| |
Definition at line 666 of file fegetopt.c.
int _fe_getopt_internal(int argc, char *const *argv, const char *optstring, const struct fe_option *longopts, int *longind, int long_only)
int fe_getopt_long_only |
( |
int |
argc, |
|
|
char *const * |
argv, |
|
|
const char * |
shortopts, |
|
|
const struct fe_option * |
longopts, |
|
|
int * |
longind |
|
) |
| |
Definition at line 676 of file fegetopt.c.
int _fe_getopt_internal(int argc, char *const *argv, const char *optstring, const struct fe_option *longopts, int *longind, int long_only)