From 44cff01e5bbe04ff991ede843e96f0c2d83d20c6 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 19 Sep 2024 18:03:17 +0200 Subject: Split into multiple C files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- text.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 text.c (limited to 'text.c') diff --git a/text.c b/text.c new file mode 100644 index 0000000..abea26a --- /dev/null +++ b/text.c @@ -0,0 +1,46 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" + + +#if defined(__linux__) +# include + +int +have_micro_symbol(void) +{ + static int ret = -1; + if (ret < 0) { + struct unimapdesc desc; + struct unipair *pairs = NULL; + size_t i; + ret = 1; + desc.entry_ct = 0; + desc.entries = NULL; + if (ioctl(STDIN_FILENO, GIO_UNIMAP, &desc)) + if (!desc.entry_ct) + goto out; + desc.entries = pairs = ecalloc(desc.entry_ct, sizeof(*pairs)); + if (ioctl(STDIN_FILENO, GIO_UNIMAP, &desc)) + goto out; + for (i = 0; i < desc.entry_ct; i++) + if (desc.entries[i++].unicode == 0xB5U) + goto out; + ret = 0; + out: + free(pairs); + } + return ret; +} + +#else + +# if defined(__GNUC__) +__attribute__((__const__)) +# endif +int +have_micro_symbol(void) +{ + return 1; +} + +#endif -- cgit v1.2.3-70-g09d2