-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsr_configtest.c
66 lines (51 loc) · 1.92 KB
/
sr_configtest.c
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
/*
This file is part of metpx-sarracenia.
The sarracenia suite is Free and is proudly provided by the Government of Canada
Copyright (C) Her Majesty The Queen in Right of Canada, Environment Canada, 2017
author: Peter Silva
status:
This is just a beginning stub, not working at all.
Purpose is to have something that parses the sarracenia configuration files in C.
*/
#include <stdio.h>
#include "sr_util.h"
#include "sr_config.h"
int main(int argc, char *const *argv)
{
int ret;
struct sr_config_s sr_cfg;
printf("reading: %s\n", argv[1]);
sr_cfg.progname = strdup("cpump");
sr_config_init(&sr_cfg, argv[0]);
ret = sr_config_read(&sr_cfg, argv[1], 0, 1);
if (!ret) {
fprintf(stderr, "failed to read config %s\n", argv[1]);
exit(1);
}
ret = sr_config_finalize(&sr_cfg, 0);
if (!ret) {
fprintf(stderr, "failed to finalize config %s\n", argv[1]);
exit(1);
}
if (sr_cfg.broker) {
printf("broker, scheme=%s\n", sr_cfg.broker->ssl ? "amqps" : "amqp");
printf("broker, userInfo=%s \n", sr_cfg.broker->user);
printf("broker, hostText=%s \n", sr_cfg.broker->hostname);
printf("broker, portText=%d \n", sr_cfg.broker->port);
}
if (sr_cfg.post_broker) {
printf("broker, scheme=%s\n", sr_cfg.post_broker->ssl ? "amqps" : "amqp");
printf("broker, userInfo=%s \n", sr_cfg.post_broker->user);
printf("broker, hostText=%s \n", sr_cfg.post_broker->hostname);
printf("broker, portText=%d \n", sr_cfg.post_broker->port);
}
printf("posting acceptUnmatched=%s \n", sr_cfg.acceptUnmatched ? "on" : "off");
printf("posting debug=%s \n", sr_cfg.debug ? "on" : "off");
printf("posting events= 0x%02x \n", sr_cfg.events);
printf("posting post_exchange=%s \n", sr_cfg.post_exchange);
printf("posting queue_name=%s \n", sr_cfg.queuename);
printf("posting post_baseUrl=%s \n", sr_cfg.post_baseUrl);
printf("posting post_baseDir=%s \n", sr_cfg.post_baseDir);
printf("posting sumalgo=%c \n", sr_cfg.sumalgo);
exit(0);
}