summary refs log tree commit diff
diff options
context:
space:
mode:
authorLain Iwakura <lain@lainmail.xyz>2026-01-04 14:12:13 +0300
committerLain Iwakura <lain@lainmail.xyz>2026-01-04 14:12:13 +0300
commit6b952069e917c28f6c9fb5266a83766840e81533 (patch)
tree7a941abeb1472833ee7264c35140fda89e95e61f
parentfeat(linux): some patches (diff)
downloadplay-6b952069e917c28f6c9fb5266a83766840e81533.tar.gz
play-6b952069e917c28f6c9fb5266a83766840e81533.zip
feat(linux): some patches
-rw-r--r--2048.c2
-rw-r--r--freecell.c2
-rw-r--r--snake.c14
3 files changed, 16 insertions, 2 deletions
diff --git a/2048.c b/2048.c
index 3f92e5d..b042ee0 100644
--- a/2048.c
+++ b/2048.c
@@ -22,7 +22,7 @@
 
 typedef unsigned uint;
 
-#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
+#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && (!defined(__GLIBC__) || !__GLIBC_PREREQ(2, 36))
 static uint arc4random_uniform(uint upper_bound) {
 	return rand() % upper_bound;
 }
diff --git a/freecell.c b/freecell.c
index a97e3b3..c543bda 100644
--- a/freecell.c
+++ b/freecell.c
@@ -30,7 +30,7 @@
 
 typedef unsigned uint;
 
-#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
+#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && (!defined(__GLIBC__) || !__GLIBC_PREREQ(2, 36))
 static uint arc4random_uniform(uint upper_bound) {
 	return rand() % upper_bound;
 }
diff --git a/snake.c b/snake.c
index 50bee4d..06ec230 100644
--- a/snake.c
+++ b/snake.c
@@ -14,13 +14,24 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#ifndef _DEFAULT_SOURCE
+#define _DEFAULT_SOURCE
+#endif
+
 #include <curses.h>
 #include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <time.h>
 #include <unistd.h>
 
 typedef unsigned uint;
+
+#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && (!defined(__GLIBC__) || !__GLIBC_PREREQ(2, 36))
+static uint arc4random_uniform(uint upper_bound) {
+	return rand() % upper_bound;
+}
+#endif
 typedef unsigned char byte;
 
 enum {
@@ -202,6 +213,9 @@ static void input(void) {
 }
 
 uint playSnake(void) {
+#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && (!defined(__GLIBC__) || !__GLIBC_PREREQ(2, 36))
+	srand(time(NULL));
+#endif
 	curse();
 	do {
 		tick();