1 /*
2 * GNU Typist - interactive typing tutor program for UNIX systems
3 *
4 * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
5 * Simon Baldwin (simonb@sco.com)
6 * Copyright (C) 2003 GNU Typist Development Team <bug-gtypist@gnu.org>
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21 #include "config.h"
22 #include "error.h"
23 #include "script.h"
24
25 #ifdef HAVE_PDCURSES
26 #include <curses.h>
27 #else
28 #include <ncurses.h>
29 #endif
30
31 #include <stdlib.h>
32
33 #include "gettext.h"
34 #define _(String) gettext (String)
35
36 char *argv0 = NULL;
37
38 /*
39 handle fatal errors (pretty much any error) by dropping out
40 of curses etc, and printing a complaint
41 message that is already translated to the appropriate language
42 */
fatal_error(const char * message,const char * line)43 void fatal_error (const char *message, const char *line)
44 {
45 /* stop curses */
46 /* if ( cl_colour && has_colors() ) */
47 wbkgdset( stdscr, 0 );
48 clear(); refresh(); endwin();
49
50 /* print out the error message and stop */
51 fprintf( stderr, "%s: %s %d: %s", argv0, _("line"), global_line_counter,
52 message );
53 if ( line != NULL )
54 fprintf( stderr, ":\n%s\n", line );
55 else
56 fprintf( stderr, "\n" );
57 exit( 1 );
58 }
59
60 /*
61 Local Variables:
62 tab-width: 8
63 End:
64 */
65