Source-Changes-HG archive

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

[src/trunk]: src/lib/libc/gen Don't encode any characters in VIS_CSTYLE that ...



details:   https://anonhg.NetBSD.org/src/rev/def0dfd2bda4
branches:  trunk
changeset: 332525:def0dfd2bda4
user:      roy <roy%NetBSD.org@localhost>
date:      Fri Sep 26 13:48:00 2014 +0000

description:
Don't encode any characters in VIS_CSTYLE that have a special meaning
in unvis(3), such as n r b, etc.

diffstat:

 lib/libc/gen/vis.c |  20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diffs (42 lines):

diff -r ccb49872d1e1 -r def0dfd2bda4 lib/libc/gen/vis.c
--- a/lib/libc/gen/vis.c        Fri Sep 26 13:03:22 2014 +0000
+++ b/lib/libc/gen/vis.c        Fri Sep 26 13:48:00 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vis.c,v 1.64 2014/09/26 05:01:44 christos Exp $        */
+/*     $NetBSD: vis.c,v 1.65 2014/09/26 13:48:00 roy Exp $     */
 
 /*-
  * Copyright (c) 1989, 1993
@@ -57,7 +57,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: vis.c,v 1.64 2014/09/26 05:01:44 christos Exp $");
+__RCSID("$NetBSD: vis.c,v 1.65 2014/09/26 13:48:00 roy Exp $");
 #endif /* LIBC_SCCS and not lint */
 #ifdef __FBSDID
 __FBSDID("$FreeBSD$");
@@ -216,8 +216,22 @@
                                *dst++ = L'0';
                        }
                        return dst;
+               /* We cannot encode these characters in VIS_CSTYLE
+                * because they special meaning */
+               case L'n':
+               case L'r':
+               case L'b':
+               case L'a':
+               case L'v':
+               case L't':
+               case L'f':
+               case L's':
+               case L'0':
+               case L'M':
+               case L'^':
+                       break;
                default:
-                       if (iswgraph(c)) {
+                       if (iswgraph(c) && !iswoctal(c)) {
                                *dst++ = L'\\';
                                *dst++ = c;
                                return dst;



Home | Main Index | Thread Index | Old Index