#include "kernel/mod2.h"
#include <stdio.h>
#include "Singular/fegetopt.h"
Go to the source code of this file.
|
char * | getenv () |
|
static size_t | my_strlen (const char *str) |
|
static const char * | my_index (const char *str, int chr) |
|
static void | exchange (char **argv) |
|
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 (int argc, char *const *argv, const char *optstring) |
|
int | fe_getopt_long (int argc, char *const *argv, const char *options, const struct fe_option *long_options, int *opt_index) |
|
int | fe_getopt_long_only (int argc, char *const *argv, const char *options, const struct fe_option *long_options, int *opt_index) |
|
◆ _NO_PROTO
◆ BAD_OPTION
◆ const
◆ anonymous enum
Enumerator |
---|
REQUIRE_ORDER | |
PERMUTE | |
RETURN_IN_ORDER | |
Definition at line 163 of file fegetopt.c.
◆ _fe_getopt_internal()
int _fe_getopt_internal |
( |
int |
argc, |
|
|
char *const * |
argv, |
|
|
const char * |
optstring, |
|
|
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] ==
'+')
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",
501 option_index = indfound;
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",
535 fprintf (stderr,
"%s: option `%s' requires an argument\n",
538 return optstring[0] ==
':' ?
':' :
BAD_OPTION;
543 *longind = option_index;
550 if (!long_only || argv[
fe_optind][1] ==
'-'
560 fprintf (stderr,
"%s: unrecognized option `--%s'\n",
564 fprintf (stderr,
"%s: unrecognized option `%c%s'\n",
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);
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_VAR int first_nonopt
static void exchange(char **argv)
static size_t my_strlen(const char *str)
static const char * my_index(const char *str, int chr)
STATIC_VAR char * nextchar
STATIC_VAR int last_nonopt
◆ exchange()
static void exchange |
( |
char ** |
argv | ) |
|
|
static |
Definition at line 245 of file fegetopt.c.
247 char *temp, **first, **
last;
252 while (first <
last) {
253 temp = *first; *first = *
last; *
last = temp; first++;
last--;
259 while (first <
last) {
260 temp = *first; *first = *
last; *
last = temp; first++;
last--;
267 while (first <
last) {
268 temp = *first; *first = *
last; *
last = temp; first++;
last--;
◆ fe_getopt()
int fe_getopt |
( |
int |
argc, |
|
|
char *const * |
argv, |
|
|
const char * |
optstring |
|
) |
| |
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)
◆ fe_getopt_long()
int fe_getopt_long |
( |
int |
argc, |
|
|
char *const * |
argv, |
|
|
const char * |
options, |
|
|
const struct fe_option * |
long_options, |
|
|
int * |
opt_index |
|
) |
| |
◆ fe_getopt_long_only()
int fe_getopt_long_only |
( |
int |
argc, |
|
|
char *const * |
argv, |
|
|
const char * |
options, |
|
|
const struct fe_option * |
long_options, |
|
|
int * |
opt_index |
|
) |
| |
◆ getenv()
◆ my_index()
static const char* my_index |
( |
const char * |
str, |
|
|
int |
chr |
|
) |
| |
|
static |
◆ my_strlen()
static size_t my_strlen |
( |
const char * |
str | ) |
|
|
static |
◆ fe_optarg
◆ fe_opterr
◆ fe_optind
◆ fe_optopt
◆ first_nonopt
◆ last_nonopt
◆ nextchar