Go to the documentation of this file.
45 struct gk_option *longopts,
int *longind,
int long_only);
201 while (top > middle && middle > bottom) {
202 if (top - middle > middle - bottom) {
204 int len = middle - bottom;
208 for (
i = 0;
i <
len;
i++) {
209 tem = argv[bottom +
i];
210 argv[bottom +
i] = argv[top - (middle - bottom) +
i];
211 argv[top - (middle - bottom) +
i] = tem;
218 int len = top - middle;
222 for (
i = 0;
i <
len;
i++) {
223 tem = argv[bottom +
i];
224 argv[bottom +
i] = argv[middle +
i];
225 argv[middle +
i] = tem;
258 if (optstring[0] ==
'-') {
262 else if (optstring[0] ==
'+') {
331 struct gk_option *longopts,
int *longind,
int long_only)
334 if (optstring[0] ==
':')
353 # define NONOPTION_P (argv[gk_optind][0] != '-' || argv[gk_optind][1] == '\0')
451 for (nameend =
nextchar; *nameend && *nameend !=
'='; nameend++)
455 for (
p = longopts, option_index = 0;
p->name;
p++, option_index++) {
457 if ((
unsigned int) (nameend -
nextchar) == (
unsigned int) strlen (
p->name)) {
460 indfound = option_index;
464 else if (pfound ==
NULL) {
467 indfound = option_index;
469 else if (long_only || pfound->
has_arg !=
p->has_arg || pfound->
flag !=
p->flag || pfound->
val !=
p->val)
475 if (ambig && !exact) {
477 fprintf(
stderr,
"%s: option `%s' is ambiguous\n", argv[0], argv[
gk_optind]);
485 if (pfound !=
NULL) {
486 option_index = indfound;
496 fprintf(
stderr,
"%s: option `--%s' doesn't allow an argument\n", argv[0], pfound->
name);
499 fprintf(
stderr,
"%s: option `%c%s' doesn't allow an argument\n", argv[0], argv[
gk_optind - 1][0], pfound->
name);
508 else if (pfound->
has_arg == 1) {
513 fprintf(
stderr,
"%s: option `%s' requires an argument\n", argv[0], argv[
gk_optind - 1]);
516 return optstring[0] ==
':' ?
':' :
'?';
521 *longind = option_index;
536 fprintf(
stderr,
"%s: unrecognized option `--%s'\n", argv[0],
nextchar);
551 char *temp = strchr(optstring,
c);
557 if (temp ==
NULL ||
c ==
':') {
561 fprintf(
stderr,
"%s: illegal option -- %c\n", argv[0],
c);
563 fprintf(
stderr,
"%s: invalid option -- %c\n", argv[0],
c);
570 if (temp[0] ==
'W' && temp[1] ==
';') {
589 fprintf(
stderr,
"%s: option requires an argument -- %c\n", argv[0],
c);
592 if (optstring[0] ==
':')
608 for (
p = longopts, option_index = 0;
p->name;
p++, option_index++) {
610 if ((
unsigned int) (nameend -
nextchar) == strlen (
p->name)) {
613 indfound = option_index;
617 else if (pfound ==
NULL) {
620 indfound = option_index;
627 if (ambig && !exact) {
629 fprintf(
stderr,
"%s: option `-W %s' is ambiguous\n", argv[0], argv[
gk_optind]);
634 if (pfound !=
NULL) {
635 option_index = indfound;
642 fprintf(
stderr,
"%s: option `-W %s' doesn't allow an argument\n", argv[0], pfound->
name);
648 else if (pfound->
has_arg == 1) {
653 fprintf(
stderr,
"%s: option `%s' requires an argument\n", argv[0], argv[
gk_optind - 1]);
655 return optstring[0] ==
':' ?
':' :
'?';
660 *longind = option_index;
671 if (temp[1] ==
':') {
672 if (temp[2] ==
':') {
691 fprintf(
stderr,
"%s: option requires an argument -- %c\n", argv[0],
695 if (optstring[0] ==
':')
char * gk_optarg
For communication arguments to the caller.
static int gk_getopt_internal(int argc, char **argv, char *optstring, struct gk_option *longopts, int *longind, int long_only)
static struct gk_option long_options[]
int gk_getopt(int argc, char **argv, char *options)
Parse command-line arguments.
static char * posixly_correct
int gk_optopt
Stores unknown option characters.
static void exchange(char **)
int gk_getopt_long(int argc, char **argv, char *options, struct gk_option *long_options, int *opt_index)
Parse command-line arguments with long options.
The structure that stores the information about the command-line options.
int gk_optind
Index in ARGV of the next element to be scanned.
int gk_opterr
Controls error reporting for unrecognized options.
static enum @1096 ordering
int gk_getopt_initialized
size_t len(handle h)
Get the length of a Python object.
int gk_getopt_long_only(int argc, char **argv, char *options, struct gk_option *long_options, int *opt_index)
Parse command-line arguments with only long options.
static char * gk_getopt_initialize(int, char **, char *)
gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:11:37