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