Expand PMF_FN_* macros.
[netbsd-mini2440.git] / usr.sbin / sup / source / quit.c
blob4593dba0562d22f9630d39514afec7c988c7013c
1 /* $NetBSD: quit.c,v 1.5 2002/07/10 20:19:41 wiz Exp $ */
3 /*
4 * Copyright (c) 1991 Carnegie Mellon University
5 * All Rights Reserved.
7 * Permission to use, copy, modify and distribute this software and its
8 * documentation is hereby granted, provided that both the copyright
9 * notice and this permission notice appear in all copies of the
10 * software, derivative works or modified versions, and any portions
11 * thereof, and that both notices appear in supporting documentation.
13 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
14 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
15 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
17 * Carnegie Mellon requests users of this software to return to
19 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
20 * School of Computer Science
21 * Carnegie Mellon University
22 * Pittsburgh PA 15213-3890
24 * any improvements or extensions that they make and grant Carnegie the rights
25 * to redistribute these changes.
28 * quit -- print message and exit
30 * Usage: quit (status,format [,arg]...);
31 * int status;
32 * (... format and arg[s] make up a printf-arglist)
34 * Quit is a way to easily print an arbitrary message and exit.
35 * It is most useful for error exits from a program:
36 * if (open (...) < 0) then quit (1,"Can't open...",file);
38 **********************************************************************
39 * HISTORY
40 * Revision 1.2 88/12/13 13:52:41 gm0w
41 * Rewritten to use varargs.
42 * [88/12/13 gm0w]
44 **********************************************************************
47 #include <stdio.h>
48 #include "supcdefs.h"
49 #include "supextern.h"
51 void
52 quit(int status, const char *fmt, ...)
54 va_list args;
56 va_start(args, fmt);
57 fflush(stdout);
58 (void) vfprintf(stderr, fmt, args);
59 va_end(args);
60 exit(status);