Commit 7ded7a65 authored by Konstantin Khlebnikov's avatar Konstantin Khlebnikov

ioping: add builtin version and -v

Signed-off-by: default avatarKonstantin Khlebnikov <koct9i@gmail.com>
parent 59575633
......@@ -27,7 +27,7 @@ install: $(BINS) $(MANS)
install -m 644 $(MANS) $(DESTDIR)$(MAN1DIR)
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $^
$(CC) $(CFLAGS) -DVERSION=\"${VERSION}\" -c -o $@ $^
ioping: $(OBJS)
$(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS)
......
......@@ -58,6 +58,9 @@ Suppress human-readable output.
.TP
.B \-h
Display help message and exit.
.TP
.B \-v
Display version and exit.
.SS Argument suffixes
For options that expect time argument (\fB\-i\fR and \fB\-w\fR),
default is seconds, unless you specify one of the following suffixes
......
......@@ -102,10 +102,16 @@ void usage(void)
" -R seek rate test (same as -q -i 0 -w 3)\n"
" -q suppress human-readable output\n"
" -h display this message and exit\n"
" -v display version and exit\n"
"\n"
);
}
void version(void)
{
fprintf(stderr, "ioping %s\n", VERSION);
}
struct suffix {
const char *txt;
long long mul;
......@@ -246,11 +252,14 @@ void parse_options(int argc, char **argv)
exit(1);
}
while ((opt = getopt(argc, argv, "hLRDCqi:w:s:S:c:o:p:")) != -1) {
while ((opt = getopt(argc, argv, "hvLRDCqi:w:s:S:c:o:p:")) != -1) {
switch (opt) {
case 'h':
usage();
exit(0);
case 'v':
version();
exit(0);
case 'L':
randomize = 0;
size = 1<<18;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment