commit 94632296d97c7e71dd87c6723a25c5b2cab36b32
parent b33c4d843e81fd7add47ddb1328a0496769ffdf0
Author: Drew DeVault <sir@cmpwn.com>
Date: Sun, 31 Jan 2021 12:46:50 -0500
Expand stdlib coverage
Diffstat:
2 files changed, 21 insertions(+), 12 deletions(-)
diff --git a/main.ha b/main.ha
@@ -2,12 +2,18 @@ use io;
use os;
export fn main() void = {
- if (len(os::args) < 2z) {
- return;
- };
-
- match (os::getenv(os::args[1])) {
- void => io::println("variable unset"),
- var: str => io::println(var),
+ let buf: [1024]u8 = [0u8...];
+ for (true) {
+ match (io::read(os::stdin, buf[..])) {
+ err: io::error => {
+ match (err) {
+ err: io::closed => {
+ break;
+ },
+ * => abort(),
+ };
+ },
+ n: size => io::write(os::stdout, buf[..n]),
+ };
};
};
diff --git a/stdlib.mk b/stdlib.mk
@@ -76,10 +76,9 @@ stdlib_strconv=$(HARECACHE)/strconv/strconv.o
# io
libio_srcs=\
- $(STDLIB)/io/println.ha
- # TODO:
- #$(STDLIB)/io/types.ha \
- #$(STDLIB)/io/stream.ha
+ $(STDLIB)/io/println.ha \
+ $(STDLIB)/io/types.ha \
+ $(STDLIB)/io/stream.ha
$(HARECACHE)/io/io.ssa: $(libio_srcs) $(stdlib_rt)
@printf 'HAREC \t$@\n'
@@ -105,8 +104,12 @@ stdlib_strings=$(HARECACHE)/strings/strings.o
# os
libos_srcs=\
$(STDLIB)/os/$(PLATFORM)/environ.ha \
+ $(STDLIB)/os/$(PLATFORM)/errors.ha \
$(STDLIB)/os/$(PLATFORM)/exit.ha \
- $(STDLIB)/os/environ.ha
+ $(STDLIB)/os/$(PLATFORM)/fdstream.ha \
+ $(STDLIB)/os/$(PLATFORM)/stdfd.ha \
+ $(STDLIB)/os/environ.ha \
+ $(STDLIB)/os/stdfd.ha
libos_deps=$(stdlib_rt) $(stdlib_strings) $(stdlib_types)