diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2002-10-05 07:11:42 +0000 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2002-10-05 07:11:42 +0000 |
commit | 11c0d03b5f84102402e59f3aa0c58f2f25015e8b (patch) | |
tree | 4ed0b11f84fe9ddccce52292199ef8b80579ae27 | |
parent | 4506f260fb6e533174cffef38357b8338c43d717 (diff) | |
download | samba-11c0d03b5f84102402e59f3aa0c58f2f25015e8b.tar.gz samba-11c0d03b5f84102402e59f3aa0c58f2f25015e8b.tar.bz2 samba-11c0d03b5f84102402e59f3aa0c58f2f25015e8b.zip |
Use popt_common and use popt for showing help info
(This used to be commit de9ea4ee6b3a939044d84f43ce14f10dd16341ce)
-rw-r--r-- | source3/utils/status.c | 45 |
1 files changed, 15 insertions, 30 deletions
diff --git a/source3/utils/status.c b/source3/utils/status.c index d87497f2fa..7fd7c93615 100644 --- a/source3/utils/status.c +++ b/source3/utils/status.c @@ -35,8 +35,6 @@ #include "includes.h" -extern BOOL AllowDebugChange; - static pstring Ucrit_username = ""; /* added by OH */ static pid_t Ucrit_pid[100]; /* Ugly !!! */ /* added by OH */ static int Ucrit_MaxPid=0; /* added by OH */ @@ -542,30 +540,27 @@ static int traverse_sessionid(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf, vo { int c; static int profile_only = 0; - static char *new_debuglevel = NULL; 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}, + POPT_AUTOHELP + {"processes", 'p', POPT_ARG_NONE, &processes_only, 'p', "Show processes only" }, + {"verbose", 'v', POPT_ARG_NONE, &verbose, 'v', "Be verbose" }, + {"locks", 'L', POPT_ARG_NONE, &locks_only, 'L', "Show locks only" }, + {"shares", 'S', POPT_ARG_NONE, &shares_only, 'S', "Show shares only" }, + {"user", 'u', POPT_ARG_STRING, 0, 'u', "Switch to user" }, + {"brief", 'b', POPT_ARG_NONE, &brief, 'b', "Be brief" }, #ifdef WITH_PROFILE - {"profile", 'P', POPT_ARG_NONE, &profile_only}, + {"profile", 'P', POPT_ARG_NONE, &profile_only, 'P', "Do profiling" }, #endif /* WITH_PROFILE */ - {"byterange", 'B', POPT_ARG_NONE, &show_brl}, + {"byterange", 'B', POPT_ARG_NONE, &show_brl, 'B', "Include byte range locks"}, { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_debug }, + { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_configfile }, { 0, 0, 0, 0} }; - setup_logging(argv[0],True); - AllowDebugChange = False; - DEBUGLEVEL = 0; dbf = x_stderr; if (getuid() != geteuid()) { @@ -578,30 +573,20 @@ static int traverse_sessionid(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf, vo while ((c = poptGetNextOpt(pc)) != EOF) { switch (c) { - case 's': - pstrcpy(dyn_CONFIGFILE, poptGetOptArg(pc)); - break; case 'u': Ucrit_addUsername(poptGetOptArg(pc)); break; - default: - fprintf(stderr, "Usage: %s [-P] [-v] [-L] [-p] [-S] [-s configfile] [-u username] [-d debuglevel]\n", *argv); - return (-1); } } - - if (!lp_load(dyn_CONFIGFILE,False,False,False)) { - fprintf(stderr, "Can't load %s - run testparm to debug it\n", dyn_CONFIGFILE); - return (-1); - } - - if (new_debuglevel) { - debug_parse_levels(new_debuglevel); - } if (verbose) { d_printf("using configfile = %s\n", dyn_CONFIGFILE); } + + if (!lp_load(dyn_CONFIGFILE,False,False,False)) { + fprintf(stderr, "Can't load %s - run testparm to debug it\n", dyn_CONFIGFILE); + return (-1); + } if (profile_only) { return profile_dump(); |