Apache/2.4.7 (Ubuntu) Linux sman1baleendah 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) safemode : OFF MySQL: ON | Perl: ON | cURL: OFF | WGet: ON > / usr / share / doc / w3m / examples / Bonus / | server ip : 104.21.89.46 your ip : 172.70.80.170 H O M E |
Filename | /usr/share/doc/w3m/examples/Bonus/scanhist.rb |
Size | 1.62 kb |
Permission | rw-r--r-- |
Owner | root : root |
Create time | 27-Apr-2025 09:56 |
Last modified | 04-Jan-2014 19:15 |
Last accessed | 07-Jul-2025 18:51 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
#!/usr/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"
# 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"