...it basically follows the same style and organization
as older Unix tools. In such cases, I find starting from
main() and jumping around with ctags a useful strategy
(after reading the globals and type definitions).
Oh, I know it's the same style and organization as older Unix tools. And it's the same style and organization as large one-off perl scripts. It would be a shame to replace old cruft with new stuff that doesn't the leverage lessons learned in software engineering over the last 40 years or so.