diff options
| author | Lain Iwakura <lain@lainmail.xyz> | 2026-01-04 14:15:34 +0300 |
|---|---|---|
| committer | Lain Iwakura <lain@lainmail.xyz> | 2026-01-04 14:15:34 +0300 |
| commit | 8ada96f26d70ba3c9959555d9948354661e161f9 (patch) | |
| tree | d2099f74c45036d7254cf07375441ff87e40de56 | |
| parent | feat(linux): some patches (diff) | |
| download | play-8ada96f26d70ba3c9959555d9948354661e161f9.tar.gz play-8ada96f26d70ba3c9959555d9948354661e161f9.zip | |
feat(linux): some patches
| -rw-r--r-- | 2048.c | 8 | ||||
| -rw-r--r-- | freecell.c | 5 | ||||
| -rw-r--r-- | play.c | 2 | ||||
| -rw-r--r-- | snake.c | 9 |
4 files changed, 13 insertions, 11 deletions
diff --git a/2048.c b/2048.c index 2eb323e..9209597 100644 --- a/2048.c +++ b/2048.c @@ -23,10 +23,12 @@ typedef unsigned uint; #if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) +#ifndef _DEFAULT_SOURCE +#define _DEFAULT_SOURCE +#endif #include <features.h> -#if defined(__GLIBC__) && __GLIBC_PREREQ(2, 36) -#else -static uint arc4random_uniform(uint upper_bound) { +#if !(defined(__GLIBC__) && defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 36)) +static inline uint arc4random_uniform(uint upper_bound) { return rand() % upper_bound; } #endif diff --git a/freecell.c b/freecell.c index 53b9712..ceed7f8 100644 --- a/freecell.c +++ b/freecell.c @@ -32,9 +32,8 @@ typedef unsigned uint; #if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) #include <features.h> -#if defined(__GLIBC__) && __GLIBC_PREREQ(2, 36) -#else -static uint arc4random_uniform(uint upper_bound) { +#if !(defined(__GLIBC__) && defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 36)) +static inline uint arc4random_uniform(uint upper_bound) { return rand() % upper_bound; } #endif diff --git a/play.c b/play.c index 98c7aa7..f4ad574 100644 --- a/play.c +++ b/play.c @@ -239,7 +239,7 @@ static const struct Game *menu(void) { attrset(A_NORMAL); addstr("You can select a game directly using "); attrset(A_BOLD); - addstr("ssh -t play@ssh.iwakura.page"); + addstr("ssh -t play@ssh.iwakura.page "); addstr(Games[game].name); attrset(A_NORMAL); clrtoeol(); diff --git a/snake.c b/snake.c index 5e1c103..f097058 100644 --- a/snake.c +++ b/snake.c @@ -29,9 +29,8 @@ typedef unsigned uint; #if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) #include <features.h> -#if defined(__GLIBC__) && __GLIBC_PREREQ(2, 36) -#else -static uint arc4random_uniform(uint upper_bound) { +#if !(defined(__GLIBC__) && defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 36)) +static inline uint arc4random_uniform(uint upper_bound) { return rand() % upper_bound; } #endif @@ -217,9 +216,11 @@ static void input(void) { } uint playSnake(void) { -#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && (!defined(__GLIBC__) || !__GLIBC_PREREQ(2, 36)) +#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) +#if !(defined(__GLIBC__) && defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 36)) srand(time(NULL)); #endif +#endif curse(); do { tick(); |