Xinqi Bao's Git

Implement fmt_human_2() and fmt_human_10()
[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 return (pscanf("/proc/sys/kernel/random/entropy_avail",
13 "%d", &num) == 1) ?
14 bprintf("%d", num) : NULL;
15 }
16 #elif defined(__OpenBSD__)
17 const char *
18 entropy(void)
19 {
20 /* Unicode Character 'INFINITY' (U+221E) */
21 return "\xe2\x88\x9e";
22 }
23 #endif