cnfparse.c

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

cnfparse.h (1396B)


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