>> + while ((r = read(fd, &c, 1) > 0)) { >> + offset++; >> + if (isprint(c)) { >> + span++; > > I think is better use the buffer interface here. Calling getc > will save a lot of system calls and it will improve the performace > of the application.
Not only that, using stdio is currently the sbase way.