commit ce1d933f78707515470d4a36071256b67647ddda
parent 4e0338c7d000d3003064b5f222f8db481ce14228
Author: Drew DeVault <sir@cmpwn.com>
Date: Fri, 21 Oct 2022 12:10:57 +0200
unix::tty: fix bugs and update gen-stdlib
Diffstat:
3 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/scripts/gen-stdlib b/scripts/gen-stdlib
@@ -1420,16 +1420,20 @@ unix_signal() {
unix_tty() {
gen_srcs -plinux unix::tty \
types.ha \
+ pty.ha \
+linux/isatty.ha \
+linux/open.ha \
+ +linux/pty.ha \
+linux/termios.ha \
+linux/winsize.ha
gen_ssa -plinux unix::tty rt fs io os
gen_srcs -pfreebsd unix::tty \
types.ha \
+ pty.ha \
+freebsd/isatty.ha \
+freebsd/open.ha \
+ +freebsd/pty.ha \
+freebsd/winsize.ha
gen_ssa -pfreebsd unix::tty rt fs io os
}
diff --git a/stdlib.mk b/stdlib.mk
@@ -2153,8 +2153,10 @@ $(HARECACHE)/unix/signal/unix_signal-linux.ssa: $(stdlib_unix_signal_linux_srcs)
# unix::tty (+linux)
stdlib_unix_tty_linux_srcs = \
$(STDLIB)/unix/tty/types.ha \
+ $(STDLIB)/unix/tty/pty.ha \
$(STDLIB)/unix/tty/+linux/isatty.ha \
$(STDLIB)/unix/tty/+linux/open.ha \
+ $(STDLIB)/unix/tty/+linux/pty.ha \
$(STDLIB)/unix/tty/+linux/termios.ha \
$(STDLIB)/unix/tty/+linux/winsize.ha
@@ -2167,8 +2169,10 @@ $(HARECACHE)/unix/tty/unix_tty-linux.ssa: $(stdlib_unix_tty_linux_srcs) $(stdlib
# unix::tty (+freebsd)
stdlib_unix_tty_freebsd_srcs = \
$(STDLIB)/unix/tty/types.ha \
+ $(STDLIB)/unix/tty/pty.ha \
$(STDLIB)/unix/tty/+freebsd/isatty.ha \
$(STDLIB)/unix/tty/+freebsd/open.ha \
+ $(STDLIB)/unix/tty/+freebsd/pty.ha \
$(STDLIB)/unix/tty/+freebsd/winsize.ha
$(HARECACHE)/unix/tty/unix_tty-freebsd.ssa: $(stdlib_unix_tty_freebsd_srcs) $(stdlib_rt) $(stdlib_rt_$(PLATFORM)) $(stdlib_fs_$(PLATFORM)) $(stdlib_io_$(PLATFORM)) $(stdlib_os_$(PLATFORM))
@@ -4406,8 +4410,10 @@ $(TESTCACHE)/unix/signal/unix_signal-linux.ssa: $(testlib_unix_signal_linux_srcs
# unix::tty (+linux)
testlib_unix_tty_linux_srcs = \
$(STDLIB)/unix/tty/types.ha \
+ $(STDLIB)/unix/tty/pty.ha \
$(STDLIB)/unix/tty/+linux/isatty.ha \
$(STDLIB)/unix/tty/+linux/open.ha \
+ $(STDLIB)/unix/tty/+linux/pty.ha \
$(STDLIB)/unix/tty/+linux/termios.ha \
$(STDLIB)/unix/tty/+linux/winsize.ha
@@ -4420,8 +4426,10 @@ $(TESTCACHE)/unix/tty/unix_tty-linux.ssa: $(testlib_unix_tty_linux_srcs) $(testl
# unix::tty (+freebsd)
testlib_unix_tty_freebsd_srcs = \
$(STDLIB)/unix/tty/types.ha \
+ $(STDLIB)/unix/tty/pty.ha \
$(STDLIB)/unix/tty/+freebsd/isatty.ha \
$(STDLIB)/unix/tty/+freebsd/open.ha \
+ $(STDLIB)/unix/tty/+freebsd/pty.ha \
$(STDLIB)/unix/tty/+freebsd/winsize.ha
$(TESTCACHE)/unix/tty/unix_tty-freebsd.ssa: $(testlib_unix_tty_freebsd_srcs) $(testlib_rt) $(testlib_rt_$(PLATFORM)) $(testlib_fs_$(PLATFORM)) $(testlib_io_$(PLATFORM)) $(testlib_os_$(PLATFORM))
diff --git a/unix/tty/pty.ha b/unix/tty/pty.ha
@@ -39,7 +39,7 @@ export fn openpty() ((io::file, io::file) | fs::error) = {
};
fmt::fprintln(pty.0, "hello, world")!;
- let s = strings::fromutf8(bufio::scanline(pty.1) as []u8);
+ let s = strings::fromutf8(bufio::scanline(pty.1) as []u8)!;
defer free(s);
assert(s == "hello, world");
};