about summary refs log tree commit diff
path: root/elf/gen-trusted-dirs.awk
blob: 59f10a4856b9759dd8c793043b2a53779db76d98 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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);
}