mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
/LAST - didn't work right.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@612 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
2de5b40ac5
commit
2e3a056110
@ -361,7 +361,6 @@ static int option_find(char **array, const char *option)
|
||||
g_return_val_if_fail(option != NULL, -1);
|
||||
|
||||
len = strlen(option);
|
||||
g_return_val_if_fail(len > 0, -1);
|
||||
|
||||
found = -1; index = 0; multiple = FALSE;
|
||||
for (tmp = array; *tmp != NULL; tmp++, index++) {
|
||||
@ -411,7 +410,7 @@ static int get_cmd_options(char **data, int ignore_unknown,
|
||||
}
|
||||
|
||||
(*data)++;
|
||||
if (**data == '-') {
|
||||
if (**data == '-' && isspace((*data)[1])) {
|
||||
/* -- option means end of options even
|
||||
if next word starts with - */
|
||||
(*data)++;
|
||||
@ -419,7 +418,12 @@ static int get_cmd_options(char **data, int ignore_unknown,
|
||||
break;
|
||||
}
|
||||
|
||||
option = cmd_get_param(data);
|
||||
if (!isspace(**data))
|
||||
option = cmd_get_param(data);
|
||||
else {
|
||||
option = "-";
|
||||
(*data)++;
|
||||
}
|
||||
|
||||
/* check if this option can have argument */
|
||||
pos = optlist == NULL ? -1 :
|
||||
@ -443,7 +447,8 @@ static int get_cmd_options(char **data, int ignore_unknown,
|
||||
if (options != NULL)
|
||||
g_hash_table_insert(options, option, "");
|
||||
|
||||
if (pos == -1 || !iscmdtype(*optlist[pos]))
|
||||
if (pos < 0 || !iscmdtype(*optlist[pos]) ||
|
||||
*optlist[pos] == '!')
|
||||
option = NULL;
|
||||
|
||||
while (isspace(**data)) (*data)++;
|
||||
|
@ -68,6 +68,7 @@ int command_have_sub(const char *command);
|
||||
options separated with space, each option can contain a special
|
||||
char in front of it:
|
||||
|
||||
'!': no argument (default)
|
||||
'-': optional argument
|
||||
'+': argument required
|
||||
'@': optional numeric argument
|
||||
@ -79,7 +80,7 @@ int command_have_sub(const char *command);
|
||||
will be merged. If there's any conflicts with option types, the last
|
||||
call will override the previous */
|
||||
#define iscmdtype(c) \
|
||||
((c) == '-' || (c) == '+' || (c) == '@')
|
||||
((c) == '!' || (c) == '-' || (c) == '+' || (c) == '@')
|
||||
void command_set_options(const char *cmd, const char *options);
|
||||
|
||||
/* Returns TRUE if command has specified option. */
|
||||
|
@ -431,7 +431,7 @@ void gui_textwidget_init(void)
|
||||
command_bind("scrollback goto", NULL, (SIGNAL_FUNC) cmd_scrollback_goto);
|
||||
command_bind("scrollback home", NULL, (SIGNAL_FUNC) cmd_scrollback_home);
|
||||
command_bind("scrollback end", NULL, (SIGNAL_FUNC) cmd_scrollback_end);
|
||||
command_set_options("lastlog", "new away word regexp");
|
||||
command_set_options("lastlog", "!- new away word regexp");
|
||||
|
||||
signal_add("away mode changed", (SIGNAL_FUNC) sig_away_changed);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user