Last change
on this file since 1133 was 1064, checked in by Bruno Cornec, 18 years ago |
More controls at the compiler level
still working with the problems around variable arguments
|
-
Property svn:eol-style
set to
native
|
File size:
889 bytes
|
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 |
|
---|
[1064] | 17 | int main(void) {
|
---|
[1054] | 18 | int ret = 0;
|
---|
| 19 | int i = 0;
|
---|
| 20 | double f = 0.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 | if ((i = mr_conf_iread("testinteger")) == 0) {
|
---|
| 28 | fprintf(stderr,"Unable to get integer\n");
|
---|
| 29 | exit(-1);
|
---|
| 30 | }
|
---|
| 31 | fprintf(stdout, "Integer : ***%d***\n",i);
|
---|
| 32 | if ((f = mr_conf_fread("testfloat")) == 0.0) {
|
---|
| 33 | fprintf(stderr,"Unable to get float\n");
|
---|
| 34 | exit(-1);
|
---|
| 35 | }
|
---|
| 36 | fprintf(stdout, "Float : ***%f***\n",f);
|
---|
| 37 | if (! (s = mr_conf_sread("teststring"))) {
|
---|
| 38 | fprintf(stderr,"Unable to get string\n");
|
---|
| 39 | exit(-1);
|
---|
| 40 | }
|
---|
| 41 | fprintf(stdout, "String : ***%s***\n",s);
|
---|
| 42 | mr_free(s);
|
---|
| 43 | mr_conf_close();
|
---|
| 44 | exit(0);
|
---|
| 45 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.