diff options
| author | Peter Stephenson <pws@users.sourceforge.net> | 2008-09-29 15:18:49 +0000 |
|---|---|---|
| committer | Peter Stephenson <pws@users.sourceforge.net> | 2008-09-29 15:18:49 +0000 |
| commit | 28cf4041b4ed58ba2ae9860f9dfc138edcdbb34b (patch) | |
| tree | 947534d0f5584a5c8ea2f92cd6ff92179ebb8b89 | |
| parent | users/13295, tweaked: dont reset line numbers when parsing strings, sometimes (diff) | |
| download | zsh-28cf4041b4ed58ba2ae9860f9dfc138edcdbb34b.tar zsh-28cf4041b4ed58ba2ae9860f9dfc138edcdbb34b.tar.gz zsh-28cf4041b4ed58ba2ae9860f9dfc138edcdbb34b.tar.bz2 zsh-28cf4041b4ed58ba2ae9860f9dfc138edcdbb34b.tar.lz zsh-28cf4041b4ed58ba2ae9860f9dfc138edcdbb34b.tar.xz zsh-28cf4041b4ed58ba2ae9860f9dfc138edcdbb34b.tar.zst zsh-28cf4041b4ed58ba2ae9860f9dfc138edcdbb34b.zip | |
25771: shell function context for substitution functions
| -rw-r--r-- | ChangeLog | 3 | ||||
| -rw-r--r-- | Src/utils.c | 13 | ||||
| -rw-r--r-- | Src/zsh.h | 1 |
3 files changed, 15 insertions, 2 deletions
@@ -1,5 +1,8 @@ 2008-09-29 Peter Stephenson <pws@csr.com> + * 25771: Src/utils.c, Src/zsh.h: shell function context + for substitution functions. + * users/13295 (with tweak always to keep old line numbers at exit from parse_string()): Src/builtin.c, Src/exec.c, Src/glob.c, Src/parse.c, Src/Modules/parameter.c, Src/Modules/zpty.c, diff --git a/Src/utils.c b/Src/utils.c index fadf46470..5518a16c7 100644 --- a/Src/utils.c +++ b/Src/utils.c @@ -2935,14 +2935,23 @@ getshfunc(char *nam) char ** subst_string_by_func(Shfunc func, char *arg1, char *orig) { + int osc = sfcontext; LinkList l = newlinklist(); + char **ret; + addlinknode(l, func->node.nam); if (arg1) addlinknode(l, arg1); addlinknode(l, orig); + sfcontext = SFC_SUBST; + if (doshfunc(func, l, 1)) - return NULL; - return getaparam("reply"); + ret = NULL; + else + ret = getaparam("reply"); + + sfcontext = osc; + return ret; } /**/ @@ -1076,6 +1076,7 @@ struct shfunc { #define SFC_WIDGET 4 /* user defined widget */ #define SFC_COMPLETE 5 /* called from completion code */ #define SFC_CWIDGET 6 /* new style completion widget */ +#define SFC_SUBST 7 /* used to perform substitution task */ /* tp in funcstack */ |
