Missing non-interactive mode support activated.

Non-interactive mode was functioning but couldn't be activated due the lack of a cmd line switch. Patched by adding a new -N switch and changed print_func pointer to printf().
Also added a small patch to check read() value (to avoid warning).