diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/special-vars.c | 5 | ||||
-rw-r--r-- | src/core/special-vars.h | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/core/special-vars.c b/src/core/special-vars.c index 45bad34d..c1523319 100644 --- a/src/core/special-vars.c +++ b/src/core/special-vars.c @@ -202,6 +202,11 @@ static char *get_special_value(char **cmd, SERVER_REC *server, void *item, char command, *value, *p; int len; + if ((flags & PARSE_FLAG_ONLY_PARAMS) && !isdigit(**cmd)) { + *free_ret = TRUE; + return g_strdup_printf("$%c", **cmd); + } + if (**cmd == '!') { /* find text from command history */ if (flags & PARSE_FLAG_GETNAME) diff --git a/src/core/special-vars.h b/src/core/special-vars.h index 45b41f52..d5ba0700 100644 --- a/src/core/special-vars.h +++ b/src/core/special-vars.h @@ -7,6 +7,7 @@ #define PARSE_FLAG_ISSET_ANY 0x02 /* arg_used field specifies that at least one of the $variables was non-empty */ #define PARSE_FLAG_ESCAPE_VARS 0x04 /* if any arguments/variables contain % chars, escape them with another % */ #define PARSE_FLAG_ESCAPE_THEME 0x08 /* if any arguments/variables contain { or } chars, escape them with % */ +#define PARSE_FLAG_ONLY_PARAMS 0x10 /* expand only arguments ($0 $1 etc.) but no other $variables */ typedef char* (*SPECIAL_HISTORY_FUNC) (const char *text, void *item, int *free_ret); |