[BZ #5186]
[glibc.git] / elf / genrtldtbl.awk
blob54cdc8c5896a33db05c5e933c3c1969481bca474
1 #! /usr/bin/awk
2 BEGIN {
3 FS=":";
4 count=0;
7 for (i = 1; i <= NF; ++i) {
8 gsub (/\/*$/, "", $i);
9 dir[count++] = $i;
12 END {
13 for (i = 0; i < count; ++i) {
14 printf ("static struct r_search_path_elem rtld_search_dir%d =\n", i+1);
15 printf (" { \"%s/\", %d, unknown, 0, nonexisting, NULL, NULL, ",
16 dir[i], length (dir[i]) + 1);
17 if (i== 0)
18 printf ("NULL };\n");
19 else
20 printf ("&rtld_search_dir%d };\n", i);
22 printf ("\nstatic struct r_search_path_elem *rtld_search_dirs[] =\n{\n");
23 for (i = 0; i < count; ++i) {
24 printf (" &rtld_search_dir%d,\n", i + 1);
26 printf (" NULL\n};\n\n");
27 printf ("static struct r_search_path_elem *all_dirs = &rtld_search_dir%d;\n",
28 count);