diff options
author | Tanaka Akira <akr@users.sourceforge.net> | 1999-11-08 19:41:18 +0000 |
---|---|---|
committer | Tanaka Akira <akr@users.sourceforge.net> | 1999-11-08 19:41:18 +0000 |
commit | 2cad2e5463e35469192d374cfd8d589e4b90fbb5 (patch) | |
tree | 8587ba41765154d031470dede3ea1be288278bea | |
parent | dd00cca82ef4a43c54edb0e14b6bc9dba3fbff46 (diff) | |
download | zsh-2cad2e5463e35469192d374cfd8d589e4b90fbb5.tar.gz zsh-2cad2e5463e35469192d374cfd8d589e4b90fbb5.tar.xz zsh-2cad2e5463e35469192d374cfd8d589e4b90fbb5.zip |
zsh-workers/8591
-rw-r--r-- | Src/Zle/zle_main.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c index f29da3e0e..42b4e21e4 100644 --- a/Src/Zle/zle_main.c +++ b/Src/Zle/zle_main.c @@ -734,8 +734,9 @@ bin_vared(char *name, char **args, char *ops, int func) Value v; Param pm = 0; int create = 0; - int type = PM_SCALAR, obreaks = breaks; + int type = PM_SCALAR, obreaks = breaks, haso = 0; char *p1 = NULL, *p2 = NULL; + FILE *oshout; if (zleactive) { zwarnnam(name, "ZLE cannot be used recursively (yet)", NULL, 0); @@ -816,6 +817,17 @@ bin_vared(char *name, char **args, char *ops, int func) return 1; } + if (SHTTY == -1) { + /* need to open /dev/tty specially */ + if ((SHTTY = open("/dev/tty", O_RDWR|O_NOCTTY)) == -1) { + zerrnam(name, "can't access terminal", NULL, 0); + return 1; + } + oshout = shout; + init_shout(); + + haso = 1; + } /* edit the parameter value */ PERMALLOC { pushnode(bufstack, ztrdup(s)); @@ -823,6 +835,12 @@ bin_vared(char *name, char **args, char *ops, int func) varedarg = *args; t = (char *) zleread(p1, p2, ops['h'] ? ZLRF_HISTORY : 0); varedarg = ova; + if (haso) { + close(SHTTY); + fclose(shout); + shout = oshout; + SHTTY = -1; + } if (!t || errflag) { /* error in editing */ errflag = 0; |