ongrep

A cleaned up fork of ngrep for OpenBSD
git clone git://git.sgregoratto.me/ongrep
Log | Files | Refs | README | LICENSE

commit 17ff2cba80999275f35338953e01aac33b19098d
parent 806985cfde7bc2678f5411db63f7c973442abcb6
Author: Jordan Ritter <jpr5@darkridge.com>
Date:   Thu, 12 Jun 2014 13:48:50 -0700

Convert all output to AC_MSG_ macros, & minor formatting cleanups

Diffstat:
Mconfigure | 136+++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------
Mconfigure.in | 84++++++++++++++++++++++++++++++++++++++++----------------------------------------
2 files changed, 130 insertions(+), 90 deletions(-)

diff --git a/configure b/configure @@ -1292,7 +1292,7 @@ Optional Features: --enable-ipv6 enable IPv6 (and ICMPv6) support --enable-pcap-restart enable BPF lexer restart bugfix for older versions of PCAP --enable-pcre use PCRE instead of GNU regex - --enable-tcpkill enable connection killing support + --enable-tcpkill enable connection killing support Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -1905,9 +1905,12 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -echo -echo 'Configuring System ...' -echo +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5 +$as_echo "" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Configuring System ..." >&5 +$as_echo "Configuring System ..." >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5 +$as_echo "" >&6; } ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do @@ -3403,9 +3406,12 @@ else USE_PCRE="0" - echo - echo 'Configuring GNU Regular Expression library ...' - echo + { $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5 +$as_echo "" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: Configuring GNU Regular Expression library ..." >&5 +$as_echo "Configuring GNU Regular Expression library ..." >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5 +$as_echo "" >&6; } REGEX_DIR='regex-0.12' REGEX_OBJS="$REGEX_DIR/regex.o" @@ -3424,7 +3430,6 @@ fi # Check whether --enable-tcpkill was given. if test "${enable_tcpkill+set}" = set; then : enableval=$enable_tcpkill; -# AC_CHECK_LIB(net, libnet_init_packet,,echo !!! error: tcpkill feature enabled but no libnet found; exit) USE_TCPKILL="1" EXTRA_OBJS="$EXTRA_OBJS tcpkill.o" EXTRA_DEFINES="$EXTRA_DEFINES $(libnet-config --defines)" @@ -3454,9 +3459,12 @@ fi -echo -echo 'Configuring Network Grep (ngrep) ...' -echo +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5 +$as_echo "" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Configuring Network Grep ..." >&5 +$as_echo "Configuring Network Grep ..." >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5 +$as_echo "" >&6; } STRIPFLAG="-s" @@ -3523,7 +3531,7 @@ _ACEOF LIBS="-lsocket $LIBS" else - echo no socket in -lsocket\?; exit + as_fn_error $? "no socket in -lsocket" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5 @@ -3570,7 +3578,7 @@ _ACEOF LIBS="-lnsl $LIBS" else - echo no gethostbyname in -lnsl\?; exit + as_fn_error $? "no gethostbyname in -lnsl" "$LINENO" 5 fi @@ -3609,7 +3617,7 @@ fi *) OS=UNKNOWN_OS - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Your OS ($target_os) is not supported yet. + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Your OS ($target_os) is not supported yet. Try playing with the build host and target options. " >&5 $as_echo "$as_me: WARNING: Your OS ($target_os) is not supported yet. @@ -3648,12 +3656,19 @@ rm -f conftest* if test -n "$found" -a "$found" != "$pcap_base"; then - echo - echo; echo more than one set found in: - echo $pcap_base - echo $found - echo; echo please wipe out all unused pcap installations - exit + { $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5 +$as_echo "" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5 +$as_echo "" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: more than one set found in:" >&5 +$as_echo "more than one set found in:" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pcap_base" >&5 +$as_echo "$pcap_base" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $found" >&5 +$as_echo "$found" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5 +$as_echo "" >&6; } + as_fn_error $? "please wipe out all unused pcap installations" "$LINENO" 5 else pcap_base="$dir" fi @@ -3662,16 +3677,18 @@ rm -f conftest* done if test -z "$pcap_base" ; then - echo no; echo !!! error: couldn\'t find a complete set of pcap headers - exit + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + as_fn_error $? "could not find a complete set of pcap headers" "$LINENO" 5 else - echo found $pcap_base + { $as_echo "$as_me:${as_lineno-$LINENO}: result: found $pcap_base" >&5 +$as_echo "found $pcap_base" >&6; } EXTRA_INCLUDES="$EXTRA_INCLUDES -I$pcap_base" DIR="`dirname $pcap_base`/lib" if test -d $DIR; then - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$DIR" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$DIR" fi fi @@ -3721,7 +3738,7 @@ _ACEOF LIBS="-lpcap $LIBS" else - echo !!! error: need a viable pcap lib; exit + as_fn_error $? "a viable pcap lib is required" "$LINENO" 5 fi @@ -3789,7 +3806,8 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BPF include path" >&5 $as_echo_n "checking for BPF include path... " >&6; } BPF=`/usr/bin/perl -ne '/include\s+<(.*bpf\.h)>/ && print "$1\n"' $pcap_base/pcap.h` -echo $BPF +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $BPF" >&5 +$as_echo "$BPF" >&6; } present="" @@ -3806,9 +3824,11 @@ yes _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "yes" >/dev/null 2>&1; then : - HAVE_DLT_LINUX_SLL="1" && echo yes + HAVE_DLT_LINUX_SLL="1" && { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } else - HAVE_DLT_LINUX_SLL="0" && echo no + HAVE_DLT_LINUX_SLL="0" && { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi rm -f conftest* @@ -3827,9 +3847,11 @@ yes _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "yes" >/dev/null 2>&1; then : - HAVE_DLT_LOOP="1" && echo yes + HAVE_DLT_LOOP="1" && { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } else - HAVE_DLT_LOOP="0" && echo no + HAVE_DLT_LOOP="0" && { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi rm -f conftest* @@ -3848,9 +3870,11 @@ yes _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "yes" >/dev/null 2>&1; then : - HAVE_DLT_IEEE802_11="1" && echo yes + HAVE_DLT_IEEE802_11="1" && { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } else - HAVE_DLT_IEEE802_11="0" && echo no + HAVE_DLT_IEEE802_11="0" && { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi rm -f conftest* @@ -3870,9 +3894,11 @@ yes _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "yes" >/dev/null 2>&1; then : - HAVE_DLT_IEEE802_11_RADIO="1" && echo yes + HAVE_DLT_IEEE802_11_RADIO="1" && { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } else - HAVE_DLT_IEEE802_11_RADIO="0" && echo no + HAVE_DLT_IEEE802_11_RADIO="0" && { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi rm -f conftest* @@ -3892,9 +3918,11 @@ yes _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "yes" >/dev/null 2>&1; then : - HAVE_DLT_RAW="1" && echo yes + HAVE_DLT_RAW="1" && { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } else - HAVE_DLT_RAW="0" && echo no + HAVE_DLT_RAW="0" && { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi rm -f conftest* @@ -3914,9 +3942,11 @@ yes _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "yes" >/dev/null 2>&1; then : - HAVE_DLT_PFLOG="1" && echo yes + HAVE_DLT_PFLOG="1" && { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } else - HAVE_DLT_PFLOG="0" && echo no + HAVE_DLT_PFLOG="0" && { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi rm -f conftest* @@ -4000,7 +4030,8 @@ _ACEOF -echo +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5 +$as_echo "" >&6; } if test "$USE_PCAP_RESTART" = "1"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: CONFIG: BPF filter lexer restart enabled (using $PCAP_RESTART_FUNC)" >&5 @@ -4008,31 +4039,40 @@ $as_echo "CONFIG: BPF filter lexer restart enabled (using $PCAP_RESTART_FUNC)" > fi if test "$USE_IPv6" = "1"; then - echo "CONFIG: ipv6 support enabled" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: CONFIG: IPV6 support enabled" >&5 +$as_echo "CONFIG: IPV6 support enabled" >&6; } else - echo "CONFIG: ipv6 support disabled" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: CONFIG: IPV6 support disabled" >&5 +$as_echo "CONFIG: IPV6 support disabled" >&6; } fi if test "$USE_DROPPRIVS" = "1"; then - echo "CONFIG: privilege dropping enabled, using \"$DROPPRIVS_USER\"" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: CONFIG: privilege dropping enabled (using $DROPPRIVS_USER)" >&5 +$as_echo "CONFIG: privilege dropping enabled (using $DROPPRIVS_USER)" >&6; } else - echo "CONFIG: privilege dropping disabled" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: CONFIG: privilege dropping DISABLED" >&5 +$as_echo "CONFIG: privilege dropping DISABLED" >&6; } fi if test "$USE_PCRE" = "1"; then - echo "CONFIG: using PCRE regex library" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: CONFIG: using PCRE regex library" >&5 +$as_echo "CONFIG: using PCRE regex library" >&6; } else - echo "CONFIG: using GNU regex library" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: CONFIG: using GNU regex library" >&5 +$as_echo "CONFIG: using GNU regex library" >&6; } fi if test "$USE_TCPKILL" = "1"; then - echo "CONFIG: tcpkill feature enabled" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: CONFIG: tcpkill feature enabled" >&5 +$as_echo "CONFIG: tcpkill feature enabled" >&6; } else - echo "CONFIG: tcpkill feature disabled" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: CONFIG: tcpkill feature disabled" >&5 +$as_echo "CONFIG: tcpkill feature disabled" >&6; } fi -echo +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5 +$as_echo "" >&6; } ac_config_headers="$ac_config_headers config.h" diff --git a/configure.in b/configure.in @@ -7,9 +7,9 @@ dnl NOTE: configure.in requires autoconf 2.57 or more recent. AC_INIT(ngrep.c) -echo -echo 'Configuring System ...' -echo +AC_MSG_RESULT +AC_MSG_RESULT(Configuring System ...) +AC_MSG_RESULT AC_CANONICAL_SYSTEM AC_PROG_CC @@ -144,9 +144,9 @@ AC_ARG_ENABLE(pcre, [ USE_PCRE="0" - echo - echo 'Configuring GNU Regular Expression library ...' - echo + AC_MSG_RESULT + AC_MSG_RESULT(Configuring GNU Regular Expression library ...) + AC_MSG_RESULT REGEX_DIR='regex-0.12' REGEX_OBJS="$REGEX_DIR/regex.o" @@ -164,9 +164,8 @@ dnl tcpkill/libnet support (from Debian patch) dnl AC_ARG_ENABLE(tcpkill, -[ --enable-tcpkill enable connection killing support], +[ --enable-tcpkill enable connection killing support], [ -# AC_CHECK_LIB(net, libnet_init_packet,,echo !!! error: tcpkill feature enabled but no libnet found; exit) USE_TCPKILL="1" EXTRA_OBJS="$EXTRA_OBJS tcpkill.o" EXTRA_DEFINES="$EXTRA_DEFINES $(libnet-config --defines)" @@ -189,9 +188,9 @@ AC_ARG_WITH(pcap-includes, ]) -echo -echo 'Configuring Network Grep (ngrep) ...' -echo +AC_MSG_RESULT +AC_MSG_RESULT(Configuring Network Grep ...) +AC_MSG_RESULT dnl dnl OS-specific options @@ -215,9 +214,9 @@ case "$target_os" in AC_SUBST(OS, SOLARIS) AC_CHECK_LIB(socket, socket,, - echo no socket in -lsocket\?; exit) + [AC_MSG_ERROR(no socket in -lsocket)]) AC_CHECK_LIB(nsl, gethostbyname,, - echo no gethostbyname in -lnsl\?; exit) + [AC_MSG_ERROR(no gethostbyname in -lnsl)]) EXTRA_LIBS="$EXTRA_LIBS -lnsl -lsocket" @@ -249,7 +248,7 @@ case "$target_os" in *) AC_SUBST(OS, UNKNOWN_OS) - AC_MSG_WARN( + AC_MSG_WARN( Your OS ($target_os) is not supported yet. Try playing with the build host and target options. ) @@ -291,12 +290,13 @@ for dir in $PCAP_DIR ; do AC_EGREP_HEADER([PCAP_VERSION_MAJOR], [$dir/pcap.h], [found=$dir], [found=""]) if test -n "$found" -a "$found" != "$pcap_base"; then - echo - echo; echo more than one set found in: - echo $pcap_base - echo $found - echo; echo please wipe out all unused pcap installations - exit + AC_MSG_RESULT + AC_MSG_RESULT + AC_MSG_RESULT(more than one set found in:) + AC_MSG_RESULT( $pcap_base) + AC_MSG_RESULT( $found) + AC_MSG_RESULT + AC_MSG_ERROR(please wipe out all unused pcap installations) else pcap_base="$dir" fi @@ -305,17 +305,17 @@ for dir in $PCAP_DIR ; do done if test -z "$pcap_base" ; then - echo no; echo !!! error: couldn\'t find a complete set of pcap headers - exit + AC_MSG_RESULT(no) + AC_MSG_ERROR(could not find a complete set of pcap headers) else - echo found $pcap_base + AC_MSG_RESULT(found $pcap_base) EXTRA_INCLUDES="$EXTRA_INCLUDES -I$pcap_base" dnl Best-effort; newer ld warns on missing dirs. DIR="`dirname $pcap_base`/lib" if test -d $DIR; then - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$DIR" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$DIR" fi fi @@ -324,7 +324,7 @@ dnl dnl Check for a working PCAP library we can link against.. dnl -AC_CHECK_LIB(pcap, pcap_open_live,,echo !!! error: need a viable pcap lib; exit) +AC_CHECK_LIB(pcap, pcap_open_live,,[AC_MSG_ERROR(a viable pcap lib is required)]) dnl dnl And the PCAP restart function. @@ -354,7 +354,7 @@ dnl AC_MSG_CHECKING(for BPF include path) BPF=`/usr/bin/perl -ne '/include\s+<(.*bpf\.h)>/ && print "$1\n"' $pcap_base/pcap.h` -echo $BPF +AC_MSG_RESULT($BPF) dnl dnl Check for DLT_* types that might not have existed in older @@ -370,7 +370,7 @@ AC_EGREP_CPP(yes, yes #endif ], -[HAVE_DLT_LINUX_SLL="1" && echo yes], [HAVE_DLT_LINUX_SLL="0" && echo no]) +[HAVE_DLT_LINUX_SLL="1" && AC_MSG_RESULT(yes)], [HAVE_DLT_LINUX_SLL="0" && AC_MSG_RESULT(no)]) present="" AC_MSG_CHECKING(for DLT_LOOP in $BPF) @@ -381,7 +381,7 @@ AC_EGREP_CPP(yes, yes #endif ], -[HAVE_DLT_LOOP="1" && echo yes], [HAVE_DLT_LOOP="0" && echo no]) +[HAVE_DLT_LOOP="1" && AC_MSG_RESULT(yes)], [HAVE_DLT_LOOP="0" && AC_MSG_RESULT(no)]) present="" AC_MSG_CHECKING(for DLT_IEEE802_11 in $BPF) @@ -392,7 +392,7 @@ AC_EGREP_CPP(yes, yes #endif ], -[HAVE_DLT_IEEE802_11="1" && echo yes], [HAVE_DLT_IEEE802_11="0" && echo no]) +[HAVE_DLT_IEEE802_11="1" && AC_MSG_RESULT(yes)], [HAVE_DLT_IEEE802_11="0" && AC_MSG_RESULT(no)]) present="" @@ -404,7 +404,7 @@ AC_EGREP_CPP(yes, yes #endif ], -[HAVE_DLT_IEEE802_11_RADIO="1" && echo yes], [HAVE_DLT_IEEE802_11_RADIO="0" && echo no]) +[HAVE_DLT_IEEE802_11_RADIO="1" && AC_MSG_RESULT(yes)], [HAVE_DLT_IEEE802_11_RADIO="0" && AC_MSG_RESULT(no)]) present="" @@ -416,7 +416,7 @@ AC_EGREP_CPP(yes, yes #endif ], -[HAVE_DLT_RAW="1" && echo yes], [HAVE_DLT_RAW="0" && echo no]) +[HAVE_DLT_RAW="1" && AC_MSG_RESULT(yes)], [HAVE_DLT_RAW="0" && AC_MSG_RESULT(no)]) present="" @@ -428,7 +428,7 @@ AC_EGREP_CPP(yes, yes #endif ], -[HAVE_DLT_PFLOG="1" && echo yes], [HAVE_DLT_PFLOG="0" && echo no]) +[HAVE_DLT_PFLOG="1" && AC_MSG_RESULT(yes)], [HAVE_DLT_PFLOG="0" && AC_MSG_RESULT(no)]) dnl @@ -467,41 +467,41 @@ dnl dnl Emit configuration messages about any flags specified. dnl -echo +AC_MSG_RESULT if test "$USE_PCAP_RESTART" = "1"; then AC_MSG_RESULT([CONFIG: BPF filter lexer restart enabled (using $PCAP_RESTART_FUNC)]) fi if test "$USE_IPv6" = "1"; then - echo "CONFIG: ipv6 support enabled" + AC_MSG_RESULT(CONFIG: IPV6 support enabled) else - echo "CONFIG: ipv6 support disabled" + AC_MSG_RESULT(CONFIG: IPV6 support disabled) fi if test "$USE_DROPPRIVS" = "1"; then - echo "CONFIG: privilege dropping enabled, using \"$DROPPRIVS_USER\"" + AC_MSG_RESULT([CONFIG: privilege dropping enabled (using $DROPPRIVS_USER)]) else - echo "CONFIG: privilege dropping disabled" + AC_MSG_RESULT(CONFIG: privilege dropping DISABLED) fi if test "$USE_PCRE" = "1"; then - echo "CONFIG: using PCRE regex library" + AC_MSG_RESULT(CONFIG: using PCRE regex library) else - echo "CONFIG: using GNU regex library" + AC_MSG_RESULT(CONFIG: using GNU regex library) fi if test "$USE_TCPKILL" = "1"; then - echo "CONFIG: tcpkill feature enabled" + AC_MSG_RESULT(CONFIG: tcpkill feature enabled) else - echo "CONFIG: tcpkill feature disabled" + AC_MSG_RESULT(CONFIG: tcpkill feature disabled) fi dnl dnl And we're done. ALL YOUR BASE. Don't forget. dnl -echo +AC_MSG_RESULT AC_CONFIG_HEADERS(config.h) AC_CONFIG_FILES(Makefile)