AROS changes
This commit is contained in:
parent
46852d6394
commit
097c701fe5
|
@ -1,30 +1,3 @@
|
||||||
.*.swp
|
|
||||||
*.tar.gz
|
|
||||||
*~
|
|
||||||
src/*.gcno
|
|
||||||
src/*.gcda
|
|
||||||
src/*.gcov
|
|
||||||
.deps
|
|
||||||
Makefile
|
Makefile
|
||||||
Makefile.in
|
*.o
|
||||||
aclocal.m4
|
|
||||||
autom4te.cache
|
|
||||||
compile
|
|
||||||
config.guess
|
|
||||||
config.h
|
|
||||||
config.h.in
|
|
||||||
config.log
|
|
||||||
config.status
|
|
||||||
config.sub
|
|
||||||
configure
|
|
||||||
depcomp
|
|
||||||
install-sh
|
|
||||||
missing
|
|
||||||
src/*.o
|
|
||||||
src/fping
|
|
||||||
src/fping6
|
|
||||||
stamp-h1
|
|
||||||
doc/fping.8
|
|
||||||
doc/fping6.8
|
|
||||||
ci/build
|
|
||||||
*.kdev4
|
*.kdev4
|
||||||
|
|
|
@ -3,34 +3,46 @@
|
||||||
all: fping
|
all: fping
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CFLAGS = -O2 -DAROS -I. -Iinclude -Wall -Werror
|
CFLAGS = -O2 -DAROS -I. -D_DEBUG -Wall -Werror
|
||||||
LDLIBS = -lm
|
LDLIBS = -lm
|
||||||
|
|
||||||
config.h: inet_getaddrinfo.h
|
build_date.h:
|
||||||
touch config.h
|
echo "#define BUILD_DATE \"$$(date -u)"\" >build_date.h
|
||||||
|
|
||||||
fping.o: fping.c config.h fping.h options.h seqmap.h
|
fping.h: mem.h
|
||||||
|
touch fping.h
|
||||||
|
|
||||||
fping_amiga.o: fping_amiga.c config.h
|
getaddrinfo.h: fping.h
|
||||||
|
touch getaddrinfo.h
|
||||||
|
|
||||||
inet_getaddrinfo.o: inet_getaddrinfo.c fping.h inet_getaddrinfo.h
|
fping.o: fping.c build_date.h fping.h getaddrinfo.h options.h seqmap.h
|
||||||
|
|
||||||
inet_ntop.o: inet_ntop.c
|
fping_amiga.o: fping_amiga.c fping.h getaddrinfo.h
|
||||||
|
|
||||||
inet_pton.o: inet_pton.c
|
getaddrinfo.o: getaddrinfo.c fping.h getaddrinfo.h
|
||||||
|
|
||||||
|
ntop.o: ntop.c
|
||||||
|
|
||||||
|
pton.o: pton.c
|
||||||
|
|
||||||
seqmap.o: seqmap.c options.h seqmap.h
|
seqmap.o: seqmap.c options.h seqmap.h
|
||||||
|
|
||||||
socket.o: socket.c config.h fping.h
|
socket.o: socket.c fping.h
|
||||||
|
|
||||||
socket4.o: socket4.c config.h fping.h
|
socket4.o: socket4.c fping.h
|
||||||
|
|
||||||
|
mem.o: mem.c mem.h
|
||||||
|
|
||||||
|
getopt.o: getopt.c getopt.h
|
||||||
|
|
||||||
|
rand.o: rand.c
|
||||||
|
|
||||||
|
|
||||||
fping: fping.o fping_amiga.o inet_getaddrinfo.o inet_ntop.o inet_pton.o seqmap.o socket.o socket4.o
|
fping: fping.o fping_amiga.o getaddrinfo.o ntop.o pton.o seqmap.o socket.o socket4.o mem.o getopt.o rand.o
|
||||||
${CC} ${CFLAGS} -s -o fping fping.o fping_amiga.o inet_getaddrinfo.o inet_ntop.o inet_pton.o seqmap.o socket.o socket4.o ${LDLIBS}
|
${CC} ${CFLAGS} -s -o fping fping.o fping_amiga.o getaddrinfo.o ntop.o pton.o seqmap.o socket.o socket4.o mem.o getopt.o rand.o ${LDLIBS}
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f fping.o fping_amiga.o inet_getaddrinfo.o inet_ntop.o inet_pton.o seqmap.o socket.o socket4.o fping
|
rm -f fping.o fping_amiga.o getaddrinfo.o ntop.o pton.o seqmap.o socket.o socket4.o mem.o getopt.o rand.o build_date.h fping
|
||||||
|
|
||||||
depend:
|
depend:
|
||||||
@echo Dependencies already done
|
@echo Dependencies already done
|
||||||
|
|
|
@ -3,45 +3,46 @@
|
||||||
all: fping
|
all: fping
|
||||||
|
|
||||||
CC = m68k-amigaos-gcc
|
CC = m68k-amigaos-gcc
|
||||||
CFLAGS = -O2 -noixemul -DAOS3 -I. -I.. -Iinclude -Wall -Werror
|
CFLAGS = -O2 -noixemul -DAOS3 -D_DEBUG -I. -I.. -Iinclude -Wall -Werror
|
||||||
LDLIBS = -liberty -lm
|
LDLIBS = -lm
|
||||||
|
|
||||||
build_date.h:
|
build_date.h:
|
||||||
echo "#define BUILD_DATE \"$$(date -u)"\" >build_date.h
|
echo "#define BUILD_DATE \"$$(date -u)"\" >build_date.h
|
||||||
|
|
||||||
config.h: inet_getaddrinfo.h
|
|
||||||
touch config.h
|
|
||||||
|
|
||||||
fping.h: mem.h
|
fping.h: mem.h
|
||||||
touch fping.h
|
touch fping.h
|
||||||
|
|
||||||
inet_getaddrinfo.h: fping.h
|
getaddrinfo.h: fping.h
|
||||||
touch inet_getaddrinfo.h
|
touch getaddrinfo.h
|
||||||
|
|
||||||
fping.o: fping.c build_date.h config.h fping.h options.h seqmap.h
|
fping.o: fping.c build_date.h fping.h getaddrinfo.h options.h seqmap.h
|
||||||
|
|
||||||
fping_amiga.o: fping_amiga.c config.h
|
fping_amiga.o: fping_amiga.c fping.h getaddrinfo.h
|
||||||
|
|
||||||
inet_getaddrinfo.o: inet_getaddrinfo.c fping.h inet_getaddrinfo.h
|
getaddrinfo.o: getaddrinfo.c fping.h getaddrinfo.h
|
||||||
|
|
||||||
inet_ntop.o: inet_ntop.c
|
ntop.o: ntop.c
|
||||||
|
|
||||||
inet_pton.o: inet_pton.c config.h
|
pton.o: pton.c
|
||||||
|
|
||||||
seqmap.o: seqmap.c options.h seqmap.h
|
seqmap.o: seqmap.c options.h seqmap.h
|
||||||
|
|
||||||
socket.o: socket.c config.h fping.h
|
socket.o: socket.c fping.h
|
||||||
|
|
||||||
socket4.o: socket4.c config.h fping.h
|
socket4.o: socket4.c fping.h
|
||||||
|
|
||||||
mem.o: mem.c mem.h
|
mem.o: mem.c mem.h
|
||||||
|
|
||||||
|
getopt.o: getopt.c getopt.h
|
||||||
|
|
||||||
fping: fping.o fping_amiga.o inet_getaddrinfo.o inet_ntop.o inet_pton.o seqmap.o socket.o socket4.o mem.o
|
rand.o: rand.c
|
||||||
${CC} ${CFLAGS} -s -o fping fping.o fping_amiga.o inet_getaddrinfo.o inet_ntop.o inet_pton.o seqmap.o socket.o socket4.o mem.o ${LDLIBS}
|
|
||||||
|
|
||||||
|
fping: fping.o fping_amiga.o getaddrinfo.o ntop.o pton.o seqmap.o socket.o socket4.o mem.o getopt.o rand.o
|
||||||
|
${CC} ${CFLAGS} -s -o fping fping.o fping_amiga.o getaddrinfo.o ntop.o pton.o seqmap.o socket.o socket4.o mem.o getopt.o rand.o ${LDLIBS}
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f fping.o fping_amiga.o inet_getaddrinfo.o inet_ntop.o inet_pton.o seqmap.o socket.o socket4.o mem.o build_date.h fping
|
rm -f fping.o fping_amiga.o getaddrinfo.o ntop.o pton.o seqmap.o socket.o socket4.o mem.o getopt.o rand.o build_date.h fping
|
||||||
|
|
||||||
depend:
|
depend:
|
||||||
@echo Dependencies already done
|
@echo Dependencies already done
|
||||||
|
|
85
src/config.h
85
src/config.h
|
@ -1,85 +0,0 @@
|
||||||
/* config.h. Generated from config.h.in by configure. */
|
|
||||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
|
||||||
|
|
||||||
#ifndef CONFIG_H
|
|
||||||
#define CONFIG_H
|
|
||||||
|
|
||||||
#ifdef AROS
|
|
||||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
|
||||||
# define HAVE_INTTYPES_H 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "inet_getaddrinfo.h"
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <memory.h> header file. */
|
|
||||||
#define HAVE_MEMORY_H 1
|
|
||||||
|
|
||||||
#ifdef AROS
|
|
||||||
/* Define to 1 if you have the <stdint.h> header file. */
|
|
||||||
# define HAVE_STDINT_H 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
|
||||||
#define HAVE_STDLIB_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <strings.h> header file. */
|
|
||||||
#define HAVE_STRINGS_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <string.h> header file. */
|
|
||||||
#define HAVE_STRING_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/file.h> header file. */
|
|
||||||
#define HAVE_SYS_FILE_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/select.h> header file. */
|
|
||||||
/* #undef HAVE_SYS_SELECT_H */
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
|
||||||
#define HAVE_SYS_STAT_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
|
||||||
#define HAVE_SYS_TYPES_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <unistd.h> header file. */
|
|
||||||
#define HAVE_UNISTD_H 1
|
|
||||||
|
|
||||||
/* Name of package */
|
|
||||||
#define PACKAGE "fping"
|
|
||||||
|
|
||||||
/* Define to the address where bug reports for this package should be sent. */
|
|
||||||
#define PACKAGE_BUGREPORT ""
|
|
||||||
|
|
||||||
/* Define to the full name of this package. */
|
|
||||||
#define PACKAGE_NAME "fping"
|
|
||||||
|
|
||||||
/* Define to the full name and version of this package. */
|
|
||||||
#define PACKAGE_STRING "fping 3.13"
|
|
||||||
|
|
||||||
/* Define to the one symbol short name of this package. */
|
|
||||||
#define PACKAGE_TARNAME "fping"
|
|
||||||
|
|
||||||
/* Define to the home page for this package. */
|
|
||||||
#define PACKAGE_URL ""
|
|
||||||
|
|
||||||
/* Define to the version of this package. */
|
|
||||||
#define PACKAGE_VERSION "3.13"
|
|
||||||
|
|
||||||
/* Define to 1 if you have the ANSI C header files. */
|
|
||||||
#define STDC_HEADERS 1
|
|
||||||
|
|
||||||
/* Version number of package */
|
|
||||||
#define VERSION "3.13"
|
|
||||||
|
|
||||||
/* some OSes do not define this ... lets take a wild guess */
|
|
||||||
|
|
||||||
#ifndef INADDR_NONE
|
|
||||||
# define INADDR_NONE 0xffffffffU
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* No TTL (time to live) in socket options */
|
|
||||||
#define NOTTL 1
|
|
||||||
|
|
||||||
/* No TOS (type of service) in socket options */
|
|
||||||
#define NOTOS 1
|
|
||||||
|
|
||||||
#endif /* CONFIG_H */
|
|
|
@ -29,24 +29,26 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
HDRS='
|
HDRS='
|
||||||
config.h
|
|
||||||
fping.h
|
fping.h
|
||||||
inet_getaddrinfo.h
|
getaddrinfo.h
|
||||||
options.h
|
options.h
|
||||||
seqmap.h
|
seqmap.h
|
||||||
mem.h
|
mem.h
|
||||||
|
getopt.h
|
||||||
'
|
'
|
||||||
|
|
||||||
SRCS='
|
SRCS='
|
||||||
fping.c
|
fping.c
|
||||||
fping_amiga.c
|
fping_amiga.c
|
||||||
inet_getaddrinfo.c
|
getaddrinfo.c
|
||||||
inet_ntop.c
|
ntop.c
|
||||||
inet_pton.c
|
pton.c
|
||||||
seqmap.c
|
seqmap.c
|
||||||
socket.c
|
socket.c
|
||||||
socket4.c
|
socket4.c
|
||||||
mem.c
|
mem.c
|
||||||
|
getopt.c
|
||||||
|
rand.c
|
||||||
'
|
'
|
||||||
|
|
||||||
if make -v 2>&1 | grep GNU > /dev/null 2>&1 ; then
|
if make -v 2>&1 | grep GNU > /dev/null 2>&1 ; then
|
||||||
|
@ -69,10 +71,10 @@ if $VALID ; then
|
||||||
if [ -n "$1" ] && [ $1 = "AMIGA" ] ; then
|
if [ -n "$1" ] && [ $1 = "AMIGA" ] ; then
|
||||||
echo 'CC = m68k-amigaos-gcc'
|
echo 'CC = m68k-amigaos-gcc'
|
||||||
echo "CFLAGS = -O2 -noixemul -DAOS3 ${DEBUG}-I. -I.. -Iinclude -Wall -Werror"
|
echo "CFLAGS = -O2 -noixemul -DAOS3 ${DEBUG}-I. -I.. -Iinclude -Wall -Werror"
|
||||||
echo "LDLIBS = -liberty -lm"
|
echo "LDLIBS = -lm"
|
||||||
elif [ -n "$1" ] && [ $1 = "AROS" ] ; then
|
elif [ -n "$1" ] && [ $1 = "AROS" ] ; then
|
||||||
echo 'CC = gcc'
|
echo 'CC = gcc'
|
||||||
echo "CFLAGS = -O2 -DAROS -I. -Iinclude -Wall -Werror"
|
echo "CFLAGS = -O2 -DAROS -I. ${DEBUG}-Wall -Werror"
|
||||||
echo "LDLIBS = -lm"
|
echo "LDLIBS = -lm"
|
||||||
else
|
else
|
||||||
echo "CFLAGS = -O2 -Wall -Werror"
|
echo "CFLAGS = -O2 -Wall -Werror"
|
||||||
|
|
74
src/fping.c
74
src/fping.c
|
@ -37,47 +37,9 @@ extern "C"
|
||||||
|
|
||||||
#include "fping.h"
|
#include "fping.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "build_date.h"
|
|
||||||
|
|
||||||
/* if compiling for Windows, use this separate set
|
|
||||||
(too difficult to ifdef all the autoconf defines) */
|
|
||||||
#ifdef WIN32
|
|
||||||
|
|
||||||
/*** Windows includes ***/
|
|
||||||
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
/*** autoconf includes ***/
|
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <time.h>
|
|
||||||
#include <signal.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include "seqmap.h"
|
#include "seqmap.h"
|
||||||
|
#include "build_date.h"
|
||||||
#ifdef HAVE_UNISTD_H
|
#include "getaddrinfo.h"
|
||||||
#include <unistd.h>
|
|
||||||
#endif /* HAVE_UNISTD_H */
|
|
||||||
|
|
||||||
#ifdef HAVE_STDLIB_H
|
|
||||||
#include <stdlib.h>
|
|
||||||
#endif /* HAVE_STDLIB_H */
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
|
|
||||||
#if HAVE_SYS_FILE_H
|
|
||||||
#include <sys/file.h>
|
|
||||||
#endif /* HAVE_SYS_FILE_H */
|
|
||||||
|
|
||||||
#ifdef IPV6
|
#ifdef IPV6
|
||||||
#include <netinet/icmp6.h>
|
#include <netinet/icmp6.h>
|
||||||
|
@ -86,22 +48,11 @@ extern "C"
|
||||||
|
|
||||||
#include <netinet/ip.h>
|
#include <netinet/ip.h>
|
||||||
#include <netinet/ip_icmp.h>
|
#include <netinet/ip_icmp.h>
|
||||||
|
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
|
|
||||||
/* RS6000 has sys/select.h */
|
|
||||||
#ifdef HAVE_SYS_SELECT_H
|
|
||||||
#include <sys/select.h>
|
|
||||||
#endif /* HAVE_SYS_SELECT_H */
|
|
||||||
|
|
||||||
#endif /* WIN32 */
|
|
||||||
|
|
||||||
/*** externals ***/
|
|
||||||
|
|
||||||
extern char *optarg;
|
extern char *optarg;
|
||||||
extern int optind,opterr;
|
extern int optind,opterr;
|
||||||
extern int h_errno;
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -368,6 +319,8 @@ int main( int argc, char **argv )
|
||||||
int res;
|
int res;
|
||||||
HOST_ENTRY *cursor;
|
HOST_ENTRY *cursor;
|
||||||
|
|
||||||
|
prog = argv[0];
|
||||||
|
|
||||||
if((res = open_libs()) != 0)
|
if((res = open_libs()) != 0)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
|
@ -378,7 +331,6 @@ int main( int argc, char **argv )
|
||||||
setuid( getuid() );
|
setuid( getuid() );
|
||||||
}
|
}
|
||||||
|
|
||||||
prog = argv[0];
|
|
||||||
ident = getpid() & 0xFFFF;
|
ident = getpid() & 0xFFFF;
|
||||||
verbose_flag = 1;
|
verbose_flag = 1;
|
||||||
backoff_flag = 1;
|
backoff_flag = 1;
|
||||||
|
@ -512,7 +464,7 @@ int main( int argc, char **argv )
|
||||||
#endif /* DEBUG || _DEBUG */
|
#endif /* DEBUG || _DEBUG */
|
||||||
|
|
||||||
case 'v':
|
case 'v':
|
||||||
printf( "%s: Version %s%s\n", argv[0], VERSION, DEBUG_TEXT );
|
printf( "%s: Version %s%s\n", argv[0], PACKAGE_VERSION, DEBUG_TEXT );
|
||||||
printf( "%s: Build %s\n", argv[0], BUILD_DATE );
|
printf( "%s: Build %s\n", argv[0], BUILD_DATE );
|
||||||
printf( "%s: Comments to %s\n", argv[0], EMAIL );
|
printf( "%s: Comments to %s\n", argv[0], EMAIL );
|
||||||
exit( 0 );
|
exit( 0 );
|
||||||
|
@ -1158,7 +1110,7 @@ void finish()
|
||||||
print_global_stats();
|
print_global_stats();
|
||||||
|
|
||||||
if ( cancelled )
|
if ( cancelled )
|
||||||
exit( 10 );
|
exit( 5 );
|
||||||
|
|
||||||
if( num_noaddress )
|
if( num_noaddress )
|
||||||
exit( 2 );
|
exit( 2 );
|
||||||
|
@ -1846,7 +1798,6 @@ void add_name( char *name )
|
||||||
{
|
{
|
||||||
struct addrinfo *res0, *res, hints;
|
struct addrinfo *res0, *res, hints;
|
||||||
int ret_ga;
|
int ret_ga;
|
||||||
size_t len;
|
|
||||||
char *printname;
|
char *printname;
|
||||||
char namebuf[256];
|
char namebuf[256];
|
||||||
char addrbuf[256];
|
char addrbuf[256];
|
||||||
|
@ -1877,7 +1828,6 @@ void add_name( char *name )
|
||||||
// (need to implement a separate option for this)
|
// (need to implement a separate option for this)
|
||||||
|
|
||||||
for (res = res0; res; res = 0) {
|
for (res = res0; res; res = 0) {
|
||||||
len = res->ai_addrlen;
|
|
||||||
/* name_flag: addr -> name lookup requested) */
|
/* name_flag: addr -> name lookup requested) */
|
||||||
if(!name_flag) {
|
if(!name_flag) {
|
||||||
printname = name;
|
printname = name;
|
||||||
|
@ -2198,7 +2148,7 @@ int recvfrom_wto( int s, char *buf, int len, struct sockaddr *saddr, socklen_t *
|
||||||
int nfound, n;
|
int nfound, n;
|
||||||
struct timeval to;
|
struct timeval to;
|
||||||
fd_set readset, writeset;
|
fd_set readset, writeset;
|
||||||
long signal = SIGBREAKF_CTRL_C;
|
SIGNAL signal = SIGBREAKF_CTRL_C;
|
||||||
|
|
||||||
select_again:
|
select_again:
|
||||||
if(timo < 100000) {
|
if(timo < 100000) {
|
||||||
|
@ -2235,7 +2185,7 @@ select_again:
|
||||||
return -1; /* timeout */
|
return -1; /* timeout */
|
||||||
|
|
||||||
// recvfrom(int socket, void *restrict buffer, size_t length, int flags, struct sockaddr *restrict address, socklen_t *restrict address_len);
|
// recvfrom(int socket, void *restrict buffer, size_t length, int flags, struct sockaddr *restrict address, socklen_t *restrict address_len);
|
||||||
n = RecvFrom( s, buf, len, 0, saddr, saddr_len );
|
n = RecvFrom( s, buf, len, 0, saddr, (int*)saddr_len );
|
||||||
if( n < 0 )
|
if( n < 0 )
|
||||||
errno_crash_and_burn( "recvfrom" );
|
errno_crash_and_burn( "recvfrom" );
|
||||||
|
|
||||||
|
@ -2292,7 +2242,7 @@ void ev_enqueue(HOST_ENTRY *h)
|
||||||
#if defined( DEBUG ) || defined( _DEBUG )
|
#if defined( DEBUG ) || defined( _DEBUG )
|
||||||
if( trace_flag ) {
|
if( trace_flag ) {
|
||||||
long st = timeval_diff(&h->ev_time, ¤t_time);
|
long st = timeval_diff(&h->ev_time, ¤t_time);
|
||||||
fprintf(stderr, "Enqueue: host=%s, when=%ld ms (%ld, %ld)\n", h->host, st/100, h->ev_time.tv_sec, h->ev_time.tv_usec);
|
fprintf(stderr, "Enqueue: host=%s, when=%ld ms (%ld, %ld)\n", h->host, st/100, (long)h->ev_time.tv_sec, (long)h->ev_time.tv_usec);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2398,7 +2348,11 @@ void ev_remove(HOST_ENTRY *h)
|
||||||
void usage(int is_error)
|
void usage(int is_error)
|
||||||
{
|
{
|
||||||
FILE *out = is_error ? stderr : stdout;
|
FILE *out = is_error ? stderr : stdout;
|
||||||
fprintf(out, "\33[33mfping version " VERSION DEBUG_TEXT "\33[31m\n" );
|
#ifdef ANSI_CONSOLE
|
||||||
|
fprintf(out, "\33[33mfping version " PACKAGE_VERSION DEBUG_TEXT "\33[31m\n" );
|
||||||
|
#else
|
||||||
|
fprintf(out, "fping version " PACKAGE_VERSION DEBUG_TEXT "\n" );
|
||||||
|
#endif
|
||||||
fprintf(out, "Usage: %s [options] [targets...]\n", prog );
|
fprintf(out, "Usage: %s [options] [targets...]\n", prog );
|
||||||
fprintf(out, " -a show targets that are alive\n" );
|
fprintf(out, " -a show targets that are alive\n" );
|
||||||
fprintf(out, " -A show targets by address\n" );
|
fprintf(out, " -A show targets by address\n" );
|
||||||
|
|
73
src/fping.h
73
src/fping.h
|
@ -6,38 +6,57 @@
|
||||||
#ifndef _FPING_H
|
#ifndef _FPING_H
|
||||||
#define _FPING_H
|
#define _FPING_H
|
||||||
|
|
||||||
#define __APPLE_USE_RFC_3542 1
|
#include <clib/dos_protos.h>
|
||||||
|
#include <clib/exec_protos.h>
|
||||||
|
#include <clib/alib_protos.h>
|
||||||
|
#include <clib/timer_protos.h>
|
||||||
|
#include <clib/utility_protos.h>
|
||||||
|
#include <utility/date.h>
|
||||||
|
#include <devices/timer.h>
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
#include <sys/file.h>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
#include "mem.h"
|
#include "mem.h"
|
||||||
#define calloc(x, y) allocmem(x*y)
|
#define calloc(x, y) allocmem(x*y)
|
||||||
#define malloc(x) allocmem(x)
|
#define malloc(x) allocmem(x)
|
||||||
#define free(x) freemem(x)
|
#define free(x) freemem(x)
|
||||||
|
|
||||||
#if defined(__AMIGA__)
|
#ifdef AOS3
|
||||||
#include <clib/dos_protos.h>
|
# include <clib/amitcp_protos.h>
|
||||||
#include <clib/exec_protos.h>
|
# include <amitcp/socketbasetags.h>
|
||||||
#include <clib/timer_protos.h>
|
# include <machine/types.h>
|
||||||
#include <clib/amitcp_protos.h>
|
# define uint16_t u_int16_t
|
||||||
#include <amitcp/socketbasetags.h>
|
# define IPTR ULONG
|
||||||
#include <clib/utility_protos.h>
|
# define ANSI_CONSOLE 1
|
||||||
#include <utility/date.h>
|
# define gettimeofday(x, y) getsystime(x)
|
||||||
#include <machine/types.h>
|
typedef unsigned int socklen_t;
|
||||||
#define uint16_t u_int16_t
|
typedef unsigned int sa_family_t;
|
||||||
#define IPTR ULONG
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef unsigned int socklen_t;
|
|
||||||
typedef u_int16_t in_port_t;
|
typedef u_int16_t in_port_t;
|
||||||
typedef unsigned int sa_family_t;
|
|
||||||
|
#ifdef AROS
|
||||||
|
# include <inttypes.h>
|
||||||
|
# include <sys/time.h>
|
||||||
|
# define Socket(a,b,c) socket(a,b,c)
|
||||||
|
# define Bind(a,b,c) bind(a,b,c)
|
||||||
|
# define RecvFrom(a,b,c,d,e,f) recvfrom(a,b,c,d,e,f)
|
||||||
|
# define SendTo(a,b,c,d,e,f) sendto(a,b,c,d,e,f)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef AOS3
|
#ifdef AOS3
|
||||||
/*
|
|
||||||
* struct addrinfo.
|
|
||||||
*/
|
|
||||||
struct addrinfo {
|
struct addrinfo {
|
||||||
int ai_flags;
|
int ai_flags;
|
||||||
int ai_family;
|
int ai_family;
|
||||||
|
@ -60,6 +79,10 @@ struct addrinfo {
|
||||||
# define FPING_ICMPHDR struct icmp6_hdr
|
# define FPING_ICMPHDR struct icmp6_hdr
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef INADDR_NONE
|
||||||
|
# define INADDR_NONE 0xffffffffU
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef PF_INET6
|
#ifndef PF_INET6
|
||||||
# define PF_INET6 10
|
# define PF_INET6 10
|
||||||
#endif
|
#endif
|
||||||
|
@ -80,7 +103,21 @@ struct addrinfo {
|
||||||
# define DEBUG_TEXT ""
|
# define DEBUG_TEXT ""
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define gettimeofday(x, y) getsystime(x)
|
#ifdef AOS3
|
||||||
|
# define random() rand()
|
||||||
|
# define srandom() srand()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define PACKAGE_NAME "fping"
|
||||||
|
#define PACKAGE_VERSION "3.13"
|
||||||
|
|
||||||
|
/* No TTL (time to live) in socket options */
|
||||||
|
#define NOTTL 1
|
||||||
|
|
||||||
|
/* No TOS (type of service) in socket options */
|
||||||
|
#define NOTOS 1
|
||||||
|
|
||||||
|
#define SIGNAL ULONG
|
||||||
|
|
||||||
/* fping.c */
|
/* fping.c */
|
||||||
void crash_and_burn( char *message );
|
void crash_and_burn( char *message );
|
||||||
|
|
|
@ -3,25 +3,20 @@
|
||||||
* Public domain.
|
* Public domain.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include "fping.h"
|
||||||
#include <stdlib.h>
|
#include "getaddrinfo.h"
|
||||||
#include <clib/exec_protos.h>
|
|
||||||
#include <clib/timer_protos.h>
|
|
||||||
#include <clib/utility_protos.h>
|
|
||||||
#include <clib/alib_protos.h>
|
|
||||||
#include <devices/timer.h>
|
|
||||||
|
|
||||||
#define OPEN_ERROR "Cannot open %s.\n"
|
#define OPEN_ERROR "Cannot open %s.\n"
|
||||||
#define OPEN_VER_ERROR "Cannot open %s (%d.0)\n"
|
#define OPEN_VER_ERROR "Cannot open %s (%d.0)\n"
|
||||||
#define DOSLIB_NAME "dos.library"
|
#define DOSLIB_NAME "dos.library"
|
||||||
#define DOSLIB_REV 37L
|
#define DOSLIB_REV 37L
|
||||||
#define BSDLIB_NAME "bsdsocket.library"
|
#define BSDLIB_NAME "bsdsocket.library"
|
||||||
#define BSDLIB_REV 03L
|
#define BSDLIB_REV 03L
|
||||||
#define UTILLIB_NAME "utility.library"
|
#define UTILLIB_NAME "utility.library"
|
||||||
#define UTILLIB_REV 37L
|
#define UTILLIB_REV 37L
|
||||||
#define TIMER_NAME TIMERNAME
|
#define TIMER_NAME TIMERNAME
|
||||||
|
#define LIB_ERROR 4
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
const char *vers = "\0$VER: " PACKAGE_NAME " " PACKAGE_VERSION " (21.02.2016)";
|
const char *vers = "\0$VER: " PACKAGE_NAME " " PACKAGE_VERSION " (21.02.2016)";
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -75,27 +70,29 @@ void close_libs()
|
||||||
SocketBase = NULL;
|
SocketBase = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
freeall();
|
||||||
|
|
||||||
if (DOSBase != NULL) {
|
if (DOSBase != NULL) {
|
||||||
CloseLibrary(DOSBase);
|
CloseLibrary(DOSBase);
|
||||||
DOSBase = NULL;
|
DOSBase = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
freeall();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int open_libs()
|
int open_libs()
|
||||||
{
|
{
|
||||||
|
struct timeval tv;
|
||||||
|
|
||||||
atexit(close_libs);
|
atexit(close_libs);
|
||||||
InitSemaphore(&GetaddrinfoSemaphore);
|
InitSemaphore(&GetaddrinfoSemaphore);
|
||||||
|
|
||||||
if(!(DOSBase = OpenLibrary((STRPTR)DOSLIB_NAME, DOSLIB_REV))) {
|
if(!(DOSBase = OpenLibrary((STRPTR)DOSLIB_NAME, DOSLIB_REV))) {
|
||||||
amiga_open_lib_error(DOSLIB_NAME, DOSLIB_REV);
|
amiga_open_lib_error(DOSLIB_NAME, DOSLIB_REV);
|
||||||
return 5;
|
return LIB_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!(SocketBase = OpenLibrary((STRPTR)BSDLIB_NAME, BSDLIB_REV))) {
|
if(!(SocketBase = OpenLibrary((STRPTR)BSDLIB_NAME, BSDLIB_REV))) {
|
||||||
amiga_open_lib_error(BSDLIB_NAME, BSDLIB_REV);
|
amiga_open_lib_error(BSDLIB_NAME, BSDLIB_REV);
|
||||||
return 5;
|
return LIB_ERROR;
|
||||||
} else {
|
} else {
|
||||||
SocketBaseTags(
|
SocketBaseTags(
|
||||||
SBTM_SETVAL(SBTC_ERRNOPTR(sizeof(errno))), (IPTR) &errno,
|
SBTM_SETVAL(SBTC_ERRNOPTR(sizeof(errno))), (IPTR) &errno,
|
||||||
|
@ -106,17 +103,21 @@ int open_libs()
|
||||||
|
|
||||||
if(!(UtilityBase = OpenLibrary((STRPTR)UTILLIB_NAME, UTILLIB_REV))) {
|
if(!(UtilityBase = OpenLibrary((STRPTR)UTILLIB_NAME, UTILLIB_REV))) {
|
||||||
amiga_open_lib_error(UTILLIB_NAME, UTILLIB_REV);
|
amiga_open_lib_error(UTILLIB_NAME, UTILLIB_REV);
|
||||||
return 5;
|
return LIB_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (create_timer() != 0) {
|
if (create_timer() != 0) {
|
||||||
amiga_open_error(TIMER_NAME);
|
amiga_open_error(TIMER_NAME);
|
||||||
return 10;
|
return LIB_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gettimeofday(&tv, NULL);
|
||||||
|
srand(tv.tv_usec);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef AOS3
|
||||||
int create_timer()
|
int create_timer()
|
||||||
{
|
{
|
||||||
LONG error;
|
LONG error;
|
||||||
|
@ -171,3 +172,7 @@ int getsystime(struct timeval *tv)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
int create_timer() { return 0; }
|
||||||
|
void delete_timer() { }
|
||||||
|
#endif
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
|
|
||||||
#include "fping.h"
|
#include "fping.h"
|
||||||
#include "inet_getaddrinfo.h"
|
#include "getaddrinfo.h"
|
||||||
|
|
||||||
#ifdef ENABLE_NLS
|
#ifdef ENABLE_NLS
|
||||||
#include <libintl.h>
|
#include <libintl.h>
|
|
@ -0,0 +1,117 @@
|
||||||
|
/*
|
||||||
|
* getopt.c --
|
||||||
|
*
|
||||||
|
* Standard UNIX getopt function. Code is from BSD.
|
||||||
|
*
|
||||||
|
* Copyright (c) 1987-2002 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:
|
||||||
|
*
|
||||||
|
* A. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* B. 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.
|
||||||
|
* C. Neither the names of the copyright holders 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 COPYRIGHT HOLDERS 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* #if !defined(lint)
|
||||||
|
* static char sccsid[] = "@(#)getopt.c 8.2 (Berkeley) 4/2/94";
|
||||||
|
* #endif
|
||||||
|
*/
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "getopt.h"
|
||||||
|
|
||||||
|
int opterr = 1, /* if error message should be printed */
|
||||||
|
optind = 1, /* index into parent argv vector */
|
||||||
|
optopt, /* character checked for validity */
|
||||||
|
optreset; /* reset getopt */
|
||||||
|
char *optarg; /* argument associated with option */
|
||||||
|
|
||||||
|
#define BADCH (int)'?'
|
||||||
|
#define BADARG (int)':'
|
||||||
|
#define EMSG ""
|
||||||
|
|
||||||
|
/*
|
||||||
|
* getopt --
|
||||||
|
* Parse argc/argv argument vector.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
getopt( int nargc,
|
||||||
|
char * const *nargv,
|
||||||
|
const char *ostr)
|
||||||
|
{
|
||||||
|
static char *place = EMSG; /* option letter processing */
|
||||||
|
char *oli; /* option letter list index */
|
||||||
|
|
||||||
|
if (optreset || !*place) { /* update scanning pointer */
|
||||||
|
optreset = 0;
|
||||||
|
if (optind >= nargc || *(place = nargv[optind]) != '-') {
|
||||||
|
place = EMSG;
|
||||||
|
return (EOF);
|
||||||
|
}
|
||||||
|
if (place[1] && *++place == '-') { /* found "--" */
|
||||||
|
++optind;
|
||||||
|
place = EMSG;
|
||||||
|
return (EOF);
|
||||||
|
}
|
||||||
|
} /* option letter okay? */
|
||||||
|
if ((optopt = (int)*place++) == (int)':' ||
|
||||||
|
!(oli = (char*) strchr(ostr, optopt))) {
|
||||||
|
/*
|
||||||
|
* if the user didn't specify '-' as an option,
|
||||||
|
* assume it means EOF.
|
||||||
|
*/
|
||||||
|
if (optopt == (int)'-')
|
||||||
|
return (EOF);
|
||||||
|
if (!*place)
|
||||||
|
++optind;
|
||||||
|
if (opterr && *ostr != ':')
|
||||||
|
(void)fprintf(stderr,
|
||||||
|
"illegal option -- %c\n", optopt);
|
||||||
|
return (BADCH);
|
||||||
|
}
|
||||||
|
if (*++oli != ':') { /* don't need argument */
|
||||||
|
optarg = NULL;
|
||||||
|
if (!*place)
|
||||||
|
++optind;
|
||||||
|
}
|
||||||
|
else { /* need an argument */
|
||||||
|
if (*place) /* no white space */
|
||||||
|
optarg = place;
|
||||||
|
else if (nargc <= ++optind) { /* no arg */
|
||||||
|
place = EMSG;
|
||||||
|
if (*ostr == ':')
|
||||||
|
return (BADARG);
|
||||||
|
if (opterr)
|
||||||
|
(void)fprintf(stderr,
|
||||||
|
"option requires an argument -- %c\n",
|
||||||
|
optopt);
|
||||||
|
return (BADCH);
|
||||||
|
}
|
||||||
|
else /* white space */
|
||||||
|
optarg = nargv[optind];
|
||||||
|
place = EMSG;
|
||||||
|
++optind;
|
||||||
|
}
|
||||||
|
return (optopt); /* dump back option letter */
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
#ifndef _HAD_GETOPT_H
|
||||||
|
#define _HAD_GETOPT_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
getopt.h -- header for getopt() replacement function
|
||||||
|
Copyright (C) 1999-2011 Dieter Baron and Thomas Klausner
|
||||||
|
|
||||||
|
This file is part of libzip, a library to manipulate ZIP archives.
|
||||||
|
The authors can be contacted at <libzip@nih.at>
|
||||||
|
|
||||||
|
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. The names of the authors may not be used to endorse or promote
|
||||||
|
products derived from this software without specific prior
|
||||||
|
written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern char *optarg;
|
||||||
|
extern int optind;
|
||||||
|
extern int opterr;
|
||||||
|
|
||||||
|
extern int getopt(int, char * const *, const char *);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _HAD_GETOPT_H */
|
|
@ -2,6 +2,7 @@
|
||||||
// This file is in the public domain. //
|
// This file is in the public domain. //
|
||||||
//--------------------------------------------------------------------------//
|
//--------------------------------------------------------------------------//
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
#include <string.h>
|
||||||
#include <exec/io.h>
|
#include <exec/io.h>
|
||||||
#include <exec/types.h>
|
#include <exec/types.h>
|
||||||
#include <exec/memory.h>
|
#include <exec/memory.h>
|
||||||
|
|
|
@ -36,8 +36,6 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
# include <config.h>
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
|
@ -21,8 +21,6 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
|
@ -0,0 +1,61 @@
|
||||||
|
/* $NetBSD: rand.c,v 1.12 2012/06/25 22:32:45 abs Exp $ */
|
||||||
|
|
||||||
|
/*-
|
||||||
|
* Copyright (c) 1990, 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 <sys/cdefs.h>
|
||||||
|
#if defined(LIBC_SCCS) && !defined(lint)
|
||||||
|
#if 1
|
||||||
|
static char sccsid[] = "@(#)rand.c 8.1 (Berkeley) 6/14/93";
|
||||||
|
#else
|
||||||
|
__RCSID("$NetBSD: rand.c,v 1.12 2012/06/25 22:32:45 abs Exp $");
|
||||||
|
#endif
|
||||||
|
#endif /* LIBC_SCCS and not lint */
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#ifndef RAND_MAX
|
||||||
|
#define RAND_MAX 2147483647
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static u_long next = 1;
|
||||||
|
|
||||||
|
int
|
||||||
|
rand(void)
|
||||||
|
{
|
||||||
|
/* LINTED integer overflow */
|
||||||
|
return (int)((next = next * 1103515245 + 12345) % ((u_long)RAND_MAX + 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
srand(u_int seed)
|
||||||
|
{
|
||||||
|
next = seed;
|
||||||
|
}
|
|
@ -31,7 +31,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "fping.h"
|
#include "fping.h"
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
int open_ping_socket_ipv4();
|
int open_ping_socket_ipv4();
|
||||||
int open_ping_socket_ipv6();
|
int open_ping_socket_ipv6();
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "fping.h"
|
#include "fping.h"
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netinet/in_systm.h>
|
#include <netinet/in_systm.h>
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "fping.h"
|
#include "fping.h"
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
|
Loading…
Reference in New Issue