1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
#! /bin/sh
# $Cambridge: exim/test/listtests,v 1.1 2006/02/06 16:07:10 ph10 Exp $
# This script scans the directories of Exim test scripts and lists the first
# comment line of each one, which gives a description. The output is piped via
# "more". If the script has an argument, it is a pattern that is used to select
# only certain subdirectories. If the script has a second argument, it is a
# pattern that is used to select only certain test titles from the selected
# directories.
/usr/bin/perl -w - "$1" "$2" <<'PerlEnd' | less
$dirpat = "$ARGV[0]";
$filpat = "$ARGV[1]";
opendir(SCRIPTS, "scripts") || die "** Failed to opendir(SCRIPTS): $!\n";
@subdirs = readdir(SCRIPTS);
closedir(SCRIPTS);
foreach $subdir (sort @subdirs)
{
my($first) = 1;
next if $subdir =~ /^\./;
next if $dirpat ne "" && $subdir !~ /$dirpat/i;
opendir(TESTS, "scripts/$subdir") ||
die "** Failed to opendir(scripts/$subdir): $!\n";
@tests = readdir(TESTS);
closedir(TESTS);
foreach $file (sort @tests)
{
next if $file !~ /^\d\d\d\d$/;
open(IN, "scripts/$subdir/$file") ||
die "** Failed to open scripts/$subdir/$file: $!\n";
my($heading) = substr(<IN>, 2);
close(IN);
if ($filpat eq "" || $heading =~ /$filpat/i)
{
if ($first)
{
print "\n=== $subdir ===\n";
if (open(REQUIRES, "scripts/$subdir/REQUIRES"))
{
my($indent) = "";
print "=== Requires: ";
while (<REQUIRES>)
{
print $indent, $_;
$indent = " ";
}
print "\n" if $indent eq "";
close (REQUIRES);
}
$first = 0;
}
printf("%s/%s %s", (substr $subdir, 5), $file, $heading);
}
}
}
PerlEnd
# End
|