MCPcopy Create free account
hub / github.com/RsyncProject/rsync / set_boolean

Function set_boolean

loadparm.c:363–376  ·  view source on GitHub ↗

Set a boolean variable from the text value stored in the passed string. * Returns True in success, False if the passed string does not correctly * represent a boolean. */

Source from the content-addressed store, hash-verified

361 * Returns True in success, False if the passed string does not correctly
362 * represent a boolean. */
363static BOOL set_boolean(BOOL *pb, char *parmvalue, int allow_unset)
364{
365 if (strwiEQ(parmvalue, "yes") || strwiEQ(parmvalue, "true") || strwiEQ(parmvalue, "1"))
366 *pb = True;
367 else if (strwiEQ(parmvalue, "no") || strwiEQ(parmvalue, "false") || strwiEQ(parmvalue, "0"))
368 *pb = False;
369 else if (allow_unset && (strwiEQ(parmvalue, "unset") || strwiEQ(parmvalue, "-1")))
370 *pb = Unset;
371 else {
372 rprintf(FLOG, "Badly formed boolean in configuration file: \"%s\".\n", parmvalue);
373 return False;
374 }
375 return True;
376}
377
378/* Process a parameter. */
379static BOOL do_parameter(char *parmname, char *parmvalue)

Callers 1

do_parameterFunction · 0.85

Calls 2

strwiEQFunction · 0.85
rprintfFunction · 0.70

Tested by

no test coverage detected