Last change
on this file since 1068 was 900, checked in by Bruno Cornec, 18 years ago |
Huge patch to introduce low level functions that will bw used everywhere (mr_free, mr_asprintf, ...)
Nearly linking now due to that.
|
File size:
882 bytes
|
Rev | Line | |
---|
[531] | 1 | /*
|
---|
| 2 | * Test file to test the configuration file handling
|
---|
| 3 | *
|
---|
| 4 | * $Id$
|
---|
| 5 | *
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | #include <stdio.h>
|
---|
| 9 | #include "my-stuff.h"
|
---|
[768] | 10 | #include "mr_conf.h"
|
---|
[900] | 11 | #include "mr_mem.h"
|
---|
[531] | 12 |
|
---|
| 13 | int g_main_pid = 0;
|
---|
| 14 | int g_buffer_pid = 0;
|
---|
| 15 |
|
---|
| 16 | main() {
|
---|
| 17 | int ret = 0;
|
---|
| 18 | int i = 0;
|
---|
| 19 | double f = 0.0;
|
---|
| 20 | char *s = NULL;
|
---|
| 21 |
|
---|
[768] | 22 | if ((ret = mr_conf_open("mondo.conf")) != 0) {
|
---|
[531] | 23 | fprintf(stderr,"Unable to open conf file (%d)\n",ret);
|
---|
| 24 | exit(-1);
|
---|
| 25 | }
|
---|
[768] | 26 | if ((i = mr_conf_iread("testinteger")) == 0) {
|
---|
[531] | 27 | fprintf(stderr,"Unable to get integer\n");
|
---|
| 28 | exit(-1);
|
---|
| 29 | }
|
---|
| 30 | fprintf(stdout, "Integer : ***%d***\n",i);
|
---|
[768] | 31 | if ((f = mr_conf_fread("testfloat")) == 0.0) {
|
---|
[531] | 32 | fprintf(stderr,"Unable to get float\n");
|
---|
| 33 | exit(-1);
|
---|
| 34 | }
|
---|
| 35 | fprintf(stdout, "Float : ***%f***\n",f);
|
---|
[768] | 36 | if (! (s = mr_conf_sread("teststring"))) {
|
---|
[531] | 37 | fprintf(stderr,"Unable to get string\n");
|
---|
| 38 | exit(-1);
|
---|
| 39 | }
|
---|
| 40 | fprintf(stdout, "String : ***%s***\n",s);
|
---|
[900] | 41 | mr_free(s);
|
---|
[768] | 42 | mr_conf_close();
|
---|
[531] | 43 | exit(0);
|
---|
| 44 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.