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

Function do_parameter

loadparm.c:379–471  ·  view source on GitHub ↗

Process a parameter. */

Source from the content-addressed store, hash-verified

377
378/* Process a parameter. */
379static BOOL do_parameter(char *parmname, char *parmvalue)
380{
381 int parmnum, i;
382 void *parm_ptr; /* where we are going to store the result */
383 void *def_ptr;
384 char *cp;
385
386 parmnum = map_parameter(parmname);
387
388 if (parmnum < 0) {
389 rprintf(FLOG, "IGNORING unknown parameter \"%s\"\n", parmname);
390 return True;
391 }
392
393 def_ptr = parm_table[parmnum].ptr;
394
395 if (bInGlobalSection)
396 parm_ptr = def_ptr;
397 else {
398 if (parm_table[parmnum].class == P_GLOBAL) {
399 rprintf(FLOG, "Global parameter %s found in module section!\n", parmname);
400 return True;
401 }
402 parm_ptr = SECTION_PTR(&iSECTION(iSectionIndex), def_ptr);
403 }
404
405 /* now switch on the type of variable it is */
406 switch (parm_table[parmnum].type) {
407 case P_PATH:
408 case P_STRING:
409 /* delay expansion of %VAR% strings */
410 break;
411 default:
412 /* expand any %VAR% strings now */
413 parmvalue = expand_vars(parmvalue);
414 break;
415 }
416
417 switch (parm_table[parmnum].type) {
418 case P_BOOL:
419 set_boolean(parm_ptr, parmvalue, False);
420 break;
421
422 case P_BOOL3:
423 set_boolean(parm_ptr, parmvalue, True);
424 break;
425
426 case P_BOOLREV:
427 set_boolean(parm_ptr, parmvalue, False);
428 *(BOOL *)parm_ptr = ! *(BOOL *)parm_ptr;
429 break;
430
431 case P_INTEGER:
432 *(int *)parm_ptr = atoi(parmvalue);
433 break;
434
435 case P_CHAR:
436 *(char *)parm_ptr = *parmvalue;

Callers 1

set_dparamsFunction · 0.85

Calls 5

map_parameterFunction · 0.85
expand_varsFunction · 0.85
set_booleanFunction · 0.85
string_setFunction · 0.85
rprintfFunction · 0.70

Tested by

no test coverage detected