| 1 | /* liblouis Braille Translation and Back-Translation Library |
| 2 | |
| 3 | Based on BRLTTY, copyright (C) 1999-2006 by |
| 4 | The BRLTTY Team |
| 5 | |
| 6 | Copyright (C) 2004, 2005, 2006, 2009 |
| 7 | ViewPlus Technologies, Inc. www.viewplus.com and |
| 8 | JJB Software, Inc. www.jjb-software.com |
| 9 | |
| 10 | This program is free software: you can redistribute it and/or modify |
| 11 | it under the terms of the GNU General Public License as published by |
| 12 | the Free Software Foundation, either version 3 of the License, or |
| 13 | (at your option) any later version. |
| 14 | |
| 15 | This program is distributed in the hope that it will be useful, |
| 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | GNU General Public License for more details. |
| 19 | |
| 20 | You should have received a copy of the GNU General Public License |
| 21 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 22 | */ |
| 23 | |
| 24 | #include <config.h>cxx . . $ `<file>/liblouis/config.h`/ |
| 25 | |
| 26 | #include <stdio.h>cxx . . $ `<file>/tools/gnulib/stdio.h`/ |
| 27 | #include <string.h>cxx . . $ `<file>/gnulib/string.h`/ |
| 28 | #include <stdlib.h>cxx . . $ `<file>/gnulib/stdlib.h`/ |
| 29 | #include "internal.h"cxx . . $ `<file>/liblouis/internal.h`/ |
| 30 | #include <getopt.h> |
| 31 | #include "progname.h"cxx . . $ `<file>/tools/gnulib/progname.h`/ |
| 32 | #include "version-etc.h"cxx . . $ `<file>/tools/gnulib/version-etc.h`/ |
| 33 | |
| 34 | static const struct optioncxx . . $ option# longoptscxx . . $ longopts.[] = { |
| 35 | { "help", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!, 'h' }, |
| 36 | { "version", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!, 'v' }, |
| 37 | { "quiet", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!, 'q' }, |
| 38 | { NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!, 0, NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!, 0 }, |
| 39 | }; |
| 40 | |
| 41 | const char version_etc_copyrightcxx . . $ version_etc_copyright.[] = |
| 42 | "Copyright %s %d ViewPlus Technologies, Inc. and JJB Software, Inc."; |
| 43 | |
| 44 | #define AUTHORScxx . . $ `tools/lou_checktable.c:44:9`! "John J. Boyer" |
| 45 | |
| 46 | static int quiet_flagcxx . . $ quiet_flag. = 0; |
| 47 | |
| 48 | static void |
| 49 | print_helpcxx . . $ print_help(49f6e7a06ebc5aa8).(void) { |
| 50 | printfcxx . . $ printf(581fddd72a8db8fc).("\ |
| 51 | Usage: %s [OPTIONS] TABLE[,TABLE,...]\n", |
| 52 | program_namecxx . . $ program_name.); |
| 53 | |
| 54 | fputscxx . . $ fputs(874fa6a5e59ab9bd).("\ |
| 55 | Test a Braille translation table. If the table contains errors,\n\ |
| 56 | appropriate messages are displayed. If there are no errors the\n\ |
| 57 | message \"no errors found.\" is shown unless you specify the --quiet\n\ |
| 58 | option.\n", |
| 59 | stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!); |
| 60 | |
| 61 | fputscxx . . $ fputs(874fa6a5e59ab9bd).("\ |
| 62 | -h, --help display this help and exit\n\ |
| 63 | -v, --version display version information and exit\n\ |
| 64 | -q, --quiet do not write to standard error if there are no errors.\n", |
| 65 | stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!); |
| 66 | |
| 67 | printfcxx . . $ printf(581fddd72a8db8fc).("\n"); |
| 68 | printfcxx . . $ printf(581fddd72a8db8fc).("Report bugs to %s.\n", PACKAGE_BUGREPORTcxx . . $ `liblouis/config.h:628:9`!); |
| 69 | |
| 70 | #ifdef PACKAGE_PACKAGER_BUG_REPORTS |
| 71 | printf("Report %s bugs to: %s\n", PACKAGE_PACKAGER, PACKAGE_PACKAGER_BUG_REPORTS); |
| 72 | #endif |
| 73 | #ifdef PACKAGE_URLcxx . . $ `liblouis/config.h:649:9`! |
| 74 | printfcxx . . $ printf(581fddd72a8db8fc).("%s home page: <%s>\n", PACKAGE_NAMEcxx . . $ `liblouis/config.h:631:9`!, PACKAGE_URLcxx . . $ `liblouis/config.h:649:9`!); |
| 75 | #endif |
| 76 | } |
| 77 | |
| 78 | int |
| 79 | maincxx . . $ main(afcd3168fc1188a4).(int argc, char **argv) { |
| 80 | const TranslationTableHeadercxx . . $ TranslationTableHeader# *table; |
| 81 | int optc; |
| 82 | |
| 83 | set_program_namecxx . . $ set_program_name(85c52e162fed56f9).(argv[0]); |
| 84 | |
| 85 | while ((optc = getopt_longcxx . . $ getopt_long(41f665c090816971).(argc, argv, "hvq", longoptscxx . . $ longopts., NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!)) != -1) switch (optc) { |
| 86 | /* --help and --version exit immediately, per GNU coding standards. */ |
| 87 | case 'v': |
| 88 | version_etccxx . . $ version_etc(b5fd392babfe1cc5).( |
| 89 | stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, program_namecxx . . $ program_name., PACKAGE_NAMEcxx . . $ `liblouis/config.h:631:9`!, VERSIONcxx . . $ `liblouis/config.h:804:9`!, AUTHORScxx . . $ `tools/lou_checktable.c:44:9`!, (char *)NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!); |
| 90 | exitcxx . . $ exit(3ca292c338df9bb3).(EXIT_SUCCESScxx . . $ `<external>/10696550936717951914/stdlib.h:97:9`!); |
| 91 | break; |
| 92 | case 'h': |
| 93 | print_helpcxx . . $ print_help(49f6e7a06ebc5aa8).(); |
| 94 | exitcxx . . $ exit(3ca292c338df9bb3).(EXIT_SUCCESScxx . . $ `<external>/10696550936717951914/stdlib.h:97:9`!); |
| 95 | break; |
| 96 | case 'q': |
| 97 | quiet_flagcxx . . $ quiet_flag. = 1; |
| 98 | break; |
| 99 | default: |
| 100 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "Try `%s --help' for more information.\n", program_namecxx . . $ program_name.); |
| 101 | exitcxx . . $ exit(3ca292c338df9bb3).(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!); |
| 102 | break; |
| 103 | } |
| 104 | |
| 105 | if (optindcxx . . $ optind. != argc - 1) { |
| 106 | /* Print error message and exit. */ |
| 107 | if (optindcxx . . $ optind. < argc - 1) |
| 108 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "%s: extra operand: %s\n", program_namecxx . . $ program_name., argv[optindcxx . . $ optind. + 1]); |
| 109 | else |
| 110 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "%s: no table specified\n", program_namecxx . . $ program_name.); |
| 111 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "Try `%s --help' for more information.\n", program_namecxx . . $ program_name.); |
| 112 | exitcxx . . $ exit(3ca292c338df9bb3).(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!); |
| 113 | } |
| 114 | |
| 115 | if (!(table = lou_getTablecxx . . $ lou_getTable(fb668cd7b4a39b42).(argv[optindcxx . . $ optind.]))) { |
| 116 | lou_freecxx . . $ lou_free(49f6e7a06ebc5aa8).(); |
| 117 | exitcxx . . $ exit(3ca292c338df9bb3).(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!); |
| 118 | } |
| 119 | if (quiet_flagcxx . . $ quiet_flag. == 0) fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "No errors found.\n"); |
| 120 | lou_freecxx . . $ lou_free(49f6e7a06ebc5aa8).(); |
| 121 | exitcxx . . $ exit(3ca292c338df9bb3).(EXIT_SUCCESScxx . . $ `<external>/10696550936717951914/stdlib.h:97:9`!); |
| 122 | } |