1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

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
This commit is contained in:
Timo Sirainen 2000-12-04 20:35:44 +00:00 committed by cras
parent ba3842761e
commit e18d43cef7

View File

@ -537,37 +537,36 @@ int cmd_get_params(const char *data, gpointer *free_me, int count, ...)
rec->data = old; rec->data = old;
*free_me = rec; *free_me = rec;
/* and now handle the string */
error = FALSE; error = FALSE;
cnt = PARAM_WITHOUT_FLAGS(count); if (count & PARAM_FLAG_OPTIONS) {
while (cnt-- > 0) { arg = (char *) va_arg(args, char *);
if (count & PARAM_FLAG_OPTIONS) { opthash = (GHashTable **) va_arg(args, GHashTable **);
arg = (char *) va_arg(args, char *);
opthash = (GHashTable **) va_arg(args, GHashTable **);
rec->options = *opthash = rec->options = *opthash =
g_hash_table_new((GHashFunc) g_istr_hash, g_hash_table_new((GHashFunc) g_istr_hash,
(GCompareFunc) g_istr_equal); (GCompareFunc) g_istr_equal);
ignore_unknown = count & PARAM_FLAG_UNKNOWN_OPTIONS; ignore_unknown = count & PARAM_FLAG_UNKNOWN_OPTIONS;
error = get_cmd_options(&datad, ignore_unknown, error = get_cmd_options(&datad, ignore_unknown,
arg, *opthash); arg, *opthash);
if (error) break; }
count &= ~PARAM_FLAG_OPTIONS; if (!error) {
cnt++; /* and now handle the string */
continue; cnt = PARAM_WITHOUT_FLAGS(count);
} else if (cnt == 0 && count & PARAM_FLAG_GETREST) { while (cnt-- > 0) {
/* get rest */ if (cnt == 0 && count & PARAM_FLAG_GETREST) {
arg = datad; /* get rest */
} else { arg = datad;
arg = (count & PARAM_FLAG_NOQUOTES) ? } else {
cmd_get_param(&datad) : arg = (count & PARAM_FLAG_NOQUOTES) ?
cmd_get_quoted_param(&datad); cmd_get_param(&datad) :
cmd_get_quoted_param(&datad);
}
str = (char **) va_arg(args, char **);
if (str != NULL) *str = arg;
} }
str = (char **) va_arg(args, char **);
if (str != NULL) *str = arg;
} }
va_end(args); va_end(args);