File: kboincspy-0.9.0-update.pl

package info (click to toggle)
kboincspy 0.9.1-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 12,880 kB
  • ctags: 3,964
  • sloc: cpp: 29,018; sh: 9,736; perl: 2,793; makefile: 472; xml: 119
file content (47 lines) | stat: -rw-r--r-- 1,021 bytes parent folder | download | duplicates (3)
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/perl

my $current_group = "";

while ( <> ) {
  chomp;
  if ( /^\[/ ) {
    $current_group = $_;
    next;
  }

  my ($key, $value) = split /=/;

  if ($current_group eq "[General - Polling]" and $key eq "rpc") {
    if ($value < 100) {
      my $new_value = $value*1000;
      
      print "$current_group\n";
      print "rpc=$new_value\n";
    }
  }

  if ($current_group eq "[KBSDocument]" and $key eq "Locations") {

    # If $value is a number, we assume that
    # kboincspyrc is already up to date.
    if ($value =~ m/^\d+?$/) { next; }

    my $host = "localhost";
    my @locations = split(/,/, $value);
    
    for ($i = 0; $i <= $#locations; $i++) {
      if ($locations[$i] =~ m/\/\/(.*?)\//) {
        $host = $1;
        $host =~ s/.*@//;
      }
      print "$current_group\n";
      print "Location $i URL=$locations[$i]\n";
      print "Location $i host=$host\n";
      print "Location $i port=0\n";
    }
    
    print "Locations=$i\n";
  }
}

print "# DELETE [General - Polling]port\n";