summaryrefslogtreecommitdiff
path: root/source3
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
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')
-rw-r--r--source3/Makefile.in14
-rw-r--r--source3/utils/status.c53
2 files changed, 30 insertions, 37 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in
index 44a16dd8e3..645539dc82 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -279,7 +279,7 @@ MAKE_PRINTERDEF_OBJ = utils/make_printerdef.o $(PARAM_OBJ) \
$(UBIQX_OBJ) $(LIB_OBJ)
STATUS_OBJ = utils/status.o $(LOCKING_OBJ) $(PARAM_OBJ) \
- $(UBIQX_OBJ) $(PROFILE_OBJ) $(LIB_OBJ)
+ $(UBIQX_OBJ) $(PROFILE_OBJ) $(LIB_OBJ) @BUILD_POPT@
SMBCONTROL_OBJ = utils/smbcontrol.o $(LOCKING_OBJ) $(PARAM_OBJ) \
$(UBIQX_OBJ) $(PROFILE_OBJ) $(LIB_OBJ)
@@ -313,7 +313,7 @@ RPCCLIENT_OBJ1 = rpcclient/rpcclient.o rpcclient/cmd_lsarpc.o \
RPCCLIENT_OBJ = $(RPCCLIENT_OBJ1) \
$(PARAM_OBJ) $(LIBSMB_OBJ) $(UBIQX_OBJ) $(LIB_OBJ) \
$(RPC_PARSE_OBJ) $(PASSDB_OBJ) $(LIBMSRPC_OBJ) \
- $(READLINE_OBJ) $(GROUPDB_OBJ)
+ $(READLINE_OBJ) $(GROUPDB_OBJ) @BUILD_POPT@
SAMSYNC_OBJ1 = rpcclient/samsync.o rpcclient/display_sec.o
@@ -343,7 +343,7 @@ NET_OBJ = utils/net.o utils/net_ads.o \
utils/net_rap.o utils/net_rpc.o \
utils/net_rpc_join.o utils/net_time.o utils/net_lookup.o \
$(LIBSMB_OBJ) $(LIBMSRPC_OBJ) $(RPC_PARSE_OBJ) $(PASSDB_OBJ) \
- $(GROUPDB_OBJ) $(PARAM_OBJ) $(UBIQX_OBJ) $(LIB_OBJ)
+ $(GROUPDB_OBJ) $(PARAM_OBJ) $(UBIQX_OBJ) $(LIB_OBJ) @BUILD_POPT@
CUPS_OBJ = client/smbspool.o $(PARAM_OBJ) $(LIBSMB_OBJ) $(UBIQX_OBJ) $(LIB_OBJ)
@@ -574,9 +574,9 @@ bin/swat: $(SWAT_OBJ) bin/.dummy
@echo Linking $@
@$(CC) $(FLAGS) -o $@ $(SWAT_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS)
-bin/rpcclient: $(RPCCLIENT_OBJ) @BUILD_POPT@ bin/.dummy
+bin/rpcclient: $(RPCCLIENT_OBJ) bin/.dummy
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(RPCCLIENT_OBJ) $(LDFLAGS) $(DYNEXP) $(TERMLDFLAGS) $(TERMLIBS) $(LIBS) @BUILD_POPT@
+ @$(CC) $(FLAGS) -o $@ $(RPCCLIENT_OBJ) $(LDFLAGS) $(DYNEXP) $(TERMLDFLAGS) $(TERMLIBS) $(LIBS)
bin/samsync: $(SAMSYNC_OBJ) bin/.dummy
@echo Linking $@
@@ -586,9 +586,9 @@ bin/smbclient: $(CLIENT_OBJ) bin/.dummy
@echo Linking $@
@$(CC) $(FLAGS) -o $@ $(CLIENT_OBJ) $(LDFLAGS) $(TERMLDFLAGS) $(TERMLIBS) $(LIBS)
-bin/net: $(NET_OBJ) bin/.dummy @BUILD_POPT@
+bin/net: $(NET_OBJ) bin/.dummy
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(NET_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) @BUILD_POPT@
+ @$(CC) $(FLAGS) -o $@ $(NET_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS)
bin/smbspool: $(CUPS_OBJ) bin/.dummy
@echo Linking $@
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);