choose [<genopts>] [<redirect>] [#<comment>] (interactively allocate)
update <addr> [<redirect>] [#<comment>]
show <addr>
- list
+ list [-a] (-a also lists aliases set to reject)
list-actions
empty string for redirect means reject
+remember to quote comments (to protect # from your shell)
END
our $usage3 = <<'END';
privileged actions
sub nextarg () {
die "too few arguments\n" unless @ARGV;
my $v = shift @ARGV;
- die "option too late on command line\n" if $v =~ m/^-/;
+ die "option in wrong place on command line\n" if $v =~ m/^-/;
return $v;
}
+ (length $worddelim) * ($numwords-1); # delimiters
die "assuming lowest reasonable mean word length $minmaxmeanwordlen".
" addrs would be $expectedmindomlen long but".
- " your maximum length specified $maxdomainlen\n"
+ " maximum length is set to $maxdomainlen (use different -m?)\n"
if $expectedmindomlen > $maxdomainlen;
}
}
sub action_list {
+ my $listall = 0;
+ $listall ||= $priv;
+ while (@ARGV) {
+ last unless $ARGV[0] =~ m/^-/;
+ $_ = shift @ARGV;
+ last if m/^--?$/;
+ if (m/^-a$/) {
+ $listall=1;
+ } else {
+ die "unknown option to list \`$_'\n";
+ }
+ }
nomoreargs;
- my $q = $dbh->prepare("SELECT * FROM addrs WHERE user=?".
- " ORDER BY localpart");
+ my $q = "SELECT * FROM addrs WHERE user=?";
+ $q .= " AND NOT redirect = ''" unless $listall;
+ $q .= " ORDER BY localpart";
+ $q = $dbh->prepare($q);
$q->execute($user);
listq($q);
}
die unless $priv;
$user = nextarg;
nomoreargs;
- $dbh->do('INSERT INTO disabled_users VALUES user (?)',{},$user);
+ $dbh->do('INSERT INTO disabled_users (user) VALUES (?)',{},$user);
$dbh->commit;
}