#include "gbos.h" /* head [n]: print the first n lines of stdin (default 10). Drains the rest to EOF so the shell sees a clean end of input. */ void main(void) { char *a = getargs(); unsigned char n = 10; unsigned char lines = 0; char c; if (*a) n = atou(a); for (;;) { c = readc(); if (c == EOF) break; if (lines < n) putc(c); if (c == '\n') lines++; } }