summary refs log tree commit diff
path: root/input.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-09-11 14:36:30 -0400
committerJune McEnroe <june@causal.agency>2018-09-11 14:36:30 -0400
commit068cff107e7147ba9dc8fb723a07a6d0a4bd80dd (patch)
tree5e87b809db205e1c865a585320fcd2082ea2cc0c /input.c
parentDepend on man.sh for chroot.tar target (diff)
downloadcatgirl-068cff107e7147ba9dc8fb723a07a6d0a4bd80dd.tar.gz
catgirl-068cff107e7147ba9dc8fb723a07a6d0a4bd80dd.zip
Add urlOpenMatch
Diffstat (limited to 'input.c')
-rw-r--r--input.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/input.c b/input.c
index 6e95b11..4497010 100644
--- a/input.c
+++ b/input.c
@@ -14,6 +14,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <ctype.h>
 #include <err.h>
 #include <stdbool.h>
 #include <stdio.h>
@@ -107,9 +108,13 @@ static void inputUrl(struct Tag tag, char *params) {
 	urlList(tag);
 }
 static void inputOpen(struct Tag tag, char *params) {
-	size_t at = (params ? strtoul(strsep(&params, "-,"), NULL, 0) : 1);
-	size_t to = (params ? strtoul(params, NULL, 0) : at);
-	urlOpen(tag, at - 1, to);
+	if (params && !isdigit(params[0])) {
+		urlOpenMatch(tag, params);
+	} else {
+		size_t at = (params ? strtoul(strsep(&params, "-,"), NULL, 0) : 1);
+		size_t to = (params ? strtoul(params, NULL, 0) : at);
+		urlOpenRange(tag, at - 1, to);
+	}
 }
 
 static void inputView(struct Tag tag, char *params) {