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 /* Copyright (c) 1988 AT&T */ 23 /* All Rights Reserved */ 24 25 26 /* 27 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 28 * Use is subject to license terms. 29 */ 30 31 #pragma ident "%Z%%M% %I% %E% SMI" 32 33 /*LINTLIBRARY*/ 34 35 /* errmsg.h 36 Include file for error message interface. 37 Command and library version. 38 */ 39 40 #define errmsg errtag( __FILE__, __LINE__ ), errtext 41 42 extern void erraction(); 43 extern int errafter(); /* routine run after text is printed */ 44 extern void errbefore(); /* routine run before text is printed */ 45 extern int errexit(); /* exit(2) code for actions that exit */ 46 extern void _errmsg(char *tag, int severity, char *format, ...); 47 extern void errprefix(); /* prefix to error message, unique to each 48 supplier */ 49 extern void errsource(); /* source of error message, usually command name 50 */ 51 extern void errtag(); 52 extern void errtext(int severity, char *format, ...); 53 extern void errtofix(); 54 extern void errusage(char *format, ...); /* routine to print command usage message */ 55 extern void errverb(); /* adjust verbosity of error messages */ 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 /* actions : returned by errafter() used as an argument to erraction() 68 */ 69 #define EEXIT 100 70 #define EABORT 200 71 #define ERETURN 300 72 73 /* used to set verbosity */ 74 #define ENO 0 75 #define EYES 1 76 #define EDEF 2 /* default value -- setting ersyserr */ 77 78 struct Err { 79 /* flags to adjust verbosity */ 80 char vbell; /* ring bell before message */ 81 char vprefix; 82 char vsource; /* source information, including prefix */ 83 char vsevmsg; /* severity message */ 84 char vsyserr; /* system error message, perror() */ 85 char vfix; /* to fix msg */ 86 char vtag; 87 char vtext; 88 /* message content and context */ 89 char *prefix; /* usually unique per manufacturer */ 90 char *envsource; /* source from ERRSOURCE environmental variable 91 */ 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 extern struct Err Err; 101 102 /* declare Common Library Functions (CLF) 103 stdio.h needs to be defined (stdio.h handles itself properly if it is 104 included more than once). 105 */ 106 107 #include <stdio.h> 108 #include <sys/types.h> 109 110 extern int zaccess(); 111 extern int zacct(); 112 extern char *zcalloc(); 113 extern int zchdir(); 114 extern int zchmod(); 115 extern int zchown(); 116 extern int zchroot(); 117 extern int zclose(); 118 extern int zcreat(); 119 extern char *zcuserid(); 120 extern int zdup(); 121 extern int zexecvp(); 122 extern int zfclose(); 123 extern int zfcntl(); 124 extern int zferror(); 125 extern int zfread(); 126 extern int zfseek(); 127 extern int zfstat(); 128 extern int zfwrite(); 129 extern int zioctl(); 130 extern int zkill(); 131 extern int zlink(); 132 extern long zlseek(); 133 extern char *zmalloc(); 134 extern int zmknod(); 135 extern int zmount(); 136 extern int znice(); 137 extern int zopen(); 138 extern int zpipe(); 139 extern int zplock(); 140 extern int zptrace(); 141 extern int zread(); 142 extern char *zrealloc(); 143 extern int zsetgid(); 144 extern int zsetuid(); 145 extern int zstat(); 146 extern daddr_t zulimit(); 147 extern int zumount(); 148 extern int zuname(); 149 extern int zunlink(); 150 extern int zwait(); 151 extern int zwrite(); 152 extern FILE *zfopen(); 153