tAdd plumbing support for 'h'TML "URL:" links - sacc - sacc(omys), simple console gopher client (mirror) HTML git clone https://git.parazyd.org/sacc DIR Log DIR Files DIR Refs DIR LICENSE --- DIR commit 92b222eb21149fa7fcd4044f53b2139d10527a1a DIR parent bdb2f6a27c4d8e74a49c7ca2764207a1f63b3646 HTML Author: Quentin Rameau <quinq@fifth.space> Date: Tue, 18 Jul 2017 11:34:52 +0200 Add plumbing support for 'h'TML "URL:" links Diffstat: M sacc.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) --- DIR diff --git a/sacc.c b/sacc.c t@@ -438,6 +438,19 @@ searchselector(Item *item) return selector; } +static void +plumb(char *url) +{ + switch (fork()) { + case -1: + fprintf(stderr, "Couldn't fork.\n"); + return; + case 0: + if (execlp("xdg-open", "xdg-open", url, NULL) < 0) + die("execlp: %s", strerror(errno)); + } +} + static int dig(Item *entry, Item *item) { t@@ -450,7 +463,7 @@ dig(Item *entry, Item *item) switch (item->type) { case 'h': /* fallthrough */ if (!strncmp(item->selector, "URL:", 4)) { - item->dat = item->selector+4; + plumb(item->selector+4); return 0; } case '0':