~ubuntu-branches/debian/jessie/liblouis/jessie

« back to all changes in this revision

Viewing changes to tools/lou_allround.c

  • Committer: Bazaar Package Importer
  • Author(s): Samuel Thibault
  • Date: 2010-01-12 23:48:47 UTC
  • mto: (1.1.4 upstream) (5.2.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: james.westby@ubuntu.com-20100112234847-ph9xdk3lrjdox6ks
ImportĀ upstreamĀ versionĀ 1.8.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
   Based on the Linux screenreader BRLTTY, copyright (C) 1999-2006 by
5
5
   The BRLTTY Team
6
6
 
7
 
   Copyright (C) 2004, 2005, 2006
8
 
   ViewPlus Technologies, Inc. www.viewplus.com
9
 
   and
 
7
   Copyright (C) 2004, 2005, 2006, 2009
 
8
   ViewPlus Technologies, Inc. www.viewplus.com and
10
9
   JJB Software, Inc. www.jjb-software.com
11
 
   All rights reserved
12
 
 
13
 
   This file is free software; you can redistribute it and/or modify it
14
 
   under the terms of the Lesser or Library GNU General Public License 
15
 
   as published by the
16
 
   Free Software Foundation; either version 3, or (at your option) any
17
 
   later version.
18
 
 
19
 
   This file is distributed in the hope that it will be useful, but
20
 
   WITHOUT ANY WARRANTY; without even the implied warranty of
21
 
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
22
 
   Library GNU General Public License for more details.
23
 
 
24
 
   You should have received a copy of the Library GNU General Public 
25
 
   License along with this program; see the file COPYING.  If not, write to
26
 
   the Free Software Foundation, 51 Franklin Street, Fifth Floor,
27
 
   Boston, MA 02110-1301, USA.
 
10
 
 
11
   This program is free software: you can redistribute it and/or modify
 
12
   it under the terms of the GNU General Public License as published by
 
13
   the Free Software Foundation, either version 3 of the License, or
 
14
   (at your option) any later version.
 
15
   
 
16
   This program is distributed in the hope that it will be useful,
 
17
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
18
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
19
   GNU General Public License for more details.
 
20
   
 
21
   You should have received a copy of the GNU General Public License
 
22
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
28
23
 
29
24
   Maintained by John J. Boyer john.boyer@jjb-software.com
30
25
   */
31
26
 
 
27
#ifdef HAVE_CONFIG_H
 
28
# include "config.h"
 
29
#endif
 
30
 
32
31
#include <stdio.h>
33
32
#include <string.h>
34
33
#include <stdlib.h>
35
34
#include "liblouis.h"
36
35
#include "louis.h"
 
36
#include <getopt.h>
 
37
#include "progname.h"
 
38
#include "version-etc.h"
 
39
 
 
40
static const struct option longopts[] =
 
41
{
 
42
  { "help", no_argument, NULL, 'h' },
 
43
  { "version", no_argument, NULL, 'v' },
 
44
  { NULL, 0, NULL, 0 }
 
45
};
 
46
 
 
47
const char version_etc_copyright[] =
 
48
  "Copyright %s %d ViewPlus Technologies, Inc. and JJB Software, Inc.";
 
49
 
 
50
#define AUTHORS "John J. Boyer"
 
51
 
 
52
static void
 
53
print_help (void)
 
54
{
 
55
  printf ("\
 
56
Usage: %s [OPTION]\n", program_name);
 
57
  
 
58
  fputs ("\
 
59
This program tests every capability of the liblouis library. It is\n\
 
60
completely interactive. \n\n", stdout);
 
61
 
 
62
  fputs ("\
 
63
  -h, --help          display this help and exit\n\
 
64
  -v, --version       display version information and exit\n", stdout);
 
65
 
 
66
  printf ("\n");
 
67
  printf ("\
 
68
Report bugs to <%s>.\n", PACKAGE_BUGREPORT);
 
69
}
 
70
 
37
71
#define BUFSIZE 256
38
72
 
39
73
static char inputBuffer[BUFSIZE];
220
254
}
221
255
 
222
256
int
223
 
main ()
 
257
main (int argc, char **argv)
224
258
{
225
259
  widechar inbuf[BUFSIZE];
226
260
  widechar transbuf[BUFSIZE];
233
267
  int cursorPos;
234
268
  int realInlen = 0;
235
269
  int k;
 
270
  int optc;
 
271
 
 
272
  set_program_name (argv[0]);
 
273
 
 
274
  while ((optc = getopt_long (argc, argv, "hv", longopts, NULL)) != -1)
 
275
    switch (optc)
 
276
      {
 
277
      /* --help and --version exit immediately, per GNU coding standards.  */
 
278
      case 'v':
 
279
        version_etc (stdout, program_name, PACKAGE_NAME, VERSION, AUTHORS, (char *) NULL);
 
280
        exit (EXIT_SUCCESS);
 
281
        break;
 
282
      case 'h':
 
283
        print_help ();
 
284
        exit (EXIT_SUCCESS);
 
285
        break;
 
286
      default:
 
287
        fprintf (stderr, "Try `%s --help' for more information.\n",
 
288
                 program_name);
 
289
        exit (EXIT_FAILURE);
 
290
        break;
 
291
      }
 
292
 
 
293
  if (optind < argc)
 
294
    {
 
295
      /* Print error message and exit.  */
 
296
      fprintf (stderr, "%s: extra operand: %s\n",
 
297
               program_name, argv[optind]);
 
298
      fprintf (stderr, "Try `%s --help' for more information.\n",
 
299
               program_name);
 
300
      exit (EXIT_FAILURE);
 
301
    }
 
302
 
236
303
  validTable = NULL;
237
304
  enteredCursorPos = -1;
238
305
  mode = 0;