From 3834ea867a4bf3d8c7742c5718927589390b98aa Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Fri, 11 Jan 2019 15:14:09 +0100 Subject: [PATCH] s3:rpcclient: Use C99 initializer for poptOption in cmd_witness Signed-off-by: Andreas Schneider Reviewed-by: Douglas Bagnall --- source3/rpcclient/cmd_witness.c | 146 ++++++++++++++++++++++++++++---- 1 file changed, 129 insertions(+), 17 deletions(-) diff --git a/source3/rpcclient/cmd_witness.c b/source3/rpcclient/cmd_witness.c index f5cac97066c..3bc7d211606 100644 --- a/source3/rpcclient/cmd_witness.c +++ b/source3/rpcclient/cmd_witness.c @@ -115,13 +115,61 @@ static WERROR cmd_witness_Register(struct rpc_pipe_client *cli, int c; poptContext optCon; struct poptOption optionsTable[] = { - {"version", 'v', POPT_ARG_LONG|POPT_ARGFLAG_SHOW_DEFAULT, &version, WITNESS_V2, "witness version", "version"}, - {"V1", '1', POPT_ARG_LONG|POPT_ARG_VAL, &version, WITNESS_V1, "witness version 1", NULL}, - {"V2", '2', POPT_ARG_LONG|POPT_ARG_VAL, &version, WITNESS_V2, "witness version 2", NULL}, - {"net", 'n', POPT_ARG_STRING|POPT_ARGFLAG_SHOW_DEFAULT, &net_name, 0, "net name", NULL}, - {"ip", 'i', POPT_ARG_STRING|POPT_ARGFLAG_SHOW_DEFAULT, &ip_addr, 0, "ip address", NULL}, - {"client", 'c', POPT_ARG_STRING|POPT_ARGFLAG_SHOW_DEFAULT|POPT_ARGFLAG_OPTIONAL, &client_name, 0, "client name", NULL}, - { NULL, 0, 0, NULL, 0 } + { + .longName = "version", + .shortName = 'v', + .argInfo = POPT_ARG_LONG|POPT_ARGFLAG_SHOW_DEFAULT, + .arg = &version, + .val = WITNESS_V2, + .descrip = "witness version", + .argDescrip = "version" + }, + { + .longName = "V1", + .shortName = '1', + .argInfo = POPT_ARG_LONG|POPT_ARG_VAL, + .arg = &version, + .val = WITNESS_V1, + .descrip = "witness version 1", + .argDescrip = NULL + }, + { + .longName = "V2", + .shortName = '2', + .argInfo = POPT_ARG_LONG|POPT_ARG_VAL, + .arg = &version, + .val = WITNESS_V2, + .descrip = "witness version 2", + .argDescrip = NULL + }, + { + .longName = "net", + .shortName = 'n', + .argInfo = POPT_ARG_STRING|POPT_ARGFLAG_SHOW_DEFAULT, + .arg = &net_name, + .val = 0, + .descrip = "net name", + .argDescrip = NULL + }, + { + .longName = "ip", + .shortName = 'i', + .argInfo = POPT_ARG_STRING|POPT_ARGFLAG_SHOW_DEFAULT, + .arg = &ip_addr, + .val = 0, + .descrip = "ip address", + .argDescrip = NULL + }, + { + .longName = "client", + .shortName = 'c', + .argInfo = POPT_ARG_STRING|POPT_ARGFLAG_SHOW_DEFAULT|POPT_ARGFLAG_OPTIONAL, + .arg = &client_name, + .val = 0, + .descrip = "client name", + .argDescrip = NULL + }, + POPT_TABLEEND }; use_only_one_rpc_pipe_hack(cli); @@ -188,16 +236,80 @@ static WERROR cmd_witness_RegisterEx(struct rpc_pipe_client *cli, int c; poptContext optCon; struct poptOption optionsTable[] = { - {"version", 'v', POPT_ARG_LONG|POPT_ARGFLAG_SHOW_DEFAULT, &version, WITNESS_V2, "witness version", "version"}, - {"V1", '1', POPT_ARG_LONG|POPT_ARG_VAL, &version, WITNESS_V1, "witness version 1", NULL}, - {"V2", '2', POPT_ARG_LONG|POPT_ARG_VAL, &version, WITNESS_V2, "witness version 2", NULL}, - {"net", 'n', POPT_ARG_STRING|POPT_ARGFLAG_SHOW_DEFAULT, &net_name, 0, "net name", NULL}, - {"ip", 'i', POPT_ARG_STRING|POPT_ARGFLAG_SHOW_DEFAULT, &ip_addr, 0, "ip address", NULL}, - {"share", 's', POPT_ARG_STRING|POPT_ARGFLAG_SHOW_DEFAULT, &share_name, 0, "share name", NULL}, - {"client", 'c', POPT_ARG_STRING|POPT_ARGFLAG_SHOW_DEFAULT|POPT_ARGFLAG_OPTIONAL, &client_name, 0, "client name", NULL}, - {"flags", 'f', POPT_ARG_LONG|POPT_ARGFLAG_OR|POPT_ARGFLAG_SHOW_DEFAULT, &flags, 0, "flags", NULL}, - {"timeout", 't', POPT_ARG_LONG|POPT_ARGFLAG_SHOW_DEFAULT, &timeout, 0, "timeout", NULL}, - { NULL, 0, 0, NULL, 0 } + { + .longName = "version", + .shortName = 'v', + .argInfo = POPT_ARG_LONG|POPT_ARGFLAG_SHOW_DEFAULT, + .arg = &version, + .val = WITNESS_V2, + .descrip = "witness version", + .argDescrip = "version" + }, + { + .longName = "V1", + .shortName = '1', + .argInfo = POPT_ARG_LONG|POPT_ARG_VAL, + .arg = &version, + .val = WITNESS_V1, + .descrip = "witness version 1", + }, + { + .longName = "V2", + .shortName = '2', + .argInfo = POPT_ARG_LONG|POPT_ARG_VAL, + .arg = &version, + .val = WITNESS_V2, + .descrip = "witness version 2", + }, + { + .longName = "net", + .shortName = 'n', + .argInfo = POPT_ARG_STRING|POPT_ARGFLAG_SHOW_DEFAULT, + .arg = &net_name, + .val = 0, + .descrip = "net name", + }, + { + .longName = "ip", + .shortName = 'i', + .argInfo = POPT_ARG_STRING|POPT_ARGFLAG_SHOW_DEFAULT, + .arg = &ip_addr, + .val = 0, + .descrip = "ip address", + }, + { + .longName = "share", + .shortName = 's', + .argInfo = POPT_ARG_STRING|POPT_ARGFLAG_SHOW_DEFAULT, + .arg = &share_name, + .val = 0, + .descrip = "share name", + }, + { + .longName = "client", + .shortName = 'c', + .argInfo = POPT_ARG_STRING|POPT_ARGFLAG_SHOW_DEFAULT|POPT_ARGFLAG_OPTIONAL, + .arg = &client_name, + .val = 0, + .descrip = "client name", + }, + { + .longName = "flags", + .shortName = 'f', + .argInfo = POPT_ARG_LONG|POPT_ARGFLAG_OR|POPT_ARGFLAG_SHOW_DEFAULT, + .arg = &flags, + .val = 0, + .descrip = "flags", + }, + { + .longName = "timeout", + .shortName = 't', + .argInfo = POPT_ARG_LONG|POPT_ARGFLAG_SHOW_DEFAULT, + .arg = &timeout, + .val = 0, + .descrip = "timeout", + }, + POPT_TABLEEND }; use_only_one_rpc_pipe_hack(cli);