Xinqi Bao's Git

Remove units from numbers
[slstatus.git] / components / entropy.c
1 /* See LICENSE file for copyright and license details. */
2 #if defined(__linux__)
3 #include <stdio.h>
4
5 #include "../util.h"
6
7 const char *
8 entropy(void)
9 {
10 int num;
11
12 if (pscanf("/proc/sys/kernel/random/entropy_avail",
13 "%d", &num) != 1) {
14 return NULL;
15 }
16
17 return bprintf("%d", num);
18 }
19 #elif defined(__OpenBSD__)
20 const char *
21 entropy(void)
22 {
23 /* Unicode Character 'INFINITY' (U+221E) */
24 return "\xe2\x88\x9e";
25 }
26 #endif