nvttest: Improve help
And do help stuff like in nvtsrv.
This commit is contained in:
+20
-4
@@ -16,8 +16,17 @@
|
||||
#include "lib/nvt_log.h"
|
||||
|
||||
|
||||
#define HELP \
|
||||
"Usage: nvttest -dqr [-n loops] [-t threads]\n"
|
||||
/**INDENT-OFF**/
|
||||
static const char help_text[] =
|
||||
"Usage: nvttest OPTIONS...\n"
|
||||
"OPTIONS:\n"
|
||||
" -d : Enable debug\n"
|
||||
" -n loops : Test loops per thread\n"
|
||||
" -q : Quiet\n"
|
||||
" -r : Insert random delay in loops\n"
|
||||
" -t threads : N. threads\n"
|
||||
;
|
||||
/**INDENT-ON**/
|
||||
|
||||
static const char *dev = "/dev/ttyNVT0";
|
||||
|
||||
@@ -28,6 +37,13 @@ typedef struct {
|
||||
bool opt_rand_delay;
|
||||
} topts_t;
|
||||
|
||||
|
||||
static void _usage(int rc)
|
||||
{
|
||||
printf(help_text);
|
||||
exit(rc);
|
||||
}
|
||||
|
||||
static void *_worker(void *arg)
|
||||
{
|
||||
topts_t *topts = arg;
|
||||
@@ -120,8 +136,8 @@ int main(int argc, char **argv)
|
||||
switch (opt)
|
||||
{
|
||||
default: /* '?' */
|
||||
fprintf(stderr, HELP);
|
||||
exit(EXIT_FAILURE);
|
||||
_usage(1);
|
||||
break;
|
||||
case 'd':
|
||||
debug += 1;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user