updates to io.sl

This commit is contained in:
IgorCielniak
2025-12-19 20:23:26 +01:00
parent 8b5ccf4edc
commit 002b36f89c
40 changed files with 152 additions and 9091 deletions

View File

@@ -2,9 +2,8 @@ import stdlib/stdlib.sl
import stdlib/io.sl
: main
"/etc/hostname" # (len addr)
swap # (addr len)
read_file # (file_len file_addr)
"/etc/hostname" # (addr len)
read_file # (file_addr file_len)
dup 0 > if # if file_len > 0, success
write_buf # print file contents (file_len file_addr)
0
@@ -13,13 +12,13 @@ import stdlib/io.sl
dup -2 == if # open() failed
drop
"open() failed: errno=" puts
swap puts
swap puti cr
exit
then
dup -1 == if # fstat() failed
drop
"fstat() failed: errno=" puts
swap puts
swap puti cr
exit
then
dup -3 == if # mmap() failed