From 6cfc00daa1693736af1599785e114026ee99cc0f Mon Sep 17 00:00:00 2001 From: Jacek Masiulaniec Date: Sat, 13 Dec 2008 18:58:29 +0000 Subject: - Correct usage text. - Drop static qualifiers. - Drop unused -d switch. - Use 0/1 exit codes instead of defines. ok gilles@ --- usr.sbin/smtpd/newaliases.c | 41 +++++++++++++---------------------------- 1 file changed, 13 insertions(+), 28 deletions(-) (limited to 'usr.sbin/smtpd') diff --git a/usr.sbin/smtpd/newaliases.c b/usr.sbin/smtpd/newaliases.c index be416a86883..86ebd77d74d 100644 --- a/usr.sbin/smtpd/newaliases.c +++ b/usr.sbin/smtpd/newaliases.c @@ -32,7 +32,6 @@ #include #include #include -#include #include #include @@ -40,12 +39,11 @@ extern char *__progname; -static int usage(void); -int parse_aliases(const char *); -int parse_entry(char *, size_t, size_t); +__dead void usage(void); +int parse_aliases(const char *); +int parse_entry(char *, size_t, size_t); DB *db; -static int dflag; int main(int argc, char *argv[]) @@ -54,21 +52,8 @@ main(int argc, char *argv[]) char pathname[MAXPATHLEN]; char dbname[MAXPATHLEN]; - while ((ch = getopt(argc, argv, "dh")) != -1) { - switch (ch) { - case 'd': - dflag = 1; - break; - case 'h': - default: - return usage(); - } - } - argc -= optind; - argv += optind; - - if (argc != 0) - return usage(); + if (argc != 1) + usage(); bzero(pathname, MAXPATHLEN); snprintf(pathname, MAXPATHLEN, "/etc/mail/aliases.XXXXX"); @@ -102,7 +87,7 @@ main(int argc, char *argv[]) if (rmdir(pathname) == -1) err(1, "rmdir"); - return EX_OK; + return 0; bad: if (dbname[0] != '\0') if (unlink(dbname) == -1) @@ -112,13 +97,6 @@ bad: return 1; } -static int -usage(void) -{ - fprintf(stderr, "usage: %s filename\n", __progname); - return EX_USAGE; -} - int parse_aliases(const char *filename) { @@ -232,3 +210,10 @@ bad: warnx("line %zd: invalid entry: %s", lineno, line); return 0; } + +void +usage(void) +{ + fprintf(stderr, "usage: %s\n", __progname); + exit(1); +} -- cgit v1.2.3