Holger Hans Peter Freyther | c87f266 | 2010-10-07 00:00:15 +0800 | [diff] [blame] | 1 | /* |
| 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 Ayuso | 8341934 | 2011-03-22 16:36:13 +0100 | [diff] [blame] | 22 | #include <osmocom/core/msgfile.h> |
Jan Engelhardt | 1a63255 | 2014-10-04 11:06:13 +0200 | [diff] [blame] | 23 | #include <osmocom/core/talloc.h> |
Holger Hans Peter Freyther | c87f266 | 2010-10-07 00:00:15 +0800 | [diff] [blame] | 24 | |
| 25 | #include <stdio.h> |
| 26 | |
Pablo Neira Ayuso | 1b4a42c | 2011-05-07 13:01:41 +0200 | [diff] [blame] | 27 | static void dump_entries(struct osmo_config_list *entries) |
Holger Hans Peter Freyther | c87f266 | 2010-10-07 00:00:15 +0800 | [diff] [blame] | 28 | { |
Pablo Neira Ayuso | 1b4a42c | 2011-05-07 13:01:41 +0200 | [diff] [blame] | 29 | struct osmo_config_entry *entry; |
Holger Hans Peter Freyther | c87f266 | 2010-10-07 00:00:15 +0800 | [diff] [blame] | 30 | |
| 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 | |
| 42 | int main(int argc, char **argv) |
| 43 | { |
Pablo Neira Ayuso | 1b4a42c | 2011-05-07 13:01:41 +0200 | [diff] [blame] | 44 | struct osmo_config_list *entries; |
Holger Hans Peter Freyther | c87f266 | 2010-10-07 00:00:15 +0800 | [diff] [blame] | 45 | |
| 46 | /* todo use msgfile_test.c.in and replace the path */ |
Pablo Neira Ayuso | 1b4a42c | 2011-05-07 13:01:41 +0200 | [diff] [blame] | 47 | entries = osmo_config_list_parse(NULL, "msgconfig.cfg"); |
Holger Hans Peter Freyther | c87f266 | 2010-10-07 00:00:15 +0800 | [diff] [blame] | 48 | dump_entries(entries); |
Holger Hans Peter Freyther | 8d950ea | 2014-08-29 14:19:20 +0200 | [diff] [blame] | 49 | talloc_free(entries); |
Holger Hans Peter Freyther | c87f266 | 2010-10-07 00:00:15 +0800 | [diff] [blame] | 50 | |
| 51 | return 0; |
| 52 | } |