diff options
author | ivan <ivan> | 1998-04-16 20:34:09 +0000 |
---|---|---|
committer | ivan <ivan> | 1998-04-16 20:34:09 +0000 |
commit | 9307a5317a1dcf9fafd8b6bac8ffc70c505f9e2b (patch) | |
tree | 774a7cb559ed9a599c08b053ec3ed9e0fbd6869b /fs_radlog | |
parent | 0b5b85344c8cb7d94ba895fbd56f483dee756de7 (diff) |
Initial revision
Diffstat (limited to 'fs_radlog')
-rwxr-xr-x | fs_radlog/fs_radlogd | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/fs_radlog/fs_radlogd b/fs_radlog/fs_radlogd new file mode 100755 index 000000000..74c2af361 --- /dev/null +++ b/fs_radlog/fs_radlogd @@ -0,0 +1,51 @@ +#!/usr/bin/perl -Tw +# +# ivan@sisd.com 98-mar-23 + +use strict; +use Date::Parse; #but hopefully not + +$|=1; + +my($file,$pos)=@_; +open(FILE,"<$file") or die "Can't open $file: $!"; +seek(FILE,$pos,0) or die "Can't seek: $!"; + +my($datestr); +my(%param); + +$SIG{'HUP'} = sub { print "EOF\n"; exit; }; + +while (1) { + + while (<FILE>) { + next if /^$/; + if ( /^\S/ ) { + chop($datestr=$_); + undef %param; + } else { + warn "Unexpected line: $_"; + } + while (<FILE>) { + if ( /^$/ ) { + #if ( $param{'Acct-Status-Type'} eq 'Stop' ) { + print join("\t", + tell FILE, + %param, + ),"\n"; + #} + last; + } elsif ( /^\s+([\w\-]+)\s\=\s\"?([\w\.\-]+)\"?\s*$/ ) { + $param{$1}=$2; + } else { + warn "Unexpected line: $_"; + } + + } + + } + sleep 1; + seek(FILE,0,1); +} + + |