entropy: OS split
authorQuentin Rameau <quinq@fifth.space>
Mon, 30 Apr 2018 13:14:34 +0000 (15:14 +0200)
committerAaron Marcher <me@drkhsh.at>
Mon, 30 Apr 2018 13:41:31 +0000 (15:41 +0200)
Makefile
components/Linux/entropy.c [new file with mode: 0644]
components/OpenBSD/entropy.c [new file with mode: 0644]
components/entropy.c [deleted file]

index dee5a4baf3951cb772ec9f4771dad4e60985fa95..bbb18a938d16324c8da69b5d31aaa50ba17e3a43 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -11,7 +11,7 @@ COM =\
        components/$(OS)/cpu \
        components/datetime\
        components/disk\
-       components/entropy\
+       components/$(OS)/entropy \
        components/hostname\
        components/ip\
        components/kernel_release\
diff --git a/components/Linux/entropy.c b/components/Linux/entropy.c
new file mode 100644 (file)
index 0000000..17be270
--- /dev/null
@@ -0,0 +1,13 @@
+/* See LICENSE file for copyright and license details. */
+#include <stdio.h>
+
+#include "../../util.h"
+
+const char *
+entropy(void)
+{
+       int num;
+
+       return (pscanf("/proc/sys/kernel/random/entropy_avail", "%d", &num) == 1) ?
+                      bprintf("%d", num) : NULL;
+}
diff --git a/components/OpenBSD/entropy.c b/components/OpenBSD/entropy.c
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/components/entropy.c b/components/entropy.c
deleted file mode 100644 (file)
index 65c65a1..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-/* See LICENSE file for copyright and license details. */
-#if defined(__linux__)
-#include <stdio.h>
-
-#include "../util.h"
-
-const char *
-entropy(void)
-{
-       int num;
-
-       return (pscanf("/proc/sys/kernel/random/entropy_avail", "%d", &num) == 1) ?
-                      bprintf("%d", num) : NULL;
-}
-#endif