summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2007-02-14 13:22:09 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:48:14 -0500
commit76a1ecccc5321ce45f171078cbd38e5b165be08b (patch)
treee57baba916b1abf7bd11e79a53868f00879b6419
parente50dc79226bcb722485019533033500b0e145a46 (diff)
downloadsamba-76a1ecccc5321ce45f171078cbd38e5b165be08b.tar.gz
samba-76a1ecccc5321ce45f171078cbd38e5b165be08b.tar.bz2
samba-76a1ecccc5321ce45f171078cbd38e5b165be08b.zip
r21333: fix POPT handling in ndrdump
make --validate, --dump-data work again metze (This used to be commit 654acc67344c097106b2f9859b5cbd973d95340f)
-rw-r--r--source4/utils/ndrdump.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/source4/utils/ndrdump.c b/source4/utils/ndrdump.c
index 0261a1c6df..9e224c8137 100644
--- a/source4/utils/ndrdump.c
+++ b/source4/utils/ndrdump.c
@@ -143,16 +143,18 @@ const struct dcerpc_interface_table *load_iface_from_plugin(const char *plugin,
void *v_st;
const char *ctx_filename = NULL;
const char *plugin = NULL;
- BOOL validate = False;
- BOOL dumpdata = False;
+ bool validate = false;
+ bool dumpdata = false;
int opt;
+ enum {OPT_CONTEXT_FILE=1000, OPT_VALIDATE, OPT_DUMP_DATA, OPT_LOAD_DSO};
struct poptOption long_options[] = {
- {"context-file", 'c', POPT_ARG_STRING, &ctx_filename, 0, "In-filename to parse first", "CTX-FILE" },
- {"validate", 0, POPT_ARG_NONE, &validate, 0, "try to validate the data", NULL },
- {"dump-data", 0, POPT_ARG_NONE, &dumpdata, 0, "dump the hex data", NULL },
- {"load-dso", 'l', POPT_ARG_STRING, &plugin, 0, "load from shared object file", NULL },
- POPT_COMMON_SAMBA
POPT_AUTOHELP
+ {"context-file", 'c', POPT_ARG_STRING, NULL, OPT_CONTEXT_FILE, "In-filename to parse first", "CTX-FILE" },
+ {"validate", 0, POPT_ARG_NONE, NULL, OPT_VALIDATE, "try to validate the data", NULL },
+ {"dump-data", 0, POPT_ARG_NONE, NULL, OPT_DUMP_DATA, "dump the hex data", NULL },
+ {"load-dso", 'l', POPT_ARG_STRING, NULL, OPT_LOAD_DSO, "load from shared object file", NULL },
+ POPT_COMMON_SAMBA
+ POPT_COMMON_VERSION
{ NULL }
};
@@ -164,6 +166,20 @@ const struct dcerpc_interface_table *load_iface_from_plugin(const char *plugin,
pc, "<pipe|uuid> <function> <inout> [<filename>]");
while ((opt = poptGetNextOpt(pc)) != -1) {
+ switch (opt) {
+ case OPT_CONTEXT_FILE:
+ ctx_filename = poptGetOptArg(pc);
+ break;
+ case OPT_VALIDATE:
+ validate = true;
+ break;
+ case OPT_DUMP_DATA:
+ dumpdata = true;
+ break;
+ case OPT_LOAD_DSO:
+ plugin = poptGetOptArg(pc);
+ break;
+ }
}
pipe_name = poptGetArg(pc);