1 .\" This file is part of the Public Domain C Library (PDCLib).
2 .\" Permission is granted to use, modify, and / or redistribute at will.
10 .Nd string duplication
13 .Sy #define _XOPEN_SOURCE || _POSIX_C_SOURCE >= 200809L
15 .Fn "char *strdup" "const char *str"
17 .Sy #define _POSIX_C_SOURCE >= 200809L
19 .Fn "char *strndup" "const char *str" "size_t len"
23 allocates a new buffer of sufficient size as to be able to hold the entirety of
25 including the terminating character, and copies the contents of
31 allocates a buffer large enough to contain
33 characters, plus a trailing null character, or sufficient to contain the
36 including the trailing null character, whichever is smaller. The first
40 are then copied into it, and a null character appended.
43 The buffers returned by these functions must be released by a call to