diff options
author | Timo Sirainen <cras@irssi.org> | 2000-12-04 20:35:44 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2000-12-04 20:35:44 +0000 |
commit | e18d43cef7e04a72070be656a361843a4fa32b47 (patch) | |
tree | 5e5c4194c3a716c3b2614a309f152da03f9bd6cc /src/core/commands.c | |
parent | ba3842761e8bc51ab02d5e14f6cb8803861f7a4d (diff) | |
download | irssi-e18d43cef7e04a72070be656a361843a4fa32b47.zip |
cmd_get_params() didn't work correctly if we didn't want any paramers
but only options.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@960 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/core/commands.c')
-rw-r--r-- | src/core/commands.c | 57 |
1 files changed, 28 insertions, 29 deletions
diff --git a/src/core/commands.c b/src/core/commands.c index ff35a0b6..042f26b6 100644 --- a/src/core/commands.c +++ b/src/core/commands.c @@ -537,37 +537,36 @@ int cmd_get_params(const char *data, gpointer *free_me, int count, ...) rec->data = old; *free_me = rec; - /* and now handle the string */ error = FALSE; - cnt = PARAM_WITHOUT_FLAGS(count); - while (cnt-- > 0) { - if (count & PARAM_FLAG_OPTIONS) { - arg = (char *) va_arg(args, char *); - opthash = (GHashTable **) va_arg(args, GHashTable **); - - rec->options = *opthash = - g_hash_table_new((GHashFunc) g_istr_hash, - (GCompareFunc) g_istr_equal); - - ignore_unknown = count & PARAM_FLAG_UNKNOWN_OPTIONS; - error = get_cmd_options(&datad, ignore_unknown, - arg, *opthash); - if (error) break; - - count &= ~PARAM_FLAG_OPTIONS; - cnt++; - continue; - } else if (cnt == 0 && count & PARAM_FLAG_GETREST) { - /* get rest */ - arg = datad; - } else { - arg = (count & PARAM_FLAG_NOQUOTES) ? - cmd_get_param(&datad) : - cmd_get_quoted_param(&datad); - } + if (count & PARAM_FLAG_OPTIONS) { + arg = (char *) va_arg(args, char *); + opthash = (GHashTable **) va_arg(args, GHashTable **); - str = (char **) va_arg(args, char **); - if (str != NULL) *str = arg; + rec->options = *opthash = + g_hash_table_new((GHashFunc) g_istr_hash, + (GCompareFunc) g_istr_equal); + + ignore_unknown = count & PARAM_FLAG_UNKNOWN_OPTIONS; + error = get_cmd_options(&datad, ignore_unknown, + arg, *opthash); + } + + if (!error) { + /* and now handle the string */ + cnt = PARAM_WITHOUT_FLAGS(count); + while (cnt-- > 0) { + if (cnt == 0 && count & PARAM_FLAG_GETREST) { + /* get rest */ + arg = datad; + } else { + arg = (count & PARAM_FLAG_NOQUOTES) ? + cmd_get_param(&datad) : + cmd_get_quoted_param(&datad); + } + + str = (char **) va_arg(args, char **); + if (str != NULL) *str = arg; + } } va_end(args); |