Use dup2 if available for -t. Also check for ttyname and isatty in configure.
authorNelson Ferreira <nelson.ferreira@ieee.org>
Mon, 5 Mar 2012 17:52:55 +0000 (12:52 -0500)
committerNelson Ferreira <nelson.ferreira@ieee.org>
Mon, 5 Mar 2012 17:52:55 +0000 (12:52 -0500)
commit438b1b3578c66d99b29c6cdf7ec3a5c44edd71d1
tree39467c5cc3074cd89ced7fd499c4adf42e066a39
parent5a365d9e21766d2ff0318ddbda9a5ae75e540fbb
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>
configure.ac
src/buffer.c
src/emacs.c
src/eval.c
src/sysdep.c
src/sysfile.h