Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/indent indent: use proper escape sequence for form feed



details:   https://anonhg.NetBSD.org/src/rev/a15cc3ddeadf
branches:  trunk
changeset: 1023953:a15cc3ddeadf
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Oct 05 06:15:24 2021 +0000

description:
indent: use proper escape sequence for form feed

This escape sequence has been available since at least 1978.

diffstat:

 usr.bin/indent/io.c         |  6 +++---
 usr.bin/indent/lexi.c       |  6 +++---
 usr.bin/indent/pr_comment.c |  8 ++++----
 3 files changed, 10 insertions(+), 10 deletions(-)

diffs (90 lines):

diff -r 0a87019b7f38 -r a15cc3ddeadf usr.bin/indent/io.c
--- a/usr.bin/indent/io.c       Tue Oct 05 06:09:42 2021 +0000
+++ b/usr.bin/indent/io.c       Tue Oct 05 06:15:24 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: io.c,v 1.69 2021/10/05 06:09:42 rillig Exp $   */
+/*     $NetBSD: io.c,v 1.70 2021/10/05 06:15:24 rillig Exp $   */
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: io.c,v 1.69 2021/10/05 06:09:42 rillig Exp $");
+__RCSID("$NetBSD: io.c,v 1.70 2021/10/05 06:15:24 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/io.c 334927 2018-06-10 16:44:18Z pstef $");
 #endif
@@ -240,7 +240,7 @@
            ps.stats.comment_lines++;
        }
        if (ps.use_ff)
-           output_char('\014');
+           output_char('\f');
        else
            output_char('\n');
        ps.stats.lines++;
diff -r 0a87019b7f38 -r a15cc3ddeadf usr.bin/indent/lexi.c
--- a/usr.bin/indent/lexi.c     Tue Oct 05 06:09:42 2021 +0000
+++ b/usr.bin/indent/lexi.c     Tue Oct 05 06:15:24 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lexi.c,v 1.68 2021/10/05 06:09:42 rillig Exp $ */
+/*     $NetBSD: lexi.c,v 1.69 2021/10/05 06:15:24 rillig Exp $ */
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: lexi.c,v 1.68 2021/10/05 06:09:42 rillig Exp $");
+__RCSID("$NetBSD: lexi.c,v 1.69 2021/10/05 06:15:24 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/lexi.c 337862 2018-08-15 18:19:45Z pstef $");
 #endif
@@ -538,7 +538,7 @@
        ttype = rbrace;
        break;
 
-    case 014:                  /* a form feed */
+    case '\f':
        unary_delim = state->last_u_d;
        state->last_nl = true;  /* remember this so we can set 'state->col_1'
                                 * right */
diff -r 0a87019b7f38 -r a15cc3ddeadf usr.bin/indent/pr_comment.c
--- a/usr.bin/indent/pr_comment.c       Tue Oct 05 06:09:42 2021 +0000
+++ b/usr.bin/indent/pr_comment.c       Tue Oct 05 06:15:24 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pr_comment.c,v 1.50 2021/10/05 06:09:42 rillig Exp $   */
+/*     $NetBSD: pr_comment.c,v 1.51 2021/10/05 06:15:24 rillig Exp $   */
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: pr_comment.c,v 1.50 2021/10/05 06:09:42 rillig Exp $");
+__RCSID("$NetBSD: pr_comment.c,v 1.51 2021/10/05 06:15:24 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/pr_comment.c 334927 2018-06-10 16:44:18Z pstef $");
 #endif
@@ -207,7 +207,7 @@
     for (;;) {                 /* this loop will go until the comment is
                                 * copied */
        switch (*buf_ptr) {     /* this checks for various special cases */
-       case 014:               /* check for a form feed */
+       case '\f':
            check_size_comment(3);
            if (!ps.box_com) {  /* in a text comment, break the line here */
                ps.use_ff = true;
@@ -221,7 +221,7 @@
                    buf_ptr++;
            } else {
                inbuf_skip();
-               *com.e++ = 014;
+               *com.e++ = '\f';
            }
            break;
 



Home | Main Index | Thread Index | Old Index