Rename global tags with angle brackets

master
Curtis McEnroe 2019-02-22 14:32:00 -05:00
parent e7926629ed
commit c2317921f8
No known key found for this signature in database
GPG Key ID: CEA2F97ADCFCD77C
2 changed files with 17 additions and 11 deletions

View File

@ -88,7 +88,7 @@ the same as the nickname.
. .
.It Fl v .It Fl v
Show raw IRC protocol in the Show raw IRC protocol in the
.Sy -raw- .Sy <raw>
window. window.
. .
.It Fl w Ar pass .It Fl w Ar pass
@ -181,7 +181,7 @@ matching the
. .
.It Ic /raw .It Ic /raw
Toggle the Toggle the
.Sy -raw- .Sy <raw>
window. window.
. .
.It Ic /url .It Ic /url

24
tag.c
View File

@ -1,4 +1,4 @@
/* Copyright (C) 2018 Curtis McEnroe <june@causal.agency> /* Copyright (C) 2018 C. McEnroe <june@causal.agency>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by * it under the terms of the GNU Affero General Public License as published by
@ -21,20 +21,26 @@
#include "chat.h" #include "chat.h"
#define NONE "-none-" #define GLOBAL_TAGS \
#define STATUS "-status-" X(TagNone, 0, "<none>") \
#define RAW "-raw-" X(TagStatus, 1, "<status>") \
X(TagRaw, 2, "<raw>")
enum { GlobalTagsLen = 3 };
const struct Tag TagNone = { 0, NONE }; #define X(tag, id, name) const struct Tag tag = { id, name };
const struct Tag TagStatus = { 1, STATUS }; GLOBAL_TAGS
const struct Tag TagRaw = { 2, RAW }; #undef X
static struct { static struct {
char *name[TagsLen]; char *name[TagsLen];
size_t len; size_t len;
} tags = { } tags = {
.name = { NONE, STATUS, RAW }, .name = {
.len = 3, #define X(_, id, name) [id] = name,
GLOBAL_TAGS
#undef X
},
.len = GlobalTagsLen,
}; };
struct Tag tagFind(const char *name) { struct Tag tagFind(const char *name) {