Add some casts to u_char to get vis working again for characters > 0177

in VIS_OCTAL mode. Also, change the mask for the most significant tribble
to 03.

Reviewed by christos.

Fixes PR 8802.
This commit is contained in:
wennmach 1999-11-17 15:52:13 +00:00
parent eac5784583
commit 2d27a472c9

View File

@ -1,4 +1,4 @@
/* $NetBSD: vis.c,v 1.13 1999/09/20 04:39:07 lukem Exp $ */
/* $NetBSD: vis.c,v 1.14 1999/11/17 15:52:13 wennmach Exp $ */
/*-
* Copyright (c) 1989, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)vis.c 8.1 (Berkeley) 7/19/93";
#else
__RCSID("$NetBSD: vis.c,v 1.13 1999/09/20 04:39:07 lukem Exp $");
__RCSID("$NetBSD: vis.c,v 1.14 1999/11/17 15:52:13 wennmach Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -133,8 +133,8 @@ vis(dst, c, flag, nextc)
}
if (((c & 0177) == ' ') || (flag & VIS_OCTAL)) {
*dst++ = '\\';
*dst++ = ((((u_int32_t)c) >> 6) & 07) + '0';
*dst++ = ((((u_int32_t)c) >> 3) & 07) + '0';
*dst++ = (u_char)((((u_int32_t)(u_char)c) >> 6) & 03) + '0';
*dst++ = (u_char)((((u_int32_t)(u_char)c) >> 3) & 07) + '0';
*dst++ = (((u_char)c) & 07) + '0';
goto done;
}