Use dup2 if available for -t. Also check for ttyname and isatty in configure.
* configure.ac: Add some additional functions to check and add the
HAVE_ISATTY and HAVE_TTYNAME
* src/emacs.c (main_1): Enhance the logging of -t with ttyname if
it is available.
* src/emacs.c (main_1): Use raw_open instead of open to avoid
using the format conversion of the filename, which at this early
stage is not setup yet.
* src/emacs.c (main_1): use dup2 if available to dup the opened
file (and then close the original descriptor). This is much more
reliable than close then open, since dup2 will make sure the
descriptor number will be the desired.
* src/eval.c (grow_specpdl): If grow_specpdl is called very early
on specpdl_size is 0 and will loop infinitely here because 2 * 0
== 0 ;)
* src/sysdep.c (raw_open): New function that just calls the system
open with no argument conversion at all
* src/sysfile.h: declare the new raw_open function.
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>