Wed Jun 5 15:57:28 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
[glibc.git] / mach / mach_error.c
blob6cac0a5a7c483b674128e621f0b816070266b53a
1 /*
2 * Mach Operating System
3 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
4 * All Rights Reserved.
5 *
6 * Permission to use, copy, modify and distribute this software and its
7 * documentation is hereby granted, provided that both the copyright
8 * notice and this permission notice appear in all copies of the
9 * software, derivative works or modified versions, and any portions
10 * thereof, and that both notices appear in supporting documentation.
12 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
16 * Carnegie Mellon requests users of this software to return to
18 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
19 * School of Computer Science
20 * Carnegie Mellon University
21 * Pittsburgh PA 15213-3890
23 * any improvements or extensions that they make and grant Carnegie Mellon
24 * the rights to redistribute these changes.
27 * HISTORY
28 * $Log$
29 * Revision 1.1 1992/10/06 18:29:54 roland
30 * entered into RCS
32 * Revision 2.4 92/02/19 15:10:52 elf
33 * Moved mach_error_string and mach_error_type to mach_error_string.c.
34 * [92/02/11 rpd]
36 * Revision 2.3 92/01/23 15:22:06 rpd
37 * Changed <servers/errorlib.h> to <errorlib.h>.
38 * [92/01/16 rpd]
40 * Revision 2.2 92/01/16 00:08:03 rpd
41 * Moved from user collection to mk collection.
43 * Revision 2.3 91/08/29 15:51:50 rpd
44 * Changed IPC_MIG_MOD to MACH_IPC_MIG_MOD, to get the new error strings.
45 * [91/08/22 rpd]
47 * Revision 2.2 91/03/27 16:06:29 mrt
48 * Changed include of "errorlib.h" to <servers/errorlib.h>
49 * Added new copyright
50 * [91/03/20 mrt]
54 * File: mach_error.c
55 * Author: Douglas Orr, Carnegie Mellon University
56 * Date: Mar 1988
58 * interprets structured mach error codes and prints
59 * or returns a descriptive string.
62 #include <stdio.h>
63 #include <mach_error.h>
64 #include <mach/boolean.h>
66 extern char * mach_error_string_int();
68 void
69 mach_error( str, err )
70 char *str;
71 mach_error_t err;
73 char * err_str;
74 char buf[1024];
75 boolean_t diag;
77 err_str=mach_error_string_int(err, &diag);
79 if ( diag ) {
80 sprintf( buf, "%s %s (%x)", mach_error_type(err), err_str, err );
81 err_str = buf;
84 fprintf(stderr, "%s %s\n", str, err_str);