From 54cbb0bb09781fb5e36872a60d2bfe69c717ac0c Mon Sep 17 00:00:00 2001 From: Gerhard Rieger Date: Sat, 29 Jun 2024 09:45:16 +0200 Subject: [PATCH] Changes for new Linux distributions: grep -E, -F --- CHANGES | 2 ++ configure.ac | 2 +- proxyecho.sh | 4 ++-- test.sh | 10 +++++----- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/CHANGES b/CHANGES index 1fb2975..3b24c7b 100644 --- a/CHANGES +++ b/CHANGES @@ -6,6 +6,8 @@ Features: Porting: Changes for building and testing on NetBSD + New Linux distributions dislike egrep, fgrep + Testing: test.sh: lots of corrections and improvements diff --git a/configure.ac b/configure.ac index 74b1503..dba0cc0 100644 --- a/configure.ac +++ b/configure.ac @@ -10,7 +10,7 @@ AC_CONFIG_HEADER(config.h) if test -f /usr/xpg4/bin/fgrep; then FGREP=/usr/xpg4/bin/fgrep # Solaris else - FGREP=fgrep + FGREP="grep -F" fi # find out which defines gcc passes to cpp, so makedepend does not run into diff --git a/proxyecho.sh b/proxyecho.sh index f5d0706..baa91dc 100755 --- a/proxyecho.sh +++ b/proxyecho.sh @@ -39,13 +39,13 @@ done # read and parse HTTP request read l -if ! echo "$l" |egrep '^CONNECT +[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+:[0-9]+ +HTTP/[1-3].[0-9]$' >/dev/null +if ! echo "$l" |grep -E '^CONNECT +[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+:[0-9]+ +HTTP/[1-3].[0-9]$' >/dev/null then echo "HTTP/1.0${SPACES}500 Bad Request" echo exit fi -if ! echo "$l" |egrep '^CONNECT +[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+:[0-9]+ +HTTP/'"$REQVER"'$' >/dev/null +if ! echo "$l" |grep -E '^CONNECT +[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+:[0-9]+ +HTTP/'"$REQVER"'$' >/dev/null then echo "HTTP/1.0${SPACES}426 Upgrade Required" echo diff --git a/test.sh b/test.sh index c6cb3fd..082015b 100755 --- a/test.sh +++ b/test.sh @@ -596,7 +596,7 @@ SunOS) #BROADCASTIF=hme0 #BROADCASTIF=eri0 #SECONDADDR=$($IFCONFIG $BROADCASTIF |grep 'inet ' |awk '{print($2);}') - SECONDADDR=$(expr "$($IFCONFIG -a |grep 'inet ' |fgrep -v ' 127.0.0.1 '| head -n 1)" : '.*inet \([0-9.]*\) .*') + SECONDADDR=$(expr "$($IFCONFIG -a |grep 'inet ' |$GREP_F -v ' 127.0.0.1 '| head -n 1)" : '.*inet \([0-9.]*\) .*') #BCIFADDR="$SECONDADDR" #BCADDR=$($IFCONFIG $BROADCASTIF |grep 'broadcast ' |sed 's/.*broadcast/broadcast/' |awk '{print($2);}') ;; @@ -608,7 +608,7 @@ DragonFly) BCADDR=$($IFCONFIG "$BROADCASTIF" |grep 'broadcast ' |sed 's/.*broadcast/broadcast/' |awk '{print($2);}') ;; #AIX|FreeBSD|Solaris) *) - SECONDADDR=$(expr "$($IFCONFIG -a |grep 'inet ' |fgrep -v ' 127.0.0.1 ' |head -n 1)" : '.*inet \([0-9.]*\) .*') + SECONDADDR=$(expr "$($IFCONFIG -a |grep 'inet ' |$GREP_F -v ' 127.0.0.1 ' |head -n 1)" : '.*inet \([0-9.]*\) .*') ;; esac # for generic sockets we need this address in hex form @@ -619,12 +619,12 @@ fi # for some tests we need a second local IPv6 address case "$UNAME" in Linux) if [ "$IP" ]; then - SECONDIP6ADDR=$(expr "$($IP address |grep 'inet6 ' |fgrep -v ' ::1/128 '| head -n 1)" : '.*inet6 \([0-9a-f:][0-9a-f:]*\)/.*') + SECONDIP6ADDR=$(expr "$($IP address |grep 'inet6 ' |$GREP_F -v ' ::1/128 '| head -n 1)" : '.*inet6 \([0-9a-f:][0-9a-f:]*\)/.*') else - SECONDIP6ADDR=$(expr "$($IFCONFIG -a |grep 'inet6 ' |fgrep -v ' ::1/128 '| head -n 1)" : '.*inet \([0-9.]*\) .*') + SECONDIP6ADDR=$(expr "$($IFCONFIG -a |grep 'inet6 ' |$GREP_F -v ' ::1/128 '| head -n 1)" : '.*inet \([0-9.]*\) .*') fi ;; *) - SECONDIP6ADDR=$(expr "$($IFCONFIG -a |grep 'inet6 ' |fgrep -v ' ::1/128 '| head -n 1)" : '.*inet \([0-9.]*\) .*') + SECONDIP6ADDR=$(expr "$($IFCONFIG -a |grep 'inet6 ' |$GREP_F -v ' ::1/128 '| head -n 1)" : '.*inet \([0-9.]*\) .*') ;; esac if [ -z "$SECONDIP6ADDR" ]; then