2009-06-10 00:27:22 +00:00
|
|
|
/*
|
2018-02-23 09:53:12 +01:00
|
|
|
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
2009-06-10 00:27:22 +00:00
|
|
|
*
|
2021-06-03 08:37:05 +02:00
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
*
|
2016-06-27 14:56:38 +10: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 16:20:40 -07:00
|
|
|
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
2018-02-23 09:53:12 +01:00
|
|
|
*
|
|
|
|
* See the COPYRIGHT file distributed with this work for additional
|
|
|
|
* information regarding copyright ownership.
|
2009-06-10 00:27:22 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*! \file */
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
2018-04-17 08:29:14 -07:00
|
|
|
#include <stdbool.h>
|
2009-06-10 00:27:22 +00:00
|
|
|
#include <stdio.h>
|
2020-02-12 13:59:18 +01:00
|
|
|
#include <stdlib.h>
|
2024-02-07 14:44:39 +01:00
|
|
|
#include <unistd.h>
|
2009-06-10 00:27:22 +00:00
|
|
|
|
2023-01-27 16:52:59 +11:00
|
|
|
#include <isc/tls.h>
|
|
|
|
|
2025-05-28 22:43:38 +02:00
|
|
|
#include "isc/commandline.h"
|
2024-02-07 14:44:39 +01:00
|
|
|
#include "util.h"
|
|
|
|
|
2020-02-13 14:44:37 -08:00
|
|
|
extern bool verbose;
|
2009-06-10 00:27:22 +00:00
|
|
|
|
|
|
|
void
|
2020-02-13 14:44:37 -08:00
|
|
|
notify(const char *fmt, ...) {
|
2009-06-10 00:27:22 +00:00
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
if (verbose) {
|
|
|
|
va_start(ap, fmt);
|
|
|
|
vfprintf(stderr, fmt, ap);
|
|
|
|
va_end(ap);
|
2020-04-02 18:51:06 -07:00
|
|
|
fprintf(stderr, "\n");
|
2009-06-10 00:27:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-11 23:47:56 +00:00
|
|
|
void
|
2020-02-13 14:44:37 -08:00
|
|
|
fatal(const char *format, ...) {
|
2009-06-10 00:27:22 +00:00
|
|
|
va_list args;
|
|
|
|
|
2025-05-28 22:43:38 +02:00
|
|
|
fprintf(stderr, "%s: ", isc_commandline_progname);
|
2009-06-10 00:27:22 +00:00
|
|
|
va_start(args, format);
|
|
|
|
vfprintf(stderr, format, args);
|
|
|
|
va_end(args);
|
|
|
|
fprintf(stderr, "\n");
|
2024-02-07 14:44:39 +01:00
|
|
|
_exit(EXIT_FAILURE);
|
2009-06-11 23:47:56 +00:00
|
|
|
}
|