diff options
author | Mattias Andrée <maandree@kth.se> | 2024-09-19 18:03:17 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2024-09-19 18:03:17 +0200 |
commit | 44cff01e5bbe04ff991ede843e96f0c2d83d20c6 (patch) | |
tree | f889f60eca251d716489e3b30994c435c00dbfa2 /text.c | |
parent | m fixes (diff) | |
download | deadshred-44cff01e5bbe04ff991ede843e96f0c2d83d20c6.tar.gz deadshred-44cff01e5bbe04ff991ede843e96f0c2d83d20c6.tar.bz2 deadshred-44cff01e5bbe04ff991ede843e96f0c2d83d20c6.tar.xz |
Split into multiple C files
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | text.c | 46 |
1 files changed, 46 insertions, 0 deletions
@@ -0,0 +1,46 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" + + +#if defined(__linux__) +# include <linux/kd.h> + +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 |