Line data Source code
1 : /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 : /*
3 : * region-db.c
4 : * Copyright (C) 2011-2012 Akira TAGOH
5 : *
6 : * Authors:
7 : * Akira TAGOH <akira@tagoh.org>
8 : *
9 : * You may distribute under the terms of either the GNU
10 : * Lesser General Public License or the Mozilla Public
11 : * License, as specified in the README file.
12 : */
13 : #ifdef HAVE_CONFIG_H
14 : #include "config.h"
15 : #endif
16 :
17 : #include <stdio.h>
18 : #include <locale.h>
19 : #include "langtag.h"
20 : #include "lt-utils.h"
21 :
22 : int
23 0 : main(int argc,
24 : char **argv)
25 : {
26 : lt_region_db_t *regiondb;
27 :
28 0 : setlocale(LC_ALL, "");
29 :
30 0 : lt_db_set_datadir(TEST_DATADIR);
31 0 : regiondb = lt_region_db_new();
32 :
33 0 : if (lt_strcmp0(argv[1], "list") == 0) {
34 0 : } else if (lt_strcmp0(argv[1], "lookup") == 0) {
35 0 : lt_region_t *region = lt_region_db_lookup(regiondb, argv[2]);
36 :
37 0 : printf("%s (%s)\n", lt_region_get_tag(region), lt_region_get_name(region));
38 0 : lt_region_unref(region);
39 : }
40 :
41 0 : lt_region_db_unref(regiondb);
42 :
43 0 : return 0;
44 : }
|