chiark / gitweb /
Allow for the use of @ in remote host calls
[elogind.git] / src / shared / util.c
index 2edf9cd8753ae8fa21edb4f08027ec5bdb54279e..d0bbf78bf371cc2340bbb7952193df5bdda12c20 100644 (file)
@@ -5847,3 +5847,17 @@ bool id128_is_valid(const char *s) {
 
         return true;
 }
+
+void parse_user_at_host(char *arg, char **user, char **host) {
+        assert(arg);
+        assert(user);
+        assert(host);
+
+        *host = strchr(arg, '@');
+        if (*host == NULL)
+                *host = arg;
+        else {
+                *host[0]++ = '\0';
+                *user = arg;
+        }
+}