xref: /titanic_44/usr/src/cmd/sgs/tsort/common/errmsg.h (revision d6555420322a42c16b93414c29a62f8e841abc7b)
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 /*
24  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
25  * Use is subject to license terms.
26  */
27 
28 /*	Copyright (c) 1988 AT&T	*/
29 /*	  All Rights Reserved  	*/
30 
31 
32 #ifndef _ERRMSG_H
33 #define	_ERRMSG_H
34 
35 #pragma ident	"%Z%%M%	%I%	%E% SMI"
36 
37 /*
38  * errmsg.h
39  *	Include file for error message interface.
40  *	Command and library version.
41  */
42 
43 #define	errmsg	errtag(__FILE__, __LINE__), errtext
44 
45 void erraction(int action);
46 int errafter(int severity, char *format, ...);
47 void errbefore(int severity, char *format, ...);
48 int errexit(int e);
49 void _errmsg(char *tag, int severity, char *format, ...);
50 void errprefix(char *str);
51 void errsource(char *str);
52 void errtag(char *str, int num);
53 void errtext(int severity, char *format, ...);
54 void errtofix(char *str);
55 void errusage(char *format, ...);
56 char *errstrtok(char *string, char *sepset);
57 void errverb(char *s);
58 
59 /* severities  first argument to errbefore(), errafter(), errtext() */
60 #define	EIGNORE	-1	/* special severity, no message, no action, returns */
61 #define	EINFO	0
62 #define	EWARN	1
63 #define	EERROR	2
64 #define	EHALT	3
65 
66 /* special errtext() argument that prints a standard message based on errno */
67 #define	EERRNO	1
68 
69 /*
70  * actions : returned by errafter() used as an argument to erraction()
71  */
72 #define	EEXIT	100
73 #define	EABORT  200
74 #define	ERETURN 300
75 
76 /* used to set verbosity */
77 #define	ENO	0
78 #define	EYES	1
79 #define	EDEF	2   /* default value -- setting ersyserr */
80 
81 struct Err {
82 			/* flags to adjust verbosity */
83 	char	vbell;	/* ring bell before message */
84 	char	vprefix;
85 	char	vsource;	/* source information, including prefix */
86 	char	vsevmsg;	/* severity message */
87 	char	vsyserr;	/* system error message, perror() */
88 	char	vfix;	/* to fix msg */
89 	char	vtag;
90 	char	vtext;
91 			/* message content and context */
92 	char	*prefix;	/* usually unique per manufacturer */
93 	char	*envsource;	/* source from ERRSOURCE environment variable */
94 	char	*source;	/* usually command name */
95 	int	severity;
96 	char	**sevmsg;	/* error messages that depend on severity */
97 	char	*tofix;  /* set by errtofix()  */
98 	int	tagnum;
99 	char	*tagstr;
100 	int	exit;	/* exit(2) code to use if error causes exit */
101 };
102 
103 extern struct Err	Err;
104 
105 #include	<stdio.h>
106 #include	<sys/types.h>
107 
108 extern void *zmalloc(int severity, size_t n);
109 FILE *zfopen(int severity, char *path, char *type);
110 
111 #endif /* _ERRMSG_H */
112