Generic function for opening file if the filename is not empty nor "-",
or using given handle otherwise (probably stdout, stderr, or stdin).
TODO: Should it become utility function?
Generic function for choosing either file with given name or stdinstdout as inputoutput.
It accepts the function that takes the corresponding handle.
Stdin/stdout is selected by "-".