aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/ChangeLog5
-rw-r--r--util/miscutil.c6
2 files changed, 8 insertions, 3 deletions
diff --git a/util/ChangeLog b/util/ChangeLog
index 7097e9125..76a7ced53 100644
--- a/util/ChangeLog
+++ b/util/ChangeLog
@@ -1,3 +1,8 @@
+2001-09-17 Werner Koch <[email protected]>
+
+ * miscutil.c (print_string): Use explicit ranges and not iscntrl().
+ (make_printable_string): Ditto.
+
2001-09-07 Werner Koch <[email protected]>
* strgutil.c (strsep): New, taken from glibc 2.2.1.
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';