From 70d558199cf2b783f894a2769df44884a5ba8719 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 16 May 2019 13:12:37 +0200 Subject: basic/escape: add truncation to xescape too This does for ASCII and non-unicode encodings what utf8_escape_non_printable_full() does for utf8-based encodings. --- src/basic/escape.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/basic/escape.h') diff --git a/src/basic/escape.h b/src/basic/escape.h index 515620993d..45e23d0651 100644 --- a/src/basic/escape.h +++ b/src/basic/escape.h @@ -46,7 +46,10 @@ int cunescape_length(const char *s, size_t length, UnescapeFlags flags, char **r int cunescape_length_with_prefix(const char *s, size_t length, const char *prefix, UnescapeFlags flags, char **ret); int cunescape_one(const char *p, size_t length, char32_t *ret, bool *eight_bit); -char *xescape(const char *s, const char *bad); +char *xescape_full(const char *s, const char *bad, size_t console_width, bool eight_bits); +static inline char *xescape(const char *s, const char *bad) { + return xescape_full(s, bad, SIZE_MAX, false); +} char *octescape(const char *s, size_t len); char *shell_escape(const char *s, const char *bad); -- cgit v1.2.1