1 /*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22 /*
23 * Copyright (c) 1996, by Sun Microsystems, Inc.
24 * All rights reserved.
25 */
26
27 #pragma ident "%Z%%M% %I% %E% SMI"
28
29 /*
30 * ticerror.c Terminal Information Compiler
31 *
32 * Copyright 1990, 1992 by Mortice Kern Systems Inc. All rights reserved.
33 *
34 * Portions of this code Copyright 1982 by Pavel Curtis.
35 *
36 */
37
38 #ifdef M_RCSID
39 #ifndef lint
40 static char const rcsID[] = "$Header: /rd/src/tic/rcs/ticerror.c 1.14 1995/06/22 18:11:44 ant Exp $";
41 #endif
42 #endif
43
44 #include "tic.h"
45 #include <stdarg.h>
46
47 int warnings = 0;
48
49 /*f
50 * Display warning message.
51 */
52 void
warning(char const * f,...)53 warning (char const *f, ...)
54 {
55 va_list ap;
56 char *fmt = m_msgdup((char *) f);
57
58 va_start(ap, f);
59
60 (void) fprintf(
61 stderr, m_textmsg(3101, "%s: Warning in \"%s\" line %u,\n", "W _ filename line_num"),
62 _cmdname, source_file, curr_line
63 );
64
65 (void) vfprintf(stderr, fmt, ap);
66 va_end(ap);
67 (void) fputc('\n', stderr);
68
69 m_msgfree(fmt);
70 warnings++;
71 return;
72 }
73
74 /*f
75 * Display error message.
76 */
77 void
err_abort(char const * f,...)78 err_abort (char const *f, ...)
79 {
80 va_list ap;
81 char *fmt = m_msgdup((char *) f);
82
83 va_start(ap, f);
84
85 (void) fprintf(
86 stderr, m_textmsg(3102, "%s: Error in \"%s\" line %u,\n", "E _ filename line_num"),
87 _cmdname, source_file, curr_line
88 );
89
90 (void) vfprintf(stderr, fmt, ap);
91 va_end(ap);
92 (void) fputc('\n', stderr);
93
94 m_msgfree(fmt);
95 exit(1);
96 }
97
98