| 1 |
#!/usr/bin/perl |
| 2 |
|
| 3 |
my $numArgs = @ARGV; |
| 4 |
my $host = ""; |
| 5 |
|
| 6 |
if ($numArgs == 1) { |
| 7 |
$host = $ARGV[0]; |
| 8 |
} |
| 9 |
|
| 10 |
my $blanked = 0; |
| 11 |
open (IN, "xscreensaver-command -watch |"); |
| 12 |
while (<IN>) { |
| 13 |
if (m/^(BLANK|LOCK)/) { |
| 14 |
if (!$blanked) { |
| 15 |
if ($host == "") { |
| 16 |
system("/us/bfsbld/Compilers/distcc/bin/enable-host"); |
| 17 |
} else { |
| 18 |
system("/us/bfsbld/Compilers/distcc/bin/enable-host $host"); |
| 19 |
} |
| 20 |
$blanked = 1; |
| 21 |
} |
| 22 |
} elsif (m/^UNBLANK/) { |
| 23 |
if ($host == "") { |
| 24 |
system("/us/bfsbld/Compilers/distcc/bin/disable-host"); |
| 25 |
} else { |
| 26 |
system("/us/bfsbld/Compilers/distcc/bin/disable-host $host"); |
| 27 |
} |
| 28 |
$blanked = 0; |
| 29 |
} |
| 30 |
} |