chiark / gitweb /
ac-power: make ac-power a proper binary that scripts can call
[elogind.git] / src / util.c
index 6f9399b41808720cd5202fea8ff4a74fd96833f0..f41861b64eda1db93d0a50cb7cfb710f206027db 100644 (file)
@@ -3566,7 +3566,6 @@ void dual_timestamp_deserialize(const char *value, dual_timestamp *t) {
         }
 }
 
-
 char *fstab_node_to_udev_node(const char *p) {
         char *dn, *t, *u;
         int r;
@@ -3617,6 +3616,24 @@ char *fstab_node_to_udev_node(const char *p) {
         return strdup(p);
 }
 
+void filter_environ(const char *prefix) {
+        int i, j;
+        assert(prefix);
+
+        if (!environ)
+                return;
+
+        for (i = 0, j = 0; environ[i]; i++) {
+
+                if (startswith(environ[i], prefix))
+                        continue;
+
+                environ[j++] = environ[i];
+        }
+
+        environ[j] = NULL;
+}
+
 static const char *const ioprio_class_table[] = {
         [IOPRIO_CLASS_NONE] = "none",
         [IOPRIO_CLASS_RT] = "realtime",