1*7034f964Sespie /* $OpenBSD: exit.c,v 1.9 2004/01/03 14:08:53 espie Exp $ */
279dbd5ceSniklas /* $NetBSD: exit.c,v 1.11 1996/12/01 20:22:19 pk Exp $ */
3df930be7Sderaadt
4df930be7Sderaadt /*-
5df930be7Sderaadt * Copyright (c) 1993 John Brezak
6df930be7Sderaadt * All rights reserved.
7df930be7Sderaadt *
8df930be7Sderaadt * Redistribution and use in source and binary forms, with or without
9df930be7Sderaadt * modification, are permitted provided that the following conditions
10df930be7Sderaadt * are met:
11df930be7Sderaadt * 1. Redistributions of source code must retain the above copyright
12df930be7Sderaadt * notice, this list of conditions and the following disclaimer.
13df930be7Sderaadt * 2. Redistributions in binary form must reproduce the above copyright
14df930be7Sderaadt * notice, this list of conditions and the following disclaimer in the
15df930be7Sderaadt * documentation and/or other materials provided with the distribution.
16df930be7Sderaadt * 3. The name of the author may not be used to endorse or promote products
17df930be7Sderaadt * derived from this software without specific prior written permission.
18df930be7Sderaadt *
19df930be7Sderaadt * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR
20df930be7Sderaadt * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21df930be7Sderaadt * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22df930be7Sderaadt * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
23df930be7Sderaadt * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24df930be7Sderaadt * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25df930be7Sderaadt * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26df930be7Sderaadt * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27df930be7Sderaadt * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28df930be7Sderaadt * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29df930be7Sderaadt * POSSIBILITY OF SUCH DAMAGE.
30df930be7Sderaadt */
3128afbff9Smillert
32*7034f964Sespie #include <sys/stdarg.h>
33df930be7Sderaadt
34df930be7Sderaadt #include "stand.h"
35df930be7Sderaadt
36df930be7Sderaadt __dead void
panic(const char * fmt,...)37df930be7Sderaadt panic(const char *fmt, ...)
38df930be7Sderaadt {
39c4071fd1Smillert extern void closeall(void);
40df930be7Sderaadt va_list ap;
41df930be7Sderaadt static int paniced;
42df930be7Sderaadt
43df930be7Sderaadt if (!paniced) {
44df930be7Sderaadt paniced = 1;
45df930be7Sderaadt closeall();
46df930be7Sderaadt }
47df930be7Sderaadt
48df930be7Sderaadt va_start(ap, fmt);
499f13aad2Sniklas vprintf(fmt, ap);
50df930be7Sderaadt printf("\n");
51df930be7Sderaadt va_end(ap);
52df930be7Sderaadt _rtt();
53df930be7Sderaadt /*NOTREACHED*/
54df930be7Sderaadt }
55df930be7Sderaadt
56df930be7Sderaadt void
exit(void)57599546b3Sderaadt exit(void)
58df930be7Sderaadt {
59df930be7Sderaadt panic("exit");
60df930be7Sderaadt /*NOTREACHED*/
61df930be7Sderaadt }
62