|
|
1.1 root 1: /* $Header: Error.c,v 1.1 87/09/11 07:57:11 toddb Exp $ */
2: #ifndef lint
3: static char *sccsid = "@(#)Error.c 1.4 2/25/87";
4: #endif lint
5:
6: /*
7: * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
8: *
9: * All Rights Reserved
10: *
11: * Permission to use, copy, modify, and distribute this software and its
12: * documentation for any purpose and without fee is hereby granted,
13: * provided that the above copyright notice appear in all copies and that
14: * both that copyright notice and this permission notice appear in
15: * supporting documentation, and that the name of Digital Equipment
16: * Corporation not be used in advertising or publicity pertaining to
17: * distribution of the software without specific, written prior permission.
18: *
19: *
20: * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
21: * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
22: * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
23: * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
24: * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
25: * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
26: * SOFTWARE.
27: */
28:
29:
30: #include "Xlib.h"
31: #include <stdio.h>
32: #include "Intrinsic.h"
33:
34: #define num_error_codes 3
35:
36: char *XtErrorList[num_error_codes + 1] = {
37: /* No error */ "",
38: /* XtNOMEM */ "insufficient resources, bad alloc",
39: /* XCNOENT */ "No entry in table ",
40: /* XtFOPEN */ "fopen failed ",
41: };
42:
43:
44: char *XtErrDescrip (code)
45: register int code;
46: {
47: if (code <= num_error_codes && code > 0)
48: return (XtErrorList[code]);
49: return("Unknown error");
50: }
51:
52: int _XtError (errorCode)
53: int errorCode;
54: {
55: extern void exit();
56: (void) fprintf(stderr, "X Toolkit Error: %s\n", XtErrDescrip (errorCode));
57: (void) fprintf(stderr, " Reference Count: %d\n", XtreferenceCount);
58: exit(1);
59: }
60:
61:
62: void XtErrorHandler(handler)
63: register int (*handler)();
64: {
65: if (handler != NULL) {
66: XtErrorFunction = handler;
67: }
68: else {
69: XtErrorFunction = _XtError;
70: }
71: }
72:
73:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.