File: watch-ssaver

package info (click to toggle)
dmucs 0.6.1-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 2,372 kB
  • ctags: 760
  • sloc: ansic: 5,053; sh: 3,521; cpp: 2,475; makefile: 59; perl: 26
file content (30 lines) | stat: -rwxr-xr-x 622 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
#!/usr/bin/perl

my $numArgs = @ARGV;
my $host = "";

if ($numArgs == 1) {
    $host = $ARGV[0];
}

my $blanked = 0;
open (IN, "xscreensaver-command -watch |");
while (<IN>) {
    if (m/^(BLANK|LOCK)/) {
	if (!$blanked) {
	    if ($host == "") {
		system("/us/bfsbld/Compilers/distcc/bin/enable-host");
	    } else {
		system("/us/bfsbld/Compilers/distcc/bin/enable-host $host");
	    }
	    $blanked = 1;
	}
    } elsif (m/^UNBLANK/) {
	if ($host == "") {
	    system("/us/bfsbld/Compilers/distcc/bin/disable-host");
	} else {
	    system("/us/bfsbld/Compilers/distcc/bin/disable-host $host");
	}
	$blanked = 0;
    }
}