summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2002-01-20 16:57:06 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2002-01-20 16:57:06 +0000
commitf12d3914e580ea1bd4d55d94190e9e59aea14f86 (patch)
treefb2328ac559529e1e83e4dee3fb15b46b386fdfd /src/core
parent93061dd48fca1b85ddcca611502435c068d0a1d8 (diff)
downloadirssi-f12d3914e580ea1bd4d55d94190e9e59aea14f86.zip
Added -before and -after options to /LASTLOG. You can also use
-<number> to specify both before and after values. Added special "#" option name to commands which specifies that -<number> parameter is allowed. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2331 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/core')
-rw-r--r--src/core/commands.c18
1 files changed, 15 insertions, 3 deletions
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 -<number> 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]) ||