| 1 | /** |
| 2 | * \file src/opustags.cc |
| 3 | * \brief Main function for opustags. |
| 4 | * |
| 5 | * See opustags.h for the program's documentation. |
| 6 | */ |
| 7 | |
| 8 | #include <opustags.h> |
| 9 | |
| 10 | #include <locale.h> |
| 11 | |
| 12 | /** |
| 13 | * Main function of the opustags binary. |
| 14 | * |
| 15 | * Does practically nothing but call the cli module. |
| 16 | */ |
| 17 | int main(int argc, char** argv) { |
| 18 | try { |
| 19 | setlocale(LC_ALL, ""); |
| 20 | ot::options opt = ot::parse_options(argc, argv, stdin); |
| 21 | ot::run(opt); |
| 22 | return 0; |
| 23 | } catch (const ot::status& rc) { |
| 24 | if (!rc.message.empty()) |
| 25 | fprintf(stderr, "error: %s\n", rc.message.c_str()); |
| 26 | return rc == ot::st::bad_arguments ? 2 : 1; |
| 27 | } |
| 28 | } |