diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2007-02-25 22:59:39 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2007-02-25 22:59:39 +0000 |
commit | 954252b2164a8ad2adf001b02db72ec15a6e0fd4 (patch) | |
tree | 3146cd3f6892fde7bd9c5fc07539b85dbca0cd76 /libexec | |
parent | d1551cfef264a45f5e4dd38602be3c820fc9e553 (diff) |
Add usage() and error out if given bogus arguments.
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/spamd-setup/spamd-setup.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/libexec/spamd-setup/spamd-setup.c b/libexec/spamd-setup/spamd-setup.c index 2deb882635e..da3dcb226f3 100644 --- a/libexec/spamd-setup/spamd-setup.c +++ b/libexec/spamd-setup/spamd-setup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: spamd-setup.c,v 1.30 2007/02/24 19:28:13 millert Exp $ */ +/* $OpenBSD: spamd-setup.c,v 1.31 2007/02/25 22:59:38 millert Exp $ */ /* * Copyright (c) 2003 Bob Beck. All rights reserved. @@ -82,11 +82,14 @@ struct cidr **collapse_blacklist(struct bl *, size_t); int configure_spamd(u_short, char *, char *, struct cidr **); int configure_pf(struct cidr **); int getlist(char **, char *, struct blacklist *, struct blacklist *); +__dead void usage(void); int debug; int dryrun; int greyonly; +extern char *__progname; + u_int32_t imask(u_int8_t b) { @@ -773,6 +776,14 @@ send_blacklist(struct blacklist *blist, in_port_t port) } } +__dead void +usage(void) +{ + + fprintf(stderr, "usage: %s [-dgn]\n", __progname); + exit(1); +} + int main(int argc, char *argv[]) { @@ -794,9 +805,14 @@ main(int argc, char *argv[]) greyonly = 1; break; default: + usage(); break; } } + argc -= optind; + argv += optind; + if (argc != 0) + usage(); if ((ent = getservbyname("spamd-cfg", "tcp")) == NULL) errx(1, "cannot find service \"spamd-cfg\" in /etc/services"); |