Line data Source code
1 : /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 : /*
3 : * lang-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_lang_db_t *langdb;
27 : lt_lang_t *lang;
28 :
29 0 : setlocale(LC_ALL, "");
30 :
31 0 : lt_db_set_datadir(TEST_DATADIR);
32 0 : langdb = lt_lang_db_new();
33 :
34 0 : if (lt_strcmp0(argv[1], "list") == 0) {
35 0 : } else if (lt_strcmp0(argv[1], "lookup") == 0) {
36 0 : lang = lt_lang_db_lookup(langdb, argv[2]);
37 0 : if (!lang) {
38 0 : printf("No entry for %s\n", argv[2]);
39 : } else {
40 0 : printf("%s (%s)\n",
41 : lt_lang_get_tag(lang),
42 : lt_lang_get_name(lang));
43 : }
44 0 : lt_lang_unref(lang);
45 : }
46 :
47 0 : lt_lang_db_unref(langdb);
48 :
49 0 : return 0;
50 : }
|