sacc

sacc(omys), simple console gopher client (mirror)
git clone https://git.parazyd.org/sacc
Log | Files | Refs | LICENSE

commit 92b222eb21149fa7fcd4044f53b2139d10527a1a
parent bdb2f6a27c4d8e74a49c7ca2764207a1f63b3646
Author: Quentin Rameau <quinq@fifth.space>
Date:   Tue, 18 Jul 2017 11:34:52 +0200

Add plumbing support for 'h'TML "URL:" links

Diffstat:
Msacc.c | 15++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/sacc.c b/sacc.c @@ -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) { @@ -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':