2001-06-22 13:22:26 -04:00
|
|
|
/*
|
2018-02-23 03:53:12 -05:00
|
|
|
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
2001-06-22 13:22:26 -04:00
|
|
|
*
|
2021-06-03 02:37:05 -04:00
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
*
|
2016-06-27 00:56:38 -04:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
2020-09-14 19:20:40 -04:00
|
|
|
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
2018-02-23 03:53:12 -05:00
|
|
|
*
|
|
|
|
|
* See the COPYRIGHT file distributed with this work for additional
|
|
|
|
|
* information regarding copyright ownership.
|
2001-06-22 13:22:26 -04:00
|
|
|
*/
|
|
|
|
|
|
2005-04-27 00:57:32 -04:00
|
|
|
/*! \file */
|
2001-06-22 13:22:26 -04:00
|
|
|
|
2020-02-12 07:59:18 -05:00
|
|
|
#include "util.h"
|
2001-06-22 13:22:26 -04:00
|
|
|
#include <stdarg.h>
|
2018-04-17 11:29:14 -04:00
|
|
|
#include <stdbool.h>
|
2001-06-22 13:22:26 -04:00
|
|
|
#include <stdio.h>
|
2020-02-12 07:59:18 -05:00
|
|
|
#include <stdlib.h>
|
2001-06-22 13:22:26 -04:00
|
|
|
|
2015-05-23 08:21:51 -04:00
|
|
|
#include <isc/print.h>
|
2001-06-22 13:22:26 -04:00
|
|
|
|
2020-02-13 17:44:37 -05:00
|
|
|
extern bool verbose;
|
2001-06-22 13:22:26 -04:00
|
|
|
extern const char *progname;
|
|
|
|
|
|
|
|
|
|
void
|
2020-02-13 17:44:37 -05:00
|
|
|
notify(const char *fmt, ...) {
|
2001-06-22 13:22:26 -04:00
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
|
|
if (verbose) {
|
|
|
|
|
va_start(ap, fmt);
|
|
|
|
|
vfprintf(stderr, fmt, ap);
|
|
|
|
|
va_end(ap);
|
2020-04-02 21:51:06 -04:00
|
|
|
fprintf(stderr, "\n");
|
2001-06-22 13:22:26 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-23 19:45:25 -04:00
|
|
|
void
|
2020-02-13 17:44:37 -05:00
|
|
|
fatal(const char *format, ...) {
|
2001-06-22 13:22:26 -04:00
|
|
|
va_list args;
|
|
|
|
|
|
|
|
|
|
fprintf(stderr, "%s: ", progname);
|
|
|
|
|
va_start(args, format);
|
|
|
|
|
vfprintf(stderr, format, args);
|
|
|
|
|
va_end(args);
|
|
|
|
|
fprintf(stderr, "\n");
|
|
|
|
|
exit(1);
|
2015-05-23 19:45:25 -04:00
|
|
|
}
|