AWK script to generate include file with search path for dl-load.c.
authordrepper <drepper>
Sat, 26 Jul 1997 02:21:02 +0000 (02:21 +0000)
committerdrepper <drepper>
Sat, 26 Jul 1997 02:21:02 +0000 (02:21 +0000)
elf/genrtldtbl.awk [new file with mode: 0644]

diff --git a/elf/genrtldtbl.awk b/elf/genrtldtbl.awk
new file mode 100644 (file)
index 0000000..50f81c8
--- /dev/null
@@ -0,0 +1,28 @@
+#! /usr/bin/awk
+BEGIN {
+  FS=":";
+  count=0;
+}
+{
+  for (i = 1; i <= NF; ++i) {
+    dir[count++] = gensub(/((.*)[^/])?[/]*/, "\\1", "", $i);
+  }
+}
+END {
+  for (i = 0; i < count; ++i) {
+    printf ("static struct r_search_path_elem rtld_search_dir%d =\n", i+1);
+    printf ("  { \"%s/\", %d, unknown, 0, unknown, ",
+           dir[i], length (dir[i]) + 1);
+    if (i== 0)
+      printf ("NULL };\n");
+    else
+      printf ("&rtld_search_dir%d };\n", i);
+  }
+  printf ("\nstatic struct r_search_path_elem *rtld_search_dirs[] =\n{\n");
+  for (i = 0; i < count; ++i) {
+    printf ("  &rtld_search_dir%d,\n", i + 1);
+  }
+  printf ("  NULL\n};\n\n");
+  printf ("static struct r_search_path_elem *all_dirs = &rtld_search_dir%d;\n",
+         count);
+}