Make improvements

- Expand redbean UNIX module
- Expand redbean documentation
- Ensure Lua copyright is embedded in binary
- Increase the PATH_MAX limit especially on NT
- Use column major sorting for linenoise completions
- Fix some suboptimalities in redbean's new UNIX API
- Figured out right flags for Multics newline in raw mode
This commit is contained in:
Justine Tunney 2022-04-24 09:59:22 -07:00
parent cf3174dc74
commit 2046c0d2ae
305 changed files with 6602 additions and 4221 deletions

View file

@ -35,8 +35,8 @@
uint64_t i;
char *oldpath;
char tmp[PATH_MAX];
char pathbuf[PATH_MAX];
char tmp[PATH_MAX + 1];
char pathbuf[PATH_MAX + 1];
char testlib_enable_tmp_setup_teardown;
void SetUp(void) {
@ -54,34 +54,34 @@ void TearDown(void) {
TEST(commandv, testPathSearch) {
EXPECT_NE(-1, touch("bin/sh", 0755));
EXPECT_STREQ("bin/sh", commandv("sh", pathbuf));
EXPECT_STREQ("bin/sh", commandv("sh", pathbuf, sizeof(pathbuf)));
}
TEST(commandv, testPathSearch_appendsComExtension) {
EXPECT_NE(-1, touch("bin/sh.com", 0755));
EXPECT_STREQ("bin/sh.com", commandv("sh", pathbuf));
EXPECT_STREQ("bin/sh.com", commandv("sh", pathbuf, sizeof(pathbuf)));
}
TEST(commandv, testSlashes_wontSearchPath_butChecksAccess) {
EXPECT_NE(-1, touch("home/sh", 0755));
i = g_syscount;
EXPECT_STREQ("home/sh", commandv("home/sh", pathbuf));
EXPECT_STREQ("home/sh", commandv("home/sh", pathbuf, sizeof(pathbuf)));
if (!IsWindows()) EXPECT_EQ(i + 1, g_syscount);
}
TEST(commandv, testSlashes_wontSearchPath_butStillAppendsComExtension) {
EXPECT_NE(-1, touch("home/sh.com", 0755));
i = g_syscount;
EXPECT_STREQ("home/sh.com", commandv("home/sh", pathbuf));
EXPECT_STREQ("home/sh.com", commandv("home/sh", pathbuf, sizeof(pathbuf)));
if (!IsWindows()) EXPECT_EQ(i + 2, g_syscount);
}
TEST(commandv, testSameDir_doesntHappenByDefaultUnlessItsWindows) {
EXPECT_NE(-1, touch("bog", 0755));
if (IsWindows()) {
EXPECT_STREQ("./bog", commandv("bog", pathbuf));
EXPECT_STREQ("./bog", commandv("bog", pathbuf, sizeof(pathbuf)));
} else {
EXPECT_EQ(NULL, commandv("bog", pathbuf));
EXPECT_EQ(NULL, commandv("bog", pathbuf, sizeof(pathbuf)));
}
}
@ -89,9 +89,9 @@ TEST(commandv, testSameDir_willHappenWithColonBlank) {
CHECK_NE(-1, setenv("PATH", "bin:", true));
EXPECT_NE(-1, touch("bog", 0755));
if (IsWindows()) {
EXPECT_STREQ("./bog", commandv("bog", pathbuf));
EXPECT_STREQ("./bog", commandv("bog", pathbuf, sizeof(pathbuf)));
} else {
EXPECT_STREQ("bog", commandv("bog", pathbuf));
EXPECT_STREQ("bog", commandv("bog", pathbuf, sizeof(pathbuf)));
}
}
@ -99,8 +99,8 @@ TEST(commandv, testSameDir_willHappenWithColonBlank2) {
CHECK_NE(-1, setenv("PATH", ":bin", true));
EXPECT_NE(-1, touch("bog", 0755));
if (IsWindows()) {
EXPECT_STREQ("./bog", commandv("bog", pathbuf));
EXPECT_STREQ("./bog", commandv("bog", pathbuf, sizeof(pathbuf)));
} else {
EXPECT_STREQ("bog", commandv("bog", pathbuf));
EXPECT_STREQ("bog", commandv("bog", pathbuf, sizeof(pathbuf)));
}
}