summaryrefslogtreecommitdiffstats
path: root/ksirc/puke/tester.pl
blob: d3b2546225af5ed9ec71d0b8aae1c78712780482 (plain)
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
#!/usr/bin/perl

$sock = $ENV{'HOME'} . "/.ksirc.socket";

use Socket;

$proto = getprotobyname('tcp');
socket(fd, PF_UNIX, SOCK_STREAM, 0) || die "Sock failed: $!\n";
$sun = sockaddr_un($sock);
print "Connecting to $sock\n";
connect(fd,$sun) || die "Connect failed: $!\n";

select(fd); $| = 1; select(STDOUT);

while(1){
  print "Command: ";
  chomp($cmd = <STDIN>);
  print "WinId: ";
  chomp($winid = <STDIN>);
  print "iArg: ";
  chomp($iarg = <STDIN>);
  print "cArg: ";
  chomp($carg = <STDIN>);
  $m = pack("iiia50xx", $cmd, $winid, $iarg, $carg);
  print fd $m;
  
}