CVSROOT: /cvs
Module name: src
Changes by: [email protected] 2022/01/28 17:19:04
Modified files:
usr.bin/head : head.c
Log message:
head(1): refactor main loop
The main loop here is horribly obfuscated. In particular, the path
through the loop to exit(3) is very complex.
Refactor the open/read/write/close portions of the loop out of main()
into a separate function, head_file().
The result is a lot easier to understand at a glance. In particular,
the path to the end of main() is now dead simple.
Thread: https://marc.info/?l=openbsd-tech&m=164325900400701&w=2
ok millert@