From: epg <> Date: Thu, 19 Jan 2006 19:48:46 +0000 (+0000) Subject: (mark): Since new.c only uses the lists from .mh_sequences, it doesn't X-Git-Url: https://diplodocus.org/git/minc/commitdiff_plain/d5c93c73ae13ff2665e0f8ac4f7f67b2612928ec (mark): Since new.c only uses the lists from .mh_sequences, it doesn't parse them, simply appending here really hurts. Bite the bullet and properly merge new messages into the existing .mh_sequences message lists (i.e. 1-39 becomes 1-40). --- diff --git a/minc b/minc index 8ac7af2..a48e412 100755 --- a/minc +++ b/minc @@ -361,8 +361,42 @@ sub mark { my $marked = 0; open($fh, '>', $fn) or die("open(>$fn): $!"); for $_ (@sequences) { - if (/^$seq: /) { - print($fh "$_ $msgnum\n"); + if (/^$seq: (.*)/) { + my @parts; + my @result; + my $done = 0; + for my $part (split(' ', $1)) { + if (not $done) { + my ($st, $en) = split('-', $part); + if ((defined($en) and ($msgnum >= $st and $msgnum <= $en)) + or $msgnum == $st) { + # It's already there. + $done = 1; + } + if (defined($en)) { + if ($st - 1 == $msgnum) { + $part = "$msgnum-$en"; + $done = 1; + } elsif ($en + 1 == $msgnum) { + $part = "$st-$msgnum"; + $done = 1; + } + } else { + if ($part - 1 == $msgnum) { + $part = "$msgnum-$part"; + $done = 1; + } elsif ($part + 1 == $msgnum) { + $part = "$part-$msgnum"; + $done = 1; + } + } + } + push(@result, $part); + } + if (not $done) { + push(@result, $msgnum); + } + print($fh "$seq: ", join(' ', @result), "\n"); $marked = 1; } else { print($fh "$_\n");