1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-10 06:47:55 -08:00

Treat backspace as printable in sanitize() for non-UTF8 locales.

Fixes printing of fortunes that use a combination of backspace and
underbars for underlining in non-UTF8 locales.  OK schwarze@
This commit is contained in:
millert 2017-08-10 17:00:08 +00:00
parent abd78d7bbb
commit 3872154d62

View File

@ -1,4 +1,4 @@
/* $OpenBSD: fortune.c,v 1.59 2017/07/12 11:36:22 schwarze Exp $ */
/* $OpenBSD: fortune.c,v 1.60 2017/08/10 17:00:08 millert Exp $ */
/* $NetBSD: fortune.c,v 1.8 1995/03/23 08:28:40 cgd Exp $ */
/*-
@ -201,7 +201,7 @@ sanitize(unsigned char *cp)
if (MB_CUR_MAX > 1)
return;
for (; *cp != '\0'; cp++)
if (!isprint(*cp) && !isspace(*cp))
if (!isprint(*cp) && !isspace(*cp) && *cp != '\b')
*cp = '?';
}