]> git.ipfire.org Git - thirdparty/HylaFAX.git/commitdiff
[Bug 327] fix faxaddmodem to not egrep or do arithmetic
authorDarren Nickerson <darren.nickerson@ifax.com>
Fri, 2 Aug 2002 17:20:54 +0000 (17:20 +0000)
committerDarren Nickerson <darren.nickerson@ifax.com>
Fri, 2 Aug 2002 17:20:54 +0000 (17:20 +0000)
Portability fix for Slowlaris and others where grep -E is not supported

etc/faxaddmodem.sh.in

index 6caa32f209be9ce75dea7f0062e31468e2b57ad1..642665d355e9d4de1548ecde876d667285a3abdd 100644 (file)
@@ -1114,18 +1114,12 @@ if [ "$RESULT" = "OK" ]; then
     # Class 1 = 1; Class 2 = 2; Class 2.0 = 3;
     # Class 1.0 = 4; Class 2.1 = 5;   
 
-    RESPONSE="`echo $RESPONSE | $SED -e 's/[()]//g'`";
+    RESPONSE="`echo $RESPONSE | $SED -e 's/[()]//g' \
+       -e 's/2.0/3/g' -e 's/1.0/4/g' -e 's/2.1/5/g'`";
     SUPPORT="This modem looks to have support for Class "
     MODEMCLASSES="";
-    CLASS=0;
-    for MATCHSTR in \
-       ",1,|^1,|,1$|^1$" \
-       ",2,|^2,|,2$|^2$" \
-       ",2\.0,|^2\.0,|,2\.0\$|^2\.0\$" \
-       ",1\.0,|^1\.0,|,1\.0\$|^1\.0\$" \
-       ",2\.1,|^2\.1,|,2\.1\$|^2\.1\$"; do
-       CLASS=$[ $CLASS + 1 ];
-       if [ "`echo $RESPONSE | $GREP -E $MATCHSTR`" != "" ]; then
+    for CLASS in 1 2 3 4 5; do
+       if [ "`echo $RESPONSE | $GREP $CLASS`" != "" ]; then
            if [ "$MODEMCLASSES" != "" ]; then
                 SUPPORT=`echo $SUPPORT | $SED 's/ and /, /g'`" and ";
            fi