diff options
Diffstat (limited to 'share/tests/libc-str-cpy-stp/stpe/006/test.c')
-rw-r--r-- | share/tests/libc-str-cpy-stp/stpe/006/test.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/share/tests/libc-str-cpy-stp/stpe/006/test.c b/share/tests/libc-str-cpy-stp/stpe/006/test.c new file mode 100644 index 0000000..58f390f --- /dev/null +++ b/share/tests/libc-str-cpy-stp/stpe/006/test.c @@ -0,0 +1,26 @@ +#include <c/str/cpy/stp/stpe/stpecpy.h> + +#include <stddef.h> +#include <stdio.h> + +int +main(void) +{ + char buf[11]; + char *p, *end; + size_t len; + + end = buf + sizeof(buf); + p = buf; + p = c_stpecpy(p, end, "Hello "); + p = c_stpecpy(p, end, "world"); + p = c_stpecpy(p, end, "!"); + p = c_stpecpy(p, end, ""); + if (p == end) { + p--; + puts("Truncated:"); + } + len = p - buf; + printf("%zu: ", len); + puts(buf); +} |