summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2015-02-09 23:14:32 +0000
committertedu <tedu@openbsd.org>2015-02-09 23:14:32 +0000
commitb3cc38c251a1dcd351a17dff9b41b13a6be4f79a (patch)
tree517202bc6bc90f4405d8071f64b610d862ab6423
parentProtect fgetwln(), wcslcat() and wcslcpy() with __BSD_VISIBLE (diff)
downloadwireguard-openbsd-b3cc38c251a1dcd351a17dff9b41b13a6be4f79a.tar.xz
wireguard-openbsd-b3cc38c251a1dcd351a17dff9b41b13a6be4f79a.zip
exit() cleanup. don't have to call it in a loop.
usage() always takes the same stream and status arguments (despite a comment indicating perhaps it shouldn't), so make it void
-rw-r--r--usr.sbin/zdump/zdump.c16
-rw-r--r--usr.sbin/zic/zic.c19
2 files changed, 15 insertions, 20 deletions
diff --git a/usr.sbin/zdump/zdump.c b/usr.sbin/zdump/zdump.c
index 9950e910fc2..93df1985039 100644
--- a/usr.sbin/zdump/zdump.c
+++ b/usr.sbin/zdump/zdump.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: zdump.c,v 1.7 2015/02/09 22:49:10 tedu Exp $ */
+/* $OpenBSD: zdump.c,v 1.8 2015/02/09 23:14:32 tedu Exp $ */
/*
** This file is in the public domain, so clarified as of
** 2009-05-17 by Arthur David Olson.
@@ -184,12 +184,10 @@ const char * const zone;
}
static void
-usage(stream, status)
-FILE * const stream;
-const int status;
+usage(void)
{
- fprintf(stream, _("usage: %s [-v] [-c [loyear,]hiyear] zonename ...\n"), progname);
- exit(status);
+ fprintf(stderr, _("usage: %s [-v] [-c [loyear,]hiyear] zonename ...\n"), progname);
+ exit(EXIT_FAILURE);
}
int
@@ -225,7 +223,7 @@ char * argv[];
else cutarg = optarg;
if ((c != EOF && c != -1) ||
(optind == argc - 1 && strcmp(argv[optind], "=") == 0)) {
- usage(stderr, EXIT_FAILURE);
+ usage();
}
if (vflag) {
if (cutarg != NULL) {
@@ -328,9 +326,7 @@ char * argv[];
perror(_("Error writing to standard output"));
exit(EXIT_FAILURE);
}
- exit(EXIT_SUCCESS);
- /* If exit fails to exit... */
- return EXIT_FAILURE;
+ return 0;
}
static void
diff --git a/usr.sbin/zic/zic.c b/usr.sbin/zic/zic.c
index a233fba98b8..f6c1fde62a7 100644
--- a/usr.sbin/zic/zic.c
+++ b/usr.sbin/zic/zic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: zic.c,v 1.9 2015/02/09 14:34:44 tedu Exp $ */
+/* $OpenBSD: zic.c,v 1.10 2015/02/09 23:14:32 tedu Exp $ */
/*
** This file is in the public domain, so clarified as of
** 2006-07-17 by Arthur David Olson.
@@ -137,7 +137,7 @@ static void stringzone(char * result, size_t size,
const struct zone * zp, int ntzones);
static void setboundaries(void);
static zic_t tadd(zic_t t1, long t2);
-static void usage(FILE *stream, int status);
+static void usage(void);
static void writezone(const char * name, const char * string);
static int yearistype(int year, const char * type);
@@ -446,11 +446,11 @@ const char * const string;
}
static void
-usage(FILE *stream, int status)
+usage(void)
{
- (void) fprintf(stream, _("usage: %s [-v] [-d directory] [-L leapsecondfilename] [-l timezone]\n\t[-p timezone] [-y command] [filename ...]\n"),
+ fprintf(stderr, _("usage: %s [-v] [-d directory] [-L leapsecondfilename] [-l timezone]\n\t[-p timezone] [-y command] [filename ...]\n"),
progname);
- exit(status);
+ exit(EXIT_FAILURE);
}
static const char * psxrules;
@@ -478,7 +478,7 @@ char * argv[];
while ((c = getopt(argc, argv, "d:l:p:L:vy:")) != -1)
switch (c) {
default:
- usage(stderr, EXIT_FAILURE);
+ usage();
case 'd':
if (directory == NULL)
directory = optarg;
@@ -534,7 +534,7 @@ char * argv[];
break;
}
if (optind == argc - 1 && strcmp(argv[optind], "=") == 0)
- usage(stderr, EXIT_FAILURE); /* usage message by request */
+ usage(); /* usage message by request */
if (directory == NULL)
directory = TZDIR;
if (yitcommand == NULL)
@@ -2379,8 +2379,7 @@ const char * const type;
error(_("Wild result from command execution"));
fprintf(stderr, _("%s: command was '%s', result was %d\n"),
progname, buf, result);
- for ( ; ; )
- exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
static int
@@ -2474,7 +2473,7 @@ char * cp;
++dp;
else {
error(_( "Odd number of quotation marks"));
- exit(1);
+ exit(EXIT_FAILURE);
}
} while (*cp != '\0' && *cp != '#' &&
(!isascii((unsigned char)*cp) || !isspace((unsigned char) *cp)));