r2701 - switchvlans: don't let tr fail on binary data under certain locales
authorDenis Ovsienko <infrastation@yandex.ru>
Fri, 8 May 2009 13:40:13 +0000 (13:40 +0000)
committerDenis Ovsienko <infrastation@yandex.ru>
Fri, 8 May 2009 13:40:13 +0000 (13:40 +0000)
gateways/switchvlans/cisco.connector

index b4860a7b7dc48e59c6e3962abbd75a21a29d497a..44ce8ced6a23797c233f6ebcab4df49685db710a 100755 (executable)
@@ -128,15 +128,15 @@ do_fetch()
        # Here we need to distinguish between different platforms and IOS version,
        # cause they produce output in different formats.
        if [ "$SW" = "Cisco+IOS+12.0" ]; then
-               cat "$OUT3" | tr -d '\r' | fgrep Dynamic | sed $SEDFLAG 's/ +Dynamic +([0-9]+) +(.+)/=\1@\2/;s/FastEthernet/Fa/;s/GigabitEthernet/Gi/' > "$FILE3"
+               cat "$OUT3" | LC_ALL=C tr -d '\r' | fgrep Dynamic | sed $SEDFLAG 's/ +Dynamic +([0-9]+) +(.+)/=\1@\2/;s/FastEthernet/Fa/;s/GigabitEthernet/Gi/' > "$FILE3"
        elif [ "$SW" = "Cisco+IOS+12.2" -o "$SW" = "Cisco+IOS+12.1" ]; then
                case "$HW" in
                        Cisco+Catalyst+35*|Cisco+Catalyst+37*|Cisco+Catalyst+29*)
-                               cat "$OUT3" | tr -d '\r' | egrep 'STATIC|DYNAMIC' | \
+                               cat "$OUT3" | LC_ALL=C tr -d '\r' | egrep 'STATIC|DYNAMIC' | \
                                sed $SEDFLAG 's/ +([0-9]+|All) +(.+)    (DYNAMIC|STATIC) +(.+)/\2=\1@\4/;s/FastEthernet/Fa/;s/GigabitEthernet/Gi/' > "$FILE3"
                        ;;
                        Cisco+Catalyst+49*)
-                               cat "$OUT3" | tr -d '\r' | fgrep dynamic | \
+                               cat "$OUT3" | LC_ALL=C tr -d '\r' | fgrep dynamic | \
                                sed $SEDFLAG 's/ +([0-9]+) +([0-9a-f\.]+)   dynamic ip +([a-zA-Z/0-9]+) */\2=\1@\3/;s/FastEthernet/Fa/;s/GigabitEthernet/Gi/;s/TenGi/Te/' > "$FILE3"
                        ;;
                esac