Take hints on port 1235, hint script in user's PATH

This commit is contained in:
blinry 2020-12-22 16:05:35 +01:00
parent cf10605bf4
commit d8d48c245e
5 changed files with 37 additions and 5 deletions

View file

@ -10,7 +10,7 @@ $socket = IO::Socket::INET->new(PeerAddr => "127.0.0.1",
my $absolute_path = File::Spec->rel2abs($ARGV[0]);
# Send the length of the first argument as a byte.
# Send the length of the first argument as four bytes.
$socket->send(pack("L", length($absolute_path)));
# Send the first argument as a string.
$socket->send($absolute_path);

15
scripts/hint Executable file
View file

@ -0,0 +1,15 @@
#!/usr/bin/env perl
use IO::Socket;
$socket = IO::Socket::INET->new(PeerAddr => "127.0.0.1",
PeerPort => 1235,
Proto => "tcp",
Type => SOCK_STREAM);
my $message = join " ", @ARGV;
# Send the length of the first argument as four bytes.
$socket->send(pack("L", length($message)));
# Send the first argument as a string.
$socket->send($message);