diff options
author | Akira TAGOH <akira@tagoh.org> | 2015-12-01 13:09:26 +0900 |
---|---|---|
committer | Akira TAGOH <akira@tagoh.org> | 2015-12-01 13:09:48 +0900 |
commit | 28caed6dd1440f19f7c8b4122ca55d1323bc82c7 (patch) | |
tree | bcd34540a121e96deef5070c4075842f8c9bb1a2 /tests | |
parent | 284f3c271e37145eb94cb1d0b5b205aaddb50dcc (diff) |
Add a lookup table to catch up a script/language from language/script
Diffstat (limited to 'tests')
-rw-r--r-- | tests/tag.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/tag.c b/tests/tag.c index aa8c109..30fba88 100644 --- a/tests/tag.c +++ b/tests/tag.c @@ -34,7 +34,7 @@ main(int argc, if (lt_strcmp0(argv[1], "help") == 0) { help: printf("Usage: %s <command> ...\n" - "commands: canonicalize, ecanonicalize, dump, from_locale, from_locale_s, lookup, match, to_locale, transform\n", + "commands: canonicalize, ecanonicalize, dump, from_locale, from_locale_s, lookup, match, script, to_locale, transform\n", argv[0]); } else if (lt_strcmp0(argv[1], "canonicalize") == 0) { char *s; @@ -105,6 +105,20 @@ main(int argc, printf("%s -> %s\n", argv[2], r); free(r); } + } else if (lt_strcmp0(argv[1], "script") == 0) { + if (lt_tag_parse(tag, argv[2], NULL)) { + lt_relation_db_t *db = lt_db_get_relation(); + const lt_lang_t *lang = lt_tag_get_language(tag); + lt_list_t *l, *ll = lt_relation_db_lookup_script_from_lang(db, lang); + + printf("%s: ", lt_lang_get_tag(lang)); + for (l = ll; l; l = lt_list_next(l)) { + lt_script_t *script = lt_list_value(l); + + printf("%s ", lt_script_get_tag(script)); + } + printf("\n"); + } } else { goto help; } |