mirror of
https://github.com/samba-team/samba.git
synced 2025-08-02 00:22:11 +03:00
r12731: Simplify and re-implemenet support for --parameter-name=foo
--service-name=bar in testparm.
Andrew Bartlett
(This used to be commit be067e9a04
)
This commit is contained in:
committed by
Gerald (Jerry) Carter
parent
1b29552e70
commit
c66bc0dadb
@ -2231,40 +2231,31 @@ static void dump_a_service(service * pService, FILE * f)
|
|||||||
BOOL lp_dump_a_parameter(int snum, char *parm_name, FILE * f, BOOL isGlobal)
|
BOOL lp_dump_a_parameter(int snum, char *parm_name, FILE * f, BOOL isGlobal)
|
||||||
{
|
{
|
||||||
service * pService = ServicePtrs[snum];
|
service * pService = ServicePtrs[snum];
|
||||||
int i, result = False;
|
|
||||||
parm_class p_class;
|
parm_class p_class;
|
||||||
unsigned flag = 0;
|
unsigned flag = 0;
|
||||||
|
struct parm_struct *parm;
|
||||||
|
void *ptr;
|
||||||
if (isGlobal) {
|
if (isGlobal) {
|
||||||
p_class = P_GLOBAL;
|
p_class = P_GLOBAL;
|
||||||
flag = FLAG_GLOBAL;
|
flag = FLAG_GLOBAL;
|
||||||
} else
|
} else
|
||||||
p_class = P_LOCAL;
|
p_class = P_LOCAL;
|
||||||
|
|
||||||
for (i = 0; parm_table[i].label; i++) {
|
parm = lp_parm_struct(parm_name);
|
||||||
if (strwicmp(parm_table[i].label, parm_name) == 0 &&
|
if (!parm) {
|
||||||
(parm_table[i].class == p_class || parm_table[i].flags & flag) &&
|
return False;
|
||||||
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;
|
if (isGlobal)
|
||||||
|
ptr = parm->ptr;
|
||||||
|
else
|
||||||
|
ptr = ((char *)pService) +
|
||||||
|
PTR_DIFF(parm->ptr, &sDefault);
|
||||||
|
|
||||||
|
print_parameter(parm,
|
||||||
|
ptr, f);
|
||||||
|
fprintf(f, "\n");
|
||||||
|
return True;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
|
@ -215,7 +215,7 @@ static int do_global_checks(void)
|
|||||||
lp_dump_one(stdout, show_defaults, s);
|
lp_dump_one(stdout, show_defaults, s);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ret = lp_dump_a_parameter(s, parameter_name, stdout, isGlobal);
|
ret = !lp_dump_a_parameter(s, parameter_name, stdout, isGlobal);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
lp_dump(stdout, show_defaults, lp_numservices());
|
lp_dump(stdout, show_defaults, lp_numservices());
|
||||||
|
Reference in New Issue
Block a user