xref: /onnv-gate/usr/src/cmd/tic/tic_error.c (revision 350:06f97f931994)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
50Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
60Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
70Sstevel@tonic-gate  * with the License.
80Sstevel@tonic-gate  *
90Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
100Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
110Sstevel@tonic-gate  * See the License for the specific language governing permissions
120Sstevel@tonic-gate  * and limitations under the License.
130Sstevel@tonic-gate  *
140Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
150Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
160Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
170Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
180Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
190Sstevel@tonic-gate  *
200Sstevel@tonic-gate  * CDDL HEADER END
210Sstevel@tonic-gate  */
220Sstevel@tonic-gate /*
23*350Sdp  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
240Sstevel@tonic-gate  * Use is subject to license terms.
250Sstevel@tonic-gate  */
260Sstevel@tonic-gate 
270Sstevel@tonic-gate /*	Copyright (c) 1988 AT&T	*/
280Sstevel@tonic-gate /*	  All Rights Reserved  	*/
290Sstevel@tonic-gate 
300Sstevel@tonic-gate 
310Sstevel@tonic-gate /*
320Sstevel@tonic-gate  * University Copyright- Copyright (c) 1982, 1986, 1988
330Sstevel@tonic-gate  * The Regents of the University of California
340Sstevel@tonic-gate  * All Rights Reserved
350Sstevel@tonic-gate  *
360Sstevel@tonic-gate  * University Acknowledgment- Portions of this document are derived from
370Sstevel@tonic-gate  * software developed by the University of California, Berkeley, and its
380Sstevel@tonic-gate  * contributors.
390Sstevel@tonic-gate  */
400Sstevel@tonic-gate 
410Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
420Sstevel@tonic-gate 
430Sstevel@tonic-gate /*
440Sstevel@tonic-gate  *			COPYRIGHT NOTICE
450Sstevel@tonic-gate  *
460Sstevel@tonic-gate  *	This software is copyright(C) 1982 by Pavel Curtis
470Sstevel@tonic-gate  *
480Sstevel@tonic-gate  *	Permission is granted to reproduce and distribute
490Sstevel@tonic-gate  *	this file by any means so long as no fee is charged
500Sstevel@tonic-gate  *	above a nominal handling fee and so long as this
510Sstevel@tonic-gate  *	notice is always included in the copies.
520Sstevel@tonic-gate  *
530Sstevel@tonic-gate  *	Other rights are reserved except as explicitly granted
540Sstevel@tonic-gate  *	by written permission of the author.
550Sstevel@tonic-gate  *		Pavel Curtis
560Sstevel@tonic-gate  *		Computer Science Dept.
570Sstevel@tonic-gate  *		405 Upson Hall
580Sstevel@tonic-gate  *		Cornell University
590Sstevel@tonic-gate  *		Ithaca, NY 14853
600Sstevel@tonic-gate  *
610Sstevel@tonic-gate  *		Ph- (607) 256-4934
620Sstevel@tonic-gate  *
630Sstevel@tonic-gate  *		Pavel.Cornell@Udel-Relay(ARPAnet)
640Sstevel@tonic-gate  *		decvax!cornell!pavel(UUCPnet)
650Sstevel@tonic-gate  */
660Sstevel@tonic-gate 
670Sstevel@tonic-gate /*
680Sstevel@tonic-gate  *	tic_error.c -- Error message routines
690Sstevel@tonic-gate  *
700Sstevel@tonic-gate  *  $Log:	RCS/tic_error.v $
710Sstevel@tonic-gate  * Revision 2.1  82/10/25  14:45:31  pavel
720Sstevel@tonic-gate  * Added Copyright Notice
730Sstevel@tonic-gate  *
740Sstevel@tonic-gate  * Revision 2.0  82/10/24  15:16:32  pavel
750Sstevel@tonic-gate  * Beta-one Test Release
760Sstevel@tonic-gate  *
770Sstevel@tonic-gate  * Revision 1.3  82/08/23  22:29:31  pavel
780Sstevel@tonic-gate  * The REAL Alpha-one Release Version
790Sstevel@tonic-gate  *
800Sstevel@tonic-gate  * Revision 1.2  82/08/19  19:09:44  pavel
810Sstevel@tonic-gate  * Alpha Test Release One
820Sstevel@tonic-gate  *
830Sstevel@tonic-gate  * Revision 1.1  82/08/12  18:36:02  pavel
840Sstevel@tonic-gate  * Initial revision
850Sstevel@tonic-gate  *
860Sstevel@tonic-gate  *
870Sstevel@tonic-gate  */
880Sstevel@tonic-gate 
890Sstevel@tonic-gate #include <unistd.h>
90*350Sdp #include <stdarg.h>
91*350Sdp #include <stdlib.h>
920Sstevel@tonic-gate 
930Sstevel@tonic-gate #include "compiler.h"
940Sstevel@tonic-gate 
950Sstevel@tonic-gate extern char *string_table;
960Sstevel@tonic-gate extern short term_names;
970Sstevel@tonic-gate extern char *progname;
980Sstevel@tonic-gate 
990Sstevel@tonic-gate /* VARARGS1 */
1000Sstevel@tonic-gate void
warning(char * fmt,...)1010Sstevel@tonic-gate warning(char *fmt, ...)
1020Sstevel@tonic-gate {
1030Sstevel@tonic-gate 	va_list args;
1040Sstevel@tonic-gate 
1050Sstevel@tonic-gate 	va_start(args, fmt);
1060Sstevel@tonic-gate 	fprintf(stderr, "%s: Warning: near line %d: ", progname, curr_line);
1070Sstevel@tonic-gate 	if (string_table != NULL) {
1080Sstevel@tonic-gate 		fprintf(stderr, "terminal '%s', ", string_table+term_names);
1090Sstevel@tonic-gate 	}
1100Sstevel@tonic-gate 	vfprintf(stderr, fmt, args);
1110Sstevel@tonic-gate 	fprintf(stderr, "\n");
1120Sstevel@tonic-gate 	va_end(args);
1130Sstevel@tonic-gate }
1140Sstevel@tonic-gate 
1150Sstevel@tonic-gate 
1160Sstevel@tonic-gate /* VARARGS1 */
117*350Sdp void
err_abort(char * fmt,...)1180Sstevel@tonic-gate err_abort(char *fmt, ...)
1190Sstevel@tonic-gate {
1200Sstevel@tonic-gate 	va_list args;
1210Sstevel@tonic-gate 
1220Sstevel@tonic-gate 	va_start(args, fmt);
1230Sstevel@tonic-gate 	fprintf(stderr, "%s: Line %d: ", progname, curr_line);
1240Sstevel@tonic-gate 	if (string_table != NULL) {
1250Sstevel@tonic-gate 		fprintf(stderr, "terminal '%s', ", string_table+term_names);
1260Sstevel@tonic-gate 	}
1270Sstevel@tonic-gate 	vfprintf(stderr, fmt, args);
1280Sstevel@tonic-gate 	fprintf(stderr, "\n");
1290Sstevel@tonic-gate 	va_end(args);
1300Sstevel@tonic-gate 	exit(1);
1310Sstevel@tonic-gate }
1320Sstevel@tonic-gate 
1330Sstevel@tonic-gate 
1340Sstevel@tonic-gate /* VARARGS1 */
1350Sstevel@tonic-gate void
syserr_abort(char * fmt,...)1360Sstevel@tonic-gate syserr_abort(char *fmt, ...)
1370Sstevel@tonic-gate {
1380Sstevel@tonic-gate 	va_list args;
1390Sstevel@tonic-gate 
1400Sstevel@tonic-gate 	va_start(args, fmt);
1410Sstevel@tonic-gate 	fprintf(stderr, "PROGRAM ERROR: Line %d: ", curr_line);
1420Sstevel@tonic-gate 	if (string_table != NULL) {
1430Sstevel@tonic-gate 		fprintf(stderr, "terminal '%s', ", string_table+term_names);
1440Sstevel@tonic-gate 	}
1450Sstevel@tonic-gate 	vfprintf(stderr, fmt, args);
1460Sstevel@tonic-gate 	fprintf(stderr, "\n");
1470Sstevel@tonic-gate 	fprintf(stderr, "*** Possibly corrupted terminfo file ***\n");
1480Sstevel@tonic-gate 	va_end(args);
1490Sstevel@tonic-gate 	exit(1);
1500Sstevel@tonic-gate }
151