aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/ChangeLog6
-rw-r--r--util/miscutil.c9
-rw-r--r--util/strgutil.c3
3 files changed, 14 insertions, 4 deletions
diff --git a/util/ChangeLog b/util/ChangeLog
index 375002a85..f6040ef5c 100644
--- a/util/ChangeLog
+++ b/util/ChangeLog
@@ -1,3 +1,9 @@
+2002-03-29 David Shaw <[email protected]>
+
+ * strgutil.c (print_string, utf8_to_native): If a delimiter is
+ used, then quote the backslash character as well. Problem noted
+ by Rainer Perske.
+
2002-02-28 Timo Schulz <[email protected]>
* http.c (write_server): Convert integer to a HANDLE for W32.
diff --git a/util/miscutil.c b/util/miscutil.c
index 3bff721c1..d6a10cb19 100644
--- a/util/miscutil.c
+++ b/util/miscutil.c
@@ -182,7 +182,8 @@ void
print_string( FILE *fp, const byte *p, size_t n, int delim )
{
for( ; n; n--, p++ )
- if( *p < 0x20 || (*p >= 0x7f && *p < 0xa0) || *p == delim ) {
+ if( *p < 0x20 || (*p >= 0x7f && *p < 0xa0) || *p == delim ||
+ (delim && *p=='\\')) {
putc('\\', fp);
if( *p == '\n' )
putc('n', fp);
@@ -246,7 +247,8 @@ 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( *p < 0x20 || (*p >= 0x7f && *p < 0xa0) || *p == delim ) {
+ if( *p < 0x20 || (*p >= 0x7f && *p < 0xa0) || *p == delim ||
+ (delim && *p=='\\')) {
if( *p=='\n' || *p=='\r' || *p=='\f'
|| *p=='\v' || *p=='\b' || !*p )
buflen += 2;
@@ -261,7 +263,8 @@ 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( *p < 0x20 || (*p >= 0x7f && *p < 0xa0) || *p == delim ) {
+ if( *p < 0x20 || (*p >= 0x7f && *p < 0xa0) || *p == delim ||
+ (delim && *p=='\\')) {
*d++ = '\\';
if( *p == '\n' )
*d++ = 'n';
diff --git a/util/strgutil.c b/util/strgutil.c
index 7b72bbbe3..c4fafe562 100644
--- a/util/strgutil.c
+++ b/util/strgutil.c
@@ -476,7 +476,8 @@ utf8_to_native( const char *string, size_t length, int delim )
}
if( !nleft ) {
if( !(*s & 0x80) ) { /* plain ascii */
- if( *s < 0x20 || *s == 0x7f || *s == delim) {
+ if( *s < 0x20 || *s == 0x7f || *s == delim ||
+ (delim && *s=='\\')) {
n++;
if( p )
*p++ = '\\';