summaryrefslogtreecommitdiffstats
path: root/usr.bin/ctfconv/ctfconv.c
diff options
context:
space:
mode:
authorjasper <jasper@openbsd.org>2017-08-11 19:34:24 +0000
committerjasper <jasper@openbsd.org>2017-08-11 19:34:24 +0000
commitd92886f70a227c7fa8d47211048688ab267c72ab (patch)
tree1c35f61f2de0a8fed6a8b88c1c1992c270f46ec3 /usr.bin/ctfconv/ctfconv.c
parentzero out sockaddr_in before use; fixes use of stack garbage as port number (diff)
downloadwireguard-openbsd-d92886f70a227c7fa8d47211048688ab267c72ab.tar.xz
wireguard-openbsd-d92886f70a227c7fa8d47211048688ab267c72ab.zip
make 'dump' mutually exclusive with writing out the data, to ease pleding
ok mpi@
Diffstat (limited to 'usr.bin/ctfconv/ctfconv.c')
-rw-r--r--usr.bin/ctfconv/ctfconv.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/usr.bin/ctfconv/ctfconv.c b/usr.bin/ctfconv/ctfconv.c
index c72503c1830..6abdbdc6b21 100644
--- a/usr.bin/ctfconv/ctfconv.c
+++ b/usr.bin/ctfconv/ctfconv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ctfconv.c,v 1.4 2017/08/11 16:55:46 mpi Exp $ */
+/* $OpenBSD: ctfconv.c,v 1.5 2017/08/11 19:34:24 jasper Exp $ */
/*
* Copyright (c) 2016-2017 Martin Pieuchot
@@ -77,7 +77,8 @@ struct itype_queue iobjq = TAILQ_HEAD_INITIALIZER(iobjq);
__dead void
usage(void)
{
- fprintf(stderr, "usage: %s [-d] -l label -o outfile file\n",
+ fprintf(stderr, "usage: %s -d file\n", getprogname());
+ fprintf(stderr, " %s -l label -o outfile file\n",
getprogname());
exit(1);
}
@@ -95,7 +96,7 @@ main(int argc, char *argv[])
while ((ch = getopt(argc, argv, "dl:o:")) != -1) {
switch (ch) {
case 'd':
- dump = 1; /* ctfdump(1) like SUNW_ctf sections */
+ dump = 1; /* ctfdump(1)-like SUNW_ctf sections */
break;
case 'l':
if (label != NULL)
@@ -118,7 +119,9 @@ main(int argc, char *argv[])
if (argc != 1)
usage();
- if (!dump && (outfile == NULL || label == NULL))
+ /* Either dump the sections, or write it out. */
+ if ((dump && (outfile != NULL || label != NULL)) ||
+ (!dump && (outfile == NULL || label == NULL)))
usage();
filename = *argv;
@@ -143,6 +146,8 @@ main(int argc, char *argv[])
dump_type(it);
}
+
+ return 0;
}
if (outfile != NULL) {