To generate stub warnings.
[glibc/history.git] / elf / genrtldtbl.awk
blob50f81c8c3449164303974381275cc6f0c0838a8d
1 #! /usr/bin/awk
2 BEGIN {
3 FS=":";
4 count=0;
7 for (i = 1; i <= NF; ++i) {
8 dir[count++] = gensub(/((.*)[^/])?[/]*/, "\\1", "", $i);
11 END {
12 for (i = 0; i < count; ++i) {
13 printf ("static struct r_search_path_elem rtld_search_dir%d =\n", i+1);
14 printf (" { \"%s/\", %d, unknown, 0, unknown, ",
15 dir[i], length (dir[i]) + 1);
16 if (i== 0)
17 printf ("NULL };\n");
18 else
19 printf ("&rtld_search_dir%d };\n", i);
21 printf ("\nstatic struct r_search_path_elem *rtld_search_dirs[] =\n{\n");
22 for (i = 0; i < count; ++i) {
23 printf (" &rtld_search_dir%d,\n", i + 1);
25 printf (" NULL\n};\n\n");
26 printf ("static struct r_search_path_elem *all_dirs = &rtld_search_dir%d;\n",
27 count);