1 /*
2  * Copyright (c) 2018 Oticon A/S
3  * Copyright (c) 2023 Nordic Semiconductor ASA
4  *
5  * SPDX-License-Identifier: Apache-2.0
6  */
7 
8 #ifndef NATIVE_SIMULATOR_NATIVE_SRC_NSI_CMDLINE_INTERNAL_H
9 #define NATIVE_SIMULATOR_NATIVE_SRC_NSI_CMDLINE_INTERNAL_H
10 
11 #include <stdbool.h>
12 #include <stddef.h>
13 #include "nsi_cmdline.h"
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
19 #define _MAX_LINE_WIDTH 100 /*Total width of the help message*/
20 /* Horizontal alignment of the 2nd column of the help message */
21 #define _LONG_HELP_ALIGN 30
22 
23 #define _MAXOPT_SWITCH_LEN  32 /* Maximum allowed length for a switch name */
24 #define _MAXOPT_NAME_LEN    32 /* Maximum allowed length for a variable name */
25 
26 #define _HELP_SWITCH  "[-h] [--h] [--help] [-?]"
27 #define _HELP_DESCR   "Display this help"
28 
29 #define _MAX_STRINGY_LEN (_MAXOPT_SWITCH_LEN + _MAXOPT_NAME_LEN + 2 + 1 + 2 + 1)
30 
31 int nsi_cmd_is_option(const char *arg, const char *option, int with_value);
32 int nsi_cmd_is_help_option(const char *arg);
33 void nsi_cmd_read_option_value(const char *str, void *dest, const char type,
34 			   const char *option);
35 void nsi_cmd_args_set_defaults(struct args_struct_t args_struct[]);
36 bool nsi_cmd_parse_one_arg(char *argv, struct args_struct_t args_struct[]);
37 void nsi_cmd_print_switches_help(struct args_struct_t args_struct[]);
38 
39 #ifdef __cplusplus
40 }
41 #endif
42 
43 #endif /* NATIVE_SIMULATOR_NATIVE_SRC_NSI_CMDLINE_INTERNAL_H */
44