diff --git a/SRC/INSTALL b/SRC/INSTALL index 3592723..ecd5afb 100644 --- a/SRC/INSTALL +++ b/SRC/INSTALL @@ -16,12 +16,6 @@ TTCP T/TCP support if your system supports it (FreeBSD does). See -USE_SIGACTION -Use sigaction instead of signal. On purely BSD systems, such as SunOS or -FreeBSD, this is necessary because we need to change the semantics of -signals. On some systems (Irix, Solaris), do not use this option, because -it will prevent echoping to compile (this is a bug). - If 'echoping -h' fails with "tcp_open: unknown service: http/tcp", add "http" to the services database (typically /etc/services or a NIS map). diff --git a/SRC/Makefile.am b/SRC/Makefile.am index ab97e82..e914259 100644 --- a/SRC/Makefile.am +++ b/SRC/Makefile.am @@ -6,4 +6,3 @@ echoping_LDADD = - diff --git a/SRC/acconfig.h b/SRC/acconfig.h index 607cd44..545d627 100644 --- a/SRC/acconfig.h +++ b/SRC/acconfig.h @@ -1,4 +1,8 @@ @BOTTOM@ + +/* Do we have POSIX signals? */ +#undef HAVE_SIGACTION + /* Is sys_errlist declared? */ #undef DECL_SYS_ERRLIST diff --git a/SRC/acinclude.m4 b/SRC/acinclude.m4 index 0937dda..6ba5dcb 100644 --- a/SRC/acinclude.m4 +++ b/SRC/acinclude.m4 @@ -1,3 +1,6 @@ +dnl Macros beginning with CF_ stolen from Lynx +dnl Thanks to "T.E.Dickey" + dnl --------------------------------------------------------------------------- dnl Make an uppercase version of a variable dnl $1=uppercase($2) diff --git a/SRC/config.h.in b/SRC/config.h.in index 838a9c6..a5a132c 100644 --- a/SRC/config.h.in +++ b/SRC/config.h.in @@ -21,6 +21,9 @@ /* Define if you have the gettimeofday function. */ #undef HAVE_GETTIMEOFDAY +/* Define if you have the sigaction function. */ +#undef HAVE_SIGACTION + /* Define if you have the socket function. */ #undef HAVE_SOCKET @@ -36,6 +39,10 @@ /* Version number of package */ #undef VERSION + +/* Do we have POSIX signals? */ +#undef HAVE_SIGACTION + /* Is sys_errlist declared? */ #undef DECL_SYS_ERRLIST diff --git a/SRC/configure b/SRC/configure index 53edc5a..e5d3ff3 100755 --- a/SRC/configure +++ b/SRC/configure @@ -1031,6 +1031,9 @@ else fi fi +if test "$GCC" = yes; then + CFLAGS="$CFLAGS -Wall" +fi # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: @@ -1043,7 +1046,7 @@ fi # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1047: checking for a BSD compatible install" >&5 +echo "configure:1050: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1098,7 +1101,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1102: checking how to run the C preprocessor" >&5 +echo "configure:1105: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1113,13 +1116,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1123: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1126: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1130,13 +1133,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1140: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1143: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1147,13 +1150,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1157: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1160: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1178,12 +1181,12 @@ fi echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1182: checking for ANSI C header files" >&5 +echo "configure:1185: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1191,7 +1194,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1195: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1198: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1208,7 +1211,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1226,7 +1229,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1247,7 +1250,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1258,7 +1261,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1262: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1265: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -1285,17 +1288,17 @@ for ac_hdr in sys/time.h unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1289: checking for $ac_hdr" >&5 +echo "configure:1292: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1299: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1302: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1326,13 +1329,13 @@ for cf_name in sys_nerr sys_errlist do echo $ac_n "checking if external $cf_name is declared""... $ac_c" 1>&6 -echo "configure:1330: checking if external $cf_name is declared" >&5 +echo "configure:1333: checking if external $cf_name is declared" >&5 if eval "test \"`echo '$''{'cf_cv_dcl_$cf_name'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1352: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval 'cf_cv_dcl_'$cf_name'=yes' else @@ -1375,13 +1378,13 @@ fi # It's possible (for near-UNIX clones) that the data doesn't exist echo $ac_n "checking if external $cf_name exists""... $ac_c" 1>&6 -echo "configure:1379: checking if external $cf_name exists" >&5 +echo "configure:1382: checking if external $cf_name exists" >&5 if eval "test \"`echo '$''{'cf_cv_have_$cf_name'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1398: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval 'cf_cv_have_'$cf_name'=yes' else @@ -1424,12 +1427,12 @@ done echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:1428: checking for working const" >&5 +echo "configure:1431: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1485: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -1499,12 +1502,12 @@ EOF fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:1503: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:1506: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1513,7 +1516,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:1517: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1520: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -1535,12 +1538,12 @@ fi echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:1539: checking return type of signal handlers" >&5 +echo "configure:1542: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1557,7 +1560,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:1561: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1564: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -1576,12 +1579,12 @@ EOF echo $ac_n "checking for vprintf""... $ac_c" 1>&6 -echo "configure:1580: checking for vprintf" >&5 +echo "configure:1583: checking for vprintf" >&5 if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1611: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_vprintf=yes" else @@ -1628,12 +1631,12 @@ fi if test "$ac_cv_func_vprintf" != yes; then echo $ac_n "checking for _doprnt""... $ac_c" 1>&6 -echo "configure:1632: checking for _doprnt" >&5 +echo "configure:1635: checking for _doprnt" >&5 if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1663: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func__doprnt=yes" else @@ -1680,15 +1683,15 @@ fi fi -for ac_func in gettimeofday socket +for ac_func in gettimeofday socket sigaction do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1687: checking for $ac_func" >&5 +echo "configure:1690: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1718: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else diff --git a/SRC/configure.in b/SRC/configure.in index 01b34b8..1919c40 100644 --- a/SRC/configure.in +++ b/SRC/configure.in @@ -21,6 +21,9 @@ AC_ARG_ENABLE(icp, dnl Checks for programs. AC_PROG_CC +if test "$GCC" = yes; then + CFLAGS="$CFLAGS -Wall" +fi AC_PROG_INSTALL dnl Checks for libraries. @@ -37,6 +40,6 @@ AC_HEADER_TIME dnl Checks for library functions. AC_TYPE_SIGNAL AC_FUNC_VPRINTF -AC_CHECK_FUNCS(gettimeofday socket) +AC_CHECK_FUNCS(gettimeofday socket sigaction) AC_OUTPUT(Makefile) diff --git a/SRC/echoping.h b/SRC/echoping.h index d6ad177..65c7706 100644 --- a/SRC/echoping.h +++ b/SRC/echoping.h @@ -1,6 +1,14 @@ -/* - * Definitions for TCP and UDP client/server programs. - */ +/* Settings you can change */ + +#define DEFLINE 256 +#define MAXLINE 65535 +#define UDPMAX 65535 +#ifdef HTTP +#define MAXTOREAD 150000 +#endif +#define MAXNUMBER 20 + +/* Settings you should not change */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -48,6 +56,11 @@ extern char *sys_errlist[]; extern int sys_nerr; #endif +/* If we have it, use it */ +#ifdef HAVE_SIGACTION +#define USE_SIGACTION 1 +#endif + struct timeval null_timeval; struct timeval max_timeval; @@ -105,14 +118,6 @@ int read_from_server (); #endif -#define DEFLINE 256 -#define MAXLINE 65535 -#define UDPMAX 65535 -#ifdef HTTP -#define MAXTOREAD 150000 -#endif -#define MAXNUMBER 20 - extern char *progname; extern unsigned short timeout_flag;