aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThijs Schreijer <thijs@thijsschreijer.nl>2024-08-28 10:15:54 +0200
committerGitHub <noreply@github.com>2024-08-28 10:15:54 +0200
commit60b66fce58b64d121b124e64ef78d37512e3a8a2 (patch)
tree55590869085a2f9954e30cc728a63e6b87ba3ea8
parent227743a147967bf1418525770082a5943b3f9f41 (diff)
downloadluasystem-60b66fce58b64d121b124e64ef78d37512e3a8a2.tar.gz
luasystem-60b66fce58b64d121b124e64ef78d37512e3a8a2.tar.bz2
luasystem-60b66fce58b64d121b124e64ef78d37512e3a8a2.zip
Re-add FreeBSD support (broken since c1a64c1) (#33)
Co-authored-by: cos <cos>
-rw-r--r--CHANGELOG.md1
-rw-r--r--doc_topics/02-development.md2
-rw-r--r--spec/04-term_spec.lua3
-rw-r--r--src/term.c19
4 files changed, 20 insertions, 5 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 398f4a0..f1d3aa5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -31,6 +31,7 @@ The scope of what is covered by the version number excludes:
31### unreleased 31### unreleased
32 32
33- Chore: add compiler error on Windows if Virtual Terminal Processing is unavailable. 33- Chore: add compiler error on Windows if Virtual Terminal Processing is unavailable.
34- Fix: fix the freebsd build
34 35
35### Version 0.4.2, released 25-Jun-2024 36### Version 0.4.2, released 25-Jun-2024
36 37
diff --git a/doc_topics/02-development.md b/doc_topics/02-development.md
index 8925b83..c145c79 100644
--- a/doc_topics/02-development.md
+++ b/doc_topics/02-development.md
@@ -8,5 +8,5 @@ The tests concerned are all labelled with `#manual`. And in CI they will
8be skipped because `--exclude-tags=manual` is being passed to the 8be skipped because `--exclude-tags=manual` is being passed to the
9`busted` command line. 9`busted` command line.
10 10
11Hence if tests like this are being added, then please ensure the tests 11Hence if tests like these are being added, then please ensure the tests
12pass locally, and do not rely on CI only. 12pass locally, and do not rely on CI only.
diff --git a/spec/04-term_spec.lua b/spec/04-term_spec.lua
index 57fb4d0..813947a 100644
--- a/spec/04-term_spec.lua
+++ b/spec/04-term_spec.lua
@@ -27,7 +27,8 @@ describe("Terminal:", function()
27 assert(type(serr) == "boolean", "serr must be a boolean") 27 assert(type(serr) == "boolean", "serr must be a boolean")
28 28
29 local tmpfile = "./spec/04-term_helper.output" 29 local tmpfile = "./spec/04-term_helper.output"
30 local execcmd = "lua ./spec/04-term_helper.lua -- " .. tmpfile 30 local lua_bin = system.getenv("LUA") or "lua"
31 local execcmd = lua_bin .. " ./spec/04-term_helper.lua -- " .. tmpfile
31 32
32 sin = sin and "" or 'echo "hello" | ' 33 sin = sin and "" or 'echo "hello" | '
33 if system.windows then 34 if system.windows then
diff --git a/src/term.c b/src/term.c
index e58e190..4deb5f1 100644
--- a/src/term.c
+++ b/src/term.c
@@ -166,7 +166,7 @@ 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#ifndef __APPLE__ 169#if !defined(__APPLE__) && !defined(__FreeBSD__)
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 not be available on all systems
171#else 171#else
172 {"I_IUCLC", 0}, 172 {"I_IUCLC", 0},
@@ -181,7 +181,7 @@ static const struct ls_RegConst nix_console_i_flags[] = {
181static const struct ls_RegConst nix_console_o_flags[] = { 181static 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#ifndef __APPLE__ 184#if !defined(__APPLE__) && !defined(__FreeBSD__)
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 not be available on all systems
186#else 186#else
187 {"O_OLCUC", 0}, 187 {"O_OLCUC", 0},
@@ -190,14 +190,27 @@ 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#ifndef __FreeBSD__
193 {"O_OFILL", CHECK_NIX_FLAG_OR_ZERO(OFILL)}, 194 {"O_OFILL", CHECK_NIX_FLAG_OR_ZERO(OFILL)},
194 {"O_OFDEL", CHECK_NIX_FLAG_OR_ZERO(OFDEL)}, 195 {"O_OFDEL", CHECK_NIX_FLAG_OR_ZERO(OFDEL)},
195 {"O_NLDLY", CHECK_NIX_FLAG_OR_ZERO(NLDLY)}, 196 {"O_NLDLY", CHECK_NIX_FLAG_OR_ZERO(NLDLY)},
196 {"O_CRDLY", CHECK_NIX_FLAG_OR_ZERO(CRDLY)}, 197 {"O_CRDLY", CHECK_NIX_FLAG_OR_ZERO(CRDLY)},
198#else
199 {"O_OFILL", 0},
200 {"O_OFDEL", 0},
201 {"O_NLDLY", 0},
202 {"O_CRDLY", 0},
203#endif
197 {"O_TABDLY", CHECK_NIX_FLAG_OR_ZERO(TABDLY)}, 204 {"O_TABDLY", CHECK_NIX_FLAG_OR_ZERO(TABDLY)},
205#ifndef __FreeBSD__
198 {"O_BSDLY", CHECK_NIX_FLAG_OR_ZERO(BSDLY)}, 206 {"O_BSDLY", CHECK_NIX_FLAG_OR_ZERO(BSDLY)},
199 {"O_VTDLY", CHECK_NIX_FLAG_OR_ZERO(VTDLY)}, 207 {"O_VTDLY", CHECK_NIX_FLAG_OR_ZERO(VTDLY)},
200 {"O_FFDLY", CHECK_NIX_FLAG_OR_ZERO(FFDLY)}, 208 {"O_FFDLY", CHECK_NIX_FLAG_OR_ZERO(FFDLY)},
209#else
210 {"O_BSDLY", 0},
211 {"O_VTDLY", 0},
212 {"O_FFDLY", 0},
213#endif
201 {NULL, 0} 214 {NULL, 0}
202}; 215};
203 216
@@ -205,7 +218,7 @@ static const struct ls_RegConst nix_console_l_flags[] = {
205 // Local flags (c_lflag) 218 // Local flags (c_lflag)
206 {"L_ISIG", CHECK_NIX_FLAG_OR_ZERO(ISIG)}, 219 {"L_ISIG", CHECK_NIX_FLAG_OR_ZERO(ISIG)},
207 {"L_ICANON", CHECK_NIX_FLAG_OR_ZERO(ICANON)}, 220 {"L_ICANON", CHECK_NIX_FLAG_OR_ZERO(ICANON)},
208#ifndef __APPLE__ 221#if !defined(__APPLE__) && !defined(__FreeBSD__)
209 {"L_XCASE", CHECK_NIX_FLAG_OR_ZERO(XCASE)}, // Might not be available on all systems 222 {"L_XCASE", CHECK_NIX_FLAG_OR_ZERO(XCASE)}, // Might not be available on all systems
210#else 223#else
211 {"L_XCASE", 0}, 224 {"L_XCASE", 0},