extract function
refactor
not const
implement fopen error handling
move
dont read LF
implement log command as cat-file -p