1 /** @file cli_utils.h 2 * 3 * @brief CLI Utils 4 * 5 * Copyright 2008-2024 NXP 6 * 7 * SPDX-License-Identifier: BSD-3-Clause 8 * 9 */ 10 11 #ifndef __CLI_UTILS_H__ 12 #define __CLI_UTILS_H__ 13 14 #include <stdbool.h> 15 #include <stdint.h> 16 17 bool string_equal(const char *s1, const char *s2); 18 bool get_uint(const char *arg, unsigned int *dest, unsigned int len); 19 bool get_mac(const char *arg, char *dest, char sep); 20 #if defined(RW610) && (CONFIG_ANT_DETECT) 21 bool get_channel_list(const char *arg, uint8_t *num_channels, uint8_t *chan_number, char sep); 22 #endif 23 /* Simplified non-re-entrant cli_getopt function. Call this in a while loop to 24 * parse argv. Here are some caveats: 25 * 26 * Be sure to set cli_optind to 1 before invoking getopt for the first time. 27 * Only short options with preceding '-' are supported. 28 * Returns '?' when it encounters an unexpected condition or option 29 */ 30 extern int cli_optind; 31 extern char *cli_optarg; 32 int cli_getopt(int argc, char **argv, const char *fmt); 33 unsigned int a2hex_or_atoi(char *value); 34 unsigned int a2hex(const char *s); 35 unsigned char hexc2bin(char chr); 36 char *string_dup(const char *s); 37 #endif 38