From 1133138f86cde9739665087aca63f063737399a9 Mon Sep 17 00:00:00 2001 From: Stefan `Sec` Zehl Date: Thu, 5 Apr 2012 15:43:55 +0200 Subject: [PATCH] Add support to change screen titles --- tools/mesh/beacon-udp.pl | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tools/mesh/beacon-udp.pl b/tools/mesh/beacon-udp.pl index 8b89189..8488631 100755 --- a/tools/mesh/beacon-udp.pl +++ b/tools/mesh/beacon-udp.pl @@ -69,6 +69,8 @@ my $hispaddr = sockaddr_in($port, $hisiaddr); ###send(SOCKET, 0, 0, $hispaddr); +my $xterm=0; +my $screen=1; my $crcerr=0; my $errors=0; @@ -82,8 +84,30 @@ if($verbose){ $dev=~s!/dev/!!; }; print "OpenBeacon Reader $id sending [$dev] to [$server:$port]\n"; + if($xterm){ + print "\e]2;", + "$id\[$dev] -> $server:$port @ ", + strftime("%Y-%m-%d %H:%M:%S ",localtime), + "\a"; + }elsif($screen){ + print "\ek", + "$id\[$dev]", + "\e\\"; + }; print "\n"; }; + +sub interrupt { + if($xterm){ + print "\e]2;", "", "\a"; + }elsif($screen){ + print "\ek", `hostname`, "\e\\"; + }; + exit; +} +if($verbose){ + $SIG{INT} = \&interrupt; +}; my $lasttime=time; my $llasttime=time; my $pkt;