chiark / gitweb /
mount: properly handle LABEL="" in fstab
[elogind.git] / src / util.c
index 7903ca07b99fe64d493948f579eb9e34f3adbd31..f1a7bbdc7124b1d977d536fcb4c83bea80213478 100644 (file)
@@ -3004,6 +3004,19 @@ int touch(const char *path) {
         return 0;
 }
 
+char *unquote(const char *s, const char quote) {
+        size_t l;
+        assert(s);
+
+        if ((l = strlen(s)) < 2)
+                return strdup(s);
+
+        if (s[0] == quote && s[l-1] == quote)
+                return strndup(s+1, l-2);
+
+        return strdup(s);
+}
+
 static const char *const ioprio_class_table[] = {
         [IOPRIO_CLASS_NONE] = "none",
         [IOPRIO_CLASS_RT] = "realtime",