cosmetic: reindent
format: don't overread by 4*5 bytes

Fixes #6.
format: move struct definition to global scope
format: early return for simpler code
format: rename to ptr

less confusing than having both opt and _opt.
format: remove unused variable
format: use enum and switch