about summary refs log tree commit diff
path: root/Src/init.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2003-11-14 17:30:07 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2003-11-14 17:30:07 +0000
commit991c83ab343917b904ed7fd47a39e8517e15dcd1 (patch)
tree06dbb4726cfe75ef04878b1145de32c616f2aa84 /Src/init.c
parentf15627d17b8bbf8c6c3623844be509b544d8a9f6 (diff)
downloadzsh-991c83ab343917b904ed7fd47a39e8517e15dcd1.tar.gz
zsh-991c83ab343917b904ed7fd47a39e8517e15dcd1.tar.xz
zsh-991c83ab343917b904ed7fd47a39e8517e15dcd1.zip
19105 shout if interactive without terminal.
19167: BRACE_CCL range with NULL at start.
19168: Sizes using ztrftime were inconsistent.
Ports from main line.
Diffstat (limited to 'Src/init.c')
-rw-r--r--Src/init.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/Src/init.c b/Src/init.c
index 291351b9d..32fd41c9a 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -382,7 +382,13 @@ init_io(void)
 #endif
 
     if (shout) {
-	fclose(shout);
+	/*
+	 * Check if shout was set to stderr, if so don't close it.
+	 * We do this if we are interactive but don't have a
+	 * terminal.
+	 */
+	if (shout != stderr)
+	    fclose(shout);
 	shout = 0;
     }
     if (SHTTY != -1) {
@@ -451,9 +457,9 @@ init_io(void)
 
     /* We will only use zle if shell is interactive, *
      * SHTTY != -1, and shout != 0                   */
-    if (interact && SHTTY != -1) {
+    if (interact) {
 	init_shout();
-	if(!shout)
+	if(!SHTTY || !shout)
 	    opts[USEZLE] = 0;
     } else
 	opts[USEZLE] = 0;
@@ -486,6 +492,14 @@ mod_export void
 init_shout(void)
 {
     static char shoutbuf[BUFSIZ];
+
+    if (SHTTY == -1)
+    {
+	/* Since we're interative, it's nice to have somewhere to write. */
+	shout = stderr;
+	return;
+    }
+
 #if defined(JOB_CONTROL) && defined(TIOCSETD) && defined(NTTYDISC)
     int ldisc = NTTYDISC;