aboutsummaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-11-05 21:09:53 +0100
committerThomas Voss <mail@thomasvoss.com> 2024-11-05 21:09:53 +0100
commite251c6463913bcd7c9c40b4dc168010f6de68b5a (patch)
treea8d2cfcfa09de64d86b10f1a6137373b553f078b /src/util.c
parent436557eca3da4492def86d5ef8c2d84c5d1c3e71 (diff)
Check for whitespace after regex using islbrk()
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c
index b5b1f8a..a946119 100644
--- a/src/util.c
+++ b/src/util.c
@@ -4,6 +4,8 @@
#include <stdlib.h>
#include <errors.h>
+#include <macros.h>
+#include <mbstring.h>
#include <pcre2.h>
#include "exitcodes.h"
@@ -47,4 +49,16 @@ getenv_posnum(const char *ev, int fallback)
return (int)n;
}
return fallback;
+}
+
+bool
+islbrk(u8view_t g)
+{
+ return ucseq(g, U8("\n"))
+ || ucseq(g, U8("\v"))
+ || ucseq(g, U8("\f"))
+ || ucseq(g, U8("\r\n"))
+ || ucseq(g, U8("\x85"))
+ || ucseq(g, U8("\u2028"))
+ || ucseq(g, U8("\u2029"));
} \ No newline at end of file