xref: /freebsd/contrib/mandoc/test-strndup.c (revision 01d4e2149e5566e5d9394913dc9fb032da259e0b)
1 #include <string.h>
2 
3 int
main(void)4 main(void)
5 {
6 	char *s;
7 
8 	s = strndup("123", 2);
9 	return s[0] != '1' ? 1 : s[1] != '2' ? 2 : s[2] != '\0' ? 3 : 0;
10 }
11