From 1b29552e70a78116337cf08a8d629170097427ad Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 6 Jan 2006 02:28:36 +0000 Subject: 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) --- source4/param/loadparm.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'source4/param') 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. -- cgit