aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Janík2002-07-05 19:56:34 +0000
committerPavel Janík2002-07-05 19:56:34 +0000
commit85271e4161f91e415e7f9352dda83dcf2ad0e482 (patch)
treefdb394cc71a00d5e91df50a6c18c0091be321cd9
parente43e5c3e8eddad51375beefdabe4cf640e701565 (diff)
downloademacs-85271e4161f91e415e7f9352dda83dcf2ad0e482.tar.gz
emacs-85271e4161f91e415e7f9352dda83dcf2ad0e482.zip
Obey the rmail file and use the unpruned header properly.
-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 6ec923d3d22..9098418d966 100644
--- a/lib-src/b2m.pl
+++ b/lib-src/b2m.pl
@@ -30,7 +30,7 @@ use Mail::Address;
30use Date::Parse; 30use Date::Parse;
31 31
32my($whoami) = basename $0; 32my($whoami) = basename $0;
33my($version) = '$Revision: 1.4 $'; 33my($version) = '$Revision: 1.1 $';
34my($usage) = "Usage: $whoami [--help] [--version] [--[no]full-headers] [Babyl-file] 34my($usage) = "Usage: $whoami [--help] [--version] [--[no]full-headers] [Babyl-file]
35\tBy default, full headers are printed.\n"; 35\tBy default, full headers are printed.\n";
36 36
@@ -62,7 +62,7 @@ if (<> !~ /^BABYL OPTIONS:/) {
62 62
63while (<>) { 63while (<>) {
64 my($msg_num) = $. - 1; 64 my($msg_num) = $. - 1;
65 my($labels, $full_header, $header); 65 my($labels, $pruned, $full_header, $header);
66 my($from_line, $from_addr); 66 my($from_line, $from_addr);
67 my($time); 67 my($time);
68 68
@@ -79,7 +79,11 @@ while (<>) {
79 } 79 }
80 $labels = $1; 80 $labels = $1;
81 81
82 s/(?:((?:.+\n)+)\n+)?\*\*\* EOOH \*\*\*\n+// || goto malformatted; 82 # Strip the integer indicating whether the header is pruned
83 $labels =~ s/^(\d+)[,\s]*//;
84 $pruned = $1;
85
86 s/(?:((?:.+\n)+)\n*)?\*\*\* EOOH \*\*\*\n+// || goto malformatted;
83 $full_header = $1; 87 $full_header = $1;
84 88
85 if (s/((?:.+\n)+)\n+//) { 89 if (s/((?:.+\n)+)\n+//) {
@@ -91,7 +95,10 @@ while (<>) {
91 $_ = ''; 95 $_ = '';
92 } 96 }
93 97
94 if (! $full_header) { 98 # "$pruned eq '0'" is different from "! $pruned". We want to make
99 # sure that we found a valid label line which explicitly indicated
100 # that the header was not pruned.
101 if ((! $full_header) || ($pruned eq '0')) {
95 $full_header = $header; 102 $full_header = $header;
96 } 103 }
97 104
@@ -101,8 +108,6 @@ while (<>) {
101 # Quote "^From " 108 # Quote "^From "
102 s/(^|\n)From /$1>From /g; 109 s/(^|\n)From /$1>From /g;
103 110
104 # Strip the integer indicating whether the header is pruned
105 $labels =~ s/^\d+[,\s]*//;
106 # Strip extra commas and whitespace from the end 111 # Strip extra commas and whitespace from the end
107 $labels =~ s/[,\s]+$//; 112 $labels =~ s/[,\s]+$//;
108 # Now collapse extra commas and whitespace in the remaining label string 113 # Now collapse extra commas and whitespace in the remaining label string