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 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
|
#! @im_path_perl@
################################################################
###
### imali
###
### Copyright (C) 1997 Internet Message Group
###
### This Perl5 library conforms
### GNU GENERAL PUBLIC LICENSE Version 2.
###
###
### Author: Internet Message Group <img@mew.org>
### Created: Apr 23, 1997
### Revised: @im_revised@
###
my $VERSION = "imali @im_version@";
$Prog = 'imali';
##
## Require packages
##
use IM::Config;
use IM::Util;
use IM::Alias qw(alias_open alias_list_mail alias_lookup alias_close);
use integer;
use strict;
use vars qw($Prog $EXPLANATION @OptConfig
$opt_file $opt_verbose $opt_debug $opt_help);
##
## Environments
##
$EXPLANATION = "
$Prog :: Internet Message Query Alias
$VERSION
Usage: $Prog [options] [target...]
";
@OptConfig = (
'file;s;;' => "Set aliases file.",
'verbose;b;;' => 'With verbose messages.',
'debug;d;;' => "With debug message.",
'help;b;;' => "Show this message.",
);
##
## Profile and option processing
##
init_opt(\@OptConfig);
read_cfg();
read_opt(\@ARGV); # help?
help($EXPLANATION) && exit $EXIT_SUCCESS if $opt_help;
debug_option($opt_debug) if $opt_debug;
##
## Main
##
# parse argument
my @targets = @ARGV;
my $i;
my $aliasesfile = &expand_path($opt_file || &aliases_file);
&alias_open($aliasesfile);
if (scalar(@targets) == 0) {
local $, = "\n";
print alias_list_mail(), "\n";
} else {
foreach $i (@targets) {
print alias_lookup($i), "\n";
}
}
alias_close();
exit $EXIT_SUCCESS;
__END__
=head1 NAME
imali - Display mail aliases
=head1 SYNOPSIS
B<imali> [B<--file=file>] [B<--help>] [targets ...]
=head1 DESCRIPTION
I<Imali> searches the named mail alias files for each of the given
aliases. It creates a list of addresses for those aliases, and writes
that list on standard output. If I<targets> are omitted, all aliases
are displayed.
=head1 OPTIONS
=over 5
=item I<-f, --file = file>
Use I<file> as a aliasfile. Default is ~/.im/Aliases.
=item I<-h, --help>
Print a usage message on standard output and exit successfully.
=back
=cut
### Local Variables:
### mode: perl
### End:
|