From 957f6aafd9fc45fb66da1888378b261ed1209036 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Tue, 27 Feb 2018 11:16:23 +0000 Subject: Add strndup(3) compat implementation. Jan Stary reports that MacOS X Snow Leopard and older lacks it. --- test-strndup.c | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 test-strndup.c (limited to 'test-strndup.c') diff --git a/test-strndup.c b/test-strndup.c new file mode 100644 index 00000000..82e4e547 --- /dev/null +++ b/test-strndup.c @@ -0,0 +1,10 @@ +#include + +int +main(void) +{ + char *s; + + s = strndup("123", 2); + return s[0] != '1' ? 1 : s[1] != '2' ? 2 : s[2] != '\0' ? 3 : 0; +} -- cgit v1.2.3-56-ge451