From dc95fc9270c75a66ffd0e7ff827e963a7dfb3726 Mon Sep 17 00:00:00 2001 From: KatolaZ Date: Thu, 6 Sep 2018 00:02:48 +0100 Subject: fixed order of keys in split arrays --- render.awk | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'render.awk') diff --git a/render.awk b/render.awk index 7707a71..d617e39 100644 --- a/render.awk +++ b/render.awk @@ -1,4 +1,11 @@ +function mylen(a){ + l=0; + for (d in a) + l+=1; + return l; +} + function info_line(name, sel, host, port, dst){ printf("[i|%s|%s|%s|%s]\r\n", name, sel, host, port) > dst; } @@ -10,7 +17,8 @@ function show_link(l, i, dst){ else{ printf("[1|%s|%s|%s|%s]\r\n", l[i,"LinkName"], l[i,"Selector"], l[i,"Host"], l[i,"Port"] ) > dst; split(l[i,"Description"], descr, "\n"); - for (d in descr){ + dl=mylen(descr); + for (d=1;d<=dl;d++){ info_line(descr[d],"Err", HOST, PORT, dst); } info_line("", "Err", HOST, PORT, dst); @@ -53,8 +61,10 @@ function category_in_parents(category, i){ function category_header(category, i, dst){ info_line(category[i,"Title"], "Err", HOST, PORT, dst); info_line("", "Err", HOST, PORT, dst); + delete descr split(category[i,"Description"], descr, "\n"); - for (d in descr){ + dl=mylen(descr); + for (d=1;d<=dl;d++){ info_line(descr[d], "Err", HOST, PORT, dst); } } -- cgit v1.2.3