aboutsummaryrefslogtreecommitdiff
path: root/src/helper/command.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/helper/command.h')
-rw-r--r--src/helper/command.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/helper/command.h b/src/helper/command.h
index fc26dda..18fe561 100644
--- a/src/helper/command.h
+++ b/src/helper/command.h
@@ -77,7 +77,7 @@ struct command_invocation {
struct command_context *ctx;
struct command *current;
const char *name;
- unsigned argc;
+ unsigned int argc;
const char **argv;
Jim_Obj * const *jimtcl_argv;
Jim_Obj *output;
@@ -414,7 +414,7 @@ int parse_llong(const char *str, long long *ul);
#define DECLARE_PARSE_WRAPPER(name, type) \
int parse ## name(const char *str, type * ul)
-DECLARE_PARSE_WRAPPER(_uint, unsigned);
+DECLARE_PARSE_WRAPPER(_uint, unsigned int);
DECLARE_PARSE_WRAPPER(_u64, uint64_t);
DECLARE_PARSE_WRAPPER(_u32, uint32_t);
DECLARE_PARSE_WRAPPER(_u16, uint16_t);
@@ -517,6 +517,15 @@ DECLARE_PARSE_WRAPPER(_target_addr, target_addr_t);
int command_parse_bool_arg(const char *in, bool *out);
COMMAND_HELPER(handle_command_parse_bool, bool *out, const char *label);
+/**
+ * Parse a number (base 10, base 16 or base 8) and store the result
+ * into a bit buffer. Use the prefixes '0' and '0x' for base 8 and 16,
+ * otherwise defaults to base 10.
+ *
+ * In case of parsing error, a user-readable error message is produced.
+ */
+COMMAND_HELPER(command_parse_str_to_buf, const char *str, void *buf, unsigned int buf_len);
+
/** parses an on/off command argument */
#define COMMAND_PARSE_ON_OFF(in, out) \
COMMAND_PARSE_BOOL(in, out, "on", "off")