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

Last change on this file since 768 was 768, checked in by Bruno Cornec, 18 years ago

mktest generates again good results with the new split of libraries.

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