*** 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 ***/ *** fping.c.ORIG Tue Sep 29 12:37:27 2009 --- fping.c Tue Sep 29 12:37:44 2009 *************** *** 2660,2666 **** int recvfrom_wto( int s, char *buf, int len, FPING_SOCKADDR *saddr, int timo ) #endif /* _NO_PROTO */ { ! int nfound, slen, n; struct timeval to; fd_set readset, writeset; --- 2660,2667 ---- int recvfrom_wto( int s, char *buf, int len, FPING_SOCKADDR *saddr, int timo ) #endif /* _NO_PROTO */ { ! int nfound, n; ! unsigned long slen; struct timeval to; fd_set readset, writeset;