diff options
author | Zachary T Welch <zw@superlucidity.net> | 2009-11-18 12:41:20 -0800 |
---|---|---|
committer | Zachary T Welch <zw@superlucidity.net> | 2009-11-18 15:51:07 -0800 |
commit | 4d8d1d32d0f0e0b8866a06cb1d3f304563fa6796 (patch) | |
tree | 753fd02c4efe2ced061dd0706f8b4cfb15064ed9 /src/helper/command.c | |
parent | 7e4adfe1c53aa18d4feba1e58ceb5c5aaa470775 (diff) |
change all bool parsers to accept any value
This patch changes the behavior of all boolean parsing callers to
accept any one of "true/enable/on/yes/1" or "false/disable/off/no/0".
Since one particular pair will be most appropriate in any given
situation, the specific macros should continue to be used in
order to display the most informative error messages possible.
Diffstat (limited to 'src/helper/command.c')
-rw-r--r-- | src/helper/command.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/helper/command.c b/src/helper/command.c index 5f3fae51..b7c44efc 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -955,7 +955,7 @@ DEFINE_PARSE_LONG(_s32, int32_t, n < INT32_MIN, INT32_MAX) DEFINE_PARSE_LONG(_s16, int16_t, n < INT16_MIN, INT16_MAX) DEFINE_PARSE_LONG(_s8, int8_t, n < INT8_MIN, INT8_MAX) -int command_parse_bool(const char *in, bool *out, +static int command_parse_bool(const char *in, bool *out, const char *on, const char *off) { if (strcasecmp(in, on) == 0) @@ -967,7 +967,7 @@ int command_parse_bool(const char *in, bool *out, return ERROR_OK; } -int command_parse_bool_any(const char *in, bool *out) +int command_parse_bool_arg(const char *in, bool *out) { if (command_parse_bool(in, out, "on", "off") == ERROR_OK) return ERROR_OK; @@ -987,7 +987,7 @@ COMMAND_HELPER(handle_command_parse_bool, bool *out, const char *label) switch (CMD_ARGC) { case 1: { const char *in = CMD_ARGV[0]; - if (command_parse_bool_any(in, out) != ERROR_OK) + if (command_parse_bool_arg(in, out) != ERROR_OK) { LOG_ERROR("%s: argument '%s' is not valid", CMD_NAME, in); return ERROR_INVALID_ARGUMENTS; |