a506381c9a06eb3e0c9e0e73d1bd014082a641ff
[single-header-libcext.git] / README.md
1 A (WIP) collection of portable, strict C99, single-header implementations of common libc extensions.
2
3 ### How to
4
5 Include the header in every file needed as usual:
6
7 ```
8 #include "<ext-func-name>.h"
9 ```
10
11 In the file chosen for the function implementation:
12
13 ```
14 #define <EXT-FUNC-NAME>_IMPLEMENTATION
15 #include "<ext-func-name.h>"
16 ```
17
18 By default, the header won't have any stdlib includes, change that with:
19
20 ```
21 #define <EXT-FUNC-NAME>_INCLUDE_LIBC
22 ```
23
24 Or disable function, type and variable override with:
25
26 ```
27 #define HAVE_<EXT-FUNC-NAME>
28 ```
29
30 ### Specifics
31
32 ---
33
34 ### asprintf
35
36 includes `vasprintf()` and `asprintf()`
37
38 ---
39
40 ### getopt\_long
41
42 includes `getopt()`, `getsubopt()`, `getopt_long()` and `getopt_long_only`
43
44 `getopt_long.h` has additional macros related to argument
45 permuting, defining those enables it (GNU behaviour, will still be disabled with `$POSIXLY_CORRECT` set):
46
47 ```
48 #define GETOPT_PERMUTE_ARGS
49 #define GETOPT_LONG_PERMUTE_ARGS
50 #define GETOPT_LONG_ONLY_PERMUTE_ARGS
51 ```
52
53 ---
54