1 A collection of portable, strict C99, single-header implementations of common libc extensions.
3 All functions are implemented as macros expanding to an internal function reference, this allows to use the headers with no meta build system - it compiles even if the extensions are already present, see _How to_ on disabling this behaviour.
7 Include the header in every file needed as usual:
10 #include "<ext-func-name>.h"
13 In the file chosen for the function implementation:
16 #define <EXT-FUNC-NAME>_IMPLEMENTATION
17 #include "<ext-func-name.h>"
20 By default, the header won't have any stdlib includes, change that with:
23 #define <EXT-FUNC-NAME>_INCLUDE_LIBC
26 Or disable function, type and variable override with:
29 #define HAVE_<EXT-FUNC-NAME>
38 includes
`vasprintf()` and
`asprintf()`
44 includes
`getopt()`,
`getsubopt()`,
`getopt_long()` and
`getopt_long_only()`
46 `getopt_long.h` has additional macros related to argument
47 permuting, defining those enables it per function (GNU behaviour, can still be disabled at runtime by setting
`$POSIXLY_CORRECT`):
50 #define GETOPT_PERMUTE_ARGS
51 #define GETOPT_LONG_PERMUTE_ARGS
52 #define GETOPT_LONG_ONLY_PERMUTE_ARGS
59 includes
`strlcat()` and
`strlcpy()`
65 includes
`strdup()` and
`strndup()`
67 `strndup()` follows the latest standard, meaning that it copies at most _n_ chars, not _n_ +
1.