X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/57507bf8b5e37c0d9355aaafbf5abb46998af392..25a48bd06bd5979d201cddde99e2dec1eb54c184:/src/sysdep.c diff --git a/src/sysdep.c b/src/sysdep.c index 091b1b1e51..53b7f39171 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -1,6 +1,5 @@ /* Interfaces to system-dependent kernel and library entries. - Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, 1999, 2000, 2001, - 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + Copyright (C) 1985-1988, 1993-1995, 1999-2011 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -30,9 +29,9 @@ along with GNU Emacs. If not, see . */ #ifdef HAVE_LIMITS_H #include #endif /* HAVE_LIMITS_H */ -#ifdef HAVE_UNISTD_H #include -#endif + +#include #include "lisp.h" #include "sysselect.h" @@ -71,10 +70,7 @@ along with GNU Emacs. If not, see . */ #endif #include - -#ifdef HAVE_FCNTL_H #include -#endif #include "systty.h" #include "syswait.h" @@ -93,12 +89,6 @@ along with GNU Emacs. If not, see . */ #include "dispextern.h" #include "process.h" #include "cm.h" /* for reset_sys_modes */ -#ifdef HAVE_TERM_H -/* Include this last. If it is ncurses header file, it adds a lot of - defines that interfere with stuff in other headers. Someone responsible - for ncurses messed up bigtime. See bug#6812. */ -#include -#endif #ifdef WINDOWSNT #include @@ -126,10 +116,8 @@ struct utimbuf { #endif #endif -/* LPASS8 is new in 4.3, and makes cbreak mode provide all 8 bits. */ -#ifndef LPASS8 -#define LPASS8 0 -#endif +/* Declare here, including term.h is problematic on some systems. */ +extern void tputs (const char *, int, int (*)(int)); static const int baud_convert[] = { @@ -137,8 +125,6 @@ static const int baud_convert[] = 1800, 2400, 4800, 9600, 19200, 38400 }; -int emacs_ospeed; - void croak (char *) NO_RETURN; /* Temporary used by `sigblock' when defined in terms of signprocmask. */ @@ -242,8 +228,8 @@ discard_tty_input (void) { if (tty->input) /* Is the device suspended? */ { - EMACS_GET_TTY (fileno (tty->input), &buf); - EMACS_SET_TTY (fileno (tty->input), &buf, 0); + emacs_get_tty (fileno (tty->input), &buf); + emacs_set_tty (fileno (tty->input), &buf, 0); } } } @@ -278,6 +264,8 @@ stuff_char (char c) void init_baud_rate (int fd) { + int emacs_ospeed; + if (noninteractive) emacs_ospeed = 0; else @@ -363,22 +351,7 @@ wait_for_termination (int pid) void flush_pending_output (int channel) { -#ifndef DOS_NT - /* If we try this, we get hit with SIGTTIN, because - the child's tty belongs to the child's pgrp. */ -#else -#ifdef TCFLSH - ioctl (channel, TCFLSH, 1); -#else -#ifdef TIOCFLUSH - int zero = 0; - /* 3rd arg should be ignored - but some 4.2 kernels actually want the address of an int - and nonzero means something different. */ - ioctl (channel, TIOCFLUSH, &zero); -#endif -#endif -#endif + /* FIXME: maybe this function should be removed */ } /* Set up the terminal at the other end of a pseudo-terminal that @@ -392,7 +365,7 @@ child_setup_tty (int out) #ifndef WINDOWSNT struct emacs_tty s; - EMACS_GET_TTY (out, &s); + emacs_get_tty (out, &s); s.main.c_oflag |= OPOST; /* Enable output postprocessing */ s.main.c_oflag &= ~ONLCR; /* Disable map of NL to CR-NL on output */ #ifdef NLDLY @@ -470,7 +443,7 @@ child_setup_tty (int out) s.main.c_cc[VTIME] = 0; #endif - EMACS_SET_TTY (out, &s, 0); + emacs_set_tty (out, &s, 0); #endif /* not WINDOWSNT */ } #endif /* not MSDOS */ @@ -580,15 +553,6 @@ sys_subshell (void) close_process_descs (); /* Close Emacs's pipes/ptys */ -#ifdef SET_EMACS_PRIORITY - { - extern EMACS_INT emacs_priority; - - if (emacs_priority < 0) - nice (-emacs_priority); - } -#endif - #ifdef MSDOS /* Demacs 1.1.2 91/10/20 Manabu Higashida */ { char *epwd = getenv ("PWD"); @@ -616,7 +580,7 @@ sys_subshell (void) write (1, "Can't execute subshell", 22); #else /* not WINDOWSNT */ execlp (sh, sh, (char *) 0); - write (1, "Can't execute subshell", 22); + ignore_value (write (1, "Can't execute subshell", 22)); _exit (1); #endif /* not WINDOWSNT */ #endif /* not MSDOS */ @@ -882,7 +846,7 @@ init_sys_modes (struct tty_display_info *tty_out) if (! tty_out->old_tty) tty_out->old_tty = (struct emacs_tty *) xmalloc (sizeof (struct emacs_tty)); - EMACS_GET_TTY (fileno (tty_out->input), tty_out->old_tty); + emacs_get_tty (fileno (tty_out->input), tty_out->old_tty); tty = *tty_out->old_tty; @@ -1028,7 +992,7 @@ init_sys_modes (struct tty_display_info *tty_out) dos_ttraw (tty_out); #endif - EMACS_SET_TTY (fileno (tty_out->input), &tty, 0); + emacs_set_tty (fileno (tty_out->input), &tty, 0); /* This code added to insure that, if flow-control is not to be used, we have an unlocked terminal at the start. */ @@ -1120,8 +1084,16 @@ tabs_safe_p (int fd) { struct emacs_tty etty; - EMACS_GET_TTY (fd, &etty); - return EMACS_TTY_TABS_OK (&etty); + emacs_get_tty (fd, &etty); +#ifndef DOS_NT +#ifdef TABDLY + return ((etty.main.c_oflag & TABDLY) != TAB3); +#else /* not TABDLY */ + return 1; +#endif /* not TABDLY */ +#else /* DOS_NT */ + return 0; +#endif /* DOS_NT */ } /* Get terminal size from system. @@ -1283,7 +1255,7 @@ reset_sys_modes (struct tty_display_info *tty_out) #endif /* F_SETFL */ if (tty_out->old_tty) - while (EMACS_SET_TTY (fileno (tty_out->input), + while (emacs_set_tty (fileno (tty_out->input), tty_out->old_tty, 0) < 0 && errno == EINTR) ; @@ -1334,11 +1306,6 @@ setup_pty (int fd) } #endif /* HAVE_PTYS */ -/* init_system_name sets up the string for the Lisp function - system-name to return. */ - -extern Lisp_Object Vsystem_name; - #ifdef HAVE_SOCKETS #include #include @@ -3093,7 +3060,3 @@ system_process_attributes (Lisp_Object pid) } #endif /* !defined (WINDOWSNT) */ - - -/* arch-tag: edb43589-4e09-4544-b325-978b5b121dcf - (do not change this comment) */