From f12d3914e580ea1bd4d55d94190e9e59aea14f86 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Sun, 20 Jan 2002 16:57:06 +0000 Subject: Added -before and -after options to /LASTLOG. You can also use - to specify both before and after values. Added special "#" option name to commands which specifies that - parameter is allowed. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2331 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/core/commands.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/core') diff --git a/src/core/commands.c b/src/core/commands.c index 9d7cfe2d..f1119069 100644 --- a/src/core/commands.c +++ b/src/core/commands.c @@ -565,9 +565,9 @@ static int get_cmd_options(char **data, int ignore_unknown, break; } - if (!isspace(**data)) + if (!isspace(**data)) { option = cmd_get_param(data); - else { + } else { option = "-"; (*data)++; } @@ -575,6 +575,18 @@ static int get_cmd_options(char **data, int ignore_unknown, /* check if this option can have argument */ pos = optlist == NULL ? -1 : option_find(optlist, option); + + if (pos == -1 && optlist != NULL && + is_numeric(option, '\0')) { + /* check if we want - option */ + pos = option_find(optlist, "#"); + if (pos != -1) { + g_hash_table_insert(options, "#", + option); + pos = -3; + } + } + if (pos == -1 && !ignore_unknown) { /* unknown option! */ *data = option; @@ -591,7 +603,7 @@ static int get_cmd_options(char **data, int ignore_unknown, option = optlist[pos] + iscmdtype(*optlist[pos]); } - if (options != NULL) + if (options != NULL && pos != -3) g_hash_table_insert(options, option, ""); if (pos < 0 || !iscmdtype(*optlist[pos]) || -- cgit v1.2.3