112891Swpaul/* 212891Swpaul * Copyright (c) 1995 312891Swpaul * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. 412891Swpaul * 512891Swpaul * Redistribution and use in source and binary forms, with or without 612891Swpaul * modification, are permitted provided that the following conditions 712891Swpaul * are met: 812891Swpaul * 1. Redistributions of source code must retain the above copyright 912891Swpaul * notice, this list of conditions and the following disclaimer. 1012891Swpaul * 2. Redistributions in binary form must reproduce the above copyright 1112891Swpaul * notice, this list of conditions and the following disclaimer in the 1212891Swpaul * documentation and/or other materials provided with the distribution. 1312891Swpaul * 3. All advertising materials mentioning features or use of this software 1412891Swpaul * must display the following acknowledgement: 1512891Swpaul * This product includes software developed by Bill Paul. 1612891Swpaul * 4. Neither the name of the author nor the names of any co-contributors 1712891Swpaul * may be used to endorse or promote products derived from this software 1812891Swpaul * without specific prior written permission. 1912891Swpaul * 2012891Swpaul * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND 2112891Swpaul * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2212891Swpaul * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2312891Swpaul * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR CONTRIBUTORS BE LIABLE 2412891Swpaul * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2512891Swpaul * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2612891Swpaul * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2712891Swpaul * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2812891Swpaul * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2912891Swpaul * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3012891Swpaul * SUCH DAMAGE. 3112891Swpaul * 3212891Swpaul */ 3330827Scharnier 34114601Sobrien#include <sys/cdefs.h> 35114601Sobrien__FBSDID("$FreeBSD$"); 3630827Scharnier 3712891Swpaul/* 3812891Swpaul * error logging/reporting facilities 3912891Swpaul * stolen from /usr/libexec/mail.local via ypserv 4012891Swpaul */ 4112891Swpaul 4290298Sdes#include <sys/types.h> 4312891Swpaul#include <stdio.h> 4490298Sdes#include <stdarg.h> 4512891Swpaul#include <syslog.h> 4679294Skris#include "yp_extern.h" 4712891Swpaul 4812891Swpaulint debug; 4912891Swpaulextern int _rpcpmstart; 5012891Swpaul 5112891Swpaulextern char *progname; 5212891Swpaul 5390298Sdesstatic void __verr(const char *fmt, va_list ap) __printflike(1, 0); 5412891Swpaul 5590298Sdesstatic void __verr(const char *fmt, va_list ap) 5612891Swpaul{ 5712891Swpaul if (debug && !_rpcpmstart) { 5812891Swpaul fprintf(stderr,"%s: ",progname); 5912891Swpaul vfprintf(stderr, fmt, ap); 6012891Swpaul fprintf(stderr, "\n"); 6112891Swpaul } else { 6212891Swpaul vsyslog(LOG_NOTICE, fmt, ap); 6312891Swpaul } 6412891Swpaul} 6512891Swpaul 6612891Swpaulvoid 6712891Swpaulyp_error(const char *fmt, ...) 6812891Swpaul{ 6912891Swpaul va_list ap; 7012891Swpaul va_start(ap, fmt); 7113640Swpaul __verr(fmt,ap); 7212891Swpaul va_end(ap); 7312891Swpaul} 74