From fe3e4269959ea7534722aa2664a3cac69d9109cf Mon Sep 17 00:00:00 2001 From: jvoisin Date: Fri, 31 Oct 2025 15:18:10 +0100 Subject: Add a testsuite Co-Authored-By: q66 --- tests/test_sprintf_62.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/test_sprintf_62.c (limited to 'tests/test_sprintf_62.c') diff --git a/tests/test_sprintf_62.c b/tests/test_sprintf_62.c new file mode 100644 index 0000000..3a84a1f --- /dev/null +++ b/tests/test_sprintf_62.c @@ -0,0 +1,21 @@ +#include "common.h" + +#include + +static char *offstr(char *str) +{ + int len = 0; + + len = sprintf(str, "%s+0x%lx", "foo", (long unsigned int)0); + sprintf(str+len, " (%s+0x%lx)","bar", (long unsigned int)0); + if (len < 0) + return NULL; + return str; +} + +int main() { + char buf[100]; + char *c = offstr(buf); + printf("%s\n", c); + return 0; +} -- cgit v1.3