diff options
author | Daniel Friesel <derf@finalrewind.org> | 2014-01-11 22:50:11 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2014-01-11 22:50:11 +0100 |
commit | ef58e86cd740064057186f9a5732f6a62b68bcf1 (patch) | |
tree | 40c537fd11d725b92058a4ad1c9e0d29bb6d6241 /bin | |
parent | 1d739bfbf784f20ec1dd7706f17268c61cdb2ede (diff) |
db-iris: implement -om
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/db-iris | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/bin/db-iris b/bin/db-iris index cbda3b6..530af08 100755 --- a/bin/db-iris +++ b/bin/db-iris @@ -74,13 +74,13 @@ if ($time) { for my $efield (@edata_pre) { given ($efield) { - when ('d') { $edata{delay} = 1 } + when ('d') { $edata{delay} = 1 } when ('f') { $edata{fullroute} = 1 } - when ('m') { $edata{messages} = 1 } - when ('q') { $edata{qos} = 1 } - when ('r') { $edata{route} = 1 } - when ('t') { $edata{times} = 1 } - default { $edata{$efield} = 1 } + when ('m') { $edata{messages} = 1 } + when ('q') { $edata{qos} = 1 } + when ('r') { $edata{route} = 1 } + when ('t') { $edata{times} = 1 } + default { $edata{$efield} = 1 } } } @@ -145,8 +145,7 @@ sub display_result { @{$line}[ 0 .. 4 ] ); - my $d = $line->[5]; - my $need_newlines = 0; + my $d = $line->[5]; if ( $edata{times} ) { if ( not defined $d->delay ) { @@ -166,13 +165,19 @@ sub display_result { } - if ( $edata{fullroute} ) { - $need_newlines = 1; - print "\n" . join( "\n", $d->route ); + if ( $edata{messages} ) { + for my $message ( reverse $d->messages ) { + + # leading spaces to align with regular output + printf( " %s %s\n", + $message->[0]->strftime('%d.%m. %H:%M'), + $message->[1] ); + } + print "\n"; } - if ($need_newlines) { - print "\n\n"; + if ( $edata{fullroute} ) { + print "\n" . join( "\n", $d->route ) . "\n\n"; } } |