rework of command-line and input/output handling

- gengetopt added
- moved to a more natural use of stdin/stdout/stderr