Skip to content

Commit 35be9e4

Browse files
committed
add --version option to uiomux tool
1 parent c130897 commit 35be9e4

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

doc/uiomux.1

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ uiomux \- query and manage the UIOMux state
1616
.B uiomux
1717
.RI SUBCOMMAND
1818

19+
.PP
20+
\fBuiomux\fR [\-\-version ]
21+
1922
.SH DESCRIPTION
2023
.B uiomux
2124
is a tool for querying UIO and managing the UIOMux state.
@@ -42,6 +45,14 @@ UIOMux shared state. Note that any subsequent program using UIOMux
4245
will reallocate and initialize this shared state, including this
4346
tool's 'info' and 'reset' commands.
4447

48+
.SH OPTIONS
49+
.PP
50+
\fBuiomux\fR accepts the following options:
51+
52+
.SS "Miscellaneous options"
53+
.IP "\-\-version" 10
54+
Output version information and exit.
55+
4556
.SH AUTHORS
4657

4758
uiomux was written by Conrad Parker.

src/tools/uiomux.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ usage (void)
6262

6363
printf ("\nUtilities:\n");
6464
printf (" alloc <n> Allocate a specified number of bytes.\n");
65+
66+
printf ("\nOptions:\n");
67+
printf (" --version Show uiomux version info\n");
68+
69+
printf ("\nPlease report bugs to <[email protected]>\n");
6570
}
6671

6772
static void
@@ -132,11 +137,20 @@ destroy (void)
132137
int
133138
main (int argc, char *argv[])
134139
{
140+
int i;
141+
135142
if (argc < 2) {
136143
usage();
137144
exit (1);
138145
}
139146

147+
for (i=1; i<argc; i++) {
148+
if (!strncmp(argv[i], "--version", 10)) {
149+
version();
150+
exit (0);
151+
}
152+
}
153+
140154
if (!strncmp (argv[1], "query", 6)) {
141155
query ();
142156
} else if (!strncmp (argv[1], "info", 5)) {

0 commit comments

Comments
 (0)