00001 /* 00002 * Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") 00003 * Copyright (C) 2000, 2001 Internet Software Consortium. 00004 * 00005 * Permission to use, copy, modify, and/or distribute this software for any 00006 * purpose with or without fee is hereby granted, provided that the above 00007 * copyright notice and this permission notice appear in all copies. 00008 * 00009 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 00010 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 00011 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 00012 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 00013 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 00014 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 00015 * PERFORMANCE OF THIS SOFTWARE. 00016 */ 00017 00018 /* $Id: util.c,v 1.7 2007/06/19 23:46:59 tbox Exp $ */ 00019 00020 /*! \file */ 00021 00022 #include <config.h> 00023 00024 #include <stdarg.h> 00025 #include <stdlib.h> 00026 #include <stdio.h> 00027 00028 #include <isc/boolean.h> 00029 00030 #include "util.h" 00031 00032 extern isc_boolean_t verbose; 00033 extern const char *progname; 00034 00035 void 00036 notify(const char *fmt, ...) { 00037 va_list ap; 00038 00039 if (verbose) { 00040 va_start(ap, fmt); 00041 vfprintf(stderr, fmt, ap); 00042 va_end(ap); 00043 fputs("\n", stderr); 00044 } 00045 } 00046 00047 void 00048 fatal(const char *format, ...) { 00049 va_list args; 00050 00051 fprintf(stderr, "%s: ", progname); 00052 va_start(args, format); 00053 vfprintf(stderr, format, args); 00054 va_end(args); 00055 fprintf(stderr, "\n"); 00056 exit(1); 00057 }