From 6f84e2e25752aa1b1913a6ba80b24d1aa0b6858e Mon Sep 17 00:00:00 2001 From: christos Date: Sun, 23 Apr 2017 01:58:48 +0000 Subject: [PATCH] Add VIS_DQ (for OpenBSD compat) --- lib/libc/gen/vis.3 | 6 ++++-- lib/libc/gen/vis.c | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/libc/gen/vis.3 b/lib/libc/gen/vis.3 index bde9c00f08e4..2e62dc010570 100644 --- a/lib/libc/gen/vis.3 +++ b/lib/libc/gen/vis.3 @@ -1,4 +1,4 @@ -.\" $NetBSD: vis.3,v 1.45 2016/06/08 15:00:04 wiz Exp $ +.\" $NetBSD: vis.3,v 1.46 2017/04/23 01:58:48 christos Exp $ .\" .\" Copyright (c) 1989, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" @(#)vis.3 8.1 (Berkeley) 6/9/93 .\" -.Dd January 14, 2015 +.Dd April 22, 2017 .Dt VIS 3 .Os .Sh NAME @@ -242,6 +242,8 @@ except space, tab, and newline are encoded (see The following flags alter this: .Bl -tag -width VIS_WHITEX +.It Dv VIS_DW +Also encode double quotes .It Dv VIS_GLOB Also encode the magic characters .Ql ( * , diff --git a/lib/libc/gen/vis.c b/lib/libc/gen/vis.c index 1d9f2c30843d..17418a25925d 100644 --- a/lib/libc/gen/vis.c +++ b/lib/libc/gen/vis.c @@ -1,4 +1,4 @@ -/* $NetBSD: vis.c,v 1.72 2017/02/12 22:37:49 christos Exp $ */ +/* $NetBSD: vis.c,v 1.73 2017/04/23 01:58:48 christos Exp $ */ /*- * Copyright (c) 1989, 1993 @@ -57,7 +57,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: vis.c,v 1.72 2017/02/12 22:37:49 christos Exp $"); +__RCSID("$NetBSD: vis.c,v 1.73 2017/04/23 01:58:48 christos Exp $"); #endif /* LIBC_SCCS and not lint */ #ifdef __FBSDID __FBSDID("$FreeBSD$"); @@ -377,6 +377,7 @@ makeextralist(int flags, const char *src) if (flags & VIS_SP) *d++ = L' '; if (flags & VIS_TAB) *d++ = L'\t'; if (flags & VIS_NL) *d++ = L'\n'; + if (flags & VIS_DQ) *d++ = L'"'; if ((flags & VIS_NOSLASH) == 0) *d++ = L'\\'; *d = L'\0';