zephyr/lib/util/getopt/getopt.h
Jakub Rzeszutko ddb07f57ec lib: add freebsd getopt library
This library is going to be used by the shell module. Some shell users
are not satisfied with subcommands alone and need to use the options
for commands as well.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2021-03-01 09:50:32 -05:00

42 lines
819 B
C

/*
* Copyright (c) 2021 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef _GETOPT_H__
#define _GETOPT_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <zephyr.h>
struct getopt_state {
int opterr; /* if error message should be printed */
int optind; /* index into parent argv vector */
int optopt; /* character checked for validity */
int optreset; /* reset getopt */
char *optarg; /* argument associated with option */
char *place; /* option letter processing */
};
/* Function intializes getopt_state structure */
void getopt_init(struct getopt_state *state);
/*
* getopt --
* Parse argc/argv argument vector.
*/
int getopt(struct getopt_state *const state, int nargc,
char *const nargv[], const char *ostr);
#ifdef __cplusplus
}
#endif
#endif /* _GETOPT_H__ */