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"
#define HELP \
"Usage: nvtsrv -deq\n"
/**INDENT-OFF**/
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 {
unsigned char mline;
@@ -30,10 +36,10 @@ int nfds;
#define fd_cli pfds[2].fd
static void _nvtsrv_usage(void)
static void _usage(int rc)
{
printf("Usage:\n" " nvtsrv host:port\n");
exit(0);
printf(help_text);
exit(rc);
}
static void _tn_cli_close(void)
@@ -127,8 +133,8 @@ int main(int argc, char **argv)
switch (opt)
{
default: /* '?' */
fprintf(stderr, HELP);
exit(EXIT_FAILURE);
_usage(0);
break;
case 'd':
debug += 1;
break;
@@ -144,7 +150,7 @@ int main(int argc, char **argv)
argc -= optind;
argv += optind;
if (argc <= 0)
_nvtsrv_usage();
_usage(1);
nvt_log_level(quiet, debug);
nvt_log_dest(NVT_LOG_STDOUT);