<feed xmlns='http://www.w3.org/2005/Atom'>
<title>gbos.git/c/wc.c, branch master</title>
<subtitle>gbos - a tiny Unix-flavored OS for the Game Boy Color (kernel, shell, coreutils in C, RAM filesystem)</subtitle>
<id>https://git.sl0p.foo/gbos.git/atom/c/wc.c?h=master</id>
<link rel='self' href='https://git.sl0p.foo/gbos.git/atom/c/wc.c?h=master'/>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/gbos.git/'/>
<updated>2026-07-17T22:38:38Z</updated>
<entry>
<title>refactor: c/ -&gt; usr/, compiled program blobs out of the source tree</title>
<updated>2026-07-17T22:38:38Z</updated>
<author>
<name>user</name>
<email>user@clank</email>
</author>
<published>2026-07-17T22:38:38Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/gbos.git/commit/?id=ba2d7ae1d7b319645b10aaa31a7f664f9f80c25c'/>
<id>urn:sha1:ba2d7ae1d7b319645b10aaa31a7f664f9f80c25c</id>
<content type='text'>
Userland sources live in usr/ (fits the Unix theme better than 'c').
SDCC output .bin blobs land in build/usr/ with the other build artifacts
instead of littering the source dir; programs.asm INCBINs them from there.
Byte-identical ROM.
</content>
</entry>
<entry>
<title>fs: reject open()/read() on a directory (EISDIR)</title>
<updated>2026-07-16T11:07:28Z</updated>
<author>
<name>user</name>
<email>user@clank</email>
</author>
<published>2026-07-16T11:07:28Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/gbos.git/commit/?id=fc6f690727aac2b5c9bd368f9b13188fb0ba36a7'/>
<id>urn:sha1:fc6f690727aac2b5c9bd368f9b13188fb0ba36a7</id>
<content type='text'>
open() now checks the target's inode type: opening a directory as a file
returns $FE (EISDIR) instead of a valid fd, so 'cat docs' no longer streams the
raw directory block as bytes. cat reports 'is a directory'; wc/head/save treat
any invalid fd (&gt;3) as an open failure. (ls is unaffected - it uses the
structural opendir/list path, not open/getb.)
</content>
</entry>
<entry>
<title>filesystem: a RAM FS (WRAMX) + ls/cat/save/rm; wc/head read files</title>
<updated>2026-07-16T05:53:19Z</updated>
<author>
<name>user</name>
<email>user@clank</email>
</author>
<published>2026-07-16T05:53:19Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/gbos.git/commit/?id=7b5c532625a864a3fbaf76f44df6aa99b0d6861e'/>
<id>urn:sha1:7b5c532625a864a3fbaf76f44df6aa99b0d6861e</id>
<content type='text'>
- fs.asm: 8-slot RAM filesystem in WRAMX ($D000-$DFFF), name[8]+len[2]+data[502];
  syscalls open/close/getb/putb/list/remove, seeded with a 'readme' at boot.
- libc: open/close/fgetc/fputc/flist/fremove wrappers + O_READ/O_WRITE/NOFD.
- tools: ls, save (stdin-&gt;file, one line), rm; cat/wc/head now take a file arg.
- fix: syscall dispatch clobbers A, so putb takes its byte in E (was reading the
  handler's low address byte, 0xDC); ls NUL-terminates 8-char names.
- verified: save/cat/ls/rm cycle; wc readme -&gt; '2 7 38'; head -n 1 readme.
- README: document the filesystem + the A-clobber ABI note.
</content>
</entry>
<entry>
<title>libc: option parsing (hasflag/optval); wc -l/-w/-c, head -n N</title>
<updated>2026-07-16T05:41:04Z</updated>
<author>
<name>user</name>
<email>user@clank</email>
</author>
<published>2026-07-16T05:41:04Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/gbos.git/commit/?id=c303bcde76d0d90a5c6e623466fd3c8d7ff3a072'/>
<id>urn:sha1:c303bcde76d0d90a5c6e623466fd3c8d7ff3a072</id>
<content type='text'>
- hasflag(argv,argc,f): single-char flag present (-f or within -abc)
- optval(argv,argc,opt): value for -opt (-n 5 or -n5)
- wc supports -l/-w/-c (default all); head supports -n N (and bare N)
</content>
</entry>
<entry>
<title>tools: wc, head, and an argc/argv demo (args) + libc.c helpers</title>
<updated>2026-07-16T05:30:34Z</updated>
<author>
<name>user</name>
<email>user@clank</email>
</author>
<published>2026-07-16T05:30:34Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/gbos.git/commit/?id=8682553498d32d3c18dea41c598ab40de18404a3'/>
<id>urn:sha1:8682553498d32d3c18dea41c598ab40de18404a3</id>
<content type='text'>
- c/libc.c: shared C helpers linked into every program - putu (print decimal),
  atou (parse decimal), argv_parse (tokenize getargs() into argc/argv).
- wc: count lines/words/chars of stdin. head [n]: first n lines (drains rest to
  EOF). args: argc/argv demo.
- pid now uses libc putu; build.sh links libc.c; Makefile CBLOBS + libc dep.
- README: document the new tools + argv_parse.
- verified: 'args one two three' -&gt; argc=3/argv[..]; wc '2 3 16'; head 2.
</content>
</entry>
</feed>
