blob: 69dcc9d4ea678796fb18f756b12f54302c168259 (
plain) (
blame)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
#!/usr/local/bin/ruby
# scan history
def usage
STDERR.print "usage: scanhist -h HISTORY ML-archive1 ML-archive2 ...\n"
exit 1
end
def html_quote(s)
s.gsub!(/&/,"&")
s.gsub!(/</,"<")
s.gsub!(/>/,">")
s
end
if ARGV.size == 0 then
usage
end
histfile = nil
while ARGV[0] =~ /^-/
case ARGV.shift
when "-h"
histfile = ARGV.shift
else
usage
end
end
if histfile.nil? then
usage
end
patched = {}
histline = {}
f = open(histfile)
while f.gets
if /Subject: (\[w3m-dev.*\])/ then
patched[$1] = true
histline[$1] = $.
end
end
f.close
archive = {}
subject = nil
for fn in ARGV
f = open(fn)
while f.gets
if /^From / then
# beginning of a mail
subject = nil
elsif subject.nil? and /^Subject: / then
$_ =~ /Subject: (\[w3m-dev.*\])/
subject = $1
archive[subject] = [$_.chop.sub(/^Subject:\s*/,""),false,fn+"#"+($.).to_s]
elsif /^\+\+\+/ or /\*\*\*/ or /filename=.*(patch|diff).*/ or /^begin \d\d\d/
archive[subject][1] = true
end
end
f.close
end
print "<html><head><title>w3m patch configuration\n</title></head><body>\n"
print "<pre>\n"
for sub in archive.keys.sort
a = archive[sub]
if a[1] then
if patched[sub] then
print "[<a href=\"#{histfile}\##{histline[sub]}\">+</a>]"
else
print "[-]"
end
print "<a href=\"#{a[2]}\">"
print "<b>",html_quote(a[0]),"</b></a>\n"
else
if patched[sub] then
print "[<a href=\"#{histfile}\##{histline[sub]}\">o</a>]"
else
print " "
end
print "<a href=\"#{a[2]}\">"
print "<b>",html_quote(a[0]),"</b></a>\n"
end
end
print "</pre></body></html>\n"
|