File: mrd6sh

package info (click to toggle)
mrd6 0.9.6-13
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 1,912 kB
  • ctags: 5,937
  • sloc: cpp: 25,489; perl: 454; makefile: 254; ansic: 180; sh: 77
file content (33 lines) | stat: -rwxr-xr-x 484 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/perl -w

# by Marco d'Itri

use strict;
use IO::Socket::UNIX;

my $MRD_SOCKET = '/var/run/mrd6';

if (@ARGV == 0) {
	print "No command specified.\n";
	exit 1;
}

my $command = join(' ', @ARGV) . "\r\n";

my $sock = new IO::Socket::UNIX(
	Type	=> SOCK_STREAM,
	Peer	=> $MRD_SOCKET,
);

if (not defined $sock) {
	print "Failed to connect to MRD6, is the router daemon running?\n";
	exit 1;
}

print $sock $command or die "write: $!";

while (<$sock>) {
	print $_;
}

exit 0;