Source-Changes-HG archive

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

[src/trunk]: src/bin/sh Redo 1.65 in a simpler way. This is the bit rot avo...



details:   https://anonhg.NetBSD.org/src/rev/02e5d0ef2607
branches:  trunk
changeset: 838410:02e5d0ef2607
user:      kre <kre%NetBSD.org@localhost>
date:      Wed Jan 16 07:14:17 2019 +0000

description:
Redo 1.65 in a simpler way.   This is the bit rot avoidance code
that is #if 0'd and (still) has never been compiled (most likely
never will be.)

While here, in the same uncompiled code, deal with line number
counting.   Whether this is correct depends upon how this code
is used, and as it never is (and never has been since line numbers
first started being counted), this is somewhat speculative, but
it seems likely to be the correct way to handle things.

NFC (this code is still all #if 0).

diffstat:

 bin/sh/input.c |  16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diffs (43 lines):

diff -r 0479e2f5d2eb -r 02e5d0ef2607 bin/sh/input.c
--- a/bin/sh/input.c    Wed Jan 16 05:19:30 2019 +0000
+++ b/bin/sh/input.c    Wed Jan 16 07:14:17 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: input.c,v 1.68 2019/01/15 14:23:56 kre Exp $   */
+/*     $NetBSD: input.c,v 1.69 2019/01/16 07:14:17 kre Exp $   */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)input.c    8.3 (Berkeley) 6/9/95";
 #else
-__RCSID("$NetBSD: input.c,v 1.68 2019/01/15 14:23:56 kre Exp $");
+__RCSID("$NetBSD: input.c,v 1.69 2019/01/16 07:14:17 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -145,18 +145,18 @@
 
        while (--nleft > 0) {
                c = pgetc_macro();
+               if (c == PFAKE)         /* consecutive PFAKEs is impossible */
+                       c = pgetc_macro();
                if (c == PEOF) {
                        if (p == line)
                                return NULL;
                        break;
                }
-               if (c == PFAKE) {
-                       ++nleft;
-                       continue;
+               *p++ = c;
+               if (c == '\n') {
+                       plinno++;
+                       break;
                }
-               *p++ = c;
-               if (c == '\n')
-                       break;
        }
        *p = '\0';
        return line;



Home | Main Index | Thread Index | Old Index