Module Name:    src
Committed By:   christos
Date:           Fri Aug 29 09:26:39 UTC 2014

Modified Files:
        src/bin/sh: parser.c

Log Message:
Eat trailing backslash like bash and pdksh (not zsh). CBACK+CEOF = TEOF


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/bin/sh/parser.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/sh/parser.c
diff -u src/bin/sh/parser.c:1.91 src/bin/sh/parser.c:1.92
--- src/bin/sh/parser.c:1.91	Tue Aug 19 08:36:58 2014
+++ src/bin/sh/parser.c	Fri Aug 29 05:26:39 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: parser.c,v 1.91 2014/08/19 12:36:58 christos Exp $	*/
+/*	$NetBSD: parser.c,v 1.92 2014/08/29 09:26:39 christos Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)parser.c	8.7 (Berkeley) 5/16/95";
 #else
-__RCSID("$NetBSD: parser.c,v 1.91 2014/08/19 12:36:58 christos Exp $");
+__RCSID("$NetBSD: parser.c,v 1.92 2014/08/29 09:26:39 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -839,15 +839,20 @@ xxreadtoken(void)
 			pungetc();
 			continue;
 		case '\\':
-			if (pgetc() == '\n') {
+			switch (c = pgetc()) {
+			case '\n':
 				startlinno = ++plinno;
 				if (doprompt)
 					setprompt(2);
 				else
 					setprompt(0);
 				continue;
+			case PEOF:
+				RETURN(TEOF);
+			default:
+				pungetc();
+				break;
 			}
-			pungetc();
 			goto breakloop;
 		case '\n':
 			plinno++;

Reply via email to