summaryrefslogtreecommitdiffstats
path: root/source4/utils
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2006-01-06 02:28:36 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:49:46 -0500
commit1b29552e70a78116337cf08a8d629170097427ad (patch)
tree1791a697f4755a7f7b2f87edb0d7e1f846b7226e /source4/utils
parent03ab3429090a9fccc8778d949cd9d92042575558 (diff)
downloadsamba-1b29552e70a78116337cf08a8d629170097427ad.tar.gz
samba-1b29552e70a78116337cf08a8d629170097427ad.tar.xz
samba-1b29552e70a78116337cf08a8d629170097427ad.zip
r12730: Reimplement --parameter-name, and bring in common samba options.
This changes -s from meaning 'suppress prompt' to 'services file'. Andrew Bartlett (This used to be commit 0f78bd743b8bc415e47006a683c53bfdff1bc1e1)
Diffstat (limited to 'source4/utils')
-rw-r--r--source4/utils/testparm.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/source4/utils/testparm.c b/source4/utils/testparm.c
index c4b7dd38d87..fd990221ed5 100644
--- a/source4/utils/testparm.c
+++ b/source4/utils/testparm.c
@@ -81,17 +81,17 @@ static int do_global_checks(void)
static const char *term_code = "";
/*
static BOOL show_all_parameters = False;
- static char *parameter_name = NULL;
static char *new_local_machine = NULL;
*/
static const char *section_name = NULL;
+ static char *parameter_name = NULL;
static const char *cname;
static const char *caddr;
static int show_defaults;
struct poptOption long_options[] = {
POPT_AUTOHELP
- {"suppress-prompt", 's', POPT_ARG_VAL, &silent_mode, 1, "Suppress prompt for enter"},
+ {"suppress-prompt", '\0', POPT_ARG_VAL, &silent_mode, 1, "Suppress prompt for enter"},
{"verbose", 'v', POPT_ARG_NONE, &show_defaults, 1, "Show default options too"},
/*
We need support for smb.conf macros before this will work again
@@ -100,11 +100,12 @@ static int do_global_checks(void)
/*
These are harder to do with the new code structure
{"show-all-parameters", '\0', POPT_ARG_VAL, &show_all_parameters, True, "Show the parameters, type, possible values" },
- {"parameter-name", '\0', POPT_ARG_STRING, &parameter_name, 0, "Limit testparm to a named parameter" },
*/
{"section-name", '\0', POPT_ARG_STRING, &section_name, 0, "Limit testparm to a named section" },
+ {"parameter-name", '\0', POPT_ARG_STRING, &parameter_name, 0, "Limit testparm to a named parameter" },
{"client-name", '\0', POPT_ARG_STRING, &cname, 0, "Client DNS name for 'hosts allow' checking (should match reverse lookup)"},
{"client-ip", '\0', POPT_ARG_STRING, &caddr, 0, "Client IP address for 'hosts allow' checking"},
+ POPT_COMMON_SAMBA
POPT_COMMON_VERSION
POPT_TABLEEND
};
@@ -196,7 +197,7 @@ static int do_global_checks(void)
fflush(stdout);
getc(stdin);
}
- if (section_name) {
+ if (section_name || parameter_name) {
BOOL isGlobal = False;
if (!section_name) {
section_name = GLOBAL_NAME;
@@ -207,10 +208,14 @@ static int do_global_checks(void)
section_name);
return(1);
}
- if (isGlobal == True) {
- lp_dump(stdout, show_defaults, 0);
+ if (!parameter_name) {
+ if (isGlobal == True) {
+ lp_dump(stdout, show_defaults, 0);
+ } else {
+ lp_dump_one(stdout, show_defaults, s);
+ }
} else {
- lp_dump_one(stdout, show_defaults, s);
+ ret = lp_dump_a_parameter(s, parameter_name, stdout, isGlobal);
}
} else {
lp_dump(stdout, show_defaults, lp_numservices());