ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/host/ihost-perl/plugins/libukcprog/panic.c
Revision: 1.2
Committed: Fri Mar 28 16:30:32 2003 UTC (21 years, 7 months ago) by tdb
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +1 -1 lines
State: FILE REMOVED
Error occurred while calculating annotation data.
Log Message:
Removed some un-used code from CVS. We can always resurrect this later if
someone feels they want to work on it. Gone are the old perl ihost which
isn't needed now, winhost which is broken and shows no sign of being fixed,
and DBReporter. If someone wants to revive them, I'll undelete them :-)

File Contents

# Content
1 /* panic.c -- Call a user user-defined panic handling routine and abort() */
2
3 /* Copyright 1992 Godfrey Paul, University of Kent at Canterbury.
4 *
5 * You can do what you like with this source code as long as
6 * you don't try to make money out of it and you include an
7 * unaltered copy of this message (including the copyright).
8 */
9
10 char ukcprog_panic_sccsid[] = "$Id: panic.c,v 1.1 2002/03/08 14:37:29 tdb Exp $ UKC";
11
12 #include <stdio.h>
13 #include <stdlib.h>
14
15 #include "ukcprog.h"
16
17
18 static panic_handler_t User_panic_handler = NULL;
19
20
21 /*
22 * install_panic_handler()
23 * Installs a new panic handler, returns the old one.
24 */
25 panic_handler_t
26 install_panic_handler(handler)
27 panic_handler_t handler;
28 {
29 panic_handler_t old;
30
31 old = User_panic_handler;
32 User_panic_handler = handler;
33
34 return old;
35 }
36
37
38 /*
39 * panic()
40 * Called when the world has ended. If a user-defined routine exists,
41 * call it with the given message as an argument. If not, or if it
42 * returns, print a suitable message and abort.
43 */
44 void
45 panic(message)
46 const char *message;
47 {
48 if (User_panic_handler != NULL)
49 (*User_panic_handler)(message);
50
51 fprintf(stderr, "Fatal internal error: %s (aborting) ...\n", message);
52 fflush(stderr);
53 abort();
54 }