diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/random.c | 4 | ||||
| -rw-r--r-- | src/term.c | 30 |
2 files changed, 17 insertions, 17 deletions
diff --git a/src/random.c b/src/random.c index 70bf13b..7bffe30 100644 --- a/src/random.c +++ b/src/random.c | |||
| @@ -18,7 +18,7 @@ | |||
| 18 | #include <string.h> | 18 | #include <string.h> |
| 19 | #if defined(__linux__) | 19 | #if defined(__linux__) |
| 20 | #include <sys/random.h> // getrandom() | 20 | #include <sys/random.h> // getrandom() |
| 21 | #elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) | 21 | #elif defined(__APPLE__) || defined(__unix__) |
| 22 | #include <stdlib.h> // arc4random_buf() | 22 | #include <stdlib.h> // arc4random_buf() |
| 23 | #endif | 23 | #endif |
| 24 | #endif | 24 | #endif |
| @@ -80,7 +80,7 @@ static int lua_get_random_bytes(lua_State* L) { | |||
| 80 | total_read += n; | 80 | total_read += n; |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | #elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) | 83 | #elif defined(__APPLE__) || defined(__unix__) |
| 84 | // Use arc4random_buf() on BSD/macOS | 84 | // Use arc4random_buf() on BSD/macOS |
| 85 | arc4random_buf(buffer, num_bytes); | 85 | arc4random_buf(buffer, num_bytes); |
| 86 | 86 | ||
| @@ -166,8 +166,8 @@ static const struct ls_RegConst nix_console_i_flags[] = { | |||
| 166 | {"I_INLCR", CHECK_NIX_FLAG_OR_ZERO(INLCR)}, | 166 | {"I_INLCR", CHECK_NIX_FLAG_OR_ZERO(INLCR)}, |
| 167 | {"I_IGNCR", CHECK_NIX_FLAG_OR_ZERO(IGNCR)}, | 167 | {"I_IGNCR", CHECK_NIX_FLAG_OR_ZERO(IGNCR)}, |
| 168 | {"I_ICRNL", CHECK_NIX_FLAG_OR_ZERO(ICRNL)}, | 168 | {"I_ICRNL", CHECK_NIX_FLAG_OR_ZERO(ICRNL)}, |
| 169 | #if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__NetBSD__) | 169 | #ifdef __linux__ |
| 170 | {"I_IUCLC", CHECK_NIX_FLAG_OR_ZERO(IUCLC)}, // Might not be available on all systems | 170 | {"I_IUCLC", CHECK_NIX_FLAG_OR_ZERO(IUCLC)}, // Might also exist on AIX |
| 171 | #else | 171 | #else |
| 172 | {"I_IUCLC", 0}, | 172 | {"I_IUCLC", 0}, |
| 173 | #endif | 173 | #endif |
| @@ -181,8 +181,8 @@ static const struct ls_RegConst nix_console_i_flags[] = { | |||
| 181 | static const struct ls_RegConst nix_console_o_flags[] = { | 181 | static const struct ls_RegConst nix_console_o_flags[] = { |
| 182 | // Output flags (c_oflag) | 182 | // Output flags (c_oflag) |
| 183 | {"O_OPOST", CHECK_NIX_FLAG_OR_ZERO(OPOST)}, | 183 | {"O_OPOST", CHECK_NIX_FLAG_OR_ZERO(OPOST)}, |
| 184 | #if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__NetBSD__) | 184 | #ifdef __linux__ |
| 185 | {"O_OLCUC", CHECK_NIX_FLAG_OR_ZERO(OLCUC)}, // Might not be available on all systems | 185 | {"O_OLCUC", CHECK_NIX_FLAG_OR_ZERO(OLCUC)}, // Might also exist on AIX |
| 186 | #else | 186 | #else |
| 187 | {"O_OLCUC", 0}, | 187 | {"O_OLCUC", 0}, |
| 188 | #endif | 188 | #endif |
| @@ -190,11 +190,11 @@ static const struct ls_RegConst nix_console_o_flags[] = { | |||
| 190 | {"O_OCRNL", CHECK_NIX_FLAG_OR_ZERO(OCRNL)}, | 190 | {"O_OCRNL", CHECK_NIX_FLAG_OR_ZERO(OCRNL)}, |
| 191 | {"O_ONOCR", CHECK_NIX_FLAG_OR_ZERO(ONOCR)}, | 191 | {"O_ONOCR", CHECK_NIX_FLAG_OR_ZERO(ONOCR)}, |
| 192 | {"O_ONLRET", CHECK_NIX_FLAG_OR_ZERO(ONLRET)}, | 192 | {"O_ONLRET", CHECK_NIX_FLAG_OR_ZERO(ONLRET)}, |
| 193 | #if !defined(__FreeBSD__) && !defined(__NetBSD__) | 193 | #if defined(__APPLE__) || defined(__linux__) |
| 194 | {"O_OFILL", CHECK_NIX_FLAG_OR_ZERO(OFILL)}, | 194 | {"O_OFILL", CHECK_NIX_FLAG_OR_ZERO(OFILL)}, // Might also exist on AIX |
| 195 | {"O_OFDEL", CHECK_NIX_FLAG_OR_ZERO(OFDEL)}, | 195 | {"O_OFDEL", CHECK_NIX_FLAG_OR_ZERO(OFDEL)}, // Might also exist on AIX |
| 196 | {"O_NLDLY", CHECK_NIX_FLAG_OR_ZERO(NLDLY)}, | 196 | {"O_NLDLY", CHECK_NIX_FLAG_OR_ZERO(NLDLY)}, // Might also exist on AIX |
| 197 | {"O_CRDLY", CHECK_NIX_FLAG_OR_ZERO(CRDLY)}, | 197 | {"O_CRDLY", CHECK_NIX_FLAG_OR_ZERO(CRDLY)}, // Might also exist on AIX |
| 198 | #else | 198 | #else |
| 199 | {"O_OFILL", 0}, | 199 | {"O_OFILL", 0}, |
| 200 | {"O_OFDEL", 0}, | 200 | {"O_OFDEL", 0}, |
| @@ -206,10 +206,10 @@ static const struct ls_RegConst nix_console_o_flags[] = { | |||
| 206 | #else | 206 | #else |
| 207 | {"O_TABDLY", 0}, | 207 | {"O_TABDLY", 0}, |
| 208 | #endif | 208 | #endif |
| 209 | #if !defined(__FreeBSD__) && !defined(__NetBSD__) | 209 | #if defined(__APPLE__) || defined(__linux__) |
| 210 | {"O_BSDLY", CHECK_NIX_FLAG_OR_ZERO(BSDLY)}, | 210 | {"O_BSDLY", CHECK_NIX_FLAG_OR_ZERO(BSDLY)}, // Might also exist on AIX |
| 211 | {"O_VTDLY", CHECK_NIX_FLAG_OR_ZERO(VTDLY)}, | 211 | {"O_VTDLY", CHECK_NIX_FLAG_OR_ZERO(VTDLY)}, // Might also exist on AIX |
| 212 | {"O_FFDLY", CHECK_NIX_FLAG_OR_ZERO(FFDLY)}, | 212 | {"O_FFDLY", CHECK_NIX_FLAG_OR_ZERO(FFDLY)}, // Might also exist on AIX |
| 213 | #else | 213 | #else |
| 214 | {"O_BSDLY", 0}, | 214 | {"O_BSDLY", 0}, |
| 215 | {"O_VTDLY", 0}, | 215 | {"O_VTDLY", 0}, |
| @@ -222,8 +222,8 @@ static const struct ls_RegConst nix_console_l_flags[] = { | |||
| 222 | // Local flags (c_lflag) | 222 | // Local flags (c_lflag) |
| 223 | {"L_ISIG", CHECK_NIX_FLAG_OR_ZERO(ISIG)}, | 223 | {"L_ISIG", CHECK_NIX_FLAG_OR_ZERO(ISIG)}, |
| 224 | {"L_ICANON", CHECK_NIX_FLAG_OR_ZERO(ICANON)}, | 224 | {"L_ICANON", CHECK_NIX_FLAG_OR_ZERO(ICANON)}, |
| 225 | #if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__NetBSD__) | 225 | #ifdef __linux__ |
| 226 | {"L_XCASE", CHECK_NIX_FLAG_OR_ZERO(XCASE)}, // Might not be available on all systems | 226 | {"L_XCASE", CHECK_NIX_FLAG_OR_ZERO(XCASE)}, // Might also exist on AIX |
| 227 | #else | 227 | #else |
| 228 | {"L_XCASE", 0}, | 228 | {"L_XCASE", 0}, |
| 229 | #endif | 229 | #endif |
