"Fossies" - the Fresh Open Source Software Archive

Member "srg-1.3.6/libconfig/libconfig.h" (5 Aug 2009, 728 Bytes) of package /linux/privat/old/srg-1.3.6.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #ifndef LIBCONFIG_H
    2 #define LIBCONFIG_H
    3 
    4 #define TYPE_INT    1
    5 #define TYPE_STR    2
    6 #define TYPE_BOOL   3
    7 #define TYPE_MASK   3
    8 
    9 #define TYPE_NOTNULL    0x10
   10 #define TYPE_NULL   0x20
   11 
   12 #ifdef __cplusplus
   13 extern "C" {
   14 #endif
   15 
   16 typedef struct {
   17     char *key;
   18     int type;
   19     void *value;
   20     } config_t;
   21 
   22 int parse_config(config_t *config,char *filename);
   23 /* Example:
   24  *
   25  * #include <stdio.h>
   26  * #include "libconfig.h"
   27  *
   28  * int foo;
   29  *
   30  * struct config_t config[] = {
   31  *  { "foo", TYPE_INT|TYPE_NOTNULL, &foo }
   32  *  { NULL, 0, NULL }
   33  *  };
   34  *
   35  * int main(int argc,char **argv) 
   36  * {
   37  *  if(!parse_config(config,"/usr/local/etc/wand.conf")) {
   38  *    return 1;
   39  *  }
   40  *
   41  *  printf("foo=%i",foo);
   42  *  return 0;
   43  * }
   44  */
   45 
   46 #ifdef __cplusplus
   47 }
   48 #endif
   49 #endif