aboutsummaryrefslogtreecommitdiffstats
path: root/util/miscutil.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/miscutil.c')
-rw-r--r--util/miscutil.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/util/miscutil.c b/util/miscutil.c
index 928ec3bc7..05beab0d6 100644
--- a/util/miscutil.c
+++ b/util/miscutil.c
@@ -182,7 +182,7 @@ void
print_string( FILE *fp, const byte *p, size_t n, int delim )
{
for( ; n; n--, p++ )
- if( iscntrl( *p ) || *p == delim ) {
+ if( *p < 0x20 || (*p >= 0x7f && *p < 0xa0) || *p == delim ) {
putc('\\', fp);
if( *p == '\n' )
putc('n', fp);
@@ -239,7 +239,7 @@ make_printable_string( const byte *p, size_t n, int delim )
/* first count length */
for(save_n = n, save_p = p, buflen=1 ; n; n--, p++ ) {
- if( iscntrl( *p ) || *p == delim ) {
+ if( *p < 0x20 || (*p >= 0x7f && *p < 0xa0) || *p == delim ) {
if( *p=='\n' || *p=='\r' || *p=='\f'
|| *p=='\v' || *p=='\b' || !*p )
buflen += 2;
@@ -254,7 +254,7 @@ make_printable_string( const byte *p, size_t n, int delim )
/* and now make the string */
d = buffer = m_alloc( buflen );
for( ; n; n--, p++ ) {
- if( iscntrl( *p ) || *p == delim ) {
+ if( *p < 0x20 || (*p >= 0x7f && *p < 0xa0) || *p == delim ) {
*d++ = '\\';
if( *p == '\n' )
*d++ = 'n';