summaryrefslogtreecommitdiff
path: root/render.awk
diff options
context:
space:
mode:
authorKatolaZ <katolaz@freaknet.org>2018-09-05 23:13:24 +0100
committerKatolaZ <katolaz@freaknet.org>2018-09-05 23:13:24 +0100
commit53bd0d759ac992125d326b9a95fb1a83a2384574 (patch)
tree40980e457fc7f3e4393a9a94e9d99aee2ea3c343 /render.awk
parent540583a496564328ce5a677ee4bac6491b4a4932 (diff)
now compatible with mawk
Diffstat (limited to 'render.awk')
-rw-r--r--render.awk28
1 files changed, 14 insertions, 14 deletions
diff --git a/render.awk b/render.awk
index 7ef884a..7707a71 100644
--- a/render.awk
+++ b/render.awk
@@ -6,7 +6,7 @@ function info_line(name, sel, host, port, dst){
function show_link(l, i, dst){
if(l[i,"Category"] == "")
- print "Uncategorised link:", l[i,"Selector"] > /dev/stderr;
+ print "Uncategorised link:", l[i,"Selector"];
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");
@@ -27,7 +27,7 @@ function show_category_link(category, i, dst){
function get_parents(a){
delete pars;
- split(a, pars, /[:blank:]*,[:blank:]*/);
+ split(a, pars, /\ \f\n\r\t\v*,\ \f\n\r\t\v*/);
for (k in pars){
gsub(/ +/, "", pars[k]);
}
@@ -61,13 +61,10 @@ function category_header(category, i, dst){
function get_link_categories(a){
delete cats;
- split(a, cats, /([[:blank:]*],[[:blank:]]*|,[[:blank:]]*)/);
- printf("%s -> ", a) >/dev/stderr;
+ split(a, cats, /([\ \f\n\r\t\v*],[\ \f\n\r\t\v]*|,[\ \f\n\r\t\v]*)/);
for (k in cats){
- printf("%s ", cats[k])>/dev/stderr;
gsub(/ +/, "", cats[k]);
}
- print > /dev/stderr
}
########################################
@@ -78,13 +75,16 @@ function render_init(){
}
-function render_categories(category, cnum, link, lnum){
+function render_categories(){
for (i=1; i<=cnum; i++){
cname=category[i,"Name"];
cfiles[cname]=BASEDIR category[i,"Selector"];
- "dirname " cfiles[cname] | getline bdir;
- if (system("ls -d " bdir " 2>/dev/null") >0){
- system("mkdir -p " bdir);
+ cmd="dirname " cfiles[cname];
+ cmd | getline bdir;
+ cmd="ls -d " bdir " 2>/dev/null";
+ if (system(cmd) != 0){
+ cmd="mkdir -p " bdir;
+ system(cmd);
}
cmd=sprintf("rm -f %s", cfiles[cname]);
system(cmd);
@@ -93,13 +93,13 @@ function render_categories(category, cnum, link, lnum){
}
}
-function render_post_categories(category, cnum){
+function render_post_categories(){
}
-function render_links(category, cnum, link, lnum){
+function render_links(){
for (i=1;i<=lnum;i++){
get_link_categories(link[i,"Category"]);
@@ -120,7 +120,7 @@ function render_links(category, cnum, link, lnum){
}
-function render_finalise(category, cnum, link, lnum){
+function render_finalise(){
for(i=1;i<=cnum; i++){
info_line("_______________", "Err", HOST, PORT, cfiles[category[i,"Name"]]);
@@ -128,7 +128,7 @@ function render_finalise(category, cnum, link, lnum){
}
}
-function dump_links(category, cnum, link, lnum){
+function dump_links(){
}