Changes for new Linux distributions: grep -E, -F

This commit is contained in:
Gerhard Rieger 2024-06-29 09:45:16 +02:00
parent 2ab4b232fc
commit 54cbb0bb09
4 changed files with 10 additions and 8 deletions

View file

@ -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

View file

@ -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

View file

@ -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

10
test.sh
View file

@ -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