blob: abea26a713d5ef28d37e3c78b3fffd014a9d3298 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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
|