1/* 2 * $Id: mnc_error.c,v 1.2 2004/09/22 16:02:26 colmmacc Exp $ 3 * 4 * mnc_multicast.c -- Multicast NetCat 5 * 6 * Colm MacCarthaigh, <colm@apache.org> 7 * 8 * Copyright (c) 2007, Colm MacCarthaigh. 9 * Copyright (c) 2004 - 2006, HEAnet Ltd. 10 * 11 * This software is an open source. 12 * 13 * Redistribution and use in source and binary forms, with or without 14 * modification, are permitted provided that the following conditions 15 * are met: 16 * 17 * Redistributions of source code must retain the above copyright notice, 18 * this list of conditions and the following disclaimer. 19 * 20 * Redistributions in binary form must reproduce the above copyright notice, 21 * this list of conditions and the following disclaimer in the documentation 22 * and/or other materials provided with the distribution. 23 * 24 * Neither the name of the HEAnet Ltd. nor the names of its contributors may 25 * be used to endorse or promote products derived from this software without 26 * specific prior written permission. 27 * 28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 30 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 31 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE 32 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 33 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 34 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 35 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 36 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 37 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 * POSSIBILITY OF SUCH DAMAGE. 39 * 40 */ 41 42#include <stdio.h> 43#include <stdlib.h> 44#include <stdarg.h> 45 46#include "mnc.h" 47 48void mnc_warning(char * string, ...) 49{ 50 va_list ap; 51 52 /* Do the vararg stuff */ 53 va_start(ap, string); 54 55 /* Output our name */ 56 if (fprintf(stderr, "mnc: ") < 0) 57 { 58 exit(2); 59 } 60 61 /* Output our error */ 62 if (vfprintf(stderr, string, ap) < 0) 63 { 64 exit(2); 65 } 66 67 /* End the vararg stuff */ 68 va_end(ap); 69} 70 71void mnc_error(char * string, ...) 72{ 73 va_list ap; 74 75 /* Do the vararg stuff */ 76 va_start(ap, string); 77 78 /* Output our name */ 79 if (fprintf(stderr, "mnc: ") < 0) 80 { 81 exit(2); 82 } 83 84 /* Output our error */ 85 if (vfprintf(stderr, string, ap) < 0) 86 { 87 exit(2); 88 } 89 90 /* End the vararg stuff */ 91 va_end(ap); 92 93 /* Die! */ 94 exit(1); 95} 96