summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorJim McDonough <jmcd@samba.org>2002-03-11 21:37:01 +0000
committerJim McDonough <jmcd@samba.org>2002-03-11 21:37:01 +0000
commit3bc38669efda51f754890474298b9d59f060724d (patch)
tree7e53e720532592ad619cc4d54a282a2cfccde3cf /source3/utils
parentc82ff4c942fb2c5efb7aceaadf374accb5b67d46 (diff)
downloadsamba-3bc38669efda51f754890474298b9d59f060724d.tar.gz
samba-3bc38669efda51f754890474298b9d59f060724d.tar.bz2
samba-3bc38669efda51f754890474298b9d59f060724d.zip
Another program converted to popt...smbstatus this time.
(This used to be commit 00d3a064f16101fecebaeaaabaf841f0a5c91523)
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/status.c53
1 files changed, 23 insertions, 30 deletions
diff --git a/source3/utils/status.c b/source3/utils/status.c
index 059c330325..7caaf3308d 100644
--- a/source3/utils/status.c
+++ b/source3/utils/status.c
@@ -545,9 +545,24 @@ static int traverse_sessionid(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf, vo
{
pstring fname;
int c;
- extern char *optarg;
- int profile_only = 0, new_debuglevel = -1;
+ int profile_only = 0;
+ static int new_debuglevel = -1;
TDB_CONTEXT *tdb;
+ poptContext pc;
+ struct poptOption long_options[] = {
+ {"processes", 'p', POPT_ARG_NONE, &processes_only},
+ {"verbose", 'v', POPT_ARG_NONE, &verbose},
+ {"locks", 'L', POPT_ARG_NONE, &locks_only},
+ {"shares", 'S', POPT_ARG_NONE, &shares_only},
+ {"conf", 's', POPT_ARG_STRING, 0, 's'},
+ {"user", 'u', POPT_ARG_STRING, 0, 'u'},
+ {"brief", 'b', POPT_ARG_NONE, &brief},
+ {"profile", 'P', POPT_ARG_NONE, &profile_only},
+ {"byterange", 'B', POPT_ARG_NONE, &show_brl},
+ {"debug", 'd', POPT_ARG_INT, &new_debuglevel},
+ { 0, 0, 0, 0}
+ };
+
setup_logging(argv[0],True);
@@ -559,39 +574,17 @@ static int traverse_sessionid(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf, vo
d_printf("smbstatus should not be run setuid\n");
return(1);
}
+
+ pc = poptGetContext(NULL, argc, (const char **) argv, long_options,
+ POPT_CONTEXT_KEEP_FIRST);
- while ((c = getopt(argc, argv, "pvLSs:u:bPBd:")) != EOF) {
+ while ((c = poptGetNextOpt(pc)) != EOF) {
switch (c) {
- case 'b':
- brief = 1;
- break;
- case 'B':
- show_brl = 1;
- break;
- case 'd':
- new_debuglevel = atoi(optarg);
- break;
-
- case 'v':
- verbose = 1;
- break;
- case 'L':
- locks_only = 1;
- break;
- case 'p':
- processes_only = 1;
- break;
- case 'P':
- profile_only = 1;
- break;
- case 'S':
- shares_only = 1;
- break;
case 's':
- pstrcpy(dyn_CONFIGFILE, optarg);
+ pstrcpy(dyn_CONFIGFILE, poptGetOptArg(pc));
break;
case 'u':
- Ucrit_addUsername(optarg);
+ Ucrit_addUsername(poptGetOptArg(pc));
break;
default:
fprintf(stderr, "Usage: %s [-P] [-v] [-L] [-p] [-S] [-s configfile] [-u username] [-d debuglevel]\n", *argv);