*** fping.c.ORIG Tue Sep 29 12:06:55 2009 --- fping.c Tue Sep 29 12:13:07 2009 *************** *** 125,131 **** --- 125,133 ---- extern char *optarg; extern int optind,opterr; + #ifndef _AIX extern int h_errno; + #endif #ifdef __cplusplus } *************** *** 375,380 **** --- 377,443 ---- char *sprint_tm( int t ); #endif /* _NO_PROTO */ + + + /***********************************************************/ + /* */ + /* AIX replacement functions: err(), errx() */ + /* */ + /***********************************************************/ + + + #include + + + void err( int eval, const char *fmt, ... ) + { + va_list ap; + char *txt, *strp; + + + txt = strerror( errno ); + + if (fmt != NULL && strcmp( (void *) fmt, "" ) != 0 ) + { + strp = (char *) malloc( 1024 * sizeof( char ) ); + va_start( ap, fmt ); + vsnprintf( strp, 1023, fmt, ap ); + va_end( ap ); + + fprintf(stderr, "%s: %s\n", strp, txt); + free( strp ); + exit( eval ); + } + else + { + fprintf( stderr, "%s\n", txt); + free( txt ); + exit( eval ); + } + } + + + void errx( int eval, const char *fmt, ... ) + { + va_list ap; + char *strp; + + strp = (char *) malloc( 1024 * sizeof( char ) ); + + va_start( ap,fmt ); + vsnprintf( strp, 1023, fmt, ap ); + va_end( ap ); + + fprintf( stderr, "%s\n", strp ); + + free( strp ); + + exit( eval ); + } + + + /***********************************************************/ + /*** function definitions ***/ *** ./vwarnx.c.ORIG Wed Feb 1 09:37:53 2012 --- ./vwarnx.c Wed Feb 1 09:37:31 2012 *************** *** 0 **** --- 1,54 ---- + /* $NetBSD: vwarnx.c,v 1.3 1997/07/17 21:33:27 thorpej Exp $ */ + + /*- + * Copyright (c) 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + + #include + + #ifdef __STDC__ + #include + #else + #include + #endif + + + void + vwarnx(fmt, ap) + const char *fmt; + va_list ap; + { + if (fmt != NULL) + (void)vfprintf(stderr, fmt, ap); + (void)fprintf(stderr, "\n"); + } + *** ./warnx.c.ORIG Wed Feb 1 09:38:04 2012 --- ./warnx.c Wed Feb 1 09:37:31 2012 *************** *** 0 **** --- 1,44 ---- + /* $NetBSD: warnx.c,v 1.14 2007/06/18 14:13:54 ginsbach Exp $ */ + + /*- + * Copyright (c) 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + + + #include + + void + warnx(const char *fmt, ...) + { + va_list ap; + + va_start(ap, fmt); + vwarnx(fmt, ap); + va_end(ap); + } + *** ./fping.c.ORIG Wed Feb 1 09:19:20 2012 --- ./fping.c Wed Feb 1 09:38:58 2012 *************** *** 102,107 **** --- 102,110 ---- #include "options.h" + #include "vwarnx.c" + #include "warnx.c" + /*** externals ***/ extern char *optarg;