Go to the source code of this file.
|
| void | sys_getopt_init (void) |
| struct sys_getopt_state * | sys_getopt_state_get (void) |
| int | sys_getopt (int nargc, char *const nargv[], const char *ostr) |
| | Parses the command-line arguments.
|
| int | sys_getopt_long (int nargc, char *const *nargv, const char *options, const struct sys_getopt_option *long_options, int *idx) |
| | Parses the command-line arguments.
|
| int | sys_getopt_long_only (int nargc, char *const *nargv, const char *options, const struct sys_getopt_option *long_options, int *idx) |
| | Parses the command-line arguments.
|
◆ sys_getopt_no_argument
| #define sys_getopt_no_argument 0 |
◆ sys_getopt_optional_argument
| #define sys_getopt_optional_argument 2 |
◆ sys_getopt_required_argument
| #define sys_getopt_required_argument 1 |
◆ sys_getopt()
| int sys_getopt |
( |
int | nargc, |
|
|
char *const | nargv[], |
|
|
const char * | ostr ) |
Parses the command-line arguments.
- Note
- This function is based on FreeBSD implementation but it does not support environment variable: POSIXLY_CORRECT.
- Parameters
-
| [in] | nargc | Arguments count. |
| [in] | nargv | Arguments. |
| [in] | ostr | String containing the legitimate option characters. |
- Returns
- If an option was successfully found, function returns the option character.
◆ sys_getopt_init()
| void sys_getopt_init |
( |
void | | ) |
|
◆ sys_getopt_long()
| int sys_getopt_long |
( |
int | nargc, |
|
|
char *const * | nargv, |
|
|
const char * | options, |
|
|
const struct sys_getopt_option * | long_options, |
|
|
int * | idx ) |
Parses the command-line arguments.
The sys_getopt_long() function works like sys_getopt() except it also accepts long options, started with two dashes.
- Note
- This function is based on FreeBSD implementation but it does not support environment variable: POSIXLY_CORRECT.
- Parameters
-
| [in] | nargc | Arguments count. |
| [in] | nargv | Arguments. |
| [in] | options | String containing the legitimate option characters. |
| [in] | long_options | Pointer to the first element of an array of struct sys_getopt_option. |
| [in] | idx | If idx is not NULL, it points to a variable which is set to the index of the long option relative to long_options. |
- Returns
- If an option was successfully found, function returns the option character.
◆ sys_getopt_long_only()
| int sys_getopt_long_only |
( |
int | nargc, |
|
|
char *const * | nargv, |
|
|
const char * | options, |
|
|
const struct sys_getopt_option * | long_options, |
|
|
int * | idx ) |
Parses the command-line arguments.
The sys_getopt_long_only() function works like sys_getopt_long(), but '-' as well as "--" can indicate a long option. If an option that starts with '-' (not "--") doesn't match a long option, but does match a short option, it is parsed as a short option instead.
- Note
- This function is based on FreeBSD implementation but it does not support environment variable: POSIXLY_CORRECT.
- Parameters
-
| [in] | nargc | Arguments count. |
| [in] | nargv | Arguments. |
| [in] | options | String containing the legitimate option characters. |
| [in] | long_options | Pointer to the first element of an array of struct sys_getopt_option. |
| [in] | idx | If idx is not NULL, it points to a variable which is set to the index of the long option relative to long_options. |
- Returns
- If an option was successfully found, function returns the option character.
◆ sys_getopt_state_get()
◆ sys_getopt_optarg
◆ sys_getopt_opterr
◆ sys_getopt_optind
◆ sys_getopt_optopt
◆ sys_getopt_optreset