* Exim - an Internet mail transport agent *
*************************************************/
-/* Copyright (c) The Exim Maintainers 2020 - 2023 */
+/* Copyright (c) The Exim Maintainers 2020 - 2024 */
/* Copyright (c) University of Cambridge 1995 - 2018 */
/* See the file NOTICE for conditions of use and distribution. */
/* SPDX-License-Identifier: GPL-2.0-or-later */
/* First find the end of the string */
if (*s != '\"')
- while (*s && !isspace(*s)) s++;
+ Uskip_nonwhite(&s);
else
{
s++;
}
-gstring *
-string_cat(gstring * g, const uschar * s)
-{
-return string_catn(g, s, Ustrlen(s));
-}
-
-
/*************************************************
* Append strings to another string *
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
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))
{
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;
}
}
}
/* 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;