diff options
| author | user <user@clank> | 2026-07-16 07:30:34 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-07-16 07:30:34 +0200 |
| commit | 8682553498d32d3c18dea41c598ab40de18404a3 (patch) | |
| tree | 74096aa1fcefce24f80583ee10f25e5831a3b589 /c/gbos.h | |
| parent | libc + CLI tools: a small C userland (diff) | |
| download | gbos-8682553498d32d3c18dea41c598ab40de18404a3.tar.gz gbos-8682553498d32d3c18dea41c598ab40de18404a3.tar.xz gbos-8682553498d32d3c18dea41c598ab40de18404a3.zip | |
tools: wc, head, and an argc/argv demo (args) + libc.c helpers
- 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' -> argc=3/argv[..]; wc '2 3 16'; head 2.
Diffstat (limited to '')
| -rw-r--r-- | c/gbos.h | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -12,4 +12,9 @@ char *getargs(void); /* this program's argument string */ char readc(void); /* one input byte, EOF at end */ void sexit(unsigned char code); unsigned char getpid(void); + +/* helpers (c/libc.c) */ +void putu(unsigned int n); /* print decimal */ +unsigned char atou(const char *s); /* parse decimal */ +unsigned char argv_parse(char **argv, unsigned char maxv); /* argc/argv */ #endif |
