move target handling out of option parsing
allow reading targets from stdin
follow site local conventions
fix leak in local db search path
Properly support formatting of %!
cleanup printing code

This fixes a bug where unknown escape sequences would be flat out
skipped.