mirror of
https://github.com/zsh-users/zsh
synced 2024-07-21 10:14:19 +00:00
18252: pass ignoreeof as flag to zleread
This commit is contained in:
parent
40c29457f2
commit
4c149a8abc
|
@ -1,5 +1,9 @@
|
|||
2003-02-17 Peter Stephenson <pws@csr.com>
|
||||
|
||||
* 18252: Src/input.c, Src/loop.c, Src/zsh.h, Src/Zle/zle_main.c:
|
||||
pass ignoreeof settings as flag to zle_main.c, only use option
|
||||
in input.c.
|
||||
|
||||
* 18251: Src/parse.c, Src/loop.c: 15030 broke `select' a year
|
||||
and a half ago and no-one noticed till now; also make `select'
|
||||
return on an EOF without complaining.
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue