about summary refs log tree commit diff
path: root/input.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-08-12 23:44:58 -0400
committerJune McEnroe <june@causal.agency>2018-08-12 23:44:58 -0400
commit19464369c3612ff8f431a2bed62861f4d20cabc4 (patch)
treeea395f5e50b548834fe085bf36b7fff09d1abbcc /input.c
parentAvoid setting mark if switching to the same view (diff)
downloadcatgirl-19464369c3612ff8f431a2bed62861f4d20cabc4.tar.gz
catgirl-19464369c3612ff8f431a2bed62861f4d20cabc4.zip
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.
Diffstat (limited to '')
-rw-r--r--input.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/input.c b/input.c
index cb7575f..c2599c1 100644
--- a/input.c
+++ b/input.c
@@ -90,14 +90,9 @@ static void inputUrl(struct Tag tag, char *params) {
 	urlList(tag);
 }
 static void inputOpen(struct Tag tag, char *params) {
-	if (!params) { urlOpen(tag, 1); return; }
-	size_t from = strtoul(strsep(&params, "-,"), NULL, 0);
-	if (!params) { urlOpen(tag, from); return; }
-	size_t to = strtoul(strsep(&params, "-,"), NULL, 0);
-	if (to < from) to = from;
-	for (size_t i = from; i <= to; ++i) {
-		urlOpen(tag, i);
-	}
+	size_t at = (params ? strtoul(strsep(&params, "-,"), NULL, 0) : 1);
+	size_t to = (params ? strtoul(params, NULL, 0) : at);
+	urlOpen(tag, at - 1, to);
 }
 
 static void inputView(struct Tag tag, char *params) {