diff --git a/debian/changelog b/debian/changelog index b44cfdbe..99b6058d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,9 @@ byobu (4.13) unreleased; urgency=low - * UNRELEASED + [ Scott Moser ] + * usr/lib/byobu/network: + - fix but where /proc/net/dev has so much traffic that integers + run up against colons with no whitespace -- Dustin Kirkland Thu, 16 Jun 2011 11:37:56 -0500 diff --git a/usr/lib/byobu/network b/usr/lib/byobu/network index 73eeeff4..374a6134 100755 --- a/usr/lib/byobu/network +++ b/usr/lib/byobu/network @@ -42,6 +42,7 @@ fi [ -d "/var/run/screen/S-$USER" ] && DIR="/var/run/screen/S-$USER" || DIR="$DATA" t2=`date +%s` +OIFS=$IFS for i in up down; do unit="kbps" case $i in @@ -54,12 +55,14 @@ for i in up down; do rate=0 else [ -r "$cache" ] && read x1 < "$cache" || tx1=0 + IFS="$OIFS:" while read iface rbytes rpackets rerrs rdrop rfifo rframe rcompressed rmulticast tbytes tpackets terrs tdrop tfifo tcolls tcarrier tcompressed; do - if [ "$iface" = "${interface}:" ]; then + if [ "$iface" = "${interface}" ]; then [ "$i" = "up" ] && x2=${tbytes} || x2=${rbytes} break; fi done < /proc/net/dev + IFS=$OIFS echo "$x2" > "$cache" rate=$((8*($x2 - $x1) / ($t2 - $t1) / 1024)) # in kbps [ "$rate" -lt 0 ] && rate=0