summaryrefslogtreecommitdiffstats
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
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@
-rw-r--r--usr.bin/ctfconv/ctfconv.15
-rw-r--r--usr.bin/ctfconv/ctfconv.c13
2 files changed, 12 insertions, 6 deletions
diff --git a/usr.bin/ctfconv/ctfconv.1 b/usr.bin/ctfconv/ctfconv.1
index d43cf820d1f..a7d0219da96 100644
--- a/usr.bin/ctfconv/ctfconv.1
+++ b/usr.bin/ctfconv/ctfconv.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: ctfconv.1,v 1.3 2017/08/11 16:45:33 jmc Exp $
+.\" $OpenBSD: ctfconv.1,v 1.4 2017/08/11 19:34:24 jasper Exp $
.\"
.\" Copyright (c) 2016 Martin Pieuchot <mpi@openbsd.org>
.\"
@@ -22,7 +22,8 @@
.Nd generates a raw CTF section from debug data
.Sh SYNOPSIS
.Nm ctfconv
-.Op Fl d
+.Fl d file
+.Nm ctfconv
.Fl l Ar label
.Fl o Ar outfile
.Ar file
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) {