Index | Thread | Search

From:
Theo Buehler <tb@theobuehler.org>
Subject:
007 in vis.c
To:
tech@openbsd.org
Date:
Mon, 4 Aug 2025 08:41:10 +0200

Download raw body.

Thread
  • Theo Buehler:

    007 in vis.c

I'm not sure if there's a particular reason to treat the BEL character
specially here. The \a escape has been available forever. It's in K&R.
I think it's clearer, cleaner, and more consistent to use that. 

I'd also be inclined to switch the order of \b and \a, but that results
in a change of the binary.

Index: gen/vis.c
===================================================================
RCS file: /cvs/src/lib/libc/gen/vis.c,v
diff -u -p -r1.26 vis.c
--- gen/vis.c	4 May 2022 18:57:50 -0000	1.26
+++ gen/vis.c	28 Jun 2025 12:16:20 -0000
@@ -66,7 +66,7 @@ isvisible(int c, int flag)
 			return 1;
 		if (!vis_nl && c == '\n')
 			return 1;
-		if (vis_safe && (c == '\b' || c == '\007' || c == '\r' || isgraph(uc)))
+		if (vis_safe && (c == '\b' || c == '\a' || c == '\r' || isgraph(uc)))
 			return 1;
 	}
 	return 0;