MCPcopy Index your code
hub / github.com/RsyncProject/rsync / poptReadConfigFiles

Function poptReadConfigFiles

popt/poptconfig.c:394–435  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

392}
393
394int poptReadConfigFiles(poptContext con, const char * paths)
395{
396 char * buf = (paths ? xstrdup(paths) : NULL);
397 const char * p;
398 char * pe;
399 int rc = 0; /* assume success */
400
401 for (p = buf; p != NULL && *p != '\0'; p = pe) {
402 const char ** av = NULL;
403 int ac = 0;
404 int i;
405 int xx;
406
407 /* locate start of next path element */
408 pe = strchr(p, ':');
409 if (pe != NULL && *pe == ':')
410 *pe++ = '\0';
411 else
412 pe = (char *) (p + strlen(p));
413
414 xx = poptGlob(con, p, &ac, &av);
415
416 /* work-off each resulting file from the path element */
417 for (i = 0; i < ac; i++) {
418 const char * fn = av[i];
419 if (!poptSaneFile(fn))
420 continue;
421 xx = poptReadConfigFile(con, fn);
422 if (xx && rc == 0)
423 rc = xx;
424 free((void *)av[i]);
425 av[i] = NULL;
426 }
427 free(av);
428 av = NULL;
429 }
430
431 if (buf)
432 free(buf);
433
434 return rc;
435}
436
437int poptReadDefaultConfig(poptContext con, UNUSED(int useEnv))
438{

Callers 1

poptInitFunction · 0.85

Calls 3

poptGlobFunction · 0.85
poptSaneFileFunction · 0.85
poptReadConfigFileFunction · 0.85

Tested by

no test coverage detected