File: get.sbr

package info (click to toggle)
im 1%3A151-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,464 kB
  • ctags: 368
  • sloc: perl: 8,081; sh: 3,254; makefile: 141
file content (43 lines) | stat: -rw-r--r-- 774 bytes parent folder | download | duplicates (9)
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
# -*-Perl-*-

# A user customizable subroutine for imget.
# 'get_sub' is called if "GetSbr=get.sbr" is specified in your "Config".
# The argments are the folder name, the start of the range, and the end
# of the range.

%hash = ();

sub get_sub ($$$) {
    my($folder, $first, $last) = @_;

    my $dir = expand_path($folder);
    my($name, $val);

    open(SEQ, "$dir/.mh_sequences") || return;

    while (<SEQ>) {
	chomp;
	($name, $val) = split(': ');
	$hash{$name} = $val;
    }

    close(SEQ);

    if (defined($hash{'unseen'})) {
	if ($first == $last) {
	    $hash{'unseen'} .= " $first";
	} else {
	    $hash{'unseen'} .= " $first-$last";
	}

	open(SEQ, ">$dir/.mh_sequences");

	foreach (keys %hash) {
	    print SEQ "$_: $hash{$_}\n";
	}

	close(SEQ);
    }
}

1;