Last change
on this file since 3681 was 1421, checked in by Bruno Cornec, 17 years ago |
tests reviewed
|
-
Property svn:eol-style
set to
native
|
File size:
1.1 KB
|
Rev | Line | |
---|
[1054] | 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 |
|
---|
[1421] | 17 | void (*mr_cleanup)(void) = NULL;
|
---|
| 18 |
|
---|
[1064] | 19 | int main(void) {
|
---|
[1054] | 20 | int ret = 0;
|
---|
| 21 | int i = 0;
|
---|
| 22 | double f = 0.0;
|
---|
| 23 | char *s = NULL;
|
---|
| 24 |
|
---|
| 25 | if ((ret = mr_conf_open("mondo.conf")) != 0) {
|
---|
| 26 | fprintf(stderr,"Unable to open conf file (%d)\n",ret);
|
---|
| 27 | exit(-1);
|
---|
| 28 | }
|
---|
| 29 | if ((i = mr_conf_iread("testinteger")) == 0) {
|
---|
| 30 | fprintf(stderr,"Unable to get integer\n");
|
---|
| 31 | exit(-1);
|
---|
| 32 | }
|
---|
| 33 | fprintf(stdout, "Integer : ***%d***\n",i);
|
---|
| 34 | if ((f = mr_conf_fread("testfloat")) == 0.0) {
|
---|
| 35 | fprintf(stderr,"Unable to get float\n");
|
---|
| 36 | exit(-1);
|
---|
| 37 | }
|
---|
| 38 | fprintf(stdout, "Float : ***%f***\n",f);
|
---|
| 39 | if (! (s = mr_conf_sread("teststring"))) {
|
---|
| 40 | fprintf(stderr,"Unable to get string\n");
|
---|
| 41 | exit(-1);
|
---|
| 42 | }
|
---|
| 43 | fprintf(stdout, "String : ***%s***\n",s);
|
---|
| 44 | mr_free(s);
|
---|
[1421] | 45 | if (! (s = mr_conf_sread("logfile"))) {
|
---|
| 46 | fprintf(stderr,"Unable to get string2\n");
|
---|
| 47 | exit(-1);
|
---|
| 48 | }
|
---|
| 49 | fprintf(stdout, "String2 : ***%s***\n",s);
|
---|
| 50 | mr_free(s);
|
---|
[1054] | 51 | mr_conf_close();
|
---|
| 52 | exit(0);
|
---|
| 53 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.