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) ...@@ -27,7 +27,7 @@ install: $(BINS) $(MANS)
install -m 644 $(MANS) $(DESTDIR)$(MAN1DIR) install -m 644 $(MANS) $(DESTDIR)$(MAN1DIR)
%.o: %.c %.o: %.c
$(CC) $(CFLAGS) -c -o $@ $^ $(CC) $(CFLAGS) -DVERSION=\"${VERSION}\" -c -o $@ $^
ioping: $(OBJS) ioping: $(OBJS)
$(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS) $(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS)
......
...@@ -58,6 +58,9 @@ Suppress human-readable output. ...@@ -58,6 +58,9 @@ Suppress human-readable output.
.TP .TP
.B \-h .B \-h
Display help message and exit. Display help message and exit.
.TP
.B \-v
Display version and exit.
.SS Argument suffixes .SS Argument suffixes
For options that expect time argument (\fB\-i\fR and \fB\-w\fR), For options that expect time argument (\fB\-i\fR and \fB\-w\fR),
default is seconds, unless you specify one of the following suffixes default is seconds, unless you specify one of the following suffixes
......
...@@ -102,10 +102,16 @@ void usage(void) ...@@ -102,10 +102,16 @@ void usage(void)
" -R seek rate test (same as -q -i 0 -w 3)\n" " -R seek rate test (same as -q -i 0 -w 3)\n"
" -q suppress human-readable output\n" " -q suppress human-readable output\n"
" -h display this message and exit\n" " -h display this message and exit\n"
" -v display version and exit\n"
"\n" "\n"
); );
} }
void version(void)
{
fprintf(stderr, "ioping %s\n", VERSION);
}
struct suffix { struct suffix {
const char *txt; const char *txt;
long long mul; long long mul;
...@@ -246,11 +252,14 @@ void parse_options(int argc, char **argv) ...@@ -246,11 +252,14 @@ void parse_options(int argc, char **argv)
exit(1); 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) { switch (opt) {
case 'h': case 'h':
usage(); usage();
exit(0); exit(0);
case 'v':
version();
exit(0);
case 'L': case 'L':
randomize = 0; randomize = 0;
size = 1<<18; 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