[alt.sources] A Smaller, faster uuwhere

rhorn@infinet.UUCP (Rob Horn) (04/11/88)

I recently noticed how much time by batch mail map processing was
taking.  The two most obvious candidates for cleanup were the article
processing and the map file frill (uuwhere).  I have not yet attacked
uuhosts itself (it does look like perl can do a faster job) but here
is a quick hack on uuwhere.  It generates the same nmail.where file as
before.  Benchmark comparisons on an 11/750 indicate that it is only
about 20% faster, but it does almost no I/O.  This makes it less of a
pest to other users.

You need perl to use this.  It abuses associative arrays vigorously
and found no bugs.  A neater, better commented version, plus uuhosts,
minimal doc's, await my having time to work on them.

=cut====cut====cut====cut====cut====cut====cut====cut====cut====cut====cut

#!/usr/local/bin/perl
#
#  UUWHERE:  annotate paths file with filename where known
#  This version has pathnames wired in.  Edit to suit your installation.
#
#  Usage:
#     uuwhere >nmail.where  
#
###############

open( index, "/usr/spool/news/maps/mod.map/Index") || 
	die "Host Index missing\n";
while (<index>) {
  ($site,$file) = split;
  $where{$site} = $file;
  }


open( annotate, "/usr/local/lib/nmail.paths") ||
	 die "Mail paths file missing\n";

while(<annotate>){
  ($site, $path) = split;
  @nodes = split( /!/, $path);
  $temp = $where{$site};
  if( $temp eq "") { print $site, "\t";}
  else {print $site, "(", $temp, ")\t";}

  for($i = 0; $nodes[$i] ne "%s"; $i++) {
    $temp = $where{$nodes[$i]};
    if( $temp eq "") { print $nodes[$i], "!";}
    else { print $nodes[$i], "(", $temp, ")!";}
    }
  print "%s\n";
  }

=cut====cut====cut====cut====cut====cut====cut====cut====cut====cut====cut
-- 
				Rob  Horn
	UUCP:	...harvard!adelie!infinet!rhorn
	Snail:	Infinet,  40 High St., North Andover, MA
	(Note: harvard!infinet path is in maps but not working yet)