summaryrefslogtreecommitdiff
path: root/bin/ed
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1997-07-08 17:36:44 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1997-07-08 17:36:44 +0000
commit1121eeafd9a61b3fd90917fc23cd1299dc437a78 (patch)
tree82296b834c564c5df19408cd16e225bd855a0520 /bin/ed
parentd63a5f8ef76b24c738525f9694418531d26407f3 (diff)
Use line-buffered output if no tty is present. Makes ed work
correctly when there is no tty. Close PR#281
Diffstat (limited to 'bin/ed')
-rw-r--r--bin/ed/main.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/bin/ed/main.c b/bin/ed/main.c
index 34d69311131..b5a600b5a0c 100644
--- a/bin/ed/main.c
+++ b/bin/ed/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.6 1997/01/15 23:40:23 millert Exp $ */
+/* $OpenBSD: main.c,v 1.7 1997/07/08 17:36:43 millert Exp $ */
/* $NetBSD: main.c,v 1.3 1995/03/21 09:04:44 cgd Exp $ */
/* main.c: This file contains the main control and user-interface routines
@@ -39,7 +39,7 @@ char *copyright =
#if 0
static char *rcsid = "@(#)main.c,v 1.1 1994/02/01 00:34:42 alm Exp";
#else
-static char rcsid[] = "$OpenBSD: main.c,v 1.6 1997/01/15 23:40:23 millert Exp $";
+static char rcsid[] = "$OpenBSD: main.c,v 1.7 1997/07/08 17:36:43 millert Exp $";
#endif
#endif /* not lint */
@@ -154,6 +154,8 @@ top:
handle_winch(SIGWINCH);
if (isatty(0)) signal(SIGWINCH, handle_winch);
#endif
+ if (!isatty(0))
+ setlinebuf(stdout);
signal(SIGHUP, signal_hup);
signal(SIGQUIT, SIG_IGN);
signal(SIGINT, signal_int);