chiark / gitweb /
units: introduce new Documentation= field and make use of it everywhere
[elogind.git] / src / shared / util.c
index 0b81e1c4f985ea08dfc657682576d467e060bae1..ae0ce320ad40b5bb0ac4cab909096a27bc7d315f 100644 (file)
@@ -5610,3 +5610,24 @@ int can_sleep(const char *type) {
         free(p);
         return found;
 }
+
+bool is_valid_documentation_url(const char *url) {
+        assert(url);
+
+        if (startswith(url, "http://") && url[7])
+                return true;
+
+        if (startswith(url, "https://") && url[8])
+                return true;
+
+        if (startswith(url, "file:") && url[5])
+                return true;
+
+        if (startswith(url, "info:") && url[5])
+                return true;
+
+        if (startswith(url, "man:") && url[4])
+                return true;
+
+        return false;
+}