]> git.donarmstrong.com Git - deb_pkgs/scowl.git/blob - src/get-level
remove r variants which were removed upstream as well
[deb_pkgs/scowl.git] / src / get-level
1 #!/usr/bin/perl
2
3 $/ = undef;
4 open F, "l/levels-list";
5 @levels = ("00", split(/[ \n]+/,<F>), "99");
6
7 if ($ARGV[0] eq 'max') {
8     print $levels[$#levels-1];
9 } elsif ($ARGV[0] eq 'min') {
10     print $levels[1];
11 } else {
12     $pos = 0;
13     while ($levels[$pos] != $ARGV[1]) {
14         die if $pos == $#levels-1;
15         $pos++;
16     }
17     if ($ARGV[0] eq 'next') {
18         print $levels[$pos+1];
19     } elsif ($ARGV[0] eq 'prev') {
20         print $levels[$pos-1];
21     } else {
22         die;
23     }
24 }
25 print "\n";
26