dot

packages and services management
Log | Files | Refs | README

commit 860a537df2d246036f8bad57add7d5157fa9ecf3
parent 84111cc59274042188ce70924680d8b02b10257a
Author: Josuah Demangeon <mail@josuah.net>
Date:   Fri, 16 Feb 2018 01:20:15 +0100

ghttpd: whole line as link content without prefix

Diffstat:
Mbin/ghttpd | 10++++------
1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/bin/ghttpd b/bin/ghttpd @@ -42,9 +42,9 @@ function url(f) return sprintf("gopher://%s:%s/%s%s", f[3], f[4], f[0], f[2]); } -function link(type, f) +function link(f) { - return sprintf("<a href=\"%s\">%s</a> %s", url(f), type, esc(f[1])); + return sprintf("<a href=\"%s\">%s</a>", url(f), esc(f[1])); } END { @@ -59,8 +59,6 @@ END { print("\r"); print("<!doctype html><title>" HOST "</title><pre>"); - t["0"] = "txt"; t["8"] = "net"; t["g"] = "img"; t["h"] = "url"; - t["1"] = "dir"; t["9"] = "bin"; t["I"] = "img"; while (cmd | getline) { sub("\r$", ""); split($0, f, "\t"); @@ -68,9 +66,9 @@ END { sub(".", "", f[1]); if (f[0] == "i") - printf(" %s\n", esc(f[1])); + printf("%s\n", esc(f[1])); else - print(link(t[f[0]], f)); + print(link(f)); } print("</pre>");