summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus/bus-internal.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsystemd/sd-bus/bus-internal.c')
-rw-r--r--src/libsystemd/sd-bus/bus-internal.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/libsystemd/sd-bus/bus-internal.c b/src/libsystemd/sd-bus/bus-internal.c
index 0bea8cac49..91b288cd25 100644
--- a/src/libsystemd/sd-bus/bus-internal.c
+++ b/src/libsystemd/sd-bus/bus-internal.c
@@ -166,6 +166,26 @@ bool service_name_is_valid(const char *p) {
return true;
}
+char* service_name_startswith(const char *a, const char *b) {
+ const char *p;
+
+ if (!service_name_is_valid(a) ||
+ !service_name_is_valid(b))
+ return NULL;
+
+ p = startswith(a, b);
+ if (!p)
+ return NULL;
+
+ if (*p == 0)
+ return (char*) p;
+
+ if (*p == '.')
+ return (char*) p + 1;
+
+ return NULL;
+}
+
bool member_name_is_valid(const char *p) {
const char *q;