summaryrefslogtreecommitdiff
path: root/render.awk
diff options
context:
space:
mode:
authorKatolaZ <katolaz@freaknet.org>2018-09-06 00:02:48 +0100
committerKatolaZ <katolaz@freaknet.org>2018-09-06 00:02:48 +0100
commitdc95fc9270c75a66ffd0e7ff827e963a7dfb3726 (patch)
tree6d30a41e3b1daa6df0abdbacbc1f50ca5fe70ac8 /render.awk
parent53bd0d759ac992125d326b9a95fb1a83a2384574 (diff)
fixed order of keys in split arrays
Diffstat (limited to 'render.awk')
-rw-r--r--render.awk14
1 files changed, 12 insertions, 2 deletions
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);
}
}