From 7516ec539764125f657a144cce32ce96df05bcf4 Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Tue, 5 Dec 2023 00:34:27 -0500 Subject: [PATCH] tests: Work around some ancient printf bugs. Some very old printf implementations (e.g., on ULTRIX 4.5) do not support negative precision with %.*s conversions in order to behave as if the precision was omitted. It is easy to change the rendertest program to avoid this problem, so let's change it. --- t/rendertest.c | 2 +- tests/internal.at | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/t/rendertest.c b/t/rendertest.c index 93574e2..14faafb 100644 --- a/t/rendertest.c +++ b/t/rendertest.c @@ -85,7 +85,7 @@ static int do_test(char *line, unsigned long n, int mode) return -1; } - printf("%lu %.*s\n", (unsigned long)rc, -(n>0), line); + printf(n > 0 ? "%lu %s\n" : "%lu\n", (unsigned long)rc, line); cdecl_free(decl); return 0; } diff --git a/tests/internal.at b/tests/internal.at index 8598073..3fa785a 100644 --- a/tests/internal.at +++ b/tests/internal.at @@ -83,8 +83,8 @@ int x[1234567890] ]]) AT_CHECK([rendertest -n 0