Skip to content

Commit

Permalink
Re-add FreeBSD support (broken since c1a64c1) (#33)
Browse files Browse the repository at this point in the history
Co-authored-by: cos <cos>
  • Loading branch information
Tieske authored Aug 28, 2024
1 parent 227743a commit 60b66fc
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ The scope of what is covered by the version number excludes:
### unreleased

- Chore: add compiler error on Windows if Virtual Terminal Processing is unavailable.
- Fix: fix the freebsd build

### Version 0.4.2, released 25-Jun-2024

Expand Down
2 changes: 1 addition & 1 deletion doc_topics/02-development.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ The tests concerned are all labelled with `#manual`. And in CI they will
be skipped because `--exclude-tags=manual` is being passed to the
`busted` command line.

Hence if tests like this are being added, then please ensure the tests
Hence if tests like these are being added, then please ensure the tests
pass locally, and do not rely on CI only.
3 changes: 2 additions & 1 deletion spec/04-term_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ describe("Terminal:", function()
assert(type(serr) == "boolean", "serr must be a boolean")

local tmpfile = "./spec/04-term_helper.output"
local execcmd = "lua ./spec/04-term_helper.lua -- " .. tmpfile
local lua_bin = system.getenv("LUA") or "lua"
local execcmd = lua_bin .. " ./spec/04-term_helper.lua -- " .. tmpfile

sin = sin and "" or 'echo "hello" | '
if system.windows then
Expand Down
19 changes: 16 additions & 3 deletions src/term.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ static const struct ls_RegConst nix_console_i_flags[] = {
{"I_INLCR", CHECK_NIX_FLAG_OR_ZERO(INLCR)},
{"I_IGNCR", CHECK_NIX_FLAG_OR_ZERO(IGNCR)},
{"I_ICRNL", CHECK_NIX_FLAG_OR_ZERO(ICRNL)},
#ifndef __APPLE__
#if !defined(__APPLE__) && !defined(__FreeBSD__)
{"I_IUCLC", CHECK_NIX_FLAG_OR_ZERO(IUCLC)}, // Might not be available on all systems
#else
{"I_IUCLC", 0},
Expand All @@ -181,7 +181,7 @@ static const struct ls_RegConst nix_console_i_flags[] = {
static const struct ls_RegConst nix_console_o_flags[] = {
// Output flags (c_oflag)
{"O_OPOST", CHECK_NIX_FLAG_OR_ZERO(OPOST)},
#ifndef __APPLE__
#if !defined(__APPLE__) && !defined(__FreeBSD__)
{"O_OLCUC", CHECK_NIX_FLAG_OR_ZERO(OLCUC)}, // Might not be available on all systems
#else
{"O_OLCUC", 0},
Expand All @@ -190,22 +190,35 @@ static const struct ls_RegConst nix_console_o_flags[] = {
{"O_OCRNL", CHECK_NIX_FLAG_OR_ZERO(OCRNL)},
{"O_ONOCR", CHECK_NIX_FLAG_OR_ZERO(ONOCR)},
{"O_ONLRET", CHECK_NIX_FLAG_OR_ZERO(ONLRET)},
#ifndef __FreeBSD__
{"O_OFILL", CHECK_NIX_FLAG_OR_ZERO(OFILL)},
{"O_OFDEL", CHECK_NIX_FLAG_OR_ZERO(OFDEL)},
{"O_NLDLY", CHECK_NIX_FLAG_OR_ZERO(NLDLY)},
{"O_CRDLY", CHECK_NIX_FLAG_OR_ZERO(CRDLY)},
#else
{"O_OFILL", 0},
{"O_OFDEL", 0},
{"O_NLDLY", 0},
{"O_CRDLY", 0},
#endif
{"O_TABDLY", CHECK_NIX_FLAG_OR_ZERO(TABDLY)},
#ifndef __FreeBSD__
{"O_BSDLY", CHECK_NIX_FLAG_OR_ZERO(BSDLY)},
{"O_VTDLY", CHECK_NIX_FLAG_OR_ZERO(VTDLY)},
{"O_FFDLY", CHECK_NIX_FLAG_OR_ZERO(FFDLY)},
#else
{"O_BSDLY", 0},
{"O_VTDLY", 0},
{"O_FFDLY", 0},
#endif
{NULL, 0}
};

static const struct ls_RegConst nix_console_l_flags[] = {
// Local flags (c_lflag)
{"L_ISIG", CHECK_NIX_FLAG_OR_ZERO(ISIG)},
{"L_ICANON", CHECK_NIX_FLAG_OR_ZERO(ICANON)},
#ifndef __APPLE__
#if !defined(__APPLE__) && !defined(__FreeBSD__)
{"L_XCASE", CHECK_NIX_FLAG_OR_ZERO(XCASE)}, // Might not be available on all systems
#else
{"L_XCASE", 0},
Expand Down

0 comments on commit 60b66fc

Please sign in to comment.