4cd765650776027d05fe7fca248478918e02e63bDavid Lawrence/*
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * Copyright (C) 2000, 2001, 2004, 2005, 2007, 2015, 2016 Internet Systems Consortium, Inc. ("ISC")
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrence *
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * This Source Code Form is subject to the terms of the Mozilla Public
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * License, v. 2.0. If a copy of the MPL was not distributed with this
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * file, You can obtain one at http://mozilla.org/MPL/2.0/.
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrence */
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrence
70e5a7403f0e0a3bd292b8287c5fed5772c15270Automatic Updater/* $Id: util.c,v 1.7 2007/06/19 23:46:59 tbox Exp $ */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/*! \file */
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrence
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrence#include <config.h>
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrence
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrence#include <stdarg.h>
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrence#include <stdlib.h>
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrence#include <stdio.h>
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrence
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrence#include <isc/boolean.h>
3759f10fc543747668b1ca4b4671f35b0dea8445Francis Dupont#include <isc/print.h>
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrence
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrence#include "util.h"
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrence
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrenceextern isc_boolean_t verbose;
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrenceextern const char *progname;
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrence
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrencevoid
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrencenotify(const char *fmt, ...) {
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrence va_list ap;
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrence
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrence if (verbose) {
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrence va_start(ap, fmt);
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrence vfprintf(stderr, fmt, ap);
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrence va_end(ap);
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrence fputs("\n", stderr);
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrence }
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrence}
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrence
d70dac20d2b88e48fbf2606180d0ba6dcc4bc44fTinderbox Uservoid
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrencefatal(const char *format, ...) {
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrence va_list args;
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrence
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrence fprintf(stderr, "%s: ", progname);
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrence va_start(args, format);
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrence vfprintf(stderr, format, args);
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrence va_end(args);
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrence fprintf(stderr, "\n");
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrence exit(1);
d70dac20d2b88e48fbf2606180d0ba6dcc4bc44fTinderbox User}