summaryrefslogtreecommitdiff
path: root/csvncgi/repolist.h
blob: a4c76ad76d08d2068b3dcf4bc101031db99f3b78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#ifndef    __REPO_LIST_H
#define    __REPO_LIST_H

#ifndef __DEBUG__
#define __DEBUG__  0
#endif

#ifndef ST_GLOBAL
#define ST_GLOBAL 1
#endif
#ifndef ST_REPOS
#define ST_REPOS  2
#endif

#ifndef DT_NUMERICAL
#define DT_NUMERICAL  0x01
#endif
#ifndef DT_PATH
#define DT_PATH       0x02
#endif
#ifndef DT_STRING
#define DT_STRING     0x04
#endif

struct section
{
  int type;
  unsigned char *name;
  struct dlist  *list;
};

struct variable
{
  unsigned char *name;
  union
  {
    int val;
    unsigned char *vptr;
  } _v;
  unsigned int type;
};

struct repo
{
  unsigned char *path;
  struct dlist  *list;
};

extern struct dlist *config;


#ifdef __cplusplus
extern "C" {
#endif

typedef void (*rlist_errfunc)( const char *fmt, ... );

extern void rlist_error( const char *fmt, ... ) __attribute__((format (printf,1,2)));
extern rlist_errfunc rlist_fatal; /* Default Fatal Error Function == rlist_error() */


extern struct dlist *read_config( void );
extern void print_config( struct strbuf *sb, struct dlist *list );
extern struct variable *lookup( struct repo *repo, struct variable *variable );
extern struct variable *lookup_global( struct section *section, struct variable *variable );
extern struct repo *lookup_repo( struct dlist *config, const char *path );
extern struct section *lookup_section( struct dlist *config, const char *name );
extern struct section *lookup_global_section( struct dlist *config );

extern int repolist_length( struct dlist *config );
extern struct repo *repolist_nth( struct dlist *config, int n );
extern int repo_position( struct dlist *config, struct repo *repo );

extern struct dlist *parent_section_node_repolist_nth( struct dlist *config, int n );
extern struct dlist *parent_rlist_node_repolist_nth( struct dlist *config, int n );

extern void free_config( void );


#ifdef __cplusplus
}
#endif

#endif  /* __REPO_LIST_H */