1778c7b1cSBill Paul /* 2778c7b1cSBill Paul * Copyright (c) 1995 3778c7b1cSBill Paul * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. 4778c7b1cSBill Paul * 5778c7b1cSBill Paul * Redistribution and use in source and binary forms, with or without 6778c7b1cSBill Paul * modification, are permitted provided that the following conditions 7778c7b1cSBill Paul * are met: 8778c7b1cSBill Paul * 1. Redistributions of source code must retain the above copyright 9778c7b1cSBill Paul * notice, this list of conditions and the following disclaimer. 10778c7b1cSBill Paul * 2. Redistributions in binary form must reproduce the above copyright 11778c7b1cSBill Paul * notice, this list of conditions and the following disclaimer in the 12778c7b1cSBill Paul * documentation and/or other materials provided with the distribution. 13778c7b1cSBill Paul * 3. All advertising materials mentioning features or use of this software 14778c7b1cSBill Paul * must display the following acknowledgement: 15778c7b1cSBill Paul * This product includes software developed by Bill Paul. 16778c7b1cSBill Paul * 4. Neither the name of the author nor the names of any co-contributors 17778c7b1cSBill Paul * may be used to endorse or promote products derived from this software 18778c7b1cSBill Paul * without specific prior written permission. 19778c7b1cSBill Paul * 20778c7b1cSBill Paul * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND 21778c7b1cSBill Paul * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22778c7b1cSBill Paul * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23778c7b1cSBill Paul * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR CONTRIBUTORS BE LIABLE 24778c7b1cSBill Paul * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25778c7b1cSBill Paul * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26778c7b1cSBill Paul * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27778c7b1cSBill Paul * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28778c7b1cSBill Paul * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29778c7b1cSBill Paul * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30778c7b1cSBill Paul * SUCH DAMAGE. 31778c7b1cSBill Paul * 32778c7b1cSBill Paul */ 3398834523SPhilippe Charnier 3498834523SPhilippe Charnier #ifndef lint 3598834523SPhilippe Charnier static const char rcsid[] = 3697d92980SPeter Wemm "$FreeBSD$"; 3798834523SPhilippe Charnier #endif /* not lint */ 3898834523SPhilippe Charnier 39778c7b1cSBill Paul /* 40778c7b1cSBill Paul * error logging/reporting facilities 41778c7b1cSBill Paul * stolen from /usr/libexec/mail.local via ypserv 42778c7b1cSBill Paul */ 43778c7b1cSBill Paul 44778c7b1cSBill Paul #include <sys/types.h> 45dc584ddbSDag-Erling Smørgrav #include <stdio.h> 46dc584ddbSDag-Erling Smørgrav #include <stdarg.h> 47778c7b1cSBill Paul #include <syslog.h> 482c0643afSKris Kennaway #include "yp_extern.h" 49778c7b1cSBill Paul 50778c7b1cSBill Paul int debug; 51778c7b1cSBill Paul extern int _rpcpmstart; 52778c7b1cSBill Paul 53778c7b1cSBill Paul extern char *progname; 54778c7b1cSBill Paul 55dc584ddbSDag-Erling Smørgrav static void __verr(const char *fmt, va_list ap) __printflike(1, 0); 56778c7b1cSBill Paul 57dc584ddbSDag-Erling Smørgrav static void __verr(const char *fmt, va_list ap) 58778c7b1cSBill Paul { 59778c7b1cSBill Paul if (debug && !_rpcpmstart) { 60778c7b1cSBill Paul fprintf(stderr,"%s: ",progname); 61778c7b1cSBill Paul vfprintf(stderr, fmt, ap); 62778c7b1cSBill Paul fprintf(stderr, "\n"); 63778c7b1cSBill Paul } else { 64778c7b1cSBill Paul vsyslog(LOG_NOTICE, fmt, ap); 65778c7b1cSBill Paul } 66778c7b1cSBill Paul } 67778c7b1cSBill Paul 68778c7b1cSBill Paul void 69778c7b1cSBill Paul yp_error(const char *fmt, ...) 70778c7b1cSBill Paul { 71778c7b1cSBill Paul va_list ap; 72778c7b1cSBill Paul va_start(ap, fmt); 73ce5b7be8SBill Paul __verr(fmt,ap); 74778c7b1cSBill Paul va_end(ap); 75778c7b1cSBill Paul } 76