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"
|
#include "lib/nvt_log.h"
|
||||||
|
|
||||||
|
|
||||||
#define HELP \
|
/**INDENT-OFF**/
|
||||||
"Usage: nvttest -dqr [-n loops] [-t threads]\n"
|
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";
|
static const char *dev = "/dev/ttyNVT0";
|
||||||
|
|
||||||
@@ -28,6 +37,13 @@ typedef struct {
|
|||||||
bool opt_rand_delay;
|
bool opt_rand_delay;
|
||||||
} topts_t;
|
} topts_t;
|
||||||
|
|
||||||
|
|
||||||
|
static void _usage(int rc)
|
||||||
|
{
|
||||||
|
printf(help_text);
|
||||||
|
exit(rc);
|
||||||
|
}
|
||||||
|
|
||||||
static void *_worker(void *arg)
|
static void *_worker(void *arg)
|
||||||
{
|
{
|
||||||
topts_t *topts = arg;
|
topts_t *topts = arg;
|
||||||
@@ -120,8 +136,8 @@ int main(int argc, char **argv)
|
|||||||
switch (opt)
|
switch (opt)
|
||||||
{
|
{
|
||||||
default: /* '?' */
|
default: /* '?' */
|
||||||
fprintf(stderr, HELP);
|
_usage(1);
|
||||||
exit(EXIT_FAILURE);
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
debug += 1;
|
debug += 1;
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user