source: MondoRescue/trunk/mondo/src/test/test-conf.c@ 979

Last change on this file since 979 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
Line 
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"
10#include "mr_conf.h"
11#include "mr_mem.h"
12
13int g_main_pid = 0;
14int g_buffer_pid = 0;
15
16main() {
17 int ret = 0;
18 int i = 0;
19 double f = 0.0;
20 char *s = NULL;
21
22 if ((ret = mr_conf_open("mondo.conf")) != 0) {
23 fprintf(stderr,"Unable to open conf file (%d)\n",ret);
24 exit(-1);
25 }
26 if ((i = mr_conf_iread("testinteger")) == 0) {
27 fprintf(stderr,"Unable to get integer\n");
28 exit(-1);
29 }
30 fprintf(stdout, "Integer : ***%d***\n",i);
31 if ((f = mr_conf_fread("testfloat")) == 0.0) {
32 fprintf(stderr,"Unable to get float\n");
33 exit(-1);
34 }
35 fprintf(stdout, "Float : ***%f***\n",f);
36 if (! (s = mr_conf_sread("teststring"))) {
37 fprintf(stderr,"Unable to get string\n");
38 exit(-1);
39 }
40 fprintf(stdout, "String : ***%s***\n",s);
41 mr_free(s);
42 mr_conf_close();
43 exit(0);
44}
Note: See TracBrowser for help on using the repository browser.