about summary refs log tree commit diff
path: root/elf/gen-trusted-dirs.awk
diff options
context:
space:
mode:
Diffstat (limited to 'elf/gen-trusted-dirs.awk')
-rw-r--r--elf/gen-trusted-dirs.awk37
1 files changed, 37 insertions, 0 deletions
diff --git a/elf/gen-trusted-dirs.awk b/elf/gen-trusted-dirs.awk
new file mode 100644
index 0000000000..59f10a4856
--- /dev/null
+++ b/elf/gen-trusted-dirs.awk
@@ -0,0 +1,37 @@
+BEGIN {
+  FS = " ";
+}
+
+{
+  for (i = 1; i <= NF; ++i) {
+    s[cnt++] = $i"/";
+  }
+}
+
+END {
+  printf ("#define SYSTEM_DIRS \\\n");
+
+  printf ("  \"%s\"", s[0]);
+
+  for (i = 1; i < cnt; ++i) {
+    printf (" \"\\0\" \"%s\"", s[i]);
+  }
+
+  printf ("\n\n");
+
+  printf ("#define SYSTEM_DIRS_LEN \\\n");
+
+  printf ("  %d", length (s[0]));
+  m = length (s[0]);
+
+  for (i = 1; i < cnt; ++i) {
+    printf (", %d", length(s[i]));
+    if (length(s[i]) > m) {
+      m = length(s[i]);
+    }
+  }
+
+  printf ("\n\n");
+
+  printf ("#define SYSTEM_DIRS_MAX_LEN\t%d\n", m);
+}