perl version oddity
[exim.git] / src / src / string.c
index af187c1992e13384795091e03946117bc2c2a584..170b47b238fd2e353dbc635d4f7aaf45e8d15e1d 100644 (file)
@@ -649,7 +649,7 @@ uschar * t, * yield;
 /* First find the end of the string */
 
 if (*s != '\"')
-  while (*s && !isspace(*s)) s++;
+  Uskip_nonwhite(&s);
 else
   {
   s++;
@@ -1234,13 +1234,6 @@ return g;
 }
 
 
-gstring *
-string_cat(gstring * g, const uschar * s)
-{
-return string_catn(g, s, Ustrlen(s));
-}
-
-
 
 /*************************************************
 *        Append strings to another string        *
@@ -1333,7 +1326,7 @@ Arguments:
        ap      variable-args pointer
 
 Flags:
-       SVFMT_EXTEND            buffer can be created or exteded as needed
+       SVFMT_EXTEND            buffer can be created or extended as needed
        SVFMT_REBUFFER          buffer can be recopied to tainted mem as needed
        SVFMT_TAINT_NOCHK       do not check inputs for taint
 
@@ -1630,7 +1623,7 @@ while (*fp)
       goto INSERT_GSTRING;
       }
 
-    case 'W':                  /* Maybe mark up spaces & newlines */
+    case 'W':                  /* Maybe mark up ctrls, spaces & newlines */
       s = va_arg(ap, char *);
       if (Ustrpbrk(s, " \n") && !IS_DEBUG(D_noutf8))
        {
@@ -1653,7 +1646,15 @@ while (*fp)
              if (precision >= 0) precision += 3;
              break;
            default:
-             zg = string_catn(zg, CUS s, 1);
+             if (*s <= ' ')
+               {       /* base of UTF8 symbols for ASCII control chars */
+               uschar ctrl_symbol[3] = {[0]=0xe2, [1]=0x90, [2]=0x80};
+               ctrl_symbol[2] |= *s;
+               zg = string_catn(zg, ctrl_symbol, 3);
+               if (precision >= 0) precision += 2;
+               }
+             else
+               zg = string_catn(zg, CUS s, 1);
              break;
            }
          }
@@ -1705,7 +1706,7 @@ while (*fp)
        }
 
       /* If a width is not specified and the precision is specified, set
-      the width to the precision, or the string length if shorted. */
+      the width to the precision, or the string length if shorter. */
 
       else if (precision >= 0)
        width = precision < slen ? precision : slen;