2 /***************************************************************************
4 ****************************************************************************
5 * ncurses is copyright (C) 1992-1995 *
7 * zmbenhal@netcom.com *
9 * esr@snark.thyrsus.com *
11 * Permission is hereby granted to reproduce and distribute ncurses *
12 * by any means and for any fee, whether alone or as part of a *
13 * larger distribution, in source or in binary form, PROVIDED *
14 * this notice is included with any such distribution, and is not *
15 * removed from any of its header files. Mention of ncurses in any *
16 * applications linked with it is highly appreciated. *
18 * ncurses comes AS IS with no warranty, implied or expressed. *
20 ***************************************************************************/
24 * comp_error.c -- Error message routines
28 #include <curses.priv.h>
32 MODULE_ID("$Id: comp_error.c,v 1.12 1996/12/21 14:24:06 tom Exp $")
34 bool _nc_suppress_warnings;
36 static const char *sourcename;
37 static char termtype[MAX_NAME_SIZE+1];
39 void _nc_set_source(const char *const name)
44 void _nc_set_type(const char *const name)
47 strncpy( termtype, name, MAX_NAME_SIZE );
52 void _nc_get_type(char *name)
54 strcpy( name, termtype );
57 static inline void where_is_problem(void)
59 fprintf (stderr, "\"%s\"", sourcename);
60 if (_nc_curr_line >= 0)
61 fprintf (stderr, ", line %d", _nc_curr_line);
62 if (_nc_curr_col >= 0)
63 fprintf (stderr, ", col %d", _nc_curr_col);
65 fprintf (stderr, ", terminal '%s'", termtype);
70 void _nc_warning(const char *const fmt, ...)
74 if (_nc_suppress_warnings)
79 vfprintf (stderr, fmt, argp);
80 fprintf (stderr, "\n");
85 void _nc_err_abort(const char *const fmt, ...)
91 vfprintf (stderr, fmt, argp);
92 fprintf (stderr, "\n");
98 void _nc_syserr_abort(const char *const fmt, ...)
104 vfprintf (stderr, fmt, argp);
105 fprintf (stderr, "\n");