cnfparse.c

Small library to make config parsing easier
git clone git://git.finwo.net/lib/cnfparse.c
Log | Files | Refs | README | LICENSE

README.md (1391B)


      1 finwo/cnfparse
      2 ==============
      3 
      4 > Small library to make config parsing easier
      5 
      6 This library makes use of [dep](https://github.com/finwo/dep) to manage its
      7 dependencies and exports.
      8 
      9 Installation
     10 ------------
     11 
     12 ```sh
     13 dep add finwo/cnfparse
     14 dep install
     15 ```
     16 
     17 After that, simply add `include lib/.dep/config.mk` in your makefile and include
     18 the header file by adding `#include "finwo/cnfparse.h`.
     19 
     20 API
     21 ---
     22 
     23 ### Structures
     24 
     25 <details>
     26   <summary>struct cnf_directive</summary>
     27 
     28   The main handle of the cnfparse library
     29 
     30 ```C
     31 struct cnf_directive {
     32  char   *name;
     33  size_t argc;
     34  char   **argv;
     35 };
     36 ```
     37 
     38 </details>
     39 
     40 ### Methods
     41 
     42 <details>
     43   <summary>cnf_directive_free(subject)</summary>
     44 
     45   Frees the memory used by a directive
     46 
     47 ```C
     48 void cnf_directive_free(struct cnf_directive *subject);
     49 ```
     50 
     51 </details>
     52 <details>
     53   <summary>cnf_directive_read(fd)</summary>
     54 
     55   Returns a single directive (or NULL) from the file descriptor.
     56 
     57   Arguments are separated by whitespace. Double-quoted strings may contain
     58   spaces and support the escapes `\n`, `\t`, `\r`, `\\`, `\"` and `\'`;
     59   unknown escapes keep the character verbatim, and `\0` becomes a literal
     60   `0` (with a warning on stderr). Single-quoted strings are literal except
     61   for `\'`.
     62 
     63 ```C
     64 struct cnf_directive * cnf_directive_read(FILE *fd);
     65 ```
     66 
     67 </details>
     68 
     69 License
     70 -------
     71 
     72 cnfparse.c source code is available under the [FGPL License](LICENSE.md)