From 19464369c3612ff8f431a2bed62861f4d20cabc4 Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Sun, 12 Aug 2018 23:44:58 -0400 Subject: Fix /open ranges by passing all URLs to open(1) This is going to be incompatible with xdg-open since it takes only one URL at a time. Write a wrapper script. --- url.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'url.c') diff --git a/url.c b/url.c index b7172ce..3a7628f 100644 --- a/url.c +++ b/url.c @@ -72,14 +72,15 @@ void urlList(struct Tag tag) { } } -void urlOpen(struct Tag tag, size_t fromEnd) { - size_t count = 0; +void urlOpen(struct Tag tag, size_t at, size_t to) { + size_t argc = 1; + char *argv[2 + RING_LEN] = { "open" }; + size_t tagIndex = 0; for (size_t i = 0; i < RING_LEN; ++i) { struct Entry entry = ring.buf[(ring.end - i) & (RING_LEN - 1)]; if (!entry.url || entry.tag != tag.id) continue; - if (++count != fromEnd) continue; - char *argv[] = { "open", entry.url, NULL }; - spawn(argv); - return; + if (tagIndex >= at && tagIndex < to) argv[argc++] = entry.url; + tagIndex++; } + if (argc > 1) spawn(argv); } -- cgit 1.4.1