This is similar to print_quoted_cstring, but not quite the same.
* tests/print_quoted_string.c (print_quoted_stringn): New function.
* tests/tests.h (print_quoted_stringn): New declaration.
}
}
+void
+print_quoted_stringn(const char *instr, const size_t size)
+{
+ const size_t len = strnlen(instr, size);
+ if (len < size) {
+ print_quoted_memory(instr, len);
+ } else {
+ print_quoted_memory(instr, size);
+ printf("...");
+ }
+}
+
static void
print_octal(unsigned char c, char next)
{
*/
void print_quoted_cstring(const char *str, size_t size);
+/*
+ * Print a NUL-terminated string `str' of length up to `size'
+ * in a quoted form.
+ */
+void print_quoted_stringn(const char *str, size_t size);
+
/* Print memory in a quoted form with optional escape characters. */
void print_quoted_memory_ex(const void *, size_t, bool quote,
const char *escape_chars);