Check if we are on tty before initializing curses.
* pinentry/pinentry-curses.c (dialog_run): Check stant stdin and stout are connected to ttys.
When we did not have a ttyname we just used stdin/out without checking
if it's a proper TTY or a pipe. In some cases this can cause endless
loop or escape seqeunces on the terminal.
This commit changes behaviour so that if stdin/out is not tty and no
ttyname is specified we error-out with errno set to ENOTTY