Break up the long help string into multiple printf() statements.

AIX xlc compiler doesn't like cpp directives in between strings.
Also fixes a complaint from cppcheck and makes translation easier.
This commit is contained in:
Todd C. Miller
2021-01-28 08:53:25 -07:00
parent c9eff93854
commit dceab7d756
2 changed files with 45 additions and 24 deletions

View File

@@ -1930,15 +1930,20 @@ usage(bool fatal)
static void static void
help(void) help(void)
{ {
(void)printf(_("%s - send sudo I/O log to remote server\n\n"), printf("%s - %s\n\n", getprogname(), _("sudo log server"));
getprogname());
usage(false); usage(false);
(void)puts(_("\nOptions:\n" printf("\n%s\n", _("Options:"));
" -f, --file path to configuration file\n" printf(" -f, --file %s\n",
" -h --help display help message and exit\n" _("path to configuration file"));
" -n, --no-fork do not fork, run in the foreground\n" printf(" -h, --help %s\n",
" -R, --random-drop percent chance connections will drop\n" _("display help message and exit"));
" -V, --version display version information and exit\n")); printf(" -n, --no-fork %s\n",
_("do not fork, run in the foreground"));
printf(" -R, --random-drop %s\n",
_("percent chance connections will drop"));
printf(" -V, --version %s\n",
_("display version information and exit"));
putchar('\n');
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
} }

View File

@@ -121,25 +121,41 @@ usage(bool fatal)
static void static void
help(void) help(void)
{ {
(void)printf(_("%s - send sudo I/O log to remote server\n\n"), printf("%s - %s\n\n", getprogname(),
getprogname()); _("send sudo I/O log to remote server"));
usage(false); usage(false);
(void)puts(_("\nOptions:\n" printf("\n%s\n", _("Options:"));
" --help display help message and exit\n" printf(" --help %s\n",
" -A, --accept only send an accept event (no I/O)\n" _("display help message and exit"));
" -h, --host host to send logs to\n" printf(" -A, --accept %s\n",
" -i, --iolog_id remote ID of I/O log to be resumed\n" _("only send an accept event (no I/O)"));
" -p, --port port to use when connecting to host\n"
" -r, --restart restart previous I/O log transfer\n"
" -R, --reject reject the command with the given reason\n"
#if defined(HAVE_OPENSSL) #if defined(HAVE_OPENSSL)
" -b, --ca-bundle certificate bundle file to verify server's cert against\n" printf(" -b, --ca-bundle %s\n",
" -c, --cert certificate file for TLS handshake\n" _("certificate bundle file to verify server's cert against"));
" -k, --key private key file\n" printf(" -c, --cert %s\n",
" -n, --no-verify do not verify server certificate\n" _("certificate file for TLS handshake"));
#endif #endif
" -t, --test test audit server by sending selected I/O log n times in parallel\n" printf(" -h, --host %s\n",
" -V, --version display version information and exit\n")); _("host to send logs to"));
printf(" -i, --iolog_id %s\n",
_("remote ID of I/O log to be resumed"));
#if defined(HAVE_OPENSSL)
printf(" -k, --key %s\n",
_("private key file"));
printf(" -n, --no-verify %s\n",
_("do not verify server certificate"));
#endif
printf(" -p, --port %s\n",
_("port to use when connecting to host"));
printf(" -r, --restart %s\n",
_("restart previous I/O log transfer"));
printf(" -R, --reject %s\n",
_("reject the command with the given reason"));
printf(" -t, --test %s\n",
_("test audit server by sending selected I/O log n times in parallel"));
printf(" -V, --version %s\n",
_("display version information and exit"));
putchar('\n');
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
} }