summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authoranton <anton@cvs.openbsd.org>2017-07-26 19:15:10 +0000
committeranton <anton@cvs.openbsd.org>2017-07-26 19:15:10 +0000
commit0cde587c9d290fa9fb8f712b0c0c779332c320e9 (patch)
treea7e5ec9992987eb029b04a1be3c0ceca5353644c /bin
parent06985a9763a8806457a1ea498f85fb6e15a262a5 (diff)
Postpone printing of prompt if filec is enabled in csh. Any I/O should be
performed first when canonical mode has been disabled on the tty just like ksh does. Discovered by the regress tests. Joint work with bluhm@, ok deraadt@
Diffstat (limited to 'bin')
-rw-r--r--bin/csh/csh.c4
-rw-r--r--bin/csh/file.c4
-rw-r--r--bin/csh/func.c4
3 files changed, 7 insertions, 5 deletions
diff --git a/bin/csh/csh.c b/bin/csh/csh.c
index 08275b83bd7..517f11413b6 100644
--- a/bin/csh/csh.c
+++ b/bin/csh/csh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: csh.c,v 1.39 2016/03/19 15:42:38 krw Exp $ */
+/* $OpenBSD: csh.c,v 1.40 2017/07/26 19:15:09 anton Exp $ */
/* $NetBSD: csh.c,v 1.14 1995/04/29 23:21:28 mycroft Exp $ */
/*-
@@ -1008,7 +1008,7 @@ process(bool catch)
* read fresh stuff. Otherwise, we are rereading input and don't
* need or want to prompt.
*/
- if (aret == F_SEEK && fseekp == feobp)
+ if (!filec && aret == F_SEEK && fseekp == feobp)
printprompt();
(void) fflush(cshout);
}
diff --git a/bin/csh/file.c b/bin/csh/file.c
index 7fb1f95d5cb..dba83e1e0c4 100644
--- a/bin/csh/file.c
+++ b/bin/csh/file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.c,v 1.31 2017/07/18 17:24:42 anton Exp $ */
+/* $OpenBSD: file.c,v 1.32 2017/07/26 19:15:09 anton Exp $ */
/* $NetBSD: file.c,v 1.11 1996/11/08 19:34:37 christos Exp $ */
/*-
@@ -779,6 +779,8 @@ tenex(Char *inputline, int inputline_size)
cl.size = sizeof(buf);
if (tio->c_lflag & ALTWERASE)
cl.flags |= CL_ALTWERASE;
+ cl.flags |= CL_PROMPT;
+ cl_flush(&cl); /* print prompt */
for (;;) {
if ((c = cl_getc(&cl)) == 0)
diff --git a/bin/csh/func.c b/bin/csh/func.c
index 978cf0652ae..4ce579d09a6 100644
--- a/bin/csh/func.c
+++ b/bin/csh/func.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: func.c,v 1.33 2016/08/14 19:46:31 guenther Exp $ */
+/* $OpenBSD: func.c,v 1.34 2017/07/26 19:15:09 anton Exp $ */
/* $NetBSD: func.c,v 1.11 1996/02/09 02:28:29 christos Exp $ */
/*-
@@ -589,7 +589,7 @@ search(int type, int level, Char *goal)
bseek(&a);
}
do {
- if (intty && fseekp == feobp && aret == F_SEEK)
+ if (intty && !filec && fseekp == feobp && aret == F_SEEK)
(void) fprintf(cshout, "? "), (void) fflush(cshout);
aword[0] = 0;
(void) getword(aword);