Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/sh Eat trailing backslash like bash and pdksh (not zsh)....



details:   https://anonhg.NetBSD.org/src/rev/076757a949ff
branches:  trunk
changeset: 802031:076757a949ff
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Aug 29 09:26:39 2014 +0000

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

diffstat:

 bin/sh/parser.c |  13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diffs (41 lines):

diff -r 826a8e98cf2a -r 076757a949ff bin/sh/parser.c
--- a/bin/sh/parser.c   Fri Aug 29 07:29:07 2014 +0000
+++ b/bin/sh/parser.c   Fri Aug 29 09:26:39 2014 +0000
@@ -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 @@
                        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++;



Home | Main Index | Thread Index | Old Index