aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/librc/librc-depend.c11
-rw-r--r--src/librc/rc.h.in5
-rw-r--r--src/librc/rc.map1
-rw-r--r--src/test/librc.funcs.hidden.list1
-rw-r--r--src/test/rc.funcs.list2
5 files changed, 17 insertions, 3 deletions
diff --git a/src/librc/librc-depend.c b/src/librc/librc-depend.c
index 765f5958..13f9076e 100644
--- a/src/librc/librc-depend.c
+++ b/src/librc/librc-depend.c
@@ -114,7 +114,13 @@ get_deptype(const RC_DEPINFO *depinfo, const char *type)
}
RC_DEPTREE *
-rc_deptree_load(void)
+rc_deptree_load(void) {
+ return rc_deptree_load_file(RC_DEPTREE_CACHE);
+}
+librc_hidden_def(rc_deptree_load)
+
+RC_DEPTREE *
+rc_deptree_load_file(const char *deptree_file)
{
FILE *fp;
RC_DEPTREE *deptree;
@@ -127,7 +133,7 @@ rc_deptree_load(void)
char *e;
int i;
- if (!(fp = fopen(RC_DEPTREE_CACHE, "r")))
+ if (!(fp = fopen(deptree_file, "r")))
return NULL;
deptree = xmalloc(sizeof(*deptree));
@@ -175,7 +181,6 @@ rc_deptree_load(void)
return deptree;
}
-librc_hidden_def(rc_deptree_load)
static bool
valid_service(const char *runlevel, const char *service, const char *type)
diff --git a/src/librc/rc.h.in b/src/librc/rc.h.in
index 3d0ffb42..7ed8f226 100644
--- a/src/librc/rc.h.in
+++ b/src/librc/rc.h.in
@@ -375,6 +375,11 @@ bool rc_deptree_update_needed(time_t *, char *);
* @return pointer to the dependency tree */
RC_DEPTREE *rc_deptree_load(void);
+/*! Load a cached dependency tree from the specified file and return a pointer
+ * to it. This pointer should be freed with rc_deptree_free when done.
+ * @return pointer to the dependency tree */
+RC_DEPTREE *rc_deptree_load_file(const char *);
+
/*! List the depend for the type of service
* @param deptree to search
* @param type to use (keywords, etc)
diff --git a/src/librc/rc.map b/src/librc/rc.map
index 113f2d7d..d763bfeb 100644
--- a/src/librc/rc.map
+++ b/src/librc/rc.map
@@ -7,6 +7,7 @@ global:
rc_deptree_depends;
rc_deptree_free;
rc_deptree_load;
+ rc_deptree_load_file;
rc_deptree_order;
rc_deptree_update;
rc_deptree_update_needed;
diff --git a/src/test/librc.funcs.hidden.list b/src/test/librc.funcs.hidden.list
index b661850f..ffacf57f 100644
--- a/src/test/librc.funcs.hidden.list
+++ b/src/test/librc.funcs.hidden.list
@@ -5,6 +5,7 @@ rc_deptree_depend
rc_deptree_depends
rc_deptree_free
rc_deptree_load
+rc_deptree_load_file
rc_deptree_order
rc_deptree_update
rc_deptree_update_needed
diff --git a/src/test/rc.funcs.list b/src/test/rc.funcs.list
index 0aac8f9a..b01ddf60 100644
--- a/src/test/rc.funcs.list
+++ b/src/test/rc.funcs.list
@@ -12,6 +12,8 @@ rc_deptree_free
rc_deptree_free@@RC_1.0
rc_deptree_load
rc_deptree_load@@RC_1.0
+rc_deptree_load_file
+rc_deptree_load_file@@RC_1.0
rc_deptree_order
rc_deptree_order@@RC_1.0
rc_deptree_update