diff options
| author | jvoisin | 2025-10-31 15:18:10 +0100 |
|---|---|---|
| committer | jvoisin | 2025-11-11 14:09:16 +0100 |
| commit | fe3e4269959ea7534722aa2664a3cac69d9109cf (patch) | |
| tree | cfb4a11fa1c2a14798b1bf1b56facdd9ea8ea170 /tests/test_sprintf_62.c | |
| parent | 558f28473a1dea3d314156f2f3c45f078433ff57 (diff) | |
Add a testsuite
Co-Authored-By: q66 <q66@chimera-linux.org>
Diffstat (limited to 'tests/test_sprintf_62.c')
| -rw-r--r-- | tests/test_sprintf_62.c | 21 |
1 files changed, 21 insertions, 0 deletions
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 @@ | |||
| 1 | #include "common.h" | ||
| 2 | |||
| 3 | #include <stdio.h> | ||
| 4 | |||
| 5 | static char *offstr(char *str) | ||
| 6 | { | ||
| 7 | int len = 0; | ||
| 8 | |||
| 9 | len = sprintf(str, "%s+0x%lx", "foo", (long unsigned int)0); | ||
| 10 | sprintf(str+len, " (%s+0x%lx)","bar", (long unsigned int)0); | ||
| 11 | if (len < 0) | ||
| 12 | return NULL; | ||
| 13 | return str; | ||
| 14 | } | ||
| 15 | |||
| 16 | int main() { | ||
| 17 | char buf[100]; | ||
| 18 | char *c = offstr(buf); | ||
| 19 | printf("%s\n", c); | ||
| 20 | return 0; | ||
| 21 | } | ||
