diff options
author | Stefan Metzmacher <metze@samba.org> | 2006-09-26 10:34:40 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:20:21 -0500 |
commit | 00cb032c0f012dc535ff443af8f760ff0696f24f (patch) | |
tree | 5a1ac706f1a661a357dcc77d7f6866e968847831 /source4/utils | |
parent | 410256e75aa720b4d88822ae415b44556bb79464 (diff) | |
download | samba-00cb032c0f012dc535ff443af8f760ff0696f24f.tar.gz samba-00cb032c0f012dc535ff443af8f760ff0696f24f.tar.bz2 samba-00cb032c0f012dc535ff443af8f760ff0696f24f.zip |
r18915: fix usage of popt, do make -W setting the recursive flag on SuSE 10.1
metze
(This used to be commit 0fef3f807dd3e156970e315d83f5cb4a45e20d12)
Diffstat (limited to 'source4/utils')
-rw-r--r-- | source4/utils/nmblookup.c | 77 |
1 files changed, 58 insertions, 19 deletions
diff --git a/source4/utils/nmblookup.c b/source4/utils/nmblookup.c index 3192b0924c..e9c8c22166 100644 --- a/source4/utils/nmblookup.c +++ b/source4/utils/nmblookup.c @@ -258,45 +258,84 @@ static BOOL process_one(const char *name) /* main program */ -int main(int argc,char *argv[]) +int main(int argc, const char *argv[]) { BOOL ret = True; poptContext pc; + int opt; + enum { + OPT_BROADCAST_ADDRESS = 1000, + OPT_UNICAST_ADDRESS, + OPT_FIND_MASTER, + OPT_WINS_LOOKUP, + OPT_NODE_STATUS, + OPT_ROOT_PORT, + OPT_LOOKUP_BY_IP, + OPT_CASE_SENSITIVE + }; struct poptOption long_options[] = { POPT_AUTOHELP - { "broadcast", 'B', POPT_ARG_STRING, &options.broadcast_address, - 'B', "Specify address to use for broadcasts", "BROADCAST-ADDRESS" }, + { "broadcast", 'B', POPT_ARG_STRING, NULL, OPT_BROADCAST_ADDRESS, + "Specify address to use for broadcasts", "BROADCAST-ADDRESS" }, - { "unicast", 'U', POPT_ARG_STRING, &options.unicast_address, - 'U', "Specify address to use for unicast" }, + { "unicast", 'U', POPT_ARG_STRING, NULL, OPT_UNICAST_ADDRESS, + "Specify address to use for unicast", NULL }, - { "master-browser", 'M', POPT_ARG_VAL, &options.find_master, - True, "Search for a master browser" }, + { "master-browser", 'M', POPT_ARG_NONE, NULL, OPT_FIND_MASTER, + "Search for a master browser", NULL }, - { "wins", 'W', POPT_ARG_VAL, &options.wins_lookup, True, "Do a WINS lookup" }, + { "wins", 'W', POPT_ARG_NONE, NULL, OPT_WINS_LOOKUP, + "Do a WINS lookup", NULL }, - { "status", 'S', POPT_ARG_VAL, &options.node_status, - True, "Lookup node status as well" }, + { "status", 'S', POPT_ARG_NONE, NULL, OPT_NODE_STATUS, + "Lookup node status as well", NULL }, - { "root-port", 'r', POPT_ARG_VAL, &options.root_port, - True, "Use root port 137 (Win95 only replies to this)" }, + { "root-port", 'r', POPT_ARG_NONE, NULL, OPT_ROOT_PORT, + "Use root port 137 (Win95 only replies to this)", NULL }, - { "lookup-by-ip", 'A', POPT_ARG_VAL, &options.lookup_by_ip, - True, "Do a node status on <name> as an IP Address" }, + { "lookup-by-ip", 'A', POPT_ARG_NONE, NULL, OPT_LOOKUP_BY_IP, + "Do a node status on <name> as an IP Address", NULL }, - { "case-sensitive", 0, POPT_ARG_VAL, &options.case_sensitive, - True, "Don't uppercase the name before sending" }, + { "case-sensitive", 0, POPT_ARG_NONE, NULL, OPT_CASE_SENSITIVE, + "Don't uppercase the name before sending", NULL }, POPT_COMMON_SAMBA { 0, 0, 0, 0 } }; - pc = poptGetContext("nmblookup", argc, (const char **)argv, long_options, + pc = poptGetContext("nmblookup", argc, argv, long_options, POPT_CONTEXT_KEEP_FIRST); - + poptSetOtherOptionHelp(pc, "<NODE> ..."); - while ((poptGetNextOpt(pc) != -1)) /* noop */ ; + while ((opt = poptGetNextOpt(pc)) != -1) { + switch(opt) { + case OPT_BROADCAST_ADDRESS: + options.broadcast_address = poptGetOptArg(pc); + break; + case OPT_UNICAST_ADDRESS: + options.unicast_address = poptGetOptArg(pc); + break; + case OPT_FIND_MASTER: + options.find_master = True; + break; + case OPT_WINS_LOOKUP: + options.wins_lookup = True; + break; + case OPT_NODE_STATUS: + options.node_status = True; + break; + case OPT_ROOT_PORT: + options.root_port = True; + break; + case OPT_LOOKUP_BY_IP: + options.lookup_by_ip = True; + break; + case OPT_CASE_SENSITIVE: + options.case_sensitive = True; + break; + } + } /* swallow argv[0] */ poptGetArg(pc); |