Listing 2: Remote display script - ntXstart
#!/usr/local/bin/perl
#
#
$sockaddr_t = 'S n a4 x8';
sub inet_ntoa_sock {
local($addr) = @_;
local($pf,$port,$ip) = unpack($sockaddr_t,$addr);
local($a,$b,$c,$d) = unpack('C4',$ip);
return "$a.$b.$c.$d";
}
$hersockaddr = getpeername(STDIN) || do {
print "getpeername failed\n";
exit 1;
}
$ip = &inet_ntoa_sock($hersockaddr);
$ENV{'DISPLAY'}="$ip:0";
exec @ARGV;
# End of File
|