diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2003-02-17 14:06:39 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2003-02-17 14:06:39 +0000 |
commit | 4c149a8abc198d38008c9f5b4eeb80a9c73a0722 (patch) | |
tree | 07b81bcf865c9f735de02415a86491b039a2e860 /Src | |
parent | 40c29457f285deaba4959dd23d5f2dd859ddb956 (diff) | |
download | zsh-4c149a8abc198d38008c9f5b4eeb80a9c73a0722.tar.gz zsh-4c149a8abc198d38008c9f5b4eeb80a9c73a0722.tar.xz zsh-4c149a8abc198d38008c9f5b4eeb80a9c73a0722.zip |
18252: pass ignoreeof as flag to zleread
Diffstat (limited to 'Src')
-rw-r--r-- | Src/Zle/zle_main.c | 12 | ||||
-rw-r--r-- | Src/input.c | 6 | ||||
-rw-r--r-- | Src/loop.c | 4 | ||||
-rw-r--r-- | Src/zsh.h | 1 |
4 files changed, 11 insertions, 12 deletions
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c index d73d63eed..a8c97ba1b 100644 --- a/Src/Zle/zle_main.c +++ b/Src/Zle/zle_main.c @@ -616,7 +616,7 @@ getkey(int keytmout) an infinite loop. The simple way around this was to add the counter (icnt) so that this happens 20 times and than the shell gives up (yes, this is a bit dirty...). */ - if (isset(IGNOREEOF) && icnt++ < 20) + if ((zlereadflags & ZLRF_IGNOREEOF) && icnt++ < 20) continue; stopmsg = 1; zexit(1, 0); @@ -681,7 +681,8 @@ zlecore(void) reselectkeymap(); selectlocalmap(NULL); bindk = getkeycmd(); - if (!ll && isfirstln && unset(IGNOREEOF) && c == eofchar) { + if (!ll && isfirstln && !(zlereadflags & ZLRF_IGNOREEOF) && + c == eofchar) { eofsent = 1; break; } @@ -865,7 +866,7 @@ execzlefunc(Thingy func, char **args) int wflags = w->flags; if (keybuf[0] == eofchar && !keybuf[1] && - !ll && isfirstln && isset(IGNOREEOF)) { + !ll && isfirstln && (zlereadflags & ZLRF_IGNOREEOF)) { showmsg((!islogin) ? "zsh: use 'exit' to exit." : "zsh: use 'logout' to logout."); ret = 1; @@ -986,7 +987,7 @@ bin_vared(char *name, char **args, Options ops, int func) struct value vbuf; Value v; Param pm = 0; - int create = 0, ifl, ieof; + int create = 0, ifl; int type = PM_SCALAR, obreaks = breaks, haso = 0; char *p1 = NULL, *p2 = NULL; FILE *oshout = NULL; @@ -1145,10 +1146,7 @@ bin_vared(char *name, char **args, Options ops, int func) if (OPT_ISSET(ops,'h')) hbegin(2); isfirstln = OPT_ISSET(ops,'e'); - ieof = opts[IGNOREEOF]; - opts[IGNOREEOF] = 0; t = (char *) zleread(p1, p2, OPT_ISSET(ops,'h') ? ZLRF_HISTORY : 0); - opts[IGNOREEOF] = ieof; if (OPT_ISSET(ops,'h')) hend(NULL); isfirstln = ifl; diff --git a/Src/input.c b/Src/input.c index a95dac52c..e712ad19a 100644 --- a/Src/input.c +++ b/Src/input.c @@ -269,8 +269,10 @@ inputline(void) * typeahead when the terminal settings are altered. * pws 1998/03/12 */ - ingetcline = (char *)zleread(ingetcpmptl, ingetcpmptr, - ZLRF_HISTORY|ZLRF_NOSETTY); + int flags = ZLRF_HISTORY|ZLRF_NOSETTY; + if (isset(IGNOREEOF)) + flags |= ZLRF_IGNOREEOF; + ingetcline = (char *)zleread(ingetcpmptl, ingetcpmptr, flags); histdone |= HISTFLAG_SETTY; } if (!ingetcline) { diff --git a/Src/loop.c b/Src/loop.c index ebb07445b..4da5a50f0 100644 --- a/Src/loop.c +++ b/Src/loop.c @@ -202,7 +202,7 @@ execselect(Estate state, int do_exec) wordcode code = state->pc[-1]; char *str, *s, *name; LinkNode n; - int i, usezle, oignoreeof = opts[IGNOREEOF]; + int i, usezle; FILE *inp; size_t more; LinkList args; @@ -238,7 +238,6 @@ execselect(Estate state, int do_exec) inp = fdopen(dup(usezle ? SHTTY : 0), "r"); more = selectlist(args, 0); loop = state->pc; - opts[IGNOREEOF] = 0; for (;;) { for (;;) { if (empty(bufstack)) { @@ -302,7 +301,6 @@ execselect(Estate state, int do_exec) fclose(inp); loops--; state->pc = end; - opts[IGNOREEOF] = oignoreeof; return lastval; } diff --git a/Src/zsh.h b/Src/zsh.h index 9d402b242..aa2c11fe3 100644 --- a/Src/zsh.h +++ b/Src/zsh.h @@ -1747,6 +1747,7 @@ struct heap { #define ZLRF_HISTORY 0x01 /* OK to access the history list */ #define ZLRF_NOSETTY 0x02 /* Don't set tty before return */ +#define ZLRF_IGNOREEOF 0x04 /* Ignore an EOF from the keyboard */ /****************/ /* Entry points */ |