2 # New configuration script
4 $ENV{'PATH'}.= ':/usr/openwin/bin';
7 $_= $ENV{'HOST'}.':0' if m/^:/ || m/^unix:/;
12 @ARGV && warn "arguments beyond the first ignored\n";
16 $_= `xauth -i extract /dev/null $c{'display'}:0 2>&1`;
17 $c{'xauth'}= length($_) ? 'false' : 'true';
19 $c{'keycodes'}="$1-$2" if m/range:\s+minimum (\d+), maximum (\d+)\s/;
20 if (m/default screen number:\s+(\d+)\s/) {
22 $_=$' if m/\nscreen \#$defscreen:/;
25 ($c{'pixels_x'}, $c{'pixels_y'}) = ($1,$2)
26 if m/dimensions:\s+(\d+)x(\d+) pixels/;
27 ($c{'mm_x'}, $c{'mm_y'}) = ($1,$2)
28 if m/dimensions:.*\D(\d+)x(\d+) millimeters/;
29 ($c{'dpi_x'}, $c{'dpi_y'}) = ($1,$2)
30 if m/resolution:\s+(\d+)x(\d+) dots per inch/;
31 $c{'depth'} = $1 if m/depth of root window:\s+(\d+) planes/;
32 if (m/default visual id:\s+(\w+)\s/) {
34 $_=$' if m/\n visual:\s+visual id:\s+$defvisual\s/;
35 $_="$`\n" if m/\n visual:/;
37 $c{'visual'} = $1 if m/class:\s+(\w+)\s/;
38 $c{'depth'} = $1 if m/depth:\s+(\d+) planes/;
41 $c{'host'}= $ENV{'HOST'};
42 #$c{'arch'}= $ENV{'ARCH'};
43 $_= `uname -sr`; s/\s(\d+)\.\S*/$1/;
49 open(L, "list") || die "$0: list: $!\n";
53 next if m/^#/ || m/^$/;
56 while ($l =~ s/\s*(\S+)// && $1 ne ':') {
65 next unless defined($c{$lhs});
66 $true= eval '$c{$lhs} '.$op.' $rhs';
70 next unless defined($c{$lhs});
71 $true= $c{$lhs} eq $rhs;
73 warn "condition `$_' in line $. not understood\n";
77 while ($l =~ s/\s*(\S+)//) {
79 warn "consequence `$1' in line $. not understood\n";
88 while (($k,$v) = each %c) {