1*04723c3fSchristos /* $NetBSD: fatal.c,v 1.5 2005/11/28 03:26:06 christos Exp $ */
2b8625712Sjdolecek
3b8625712Sjdolecek /*
4b8625712Sjdolecek * Copyright (c) 1983, 1993
5b8625712Sjdolecek * The Regents of the University of California. All rights reserved.
6b8625712Sjdolecek * (c) UNIX System Laboratories, Inc.
7b8625712Sjdolecek * All or some portions of this file are derived from material licensed
8b8625712Sjdolecek * to the University of California by American Telephone and Telegraph
9b8625712Sjdolecek * Co. or Unix System Laboratories, Inc. and are reproduced herein with
10b8625712Sjdolecek * the permission of UNIX System Laboratories, Inc.
11b8625712Sjdolecek *
12b8625712Sjdolecek * Redistribution and use in source and binary forms, with or without
13b8625712Sjdolecek * modification, are permitted provided that the following conditions
14b8625712Sjdolecek * are met:
15b8625712Sjdolecek * 1. Redistributions of source code must retain the above copyright
16b8625712Sjdolecek * notice, this list of conditions and the following disclaimer.
17b8625712Sjdolecek * 2. Redistributions in binary form must reproduce the above copyright
18b8625712Sjdolecek * notice, this list of conditions and the following disclaimer in the
19b8625712Sjdolecek * documentation and/or other materials provided with the distribution.
20326b2259Sagc * 3. Neither the name of the University nor the names of its contributors
21b8625712Sjdolecek * may be used to endorse or promote products derived from this software
22b8625712Sjdolecek * without specific prior written permission.
23b8625712Sjdolecek *
24b8625712Sjdolecek * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25b8625712Sjdolecek * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26b8625712Sjdolecek * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27b8625712Sjdolecek * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28b8625712Sjdolecek * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29b8625712Sjdolecek * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30b8625712Sjdolecek * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31b8625712Sjdolecek * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32b8625712Sjdolecek * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33b8625712Sjdolecek * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34b8625712Sjdolecek * SUCH DAMAGE.
35b8625712Sjdolecek */
36b8625712Sjdolecek
37b8625712Sjdolecek #include <sys/cdefs.h>
38b8625712Sjdolecek #ifndef lint
39*04723c3fSchristos __RCSID("$NetBSD: fatal.c,v 1.5 2005/11/28 03:26:06 christos Exp $");
40b8625712Sjdolecek #endif /* not lint */
41b8625712Sjdolecek
42b8625712Sjdolecek #include <sys/param.h>
43b8625712Sjdolecek #include <sys/dirent.h>
44895dc72aSwiz #include <stdarg.h>
45b8625712Sjdolecek #include <stdio.h>
463ab02a87Smatt #include <stdlib.h>
47b8625712Sjdolecek
48b8625712Sjdolecek #include "lp.h"
49b8625712Sjdolecek
50b8625712Sjdolecek void
fatal(const char * msg,...)51b8625712Sjdolecek fatal(const char *msg, ...)
52b8625712Sjdolecek {
53b8625712Sjdolecek va_list ap;
54895dc72aSwiz
55b8625712Sjdolecek va_start(ap, msg);
56b8625712Sjdolecek if (from != host)
57b8625712Sjdolecek (void)printf("%s: ", host);
58*04723c3fSchristos (void)printf("%s: ", getprogname());
59b8625712Sjdolecek if (printer)
60b8625712Sjdolecek (void)printf("%s: ", printer);
61b8625712Sjdolecek (void)vprintf(msg, ap);
62b8625712Sjdolecek va_end(ap);
63b8625712Sjdolecek (void)putchar('\n');
64b8625712Sjdolecek exit(1);
65b8625712Sjdolecek }
66