summaryrefslogtreecommitdiff
path: root/source4/param
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/param
parent03ab3429090a9fccc8778d949cd9d92042575558 (diff)
downloadsamba-1b29552e70a78116337cf08a8d629170097427ad.tar.gz
samba-1b29552e70a78116337cf08a8d629170097427ad.tar.bz2
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/param')
-rw-r--r--source4/param/loadparm.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c
index 6e7716b1f2..3d079f3e3e 100644
--- a/source4/param/loadparm.c
+++ b/source4/param/loadparm.c
@@ -2228,6 +2228,44 @@ static void dump_a_service(service * pService, FILE * f)
}
}
+BOOL lp_dump_a_parameter(int snum, char *parm_name, FILE * f, BOOL isGlobal)
+{
+ service * pService = ServicePtrs[snum];
+ int i, result = False;
+ parm_class p_class;
+ unsigned flag = 0;
+
+ if (isGlobal) {
+ p_class = P_GLOBAL;
+ flag = FLAG_GLOBAL;
+ } else
+ p_class = P_LOCAL;
+
+ for (i = 0; parm_table[i].label; i++) {
+ if (strwicmp(parm_table[i].label, parm_name) == 0 &&
+ (parm_table[i].class == p_class || parm_table[i].flags & flag) &&
+ parm_table[i].ptr &&
+ (*parm_table[i].label != '-') &&
+ (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr)))
+ {
+ void *ptr;
+
+ if (isGlobal)
+ ptr = parm_table[i].ptr;
+ else
+ ptr = ((char *)pService) +
+ PTR_DIFF(parm_table[i].ptr, &sDefault);
+
+ print_parameter(&parm_table[i],
+ ptr, f);
+ fprintf(f, "\n");
+ result = True;
+ break;
+ }
+ }
+
+ return result;
+}
/***************************************************************************
Return info about the next service in a service. snum==-1 gives the globals.