xref: /titanic_51/usr/src/cmd/tic/tic_error.c (revision 8eea8e29cc4374d1ee24c25a07f45af132db3499)
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 2004 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 
91 #include "compiler.h"
92 #ifdef __STDC__
93 #include <stdarg.h>
94 #else
95 #include <varargs.h>
96 #endif
97 
98 extern char *string_table;
99 extern short term_names;
100 extern char *progname;
101 
102 /* VARARGS1 */
103 #ifdef __STDC__
104 void
105 warning(char *fmt, ...)
106 #else
107 warning(va_alist)
108 va_dcl
109 #endif
110 {
111 #ifndef __STDC__
112 	register char *fmt;
113 #endif
114 	va_list args;
115 
116 #ifdef __STDC__
117 	va_start(args, fmt);
118 #else
119 	va_start(args);
120 	fmt = va_arg(args, char *);
121 #endif
122 	fprintf(stderr, "%s: Warning: near line %d: ", progname, curr_line);
123 	if (string_table != NULL) {
124 		fprintf(stderr, "terminal '%s', ", string_table+term_names);
125 	}
126 	vfprintf(stderr, fmt, args);
127 	fprintf(stderr, "\n");
128 	va_end(args);
129 }
130 
131 
132 /* VARARGS1 */
133 #ifdef __STDC__
134 err_abort(char *fmt, ...)
135 #else
136 err_abort(va_alist)
137 va_dcl
138 #endif
139 {
140 #ifndef __STDC__
141 	register char *fmt;
142 #endif
143 	va_list args;
144 
145 #ifdef __STDC__
146 	va_start(args, fmt);
147 #else
148 	va_start(args);
149 	fmt = va_arg(args, char *);
150 #endif
151 	fprintf(stderr, "%s: Line %d: ", progname, curr_line);
152 	if (string_table != NULL) {
153 		fprintf(stderr, "terminal '%s', ", string_table+term_names);
154 	}
155 	vfprintf(stderr, fmt, args);
156 	fprintf(stderr, "\n");
157 	va_end(args);
158 	exit(1);
159 }
160 
161 
162 /* VARARGS1 */
163 #ifdef __STDC__
164 void
165 syserr_abort(char *fmt, ...)
166 #else
167 syserr_abort(va_alist)
168 va_dcl
169 #endif
170 {
171 #ifndef __STDC__
172 	register char *fmt;
173 #endif
174 	va_list args;
175 
176 #ifdef __STDC__
177 	va_start(args, fmt);
178 #else
179 	va_start(args);
180 	fmt = va_arg(args, char *);
181 #endif
182 	fprintf(stderr, "PROGRAM ERROR: Line %d: ", curr_line);
183 	if (string_table != NULL) {
184 		fprintf(stderr, "terminal '%s', ", string_table+term_names);
185 	}
186 	vfprintf(stderr, fmt, args);
187 	fprintf(stderr, "\n");
188 	fprintf(stderr, "*** Possibly corrupted terminfo file ***\n");
189 	va_end(args);
190 	exit(1);
191 }
192