Mercurial > hg > xemacs-beta
diff src/systty.h @ 442:abe6d1db359e r21-2-36
Import from CVS: tag r21-2-36
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:35:02 +0200 |
parents | 8de8e3f6228a |
children | e159a0b4bed4 |
line wrap: on
line diff
--- a/src/systty.h Mon Aug 13 11:33:40 2007 +0200 +++ b/src/systty.h Mon Aug 13 11:35:02 2007 +0200 @@ -94,9 +94,9 @@ # include <fcntl.h> # endif -#elif defined (DOS_NT) +#elif defined (WIN32_NATIVE) -/***** (3) The MSDOS/NT way *****/ +/***** (3) The WIN32_NATIVE way *****/ /* Nothing doing */ @@ -124,7 +124,7 @@ /* Generally useful to include this file: */ /* But Sun OS has broken include files and doesn't want it included */ -#if !defined (DOS_NT) && !defined (WIN32) && !defined (SUNOS4) +#if !defined (WIN32_NATIVE) && !defined (SUNOS4) # include <sys/ioctl.h> #endif /* UNIPLUS systems may have FIONREAD. */ @@ -246,55 +246,34 @@ /* Manipulate a terminal's current (foreground) process group */ /* -------------------------------------------------------------------- */ -/* EMACS_HAVE_TTY_PGRP is true if we can get and set the tty's current - controlling process group. +/* EMACS_GET_TTY_PGRP(int FD, pid_t *PGID) sets *PGID to the terminal + FD's current foreground process group. Return -1 if there is an error. + + EMACS_SET_TTY_PGRP(int FD, pid_t *PGID) sets the terminal FD's current + foreground process group to *PGID. Return -1 if there is an error. - EMACS_GET_TTY_PGRP(int FD, int *PGID) sets *PGID the terminal FD's - current process group. Return -1 if there is an error. + We prefer using the ioctl (BSD) interface instead of its Posix + replacement tgetpgrp/tcsetpgrp since that is documented as being + restricted to processes sharing the same controlling tty. */ - EMACS_SET_TTY_PGRP(int FD, int *PGID) sets the terminal FD's - current process group to *PGID. Return -1 if there is an error. */ +#if defined (TIOCGPGRP) -/* HPUX tty process group stuff doesn't work, says the anonymous voice - from the past. */ -/* But HPUX people say it does, so I've removed it. --ben */ -# ifdef TIOCGPGRP -# define EMACS_HAVE_TTY_PGRP -# else -# ifdef HAVE_TERMIOS -# define EMACS_HAVE_TTY_PGRP -# endif -# endif +#define EMACS_GET_TTY_PROCESS_GROUP(fd, pgid) ioctl (fd, TIOCGPGRP, pgid) +#define EMACS_SET_TTY_PROCESS_GROUP(fd, pgid) ioctl (fd, TIOCSPGRP, pgid) + +#elif defined (HAVE_TCGETPGRP) -#ifdef EMACS_HAVE_TTY_PGRP - -#if defined (HAVE_TERMIOS) && ! defined (BSD_TERMIOS) +#define EMACS_GET_TTY_PROCESS_GROUP(fd, pgid) (*(pgid) = tcgetpgrp (fd)) +#define EMACS_SET_TTY_PROCESS_GROUP(fd, pgid) tcsetpgrp (fd, *(pgid)) -/* Resist the urge to insert needless extra parentheses. */ -#define EMACS_GET_TTY_PGRP(fd, pgid) (*(pgid) = tcgetpgrp (fd)) -#define EMACS_SET_TTY_PGRP(fd, pgid) tcsetpgrp (fd, *(pgid)) +#else -#elif defined (TIOCSPGRP) - -#define EMACS_GET_TTY_PGRP(fd, pgid) (ioctl ((fd), TIOCGPGRP, (pgid))) -#define EMACS_SET_TTY_PGRP(fd, pgid) (ioctl ((fd), TIOCSPGRP, (pgid))) +/* Just ignore this for now and hope for the best */ +#define EMACS_GET_TTY_PROCESS_GROUP(fd, pgid) 0 +#define EMACS_SET_TTY_PROCESS_GROUP(fd, pgif) 0 #endif -#endif /* EMACS_HAVE_TTY_PGRP */ - -#ifndef EMACS_GET_TTY_PGRP - -/* Just ignore this for now and hope for the best */ -#define EMACS_GET_TTY_PGRP(fd, pgid) 0 -#define EMACS_SET_TTY_PGRP(fd, pgif) 0 - -#endif - -/* XEmacs interim backward-compatibility */ -#define EMACS_GET_TTY_PROCESS_GROUP EMACS_GET_TTY_PGRP -#define EMACS_SET_TTY_PROCESS_GROUP EMACS_SET_TTY_PGRP - /* EMACS_GETPGRP (arg) returns the process group of the terminal. */ #ifdef GETPGRP_VOID @@ -333,7 +312,7 @@ No big loss -- it just means that ^Z won't work right if we're run from sh. */ # define EMACS_SET_PROCESS_GROUP(pg) -#elif defined(__MINGW32__) +#elif defined(MINGW) # define EMACS_SEPARATE_PROCESS_GROUP() #else /* Under NeXTstep, a process group of 0 is not the same as specifying @@ -384,11 +363,11 @@ #ifdef HAVE_TERMIO struct termio main; #else /* !HAVE_TERMIO */ -#ifdef DOS_NT +#ifdef WIN32_NATIVE int main; -#else /* not DOS_NT */ +#else /* not WIN32_NATIVE */ struct sgttyb main; -#endif /* not DOS_NT */ +#endif /* not WIN32_NATIVE */ #endif /* !HAVE_TERMIO */ #endif /* !HAVE_TCATTR */ @@ -428,11 +407,11 @@ #define EMACS_TTY_TABS_OK(p) (((p)->main.c_oflag & TABDLY) != TAB3) #else /* neither HAVE_TERMIO nor HAVE_TERMIOS */ -#ifdef DOS_NT +#ifdef WIN32_NATIVE #define EMACS_TTY_TABS_OK(p) 0 -#else /* not DOS_NT */ +#else /* not WIN32_NATIVE */ #define EMACS_TTY_TABS_OK(p) (((p)->main.sg_flags & XTABS) != XTABS) -#endif /* not DOS_NT */ +#endif /* not WIN32_NATIVE */ #endif /* not def HAVE_TERMIO */ #endif /* not def HAVE_TERMIOS */