xref: /titanic_41/usr/src/cmd/tic/tic_error.c (revision c40d696f8f0e05103b3795dd37198e00ae7ef955)
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 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*	Copyright (c) 1988 AT&T	*/
28 /*	  All Rights Reserved  	*/
29 
30 
31 /*
32  * University Copyright- Copyright (c) 1982, 1986, 1988
33  * The Regents of the University of California
34  * All Rights Reserved
35  *
36  * University Acknowledgment- Portions of this document are derived from
37  * software developed by the University of California, Berkeley, and its
38  * contributors.
39  */
40 
41 #pragma ident	"%Z%%M%	%I%	%E% SMI"
42 
43 /*
44  *			COPYRIGHT NOTICE
45  *
46  *	This software is copyright(C) 1982 by Pavel Curtis
47  *
48  *	Permission is granted to reproduce and distribute
49  *	this file by any means so long as no fee is charged
50  *	above a nominal handling fee and so long as this
51  *	notice is always included in the copies.
52  *
53  *	Other rights are reserved except as explicitly granted
54  *	by written permission of the author.
55  *		Pavel Curtis
56  *		Computer Science Dept.
57  *		405 Upson Hall
58  *		Cornell University
59  *		Ithaca, NY 14853
60  *
61  *		Ph- (607) 256-4934
62  *
63  *		Pavel.Cornell@Udel-Relay(ARPAnet)
64  *		decvax!cornell!pavel(UUCPnet)
65  */
66 
67 /*
68  *	tic_error.c -- Error message routines
69  *
70  *  $Log:	RCS/tic_error.v $
71  * Revision 2.1  82/10/25  14:45:31  pavel
72  * Added Copyright Notice
73  *
74  * Revision 2.0  82/10/24  15:16:32  pavel
75  * Beta-one Test Release
76  *
77  * Revision 1.3  82/08/23  22:29:31  pavel
78  * The REAL Alpha-one Release Version
79  *
80  * Revision 1.2  82/08/19  19:09:44  pavel
81  * Alpha Test Release One
82  *
83  * Revision 1.1  82/08/12  18:36:02  pavel
84  * Initial revision
85  *
86  *
87  */
88 
89 #include <unistd.h>
90 #include <stdarg.h>
91 #include <stdlib.h>
92 
93 #include "compiler.h"
94 
95 extern char *string_table;
96 extern short term_names;
97 extern char *progname;
98 
99 /* VARARGS1 */
100 void
101 warning(char *fmt, ...)
102 {
103 	va_list args;
104 
105 	va_start(args, fmt);
106 	fprintf(stderr, "%s: Warning: near line %d: ", progname, curr_line);
107 	if (string_table != NULL) {
108 		fprintf(stderr, "terminal '%s', ", string_table+term_names);
109 	}
110 	vfprintf(stderr, fmt, args);
111 	fprintf(stderr, "\n");
112 	va_end(args);
113 }
114 
115 
116 /* VARARGS1 */
117 void
118 err_abort(char *fmt, ...)
119 {
120 	va_list args;
121 
122 	va_start(args, fmt);
123 	fprintf(stderr, "%s: Line %d: ", progname, curr_line);
124 	if (string_table != NULL) {
125 		fprintf(stderr, "terminal '%s', ", string_table+term_names);
126 	}
127 	vfprintf(stderr, fmt, args);
128 	fprintf(stderr, "\n");
129 	va_end(args);
130 	exit(1);
131 }
132 
133 
134 /* VARARGS1 */
135 void
136 syserr_abort(char *fmt, ...)
137 {
138 	va_list args;
139 
140 	va_start(args, fmt);
141 	fprintf(stderr, "PROGRAM ERROR: Line %d: ", curr_line);
142 	if (string_table != NULL) {
143 		fprintf(stderr, "terminal '%s', ", string_table+term_names);
144 	}
145 	vfprintf(stderr, fmt, args);
146 	fprintf(stderr, "\n");
147 	fprintf(stderr, "*** Possibly corrupted terminfo file ***\n");
148 	va_end(args);
149 	exit(1);
150 }
151