From: Felix Fietkau Date: Sat, 19 Dec 2009 22:19:34 +0000 (+0000) Subject: libipfix: specify the number of the wprobe ie append script on the command line X-Git-Url: http://git.openwrt.org/?p=openwrt%2Fsvn-archive%2Farchive.git;a=commitdiff_plain;hb=0ec52ed312d266548b8e8b3b7fe4ea2fc218db52 libipfix: specify the number of the wprobe ie append script on the command line SVN-Revision: 18855 --- diff --git a/package/libipfix/extra/append-wprobe-ie.pl b/package/libipfix/extra/append-wprobe-ie.pl index fa838ff76a..8bb658bbb9 100644 --- a/package/libipfix/extra/append-wprobe-ie.pl +++ b/package/libipfix/extra/append-wprobe-ie.pl @@ -6,16 +6,12 @@ my @fields = ( [ "_ss", "UINT", " - Sum of squared samples", 8 ], ); -my $file = $ARGV[0] or die "Syntax: $0 \n"; +my $file = $ARGV[0] or die "Syntax: $0 \n"; -f $file or die "File not found\n"; -my $last_ie = 0; -my $line; -open IES, "<$file" or die "Can't open file"; -while ($line = ) { - $line =~ /^(\d+)\s*,/ and $last_ie = $1; -} -close IES; -while () { +my $start = $ARGV[1]; +$start =~ /^\d+$/ or die "Invalid start number"; +open FILE, "<$file" or die "Can't open file"; +while () { /^(%?)(\w+),\s*(\w+),\s*(.+)$/ and do { my $counter = $1; my $rfield = $2; @@ -28,7 +24,7 @@ while () { @f = @fields; } foreach my $f (@f) { - my $nr = ++$last_ie; + my $nr = $start++; my $n = $f->[0]; my $N = uc $n; my $ftype = $f->[1]; @@ -38,4 +34,5 @@ while () { } }; } +close FILE;