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
  | 
#ifndef CONFIG_H
#define CONFIG_H
#include <stddef.h>
#include "keyword.h"
typedef struct config config;
struct config {
	char *git_root;		
	char *sock_type;	
	char *sock;		
	char *port;		
	int merge_type;		
	char *pr_root;		
	char *key_path;		
};
int check_port(void *ctx, void *ret, const keyword *key, keyword_val val);
#define offset_list(...) (size_t []){__VA_ARGS__, -1}
static const keyword *config_keywords[] = {
	&(const keyword){"git-root", "Root of git server (can also be a url).", NULL, TYPE_STRING, offset_list(offsetof(config, git_root)), NULL},
	&(const keyword){"socket-type", "Socket type to use (options: unix, network. default: network).", NULL, TYPE_STRING, offset_list(offsetof(config, sock_type)), NULL},
	&(const keyword){"socket", "Path, IP address, or domain name of socket.", NULL, TYPE_STRING, offset_list(offsetof(config, sock)), NULL},
	&(const keyword){"port", "Port to listen on (network socket only).", NULL, TYPE_STRING, offset_list(offsetof(config, port)), check_port},
	&(const keyword){"merge-type", "Type of merge (options: 0 = Merge individually, 1 = Merge into one).", NULL, TYPE_INT, offset_list(offsetof(config, merge_type)), NULL},
	&(const keyword){"pr-root", "Directory to store pull requests in.", NULL, TYPE_STRING, offset_list(offsetof(config, pr_root)), NULL},
	&(const keyword){"key-file", "Path to file containing gpg/pgp public keys of each maintainer.", NULL, TYPE_STRING, offset_list(offsetof(config, key_path)), NULL},
	NULL,
};
#undef offset_list
extern config *parse_config(const char *filename);
extern void cleanup_config(config *conf);
#endif
  |