<feed xmlns='http://www.w3.org/2005/Atom'>
<title>gbos.git/usr/rev.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/usr/rev.c?h=master</id>
<link rel='self' href='https://git.sl0p.foo/gbos.git/atom/usr/rev.c?h=master'/>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/gbos.git/'/>
<updated>2026-09-24T20:45:04Z</updated>
<entry>
<title>usr: touch, tr, rev, cut, uniq</title>
<updated>2026-09-24T20:45:04Z</updated>
<author>
<name>user</name>
<email>user@clank</email>
</author>
<published>2026-09-24T20:45:04Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/gbos.git/commit/?id=4cd933009dd6ce87fe710acfca6b1f786d51040c'/>
<id>urn:sha1:4cd933009dd6ce87fe710acfca6b1f786d51040c</id>
<content type='text'>
    /# ls -l /bin &gt; b
    /# cut -d \s -f 1 b | uniq -c
    52 -

- touch FILE...: gbfs has no timestamps (an MBC5 cart has no RTC), so touch
  does the half that means something here - make an empty file. O_APPEND is
  exactly right: it creates, and it does not truncate what is already there.
- tr [-d] SET1 [SET2]: ranges (a-z), -d to delete, and a short SET2 padded
  with its last character, like tr(1). ASCII only - a 128-entry map.
- rev, uniq [-c]: one line each, from a file or stdin like the other filters.

Two things the tests caught. A bare "-" is a SET, not a flag, so `tr . -`
has to skip flag-matching only when a letter follows the dash. And uniq
compared an empty "line" against the last run at EOF and flushed a phantom
blank one - a stray "1" in uniq -c output.

tr and cut also take \s \t \n \r escapes, because the shell has no quoting:
`-d ' '` arrives as three tokens, so a space or tab delimiter was simply
untypeable. Shell quoting would be the better fix; this makes the tools
usable today without touching the parser.

Banks 49-53; 10 program slots left in the 1 MB ROM.
</content>
</entry>
</feed>
