summaryrefslogtreecommitdiff
path: root/src/server/service.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/service.c')
-rw-r--r--src/server/service.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/server/service.c b/src/server/service.c
new file mode 100644
index 0000000..b5d06f4
--- /dev/null
+++ b/src/server/service.c
@@ -0,0 +1,18 @@
+/* ISC license. */
+
+#include "service.h"
+
+common_t const *service_common (db_t const *db, stype_t stype, uint32_t i)
+{
+ if (stype >= STYPE_PHAIL) return 0 ;
+ if (i >= db->n[stype]) return 0 ;
+ switch (stype)
+ {
+ case STYPE_LONGRUN : return &db->longruns[i].common ;
+ case STYPE_ONESHOT : return &db->oneshots[i].common ;
+ case STYPE_EXTERNAL : return &db->externals[i].common ;
+ case STYPE_BUNDLE : return &db->bundles[i].common ;
+ case STYPE_VIRTUAL : return &db->virtuals[i].common ;
+ default : return 0 ;
+ }
+}