Last change
on this file since 2310 was
2310,
checked in by Bruno Cornec, 12 years ago
|
Backport all test programs from trunk into 2.2.10
|
-
Property svn:eol-style set to
native
|
File size:
953 bytes
|
Line | |
---|
1 | /* |
---|
2 | * Test file to test the configuration file handling |
---|
3 | * |
---|
4 | * $Id$ |
---|
5 | * |
---|
6 | */ |
---|
7 | |
---|
8 | #include <stdio.h> |
---|
9 | #include <stdlib.h> |
---|
10 | |
---|
11 | #include "mr_conf.h" |
---|
12 | #include "mr_mem.h" |
---|
13 | |
---|
14 | int g_main_pid = 0; |
---|
15 | int g_buffer_pid = 0; |
---|
16 | |
---|
17 | void (*mr_cleanup)(void) = NULL; |
---|
18 | |
---|
19 | int main(void) { |
---|
20 | int ret = 0; |
---|
21 | char *s = NULL; |
---|
22 | |
---|
23 | if ((ret = mr_conf_open("mondo.conf")) != 0) { |
---|
24 | fprintf(stderr,"Unable to open conf file (%d)\n",ret); |
---|
25 | exit(-1); |
---|
26 | } |
---|
27 | s = mr_conf_iread("testinteger"); |
---|
28 | if (s == NULL) { |
---|
29 | fprintf(stderr,"Unable to get integer\n"); |
---|
30 | exit(-1); |
---|
31 | } |
---|
32 | fprintf(stdout, "Integer : ***%d***\n",atoi(s)); |
---|
33 | mr_free(s); |
---|
34 | |
---|
35 | s = mr_conf_fread("testfloat"); |
---|
36 | if (s == NULL) { |
---|
37 | fprintf(stderr,"Unable to get float\n"); |
---|
38 | exit(-1); |
---|
39 | } |
---|
40 | fprintf(stdout, "Float : ***%f***\n",atof(s)); |
---|
41 | mr_free(s); |
---|
42 | |
---|
43 | s = mr_conf_sread("teststring"); |
---|
44 | if (s == NULL) { |
---|
45 | fprintf(stderr,"Unable to get string\n"); |
---|
46 | exit(-1); |
---|
47 | } |
---|
48 | fprintf(stdout, "String : ***%s***\n",s); |
---|
49 | mr_free(s); |
---|
50 | |
---|
51 | mr_conf_close(); |
---|
52 | exit(ret); |
---|
53 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.