Commit Diff


commit - 53bed50154a249d1263a3066d28500b3541539d5
commit + bbdbef1aa611793df3db28ba27fa2ef8bb34cfad
blob - a1c53732ad9b93159612c229b7eda9d445762de2
blob + c57cf11f9f81d7c1e856642def029495e5b397c6
--- GotMArc.pm
+++ GotMArc.pm
@@ -55,7 +55,8 @@ sub parse {
 	my ($time, $id) = split /\./, basename($fname);
 	my $mid = "$time.$id";
 
-	return ($level, $fname, $mid, $date, $from, $subj);
+	return {level => $level, fname => $fname,
+	    mid => $mid, date => $date, from => $from, subj => $subj};
 }
 
 sub readall {
blob - 8f291686b1442a49b81b17cfe468f87b9a6d5084
blob + 44cac2bf265eeab9be0d4e2fd15357ec586d578c
--- mexp
+++ mexp
@@ -58,22 +58,22 @@ sub humanize {
 
 my $tid;
 while (<>) {
-	my ($level, $fname, $mid, $date, $from, $subj) = parse;
+	my $mail = parse;
 
-	$tid = $mid if $level == 0;
+	$tid = $mail->{mid} if $mail->{level} == 0;
 	die "unknown tid" unless defined $tid;
 
-	my $dest = "$outdir/mail/$mid.html";
+	my $dest = "$outdir/mail/$mail->{mid}.html";
 
 	open(my $fh, '>', "$dest") or die "can't open $dest: $!";
 
-	initpage $fh, $subj;
+	initpage $fh, $mail->{subj};
 
-	open(my $mshow, "-|", "mshow", "-nNA", "text/plain", $fname)
+	open(my $mshow, "-|", "mshow", "-nNA", "text/plain", $mail->{fname})
 	    or die "can't exec mshow: $!";
 
-	open(my $text, '>', "$outdir/text/$mid.txt")
-	    or die "can't open $outdir/text/$mid.txt: $!";
+	open(my $text, '>', "$outdir/text/$mail->{mid}.txt")
+	    or die "can't open $outdir/text/$mail->{mid}.txt: $!";
 
 	my @hdrs;
 	while (<$mshow>) {
@@ -86,7 +86,7 @@ while (<>) {
 	}
 	say $text "";
 
-	thread_header $fh, $tid, $mid, \@hdrs;
+	thread_header $fh, $tid, $mail->{mid}, \@hdrs;
 
 	print $fh "<pre>";
 	while (<$mshow>) {
@@ -96,7 +96,7 @@ while (<>) {
 	print $fh "</pre>";
 
 	# generate the listing for the exported parts
-	open(my $parts, '-|', 'mshow', '-t', $fname)
+	open(my $parts, '-|', 'mshow', '-t', $mail->{fname})
 	    or die "can't exec mshow: $!";
 
 	my $partno = 0;
@@ -127,10 +127,10 @@ while (<>) {
 		say $fh "<ul class='parts'>" if $partno == 0;
 		$partno++;
 
-		my $path = "$outdir/parts/$mid.$partno.$ext";
+		my $path = "$outdir/parts/$mail->{mid}.$partno.$ext";
 		open my $p, '>', $path
-		    or die "can't open $fname: $!";
-		export_part($p, $n, $fname);
+		    or die "can't open $mail->{fname}: $!";
+		export_part($p, $n, $mail->{fname});
 		close($p);
 
 		$path =~ s,^.*/parts/,/parts/,;
@@ -141,7 +141,7 @@ while (<>) {
 	}
 	say $fh "</ul>" if $partno > 0;
 
-	my $encmid = urlencode $mid;
+	my $encmid = urlencode $mail->{mid};
 	my $enctid = urlencode $tid;
 
 	print $fh "<nav>";
blob - e52ae37dbcfeb93da16bc0ca78e21f0535985c9a
blob + 9e2f0625262e48e0e16ba735edb2501bd66cd50e
--- mkindex
+++ mkindex
@@ -186,10 +186,10 @@ pledge("stdio rpath wpath cpath fattr") or die "pledge
 nextfile;
 
 while (<>) {
-	my ($level, $fname, $mid, $date, $from, $subj) = parse;
+	my $mail = parse;
 
-	if ($level == 0) {
-		nextthread $mid, $subj;
+	if ($mail->{level} == 0) {
+		nextthread $mail->{mid}, $mail->{subj};
 
 		$threads++;
 		if ($threads > $threads_per_page) {
@@ -199,28 +199,29 @@ while (<>) {
 			$from_day = undef;
 		}
 
-		my $day = $date =~ s/ .*//r;
+		my $day = $mail->{date} =~ s/ .*//r;
 		$to_day = mins $day, $to_day;
 		$from_day = maxs $day, $from_day;
 	}
 
-	thread_entry $tfh, $mid, $level, $date, $from, $subj;
-	$last_level = $level;
+	thread_entry($tfh, $mail->{mid}, $mail->{level}, $mail->{date},
+	    $mail->{from}, $mail->{subj});
+	$last_level = $mail->{level};
 	$threads_seen = 1;
 
 	index_entry $pfh, $last_tid, $last_date, $last_from, $last_subj
-	    if defined $last_tid && $level == 0;
+	    if defined $last_tid && $mail->{level} == 0;
 
 	# `gt' on dates works because the format used allow for
 	# lexicographic comparisons.
-	if ($level == 0 || $date gt $last_date) {
-		$last_date = $date;
-		$last_from = $from;
+	if ($mail->{level} == 0 || $mail->{date} gt $last_date) {
+		$last_date = $mail->{date};
+		$last_from = $mail->{from};
 	}
 
-	if ($level == 0) {
-		$last_tid = $mid;
-		$last_subj = $subj;
+	if ($mail->{level} == 0) {
+		$last_tid = $mail->{mid};
+		$last_subj = $mail->{subj};
 	}
 }
 
blob - a32837235a1e361e572ac8cb931e8b188a902a02
blob + 2c6179bd710adbb5ed6462636453130c694ed9c0
--- pe
+++ pe
@@ -61,10 +61,10 @@ sub process {
 	return unless @entries;
 
 	local $_ = $entries[0];
-	my ($level, $fname, $mid, $date, $from, $subj) = parse;
-	die "wtf?" if $level != 0;
+	my $mail = parse;
+	die "wtf?" if $mail->{level} != 0;
 
-	my $tid = $mid;
+	my $tid = $mail->{mid};
 	my $thrsum = thrsum @_;
 	my $oldsum = oldsum $tid;
 	return if $thrsum eq $oldsum;