summaryrefslogtreecommitdiff
path: root/lib-src/b2m.pl
diff options
context:
space:
mode:
authorPavel Janík <Pavel@Janik.cz>2002-07-05 19:56:34 +0000
committerPavel Janík <Pavel@Janik.cz>2002-07-05 19:56:34 +0000
commit85271e4161f91e415e7f9352dda83dcf2ad0e482 (patch)
treefdb394cc71a00d5e91df50a6c18c0091be321cd9 /lib-src/b2m.pl
parente43e5c3e8eddad51375beefdabe4cf640e701565 (diff)
Obey the rmail file and use the unpruned header properly.
Diffstat (limited to 'lib-src/b2m.pl')
-rw-r--r--lib-src/b2m.pl17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib-src/b2m.pl b/lib-src/b2m.pl
index 6ec923d3d2..9098418d96 100644
--- a/lib-src/b2m.pl
+++ b/lib-src/b2m.pl
@@ -30,7 +30,7 @@ use Mail::Address;
use Date::Parse;
my($whoami) = basename $0;
-my($version) = '$Revision: 1.4 $';
+my($version) = '$Revision: 1.1 $';
my($usage) = "Usage: $whoami [--help] [--version] [--[no]full-headers] [Babyl-file]
\tBy default, full headers are printed.\n";
@@ -62,7 +62,7 @@ if (<> !~ /^BABYL OPTIONS:/) {
while (<>) {
my($msg_num) = $. - 1;
- my($labels, $full_header, $header);
+ my($labels, $pruned, $full_header, $header);
my($from_line, $from_addr);
my($time);
@@ -79,7 +79,11 @@ while (<>) {
}
$labels = $1;
- s/(?:((?:.+\n)+)\n+)?\*\*\* EOOH \*\*\*\n+// || goto malformatted;
+ # Strip the integer indicating whether the header is pruned
+ $labels =~ s/^(\d+)[,\s]*//;
+ $pruned = $1;
+
+ s/(?:((?:.+\n)+)\n*)?\*\*\* EOOH \*\*\*\n+// || goto malformatted;
$full_header = $1;
if (s/((?:.+\n)+)\n+//) {
@@ -91,7 +95,10 @@ while (<>) {
$_ = '';
}
- if (! $full_header) {
+ # "$pruned eq '0'" is different from "! $pruned". We want to make
+ # sure that we found a valid label line which explicitly indicated
+ # that the header was not pruned.
+ if ((! $full_header) || ($pruned eq '0')) {
$full_header = $header;
}
@@ -101,8 +108,6 @@ while (<>) {
# Quote "^From "
s/(^|\n)From /$1>From /g;
- # Strip the integer indicating whether the header is pruned
- $labels =~ s/^\d+[,\s]*//;
# Strip extra commas and whitespace from the end
$labels =~ s/[,\s]+$//;
# Now collapse extra commas and whitespace in the remaining label string