blob: 2684b6a44f3bc659b2c2063b806009157173a796 [file] [log] [blame]
Holger Hans Peter Freytherc87f2662010-10-07 00:00:15 +08001/*
2 * (C) 2010 by Holger Hans Peter Freyther
3 * (C) 2010 by On-Waves
4 * All Rights Reserved
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 */
21
Pablo Neira Ayuso83419342011-03-22 16:36:13 +010022#include <osmocom/core/msgfile.h>
Jan Engelhardt1a632552014-10-04 11:06:13 +020023#include <osmocom/core/talloc.h>
Holger Hans Peter Freytherc87f2662010-10-07 00:00:15 +080024
25#include <stdio.h>
26
Pablo Neira Ayuso1b4a42c2011-05-07 13:01:41 +020027static void dump_entries(struct osmo_config_list *entries)
Holger Hans Peter Freytherc87f2662010-10-07 00:00:15 +080028{
Pablo Neira Ayuso1b4a42c2011-05-07 13:01:41 +020029 struct osmo_config_entry *entry;
Holger Hans Peter Freytherc87f2662010-10-07 00:00:15 +080030
31 if (!entries) {
32 fprintf(stderr, "Failed to parse the file\n");
33 return;
34 }
35
36 llist_for_each_entry(entry, &entries->entry, list) {
37 printf("Entry '%s:%s:%s:%s'\n",
38 entry->mcc, entry->mnc, entry->option, entry->text);
39 }
40}
41
42int main(int argc, char **argv)
43{
Pablo Neira Ayuso1b4a42c2011-05-07 13:01:41 +020044 struct osmo_config_list *entries;
Holger Hans Peter Freytherc87f2662010-10-07 00:00:15 +080045
46 /* todo use msgfile_test.c.in and replace the path */
Pablo Neira Ayuso1b4a42c2011-05-07 13:01:41 +020047 entries = osmo_config_list_parse(NULL, "msgconfig.cfg");
Holger Hans Peter Freytherc87f2662010-10-07 00:00:15 +080048 dump_entries(entries);
Holger Hans Peter Freyther8d950ea2014-08-29 14:19:20 +020049 talloc_free(entries);
Holger Hans Peter Freytherc87f2662010-10-07 00:00:15 +080050
51 return 0;
52}