summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2019-05-23 09:16:51 +0200
committerRalph Boehme <slow@samba.org>2019-05-28 10:34:24 +0000
commit37de8208d1c24008c5832b95417a274f86bc2336 (patch)
tree560819f65834dd9146359405e1543385db8c2c8d /examples
parent2ef79a4c1d695a3e498b142810a1317d85b9b6da (diff)
downloadsamba-37de8208d1c24008c5832b95417a274f86bc2336.tar.gz
winexe: Use C99 initializer for poptOption in winexe.c
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
Diffstat (limited to 'examples')
-rw-r--r--examples/winexe/winexe.c149
1 files changed, 115 insertions, 34 deletions
diff --git a/examples/winexe/winexe.c b/examples/winexe/winexe.c
index 429ba2f5163..b2257852272 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
};