summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd
diff options
context:
space:
mode:
authorJacek Masiulaniec <jacekm@cvs.openbsd.org>2008-12-13 18:58:29 +0000
committerJacek Masiulaniec <jacekm@cvs.openbsd.org>2008-12-13 18:58:29 +0000
commit6cfc00daa1693736af1599785e114026ee99cc0f (patch)
tree9781f3263a5e4c981b9f5fa45411a5c8d8c3b998 /usr.sbin/smtpd
parentc9beca9ca0428758ce10279520ead1ccd27f30aa (diff)
- Correct usage text.
- Drop static qualifiers. - Drop unused -d switch. - Use 0/1 exit codes instead of <sysexits.h> defines. ok gilles@
Diffstat (limited to 'usr.sbin/smtpd')
-rw-r--r--usr.sbin/smtpd/newaliases.c41
1 files changed, 13 insertions, 28 deletions
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 <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sysexits.h>
#include <unistd.h>
#include <util.h>
@@ -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);
+}