summary refs log tree commit diff
path: root/tag.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-08-12 23:55:12 -0400
committerJune McEnroe <june@causal.agency>2018-08-12 23:55:12 -0400
commit1232ce451de8372a54e477882ed9e7cfa129c4b9 (patch)
treec8f6c6e2a07c02f920128d28f29087dc84795ba3 /tag.c
parentFix /open ranges by passing all URLs to open(1) (diff)
downloadcatgirl-1232ce451de8372a54e477882ed9e7cfa129c4b9.tar.gz
catgirl-1232ce451de8372a54e477882ed9e7cfa129c4b9.zip
Factor out input param and add tagFind
So that /view can't just invent tags.
Diffstat (limited to '')
-rw-r--r--tag.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/tag.c b/tag.c
index 397c191..4a89d31 100644
--- a/tag.c
+++ b/tag.c
@@ -37,11 +37,17 @@ static struct Tag Tag(size_t id) {
 	return (struct Tag) { id, tags.name[id] };
 }
 
-struct Tag tagFor(const char *name) {
+struct Tag tagFind(const char *name) {
 	for (size_t id = 0; id < tags.len; ++id) {
 		if (strcmp(tags.name[id], name)) continue;
 		return Tag(id);
 	}
+	return TAG_NONE;
+}
+
+struct Tag tagFor(const char *name) {
+	struct Tag tag = tagFind(name);
+	if (tag.id != TAG_NONE.id) return tag;
 	if (tags.len == TAGS_LEN) return TAG_STATUS;
 	size_t id = tags.len++;
 	tags.name[id] = strdup(name);
212a6f0117f9cb82702be&follow=1'>Add The Kingdom of GodsJune McEnroe Reading has really slowed down :( 2020-09-07Add SunglassesJune McEnroe An IRC find. 2020-09-06Add Between the BreathsJune McEnroe One of those good songs from a soundtrack of a film that probably isn't? The summary sounds a lot more interesting than the title implies, at least. 2020-09-04Open /dev/tty in nudgeJune McEnroe This makes it work even when it's run connected to a pipe, i.e. as the notify command of catgirl... 2020-09-04Add nudgeJune McEnroe 2020-09-03Build fbclock with -lzJune McEnroe I guess this got lost somewhere, long ago... 2020-08-29Add tweets from retweetsJune McEnroe