]> git.street.me.uk Git - andy/viking.git/blame - test/test_babel.c
Fix small memory leak.
[andy/viking.git] / test / test_babel.c
CommitLineData
6ea34309
RN
1// Decide the Babel file types capability you wish to list
2// e.g. for read support of waypoints, tracks and routes:
3// run like: ./test_babel 1 0 1 0 1 0
4#include <stdlib.h>
45680629
RN
5#include "babel.h"
6#include "preferences.h"
b666a8ba 7
6ea34309 8static void print_file_format (gpointer data, gpointer user_data)
b666a8ba 9{
6ea34309 10 BabelFile *file = (BabelFile*)data;
b666a8ba
GB
11 printf("%s : %d%d%d%d%d%d\n",
12 file->label,
13 file->mode.waypointsRead, file->mode.waypointsWrite,
14 file->mode.tracksRead, file->mode.tracksWrite,
15 file->mode.routesRead, file->mode.routesWrite);
16}
17
18int main(int argc, char*argv[])
19{
45680629
RN
20 // Preferences must be initialized as it gets auto used
21 a_preferences_init ();
22
b666a8ba 23 a_babel_init();
45680629 24 a_babel_post_init ();
b666a8ba
GB
25
26 if (argc != 7) return 1;
27 BabelMode mode = { atoi(argv[1]),atoi(argv[2]),atoi(argv[3]),atoi(argv[4]),atoi(argv[5]),atoi(argv[6]) };
28 a_babel_foreach_file_with_mode(mode, print_file_format, NULL);
29
30 a_babel_uninit();
31
28cb7c11
RN
32 a_preferences_uninit ();
33
b666a8ba
GB
34 return 0;
35}
36