From f5613a0977edfcf162f75f63dd98d6a1fa9e1db4 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Mon, 28 May 2012 02:30:54 +0200 Subject: searchalias: Simplify output --- fripost-searchalias | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'fripost-searchalias') diff --git a/fripost-searchalias b/fripost-searchalias index a70b900..0a6c4d7 100755 --- a/fripost-searchalias +++ b/fripost-searchalias @@ -131,31 +131,30 @@ sub perform_search { my %alias = @_; foreach my $alias ($ldap->alias->search( \%alias )->entries) { - say "From: " . (join ', ', @{$alias->{address}}); - say "Goto: " . $alias->{goto}; - say "IsActive: " . $alias->{isActive}; - say "--------------------------------" + say "" . ($alias->{isActive} ? "ACTIVE" : "INACTIVE") + . " alias for " . $alias->{goto} . " are " + . (join ', ', @{$alias->{address}}); } } +my $search = $ARGV[0]; + my $f = $conf->{from}; my $g = $conf->{goto}; my $from = $f || !$f && !$g; my $goto = $g || !$f && !$g; if ($from) { - say " Searchin 'from'"; - perform_search(address => $ARGV[0]); + perform_search(address => $search); - my ($u,$d) = split /\@/, $ARGV[0], 2; + my ($u,$d) = split /\@/, $search, 2; $d = $u if (defined $u) and not (defined $d); $ldap->domain->search({ domain => $d })->count or die "Error: Unknown domain `$d'.\n"; } if ($goto) { - say " Searchin 'goto'"; - perform_search(goto => $ARGV[0]); + perform_search(goto => $search); } $ldap->unbind(); @@ -169,6 +168,8 @@ Guilhem Moulin C<< >> Copyright 2012 Guilhem Moulin. +Copyright 2012 Stefan Kangas . + =head1 LICENSE This program is free software; you can redistribute it and/or modify it -- cgit v1.2.3