Do not format int as a non-printable character

Output gets truncated otherwise.
This commit is contained in:
mataha 2023-09-12 21:28:54 +02:00 committed by GitHub
parent 81f391dd22
commit 03788b0117
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -29,7 +29,7 @@ char *testlib_formatint(intptr_t x) {
char *str = sbufi_ < ARRAYLEN(sbufs_) ? sbufs_[sbufi_++] : malloc(256);
char *p = str;
p += sprintf(p, "%ld\t(or %#lx", x, x);
if (0 <= x && x < 256) {
if (32 <= x && x < 256) {
p += sprintf(p, " or %#`c", (unsigned char)x);
}
*p++ = ')';