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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
#!/usr/local/bin/perl -w
#-*- perl -*-
#
# Copyright (C) 2000-2001 Ken'ichi Fukamachi
# All rights reserved.
#
# $Id$
# $FML$
#
use vars qw($MainCF);
use strict;
use Carp;
# main configuration file for directory switch
$MainCF = '/etc/fml/main.cf';
eval { &Bootstrap();};
if ($@) { print STDERR "Error: ", $@, "\n";}
exit 0;
BEGIN {
use File::Basename;
unshift(@INC, dirname($0));
require Standalone;
}
sub Bootstrap
{
# 1. main.cf exists and I can open it?
-f $MainCF || die("cannot find ${MainCF}");
my $fh = new FileHandle $MainCF;
defined($fh) || die("cannot find ${MainCF}");
# 1.1 o.k. try to load main.cf
my $config = Standalone::load_cf($MainCF);
my $libexec_dir = $config->{ libexec_dir };
my $default_config = $config->{ default_config };
# 2. pick up *.cf files to read and set them to @cf.
# We pass it to fml_loader.
# pass *.cf files to libexec/{distribute,command}
# for example
# @cf = ( /etc/fml/defaults/$VERSION/default_config.cf
# /etc/fml/domains/$DOMAIN/config.cf
# /var/spool/ml/elena/config.cf
# );
my @cf = ($default_config);
my %optargs = ();
for (@ARGV) {
if ($_ eq '--ctladdr') {
$optargs{ ctladdr } = 1;
}
elsif (-d $_) {
push(@cf, "$_/config.cf") if -f "$_/config.cf";
}
elsif (-f $_) {
push(@cf, "$_");
}
}
# 3. reset @INC
use lib qw( $config->{ local_lib_dir } $config->{ lib_dir });
# 4. inspect my mode from $0
use File::Basename;
my $myname = basename($0);
# 5. o.k. here we go!
require "$libexec_dir/fml";
ProcessSwitch(
{
main_config => $config,
cf_list => \@cf,
myname => $myname,
options => \%optargs,
});
}
=head1 NAME
fml.pl -- wrapper which executes the real fml5 programs.
=head1 SYNOPSIS
fml.pl C<[-d]> C<[--ctladdr]> $mail_list_address
=head1 DESCRIPTION
C<$mail_list_address>
Hmm,,,?
C<-d>
debug on.
C<--ctladdr>
execute fml/libexec/command.
=cut
|