From 37de8208d1c24008c5832b95417a274f86bc2336 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 23 May 2019 09:16:51 +0200 Subject: [PATCH] winexe: Use C99 initializer for poptOption in winexe.c Signed-off-by: Stefan Metzmacher Reviewed-by: Ralph Boehme --- examples/winexe/winexe.c | 149 ++++++++++++++++++++++++++++++--------- 1 file changed, 115 insertions(+), 34 deletions(-) diff --git a/examples/winexe/winexe.c b/examples/winexe/winexe.c index 429ba2f5163e..b2257852272a 100644 --- a/examples/winexe/winexe.c +++ b/examples/winexe/winexe.c @@ -88,41 +88,122 @@ static void parse_args(int argc, const char *argv[], char *opt_kerberos = NULL; char *opt_auth_file = NULL; char *opt_debuglevel = NULL; - struct poptOption long_options[] = { - { "help", 'h', POPT_ARG_NONE, &flag_help, 0, - "Display help message" }, - { "version", 'V', POPT_ARG_NONE, &flag_version, 0, - "Display version number" }, - { "user", 'U', POPT_ARG_STRING, &opt_user, 0, - "Set the network username", "[DOMAIN/]USERNAME[%PASSWORD]" }, - { "authentication-file", 'A', - POPT_ARG_STRING, &opt_auth_file, 0, - "Get the credentials from a file", "FILE" }, - { "no-pass", 'N', POPT_ARG_NONE, &flag_nopass, 0, - "Do not ask for a password", NULL }, - { "kerberos", 'k', POPT_ARG_STRING, &opt_kerberos, 0, - "Use Kerberos, -k [yes|no]" }, - { "debuglevel", 'd', POPT_ARG_STRING, &opt_debuglevel, 0, - "Set debug level", "DEBUGLEVEL" }, - { "uninstall", 0, POPT_ARG_NONE, &flag_uninstall, 0, - "Uninstall winexe service after remote execution", NULL}, - { "reinstall", 0, POPT_ARG_NONE, &flag_reinstall, 0, - "Reinstall winexe service before remote execution", NULL}, - { "runas", 0, POPT_ARG_STRING, &options->runas, 0, - "Run as the given user (BEWARE: this password is sent " - "in cleartext over the network!)", - "[DOMAIN\\]USERNAME%PASSWORD"}, - { "runas-file", 0, POPT_ARG_STRING, &options->runas_file, 0, - "Run as user options defined in a file", "FILE"}, - { "interactive", 0, POPT_ARG_INT, &flag_interactive, 0, - "Desktop interaction: 0 - disallow, 1 - allow. If allow, " - "also use the --system switch (Windows requirement). Vista " - "does not support this option.", "0|1"}, - { "ostype", 0, POPT_ARG_INT, &flag_ostype, 0, - "OS type: 0 - 32-bit, 1 - 64-bit, 2 - winexe will decide. " - "Determines which version (32-bit or 64-bit) of service " - "will be installed.", "0|1|2"}, + { + .longName = "help", + .shortName = 'h', + .argInfo = POPT_ARG_NONE, + .arg = &flag_help, + .val = 0, + .descrip = "Display help message", + .argDescrip = NULL, + },{ + .longName = "version", + .shortName = 'V', + .argInfo = POPT_ARG_NONE, + .arg = &flag_version, + .val = 0, + .descrip = "Display version number", + .argDescrip = NULL, + },{ + .longName = "user", + .shortName = 'U', + .argInfo = POPT_ARG_STRING, + .arg = &opt_user, + .val = 0, + .descrip = "Set the network username", + .argDescrip = "[DOMAIN/]USERNAME[%PASSWORD]", + },{ + .longName = "authentication-file", + .shortName = 'A', + .argInfo = POPT_ARG_STRING, + .arg = &opt_auth_file, + .val = 0, + .descrip = "Get the credentials from a file", + .argDescrip = "FILE", + },{ + .longName = "no-pass", + .shortName = 'N', + .argInfo = POPT_ARG_NONE, + .arg = &flag_nopass, + .val = 0, + .descrip = "Do not ask for a password", + .argDescrip = NULL + },{ + .longName = "kerberos", + .shortName = 'k', + .argInfo = POPT_ARG_STRING, + .arg = &opt_kerberos, + .val = 0, + .descrip = "Use Kerberos", + .argDescrip = "[yes|no]", + },{ + .longName = "debuglevel", + .shortName = 'd', + .argInfo = POPT_ARG_STRING, + .arg = &opt_debuglevel, + .val = 0, + .descrip = "Set debug level", + .argDescrip = "DEBUGLEVEL", + },{ + .longName = "uninstall", + .shortName = 0, + .argInfo = POPT_ARG_NONE, + .arg = &flag_uninstall, + .val = 0, + .descrip = "Uninstall winexe service after " + "remote execution", + .argDescrip = NULL, + },{ + .longName = "reinstall", + .shortName = 0, + .argInfo = POPT_ARG_NONE, + .arg = &flag_reinstall, + .val = 0, + .descrip = "Reinstall winexe service before " + "remote execution", + .argDescrip = NULL, + },{ + .longName = "runas", + .shortName = 0, + .argInfo = POPT_ARG_STRING, + .arg = &options->runas, + .val = 0, + .descrip = "Run as the given user (BEWARE: this " + "password is sent in cleartext over " + "the network!)", + .argDescrip = "[DOMAIN\\]USERNAME%PASSWORD", + },{ + .longName = "runas-file", + .shortName = 0, + .argInfo = POPT_ARG_STRING, + .arg = &options->runas_file, + .val = 0, + .descrip = "Run as user options defined in a file", + .argDescrip = "FILE", + },{ + .longName = "interactive", + .shortName = 0, + .argInfo = POPT_ARG_INT, + .arg = &flag_interactive, + .val = 0, + .descrip = "Desktop interaction: 0 - disallow, " + "1 - allow. If allow, also use the " + "--system switch (Windows requirement). " + "Vista does not support this option.", + .argDescrip = "0|1", + },{ + .longName = "ostype", + .shortName = 0, + .argInfo = POPT_ARG_INT, + .arg = &flag_ostype, + .val = 0, + .descrip = "OS type: 0 - 32-bit, 1 - 64-bit, " + "2 - winexe will decide. " + "Determines which version (32-bit or 64-bit)" + " of service will be installed.", + .argDescrip = "0|1|2", + }, POPT_TABLEEND }; -- 2.34.1