Refactored b2df5fc: Moved error_handler code into string

First, install traps HUP, INT, QUIT, TERM and ERR. Regular errors (e.g.
wrong invocation of pkgbox) will not fire the EXIT signal. At a later
time the EXIT trap is added so that errors like Bash's "nounset"-errors
can be "caught".
Set window title only if there's a real tty and terminal is supported