X-Git-Url: http://git.chise.org/gitweb/?p=chise%2Fxemacs-chise.git.1;a=blobdiff_plain;f=src%2Fsystty.h;h=6494003edbcd95111875d6e1b21d6bbe3d65b5e8;hp=bceec586c8027c14082d350854baa33419cabc27;hb=f7019bf646d0d4e750e0186d6e912ec7a3b9da90;hpb=6883ee56ec887c2c48abe5b06b5e66aa74031910 diff --git a/src/systty.h b/src/systty.h index bceec58..6494003 100644 --- a/src/systty.h +++ b/src/systty.h @@ -20,8 +20,8 @@ Boston, MA 02111-1307, USA. */ /* Synched up with: FSF 19.30. */ -#ifndef _XEMACS_SYSTTY_H_ -#define _XEMACS_SYSTTY_H_ +#ifndef INCLUDED_systty_h_ +#define INCLUDED_systty_h_ #ifdef HAVE_TERMIOS # define HAVE_TCATTR @@ -53,6 +53,10 @@ Boston, MA 02111-1307, USA. */ /* Include the proper files. */ +#ifdef HAVE_UNISTD_H +#include +#endif + /* XEmacs: TERMIOS is mo' better than TERMIO so we use it if it's there. Since TERMIO is backward-compatibility stuff if both it and TERMIOS exist, it's more likely to be broken. */ @@ -90,9 +94,9 @@ Boston, MA 02111-1307, USA. */ # include # endif -#elif defined (DOS_NT) +#elif defined (WIN32_NATIVE) -/***** (3) The MSDOS/NT way *****/ +/***** (3) The WIN32_NATIVE way *****/ /* Nothing doing */ @@ -120,7 +124,7 @@ Boston, MA 02111-1307, USA. */ /* 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 #endif /* UNIPLUS systems may have FIONREAD. */ @@ -177,10 +181,6 @@ Boston, MA 02111-1307, USA. */ /* ----------------------------------------------------- */ -#ifdef APOLLO -#undef TIOCSTART -#endif - #if defined (XENIX) || defined (BROKEN_TIOCGETC) #undef TIOCGETC /* Avoid confusing some conditionals that test this. */ #endif @@ -193,10 +193,6 @@ Boston, MA 02111-1307, USA. */ #undef TIOCSWINSZ #endif -#ifdef BROKEN_O_NONBLOCK /* XEmacs addition */ -# undef O_NONBLOCK -#endif /* BROKEN_O_NONBLOCK */ - /* On TERMIOS systems, the tcmumbleattr calls take care of these parameters, and it's a bad idea to use them (on AIX, it makes the tty hang for a long time). */ @@ -214,19 +210,16 @@ Boston, MA 02111-1307, USA. */ /* ----------------------------------------------------- */ /* Try to establish the correct character to disable terminal functions - in a system-independent manner. Note that USG (at least) define - _POSIX_VDISABLE as 0! */ - -#ifdef _POSIX_VDISABLE -#define CDISABLE _POSIX_VDISABLE -#else /* not _POSIX_VDISABLE */ -#ifdef CDEL -#undef CDISABLE -#define CDISABLE CDEL -#else /* not CDEL */ -#define CDISABLE 255 -#endif /* not CDEL */ -#endif /* not _POSIX_VDISABLE */ + in a system-independent manner. + We use the POSIX standard way to do this, and emulate on other systems. */ + +#ifndef _POSIX_VDISABLE +# if defined CDEL +# define _POSIX_VDISABLE CDEL +# else +# define _POSIX_VDISABLE 255 +# endif +#endif /* ! _POSIX_VDISABLE */ /* ----------------------------------------------------- */ @@ -253,55 +246,34 @@ Boston, MA 02111-1307, USA. */ /* 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_GET_TTY_PGRP(int FD, int *PGID) sets *PGID the terminal FD's - current 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_SET_TTY_PGRP(int FD, int *PGID) sets the terminal FD's - current process group to *PGID. 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. */ -/* 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 - -#ifdef EMACS_HAVE_TTY_PGRP - -#if defined (HAVE_TERMIOS) && ! defined (BSD_TERMIOS) +#if defined (TIOCGPGRP) -/* 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)) +#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 (TIOCSPGRP) +#elif defined (HAVE_TCGETPGRP) -#define EMACS_GET_TTY_PGRP(fd, pgid) (ioctl ((fd), TIOCGPGRP, (pgid))) -#define EMACS_SET_TTY_PGRP(fd, pgid) (ioctl ((fd), TIOCSPGRP, (pgid))) - -#endif +#define EMACS_GET_TTY_PROCESS_GROUP(fd, pgid) (*(pgid) = tcgetpgrp (fd)) +#define EMACS_SET_TTY_PROCESS_GROUP(fd, pgid) tcsetpgrp (fd, *(pgid)) -#endif /* EMACS_HAVE_TTY_PGRP */ - -#ifndef EMACS_GET_TTY_PGRP +#else /* 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 +#define EMACS_GET_TTY_PROCESS_GROUP(fd, pgid) 0 +#define EMACS_SET_TTY_PROCESS_GROUP(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 @@ -340,6 +312,8 @@ Boston, MA 02111-1307, USA. */ 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(MINGW) +# define EMACS_SEPARATE_PROCESS_GROUP() #else /* Under NeXTstep, a process group of 0 is not the same as specifying your own process ID, so we go ahead and specify it explicitly. */ @@ -359,11 +333,11 @@ Boston, MA 02111-1307, USA. */ emacs_tty should contain an element for each parameter struct that Emacs may change. - EMACS_GET_TTY (int FD, struct emacs_tty *P) stores the parameters + emacs_get_tty (int FD, struct emacs_tty *P) stores the parameters of the tty on FD in *P. Return zero if all's well, or -1 if we ran into an error we couldn't deal with. - EMACS_SET_TTY (int FD, struct emacs_tty *P, int flushp) + emacs_set_tty (int FD, struct emacs_tty *P, int flushp) sets the parameters of the tty on FD according to the contents of *P. If flushp is non-zero, we discard queued input to be written before making the change. @@ -389,11 +363,11 @@ struct emacs_tty { #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 */ @@ -410,15 +384,9 @@ struct emacs_tty { #endif /* HAVE_TCHARS */ #endif /* HAVE_TERMIOS */ }; - -/* Define EMACS_GET_TTY and EMACS_SET_TTY, - the macros for reading and setting parts of `struct emacs_tty'. - These got pretty unmanageable (huge macros are hard to debug), and - finally needed some code which couldn't be done as part of an - expression, so we moved them out to their own functions in sysdep.c. */ -#define EMACS_GET_TTY(fd, p) emacs_get_tty (fd, p) -#define EMACS_SET_TTY(fd, p, waitp) emacs_set_tty (fd, p, waitp) +int emacs_get_tty (int fd, struct emacs_tty *settings); +int emacs_set_tty (int fd, struct emacs_tty *settings, int flushp); /* --------------------------------------------------------- */ @@ -439,13 +407,13 @@ struct emacs_tty { #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 */ -#endif /* _XEMACS_SYSTTY_H_ */ +#endif /* INCLUDED_systty_h_ */