#! /usr/bin/perl -w

# <@LICENSE>
# Copyright 2004 Apache Software Foundation
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# </@LICENSE>
#
# This goes with the run-masses script to take the ham/spam directories
# and spit out the appropriate spam:mbox:path statements for mass-check.
#

use strict;
use File::Find ();

# Set the variable $File::Find::dont_use_nlink if you're using AFS,
# since AFS cheats.

# for the convenience of &wanted calls, including -eval statements:
use vars qw/*name *dir *prune/;
*name   = *File::Find::name;
*dir    = *File::Find::dir;
*prune  = *File::Find::prune;

my @dirs = @ARGV || ( 'ham', 'spam' );

# Traverse desired filesystems
File::Find::find({wanted => \&wanted}, @dirs);
exit;


sub wanted {
    if ( -f $_ ) {
	$name =~ m@^([^/]+)@;
	print "$1:mbox:$name\n";
    }
}
