/[baselayout]/trunk/src/librc-depend.c
Gentoo

Diff of /trunk/src/librc-depend.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 3039 Revision 3040
349 rc_strlist_add (&providers.list, service); 349 rc_strlist_add (&providers.list, service);
350 350
351 return (providers.list); 351 return (providers.list);
352} 352}
353 353
354static void visit_service (rc_depinfo_t *deptree, char **types, 354static void visit_service (rc_depinfo_t *deptree, const char * const *types,
355 struct lhead *sorted, struct lhead *visited, 355 struct lhead *sorted, struct lhead *visited,
356 rc_depinfo_t *depinfo, 356 rc_depinfo_t *depinfo,
357 const char *runlevel, int options) 357 const char *runlevel, int options)
358{ 358{
359 int i, j, k; 359 int i, j, k;
360 char *lp, *item; 360 char *lp;
361 const char *item;
361 char *service; 362 char *service;
362 rc_depinfo_t *di; 363 rc_depinfo_t *di;
363 rc_deptype_t *dt; 364 rc_deptype_t *dt;
364 char **provides; 365 char **provides;
365 char *svcname; 366 char *svcname;
439 if (! get_deptype (depinfo, "providedby")) 440 if (! get_deptype (depinfo, "providedby"))
440 rc_strlist_add (&sorted->list, depinfo->service); 441 rc_strlist_add (&sorted->list, depinfo->service);
441} 442}
442 443
443char **rc_deptree_depends (rc_depinfo_t *deptree, 444char **rc_deptree_depends (rc_depinfo_t *deptree,
444 char **types, char **services, 445 const char * const *types, const char * const *services,
445 const char *runlevel, int options) 446 const char *runlevel, int options)
446{ 447{
447 struct lhead sorted; 448 struct lhead sorted;
448 struct lhead visited; 449 struct lhead visited;
449 rc_depinfo_t *di; 450 rc_depinfo_t *di;
450 char *service; 451 const char *service;
451 int i; 452 int i;
452 453
453 if (! deptree || ! services) 454 if (! deptree || ! services)
454 return (NULL); 455 return (NULL);
455 456
474 rc_strlist_free (visited.list); 475 rc_strlist_free (visited.list);
475 return (sorted.list); 476 return (sorted.list);
476} 477}
477librc_hidden_def(rc_deptree_depends) 478librc_hidden_def(rc_deptree_depends)
478 479
480static const const char *order_types[] = { "ineed", "iuse", "iafter", NULL };
479char **rc_deptree_order (rc_depinfo_t *deptree, const char *runlevel, 481char **rc_deptree_order (rc_depinfo_t *deptree, const char *runlevel,
480 int options) 482 int options)
481{ 483{
482 char **list = NULL; 484 char **list = NULL;
483 char **types = NULL;
484 char **services = NULL; 485 char **services = NULL;
485 bool reverse = false; 486 bool reverse = false;
486 char **tmp = NULL; 487 char **tmp = NULL;
487 488
488 if (! runlevel) 489 if (! runlevel)
523 } 524 }
524 } 525 }
525 526
526 /* Now we have our lists, we need to pull in any dependencies 527 /* Now we have our lists, we need to pull in any dependencies
527 and order them */ 528 and order them */
528 rc_strlist_add (&types, "ineed");
529 rc_strlist_add (&types, "iuse");
530 rc_strlist_add (&types, "iafter");
531 services = rc_deptree_depends (deptree, types, list, runlevel, 529 services = rc_deptree_depends (deptree, order_types, (const char **) list,
530 runlevel,
532 RC_DEP_STRICT | RC_DEP_TRACE | options); 531 RC_DEP_STRICT | RC_DEP_TRACE | options);
533 rc_strlist_free (list); 532 rc_strlist_free (list);
534 rc_strlist_free (types);
535 533
536 if (reverse) 534 if (reverse)
537 rc_strlist_reverse (services); 535 rc_strlist_reverse (services);
538 536
539 return (services); 537 return (services);

Legend:
Removed from v.3039  
changed lines
  Added in v.3040

  ViewVC Help
Powered by ViewVC 1.1.20