about summary refs log tree commit diff
path: root/Src/input.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/input.c')
-rw-r--r--Src/input.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/Src/input.c b/Src/input.c
index 248d2ae71..0e802da62 100644
--- a/Src/input.c
+++ b/Src/input.c
@@ -195,21 +195,24 @@ ingetc(void)
 	    return lastc;
 	}
 
-	/* If the next element down the input stack is a continuation of
-	 * this, use it.
-	 */ 
-	if (inbufflags & INP_CONT) {
-	    inpoptop();
-	    continue;
-	}
 	/*
-	 * Otherwise, see if we have reached the end of input
+	 * See if we have reached the end of input
 	 * (due to an error, or to reading from a single string).
+	 * Check the remaining characters left, since if there aren't
+	 * any we don't want to pop the stack---it'll mark any aliases
+	 * as not in use before we've finished processing.
 	 */
-	if (strin || errflag) {
+	if (!inbufct && (strin || errflag)) {
 	    lexstop = 1;
 	    return ' ';
 	}
+	/* If the next element down the input stack is a continuation of
+	 * this, use it.
+	 */
+	if (inbufflags & INP_CONT) {
+	    inpoptop();
+	    continue;
+	}
 	/* As a last resort, get some more input */
 	if (inputline())
 	    return ' ';