diff options
Diffstat (limited to 'render.awk')
-rw-r--r-- | render.awk | 28 |
1 files changed, 14 insertions, 14 deletions
@@ -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(){ } |