From 1bd1f9b85f45275b1600d148530bc1877ff15213 Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Tue, 25 May 2010 11:27:49 +0100 Subject: New API: available-all-groups to return list of all optional groups. --- daemon/available.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'daemon') diff --git a/daemon/available.c b/daemon/available.c index 77fdfa2c..2a30cadf 100644 --- a/daemon/available.c +++ b/daemon/available.c @@ -53,3 +53,21 @@ do_available (char *const *groups) return 0; } + +char ** +do_available_all_groups (void) +{ + size_t i; + char **groups = NULL; + int size = 0, alloc = 0; + + for (i = 0; optgroups[i].group != NULL; ++i) { + if (add_string (&groups, &size, &alloc, optgroups[i].group) == -1) + return NULL; + } + + if (add_string (&groups, &size, &alloc, NULL) == -1) + return NULL; + + return groups; /* caller frees */ +} -- cgit