nvtsrv: Fix inconsistent help

This commit is contained in:
Kim Woelders
2024-11-09 18:58:22 +01:00
parent 3d5848aff0
commit 6e2e530215
+15 -9
View File
@@ -14,9 +14,15 @@
#include "telnet.h" #include "telnet.h"
#define HELP \ /**INDENT-OFF**/
"Usage: nvtsrv -deq\n" static const char help_text[] =
"Usage: nvtsrv OPTIONS... HOST:PORT\n"
"OPTIONS:\n"
" -d : Enable debug\n"
" -e : Echo received data\n"
" -q : Quiet\n"
;
/**INDENT-ON**/
struct { struct {
unsigned char mline; unsigned char mline;
@@ -30,10 +36,10 @@ int nfds;
#define fd_cli pfds[2].fd #define fd_cli pfds[2].fd
static void _nvtsrv_usage(void) static void _usage(int rc)
{ {
printf("Usage:\n" " nvtsrv host:port\n"); printf(help_text);
exit(0); exit(rc);
} }
static void _tn_cli_close(void) static void _tn_cli_close(void)
@@ -127,8 +133,8 @@ int main(int argc, char **argv)
switch (opt) switch (opt)
{ {
default: /* '?' */ default: /* '?' */
fprintf(stderr, HELP); _usage(0);
exit(EXIT_FAILURE); break;
case 'd': case 'd':
debug += 1; debug += 1;
break; break;
@@ -144,7 +150,7 @@ int main(int argc, char **argv)
argc -= optind; argc -= optind;
argv += optind; argv += optind;
if (argc <= 0) if (argc <= 0)
_nvtsrv_usage(); _usage(1);
nvt_log_level(quiet, debug); nvt_log_level(quiet, debug);
nvt_log_dest(NVT_LOG_STDOUT); nvt_log_dest(NVT_LOG_STDOUT);