Zephyr API
4.4.99
A Scalable Open Source RTOS
Toggle main menu visibility
Loading...
Searching...
No Matches
sys_getopt.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2021 Nordic Semiconductor ASA
3
*
4
* SPDX-License-Identifier: Apache-2.0
5
*/
6
7
#ifndef ZEPHYR_INCLUDE_SYS_GETOPT_H_
8
#define ZEPHYR_INCLUDE_SYS_GETOPT_H_
9
10
#ifdef __cplusplus
11
extern
"C"
{
12
#endif
13
14
#include <
zephyr/kernel.h
>
15
16
struct
sys_getopt_state
{
17
int
opterr
;
/* if error message should be printed */
18
int
optind
;
/* index into parent argv vector */
19
int
optopt
;
/* character checked for validity */
20
int
optreset
;
/* reset getopt */
21
char
*
optarg
;
/* argument associated with option */
22
23
char
*
place
;
/* option letter processing */
24
25
#if CONFIG_GETOPT_LONG
26
int
nonopt_start;
27
int
nonopt_end;
28
#endif
29
};
30
31
extern
int
sys_getopt_optreset
;
/* reset getopt */
32
extern
char
*
sys_getopt_optarg
;
33
extern
int
sys_getopt_opterr
;
34
extern
int
sys_getopt_optind
;
35
extern
int
sys_getopt_optopt
;
36
37
#define sys_getopt_no_argument 0
38
#define sys_getopt_required_argument 1
39
#define sys_getopt_optional_argument 2
40
41
struct
sys_getopt_option
{
42
/* name of long option */
43
const
char
*
name
;
44
/*
45
* one of no_argument, required_argument, and optional_argument:
46
* whether option takes an argument
47
*/
48
int
has_arg
;
49
/* if not NULL, set *flag to val when option found */
50
int
*
flag
;
51
/* if flag not NULL, value to set *flag to; else return value */
52
int
val
;
53
};
54
55
/* Function initializes getopt_state structure for current thread */
56
void
sys_getopt_init
(
void
);
57
58
/* Function returns getopt_state structure for the current thread. */
59
struct
sys_getopt_state
*
sys_getopt_state_get
(
void
);
60
74
int
sys_getopt
(
int
nargc,
char
*
const
nargv[],
const
char
*ostr);
75
97
int
sys_getopt_long
(
int
nargc,
char
*
const
*nargv,
const
char
*options,
98
const
struct
sys_getopt_option
*long_options,
int
*idx);
99
123
int
sys_getopt_long_only
(
int
nargc,
char
*
const
*nargv,
const
char
*options,
124
const
struct
sys_getopt_option
*long_options,
int
*idx);
125
126
#ifdef __cplusplus
127
}
128
#endif
129
130
#endif
/* ZEPHYR_INCLUDE_SYS_GETOPT_H_ */
kernel.h
Public kernel APIs.
sys_getopt_option
Definition
sys_getopt.h:41
sys_getopt_option::has_arg
int has_arg
Definition
sys_getopt.h:48
sys_getopt_option::name
const char * name
Definition
sys_getopt.h:43
sys_getopt_option::flag
int * flag
Definition
sys_getopt.h:50
sys_getopt_option::val
int val
Definition
sys_getopt.h:52
sys_getopt_state
Definition
sys_getopt.h:16
sys_getopt_state::opterr
int opterr
Definition
sys_getopt.h:17
sys_getopt_state::optarg
char * optarg
Definition
sys_getopt.h:21
sys_getopt_state::place
char * place
Definition
sys_getopt.h:23
sys_getopt_state::optreset
int optreset
Definition
sys_getopt.h:20
sys_getopt_state::optind
int optind
Definition
sys_getopt.h:18
sys_getopt_state::optopt
int optopt
Definition
sys_getopt.h:19
sys_getopt_optarg
char * sys_getopt_optarg
sys_getopt_opterr
int sys_getopt_opterr
sys_getopt
int sys_getopt(int nargc, char *const nargv[], const char *ostr)
Parses the command-line arguments.
sys_getopt_optreset
int sys_getopt_optreset
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.
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.
sys_getopt_init
void sys_getopt_init(void)
sys_getopt_state_get
struct sys_getopt_state * sys_getopt_state_get(void)
sys_getopt_optind
int sys_getopt_optind
sys_getopt_optopt
int sys_getopt_optopt
zephyr
sys
sys_getopt.h
Generated on
for Zephyr API by
1.17.0