9002
|
1 /* Copyright (C) 2005-2008 Timo Sirainen */
|
|
2
|
|
3 #include "common.h"
|
|
4 #include "lib-signals.h"
|
|
5 #include "ioloop.h"
|
|
6 #include "str.h"
|
|
7 #include "config-connection.h"
|
|
8 #include "config-parser.h"
|
|
9
|
|
10 #include <stdlib.h>
|
|
11 #include <unistd.h>
|
|
12
|
|
13 string_t *config_string;
|
|
14 pool_t parsers_pool;
|
|
15
|
|
16 static const char *config_path = SYSCONFDIR "/" PACKAGE ".conf";
|
|
17
|
|
18 static void main_init(const char *service)
|
|
19 {
|
|
20 i_set_failure_internal();
|
|
21
|
|
22 parsers_pool = pool_alloconly_create("parent parsers", 2048);
|
|
23 config_parsers_fix_parents(parsers_pool);
|
|
24
|
|
25 config_string = str_new(default_pool, 10240);
|
|
26 config_parse_file(config_string, config_path, service);
|
|
27 str_append_c(config_string, '\n');
|
|
28 }
|
|
29
|
|
30 int main(int argc, char *argv[])
|
|
31 {
|
|
32 struct ioloop *ioloop;
|
|
33 const char *path, *service = "";
|
|
34 bool dump_nondefaults = FALSE, human_readable = FALSE;
|
|
35 int c;
|
|
36
|
|
37 lib_init();
|
|
38
|
|
39 path = getenv("CONFIG_FILE_PATH");
|
|
40 if (path != NULL)
|
|
41 config_path = path;
|
|
42
|
|
43 while ((c = getopt(argc, argv, "c:s:na")) > 0) {
|
|
44 switch (c) {
|
|
45 case 'c':
|
|
46 config_path = optarg;
|
|
47 break;
|
|
48 case 's':
|
|
49 service = optarg;
|
|
50 break;
|
|
51 case 'n':
|
|
52 dump_nondefaults = TRUE;
|
|
53 /* fall through */
|
|
54 case 'a':
|
|
55 /* FIXME: make it work */
|
|
56 human_readable = TRUE;
|
|
57 break;
|
|
58 default:
|
|
59 i_fatal("Unknown parameter: %c", c);
|
|
60 }
|
|
61 }
|
|
62
|
|
63 main_init(service);
|
|
64 ioloop = io_loop_create();
|
|
65 config_connection_dump_request(STDOUT_FILENO, "master");
|
|
66 io_loop_destroy(&ioloop);
|
|
67 lib_deinit();
|
|
68 return 0;
|
|
69 }
|