summaryrefslogtreecommitdiff
path: root/tests/config.c
blob: 85794c06bae8a1cce5844528c2eb962ecaed93e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/**
 * Config file parsing tests.
 */

#include <gammu.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "common.h"

int main(int argc, char **argv)
{
	GSM_Error error;
	GSM_Config cfg = { "", "", NULL, NULL, FALSE, FALSE, NULL, FALSE, FALSE, "", "", "", "", "", {0} };
	INI_Section *ini = NULL;

	/* Check parameters */
	if (argc != 2) {
		printf("Not enough parameters!\nUsage: config config_file\n");
		return 1;
	}

	error = GSM_FindGammuRC(&ini, argv[1]);
	gammu_test_result(error, "GSM_FindGammuRC");

	error = GSM_ReadConfig(ini, &cfg, 0);
	gammu_test_result(error, "GSM_ReadConfig");

	/* Free config file structures */
	INI_Free(ini);

	printf("DEBUG_LEVEL: '%s'\n", cfg.DebugLevel);

	free(cfg.Device);
	free(cfg.Connection);
	free(cfg.DebugFile);

	return 0;
}