about summary refs log tree commit diff
path: root/sysdeps/generic/dl-sysdep.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/generic/dl-sysdep.c')
-rw-r--r--sysdeps/generic/dl-sysdep.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/sysdeps/generic/dl-sysdep.c b/sysdeps/generic/dl-sysdep.c
index b007aa6b9d..21b470c6ae 100644
--- a/sysdeps/generic/dl-sysdep.c
+++ b/sysdeps/generic/dl-sysdep.c
@@ -243,3 +243,29 @@ _dl_show_auxv (void)
 	break;
       }
 }
+
+/* Walk through the environment of the process and return all entries
+   starting with `LD_'.  */
+char *
+_dl_next_ld_env_entry (char ***position)
+{
+  char **current = *position;
+  char *result = NULL;
+
+  if (current == NULL)
+    /* We start over.  */
+    current = _environ;
+
+  while (result == NULL && *current != NULL)
+    {
+      if ((*current)[0] == 'L' && (*current)[1] == 'D' && (*current)[2] == '_')
+	result = *current;
+
+      ++current;
+    }
+
+  /* Save current position for next visit.  */
+  *position = current;
+
+  return result;
+}