1135446Strhodes/*
2193149Sdougb * Copyright (C) 2004, 2005, 2007  Internet Systems Consortium, Inc. ("ISC")
3135446Strhodes * Copyright (C) 2000, 2001  Internet Software Consortium.
4135446Strhodes *
5193149Sdougb * Permission to use, copy, modify, and/or distribute this software for any
6135446Strhodes * purpose with or without fee is hereby granted, provided that the above
7135446Strhodes * copyright notice and this permission notice appear in all copies.
8135446Strhodes *
9135446Strhodes * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10135446Strhodes * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11135446Strhodes * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12135446Strhodes * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13135446Strhodes * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14135446Strhodes * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15135446Strhodes * PERFORMANCE OF THIS SOFTWARE.
16135446Strhodes */
17135446Strhodes
18234010Sdougb/* $Id: util.c,v 1.7 2007/06/19 23:46:59 tbox Exp $ */
19135446Strhodes
20170222Sdougb/*! \file */
21170222Sdougb
22135446Strhodes#include <config.h>
23135446Strhodes
24135446Strhodes#include <stdarg.h>
25135446Strhodes#include <stdlib.h>
26135446Strhodes#include <stdio.h>
27135446Strhodes
28135446Strhodes#include <isc/boolean.h>
29135446Strhodes
30135446Strhodes#include "util.h"
31135446Strhodes
32135446Strhodesextern isc_boolean_t verbose;
33135446Strhodesextern const char *progname;
34135446Strhodes
35135446Strhodesvoid
36135446Strhodesnotify(const char *fmt, ...) {
37135446Strhodes	va_list ap;
38135446Strhodes
39135446Strhodes	if (verbose) {
40135446Strhodes		va_start(ap, fmt);
41135446Strhodes		vfprintf(stderr, fmt, ap);
42135446Strhodes		va_end(ap);
43135446Strhodes		fputs("\n", stderr);
44135446Strhodes	}
45135446Strhodes}
46135446Strhodes
47135446Strhodesvoid
48135446Strhodesfatal(const char *format, ...) {
49135446Strhodes	va_list args;
50135446Strhodes
51135446Strhodes	fprintf(stderr, "%s: ", progname);
52135446Strhodes	va_start(args, format);
53135446Strhodes	vfprintf(stderr, format, args);
54135446Strhodes	va_end(args);
55135446Strhodes	fprintf(stderr, "\n");
56135446Strhodes	exit(1);
57135446Strhodes}
58