summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper Lievisse Adriaanse <jasper@cvs.openbsd.org>2017-08-11 19:34:25 +0000
committerJasper Lievisse Adriaanse <jasper@cvs.openbsd.org>2017-08-11 19:34:25 +0000
commit1f004c31ef0eccb5d8a43bfc3935f9f261e4eca7 (patch)
tree4d5b84facf455dadd9e01d7dcb95c3a0cb6cca0d
parent8eed160950b504d86296fa816dfbdba5be8c40cb (diff)
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) {