diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2011-12-04 21:46:30 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2011-12-04 21:46:30 +0100 |
commit | 96647c3c3ddb0161bc9fe67007897daadeb4a26f (patch) | |
tree | 1b151640cd4b0c8baa8bf6cd026a51d047c00a65 /svdrpsend.pl | |
parent | 8db58ff99e815ebb42408a30bf84002bb7ee08dc (diff) | |
download | vdr-96647c3c3ddb0161bc9fe67007897daadeb4a26f.tar.gz vdr-96647c3c3ddb0161bc9fe67007897daadeb4a26f.tar.bz2 |
Removed the '.pl' suffix from svdrpsend.pl
Diffstat (limited to 'svdrpsend.pl')
-rwxr-xr-x | svdrpsend.pl | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/svdrpsend.pl b/svdrpsend.pl deleted file mode 100755 index caf3b41f..00000000 --- a/svdrpsend.pl +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/perl - -use Socket; -use Getopt::Std; - -$Usage = qq{ -Usage: $0 options command... - -Options: -d hostname destination hostname (default: localhost) - -p port SVDRP port number (default: 6419) -}; - -die $Usage if (!$ARGV[0] || !getopts("d:p:")); - -$Dest = $opt_d || "localhost"; -$Port = $opt_p || 6419; -$Cmd = "@ARGV" || Error("missing command"); - -$Timeout = 10; # max. seconds to wait for response - -$SIG{ALRM} = sub { Error("timeout"); }; -alarm($Timeout); - -$iaddr = inet_aton($Dest) || Error("no host: $Dest"); -$paddr = sockaddr_in($Port, $iaddr); - -$proto = getprotobyname('tcp'); -socket(SOCK, PF_INET, SOCK_STREAM, $proto) || Error("socket: $!"); -connect(SOCK, $paddr) || Error("connect: $!"); -select(SOCK); $| = 1; -Receive(); -Send($Cmd); -Send("quit"); -close(SOCK) || Error("close: $!"); - -sub Send -{ - my $cmd = shift || Error("no command to send"); - print SOCK "$cmd\r\n"; - Receive(); -} - -sub Receive -{ - while (<SOCK>) { - print STDOUT $_; - last if substr($_, 3, 1) ne "-"; - } -} - -sub Error -{ - print STDERR "@_\n"; - close(SOCK); - exit 1; -} - |