summaryrefslogtreecommitdiffstats
path: root/share/tests/libc-str-cpy-stp/stpe/007/test.c
blob: baf7df62e43e100014965303b4799401f8512b2f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <c/str/cpy/stp/stpe/stpecpy.h>
#include <c/str/cpy/stp/stpe/stpeprintf.h>

#include <stddef.h>
#include <stdio.h>

int
main(void)
{
	char    buf[BUFSIZ];
	char    *p, *end;
	size_t  len;

	end = buf + sizeof(buf);
	p = buf;
	p = c_stpecpy(p, end, "Hello, ");
	p = c_stpeprintf(p, end, "%d worlds", 22);
	p = c_stpecpy(p, end, "!");
	if (p == end) {
		p--;
		puts("Truncated:");
	}
	len = p - buf;
	printf("%zu: ", len);
	puts(buf);
}