#!/usr/bin/perl -s $minhdr = 'minhdr -m'; $txt2html = 'webrowse -mqnok 0'; $frmcolor = '#009900'; # header color for sender lines $to_color = '#999900'; # header color for recipient lines $datcolor = '#009999'; # header color for date lines $sbjcolor = '#990099'; # header color for subject lines $txtcolor = '#DDDDDD'; # background color for text attachments $attcolor = '#FF0000'; # listing color for unpresented attachments # mimeindex - create a msg-index.html file in the given directories # Steve Kinzler, kinzler@cs.indiana.edu, Oct 05 # http://www.cs.indiana.edu/~kinzler/home.html#unix $usage = "usage: $0 directory ...\n"; die $usage if $h || ! @ARGV; $mbxre = 'mimebrowse|mbx-\d+-\d'; $txtre = 'txt|html?'; $imgre = 'gif|jpe?g|png|bmp'; chop($wd = `pwd`); foreach $dir (@ARGV) { warn("$0: cannot chdir $dir ($!)\n"), chdir($wd), next unless chdir($dir); warn("$0: cannot opendir $dir/. ($!)\n"), chdir($wd), next unless opendir(DIR, '.'); warn("$0: cannot open $dir/msg-index.html ($!)\n"), close DIR, chdir($wd), next unless open(INDEX, '>msg-index.html'); select INDEX; @files = sort readdir DIR; close DIR; $hdrs = $subj = ''; foreach (grep(/^($mbxre)/, @files)) { warn("$0: cannot run $minhdr ($!)\n"), next unless open(HDR, "$minhdr " . &shencode($_) . '|'); $hdrs .= '
' . &ahref($_) . '';
while (
\n$_";
}
$hdrs .= "
';
foreach (`ls -al`) {
s/( \w\w\w +\d+ +\d+:\d+ )(.*)/$1 . &ahref($2)/e;
s/.*/&color($attcolor, "$&<\/B>")/e
unless $2 =~ /^(\.{0,2}$|$mbxre|cid-)/
|| $2 =~ /\.($txtre|$imgre)$/i;
print;
}
print "\n\n";
foreach (grep(/\.($txtre)$/i, @files)) {
if (/\.txt$/i) {
print '| ', &ahref($_), " |
| ";
warn("$0: cannot run $txt2html ($!)\n") unless
open(TXT, "$txt2html < " . &shencode($_) . '|');
while ( |
| ', &ahref($_), " |