Mercurial > hg > xemacs-beta
comparison 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 |
comparison
equal
deleted
inserted
replaced
441:72a7cfa4a488 | 442:abe6d1db359e |
---|---|
92 # ifndef INCLUDED_FCNTL | 92 # ifndef INCLUDED_FCNTL |
93 # define INCLUDED_FCNTL | 93 # define INCLUDED_FCNTL |
94 # include <fcntl.h> | 94 # include <fcntl.h> |
95 # endif | 95 # endif |
96 | 96 |
97 #elif defined (DOS_NT) | 97 #elif defined (WIN32_NATIVE) |
98 | 98 |
99 /***** (3) The MSDOS/NT way *****/ | 99 /***** (3) The WIN32_NATIVE way *****/ |
100 | 100 |
101 /* Nothing doing */ | 101 /* Nothing doing */ |
102 | 102 |
103 #else | 103 #else |
104 | 104 |
122 USG5_4 was defined, but this is already included in s/usg5-4.h */ | 122 USG5_4 was defined, but this is already included in s/usg5-4.h */ |
123 | 123 |
124 /* Generally useful to include this file: */ | 124 /* Generally useful to include this file: */ |
125 | 125 |
126 /* But Sun OS has broken include files and doesn't want it included */ | 126 /* But Sun OS has broken include files and doesn't want it included */ |
127 #if !defined (DOS_NT) && !defined (WIN32) && !defined (SUNOS4) | 127 #if !defined (WIN32_NATIVE) && !defined (SUNOS4) |
128 # include <sys/ioctl.h> | 128 # include <sys/ioctl.h> |
129 #endif | 129 #endif |
130 /* UNIPLUS systems may have FIONREAD. */ | 130 /* UNIPLUS systems may have FIONREAD. */ |
131 #ifdef UNIPLUS | 131 #ifdef UNIPLUS |
132 #include <sys.ioctl.h> | 132 #include <sys.ioctl.h> |
244 | 244 |
245 /* -------------------------------------------------------------------- */ | 245 /* -------------------------------------------------------------------- */ |
246 /* Manipulate a terminal's current (foreground) process group */ | 246 /* Manipulate a terminal's current (foreground) process group */ |
247 /* -------------------------------------------------------------------- */ | 247 /* -------------------------------------------------------------------- */ |
248 | 248 |
249 /* EMACS_HAVE_TTY_PGRP is true if we can get and set the tty's current | 249 /* EMACS_GET_TTY_PGRP(int FD, pid_t *PGID) sets *PGID to the terminal |
250 controlling process group. | 250 FD's current foreground process group. Return -1 if there is an error. |
251 | 251 |
252 EMACS_GET_TTY_PGRP(int FD, int *PGID) sets *PGID the terminal FD's | 252 EMACS_SET_TTY_PGRP(int FD, pid_t *PGID) sets the terminal FD's current |
253 current process group. Return -1 if there is an error. | 253 foreground process group to *PGID. Return -1 if there is an error. |
254 | 254 |
255 EMACS_SET_TTY_PGRP(int FD, int *PGID) sets the terminal FD's | 255 We prefer using the ioctl (BSD) interface instead of its Posix |
256 current process group to *PGID. Return -1 if there is an error. */ | 256 replacement tgetpgrp/tcsetpgrp since that is documented as being |
257 | 257 restricted to processes sharing the same controlling tty. */ |
258 /* HPUX tty process group stuff doesn't work, says the anonymous voice | 258 |
259 from the past. */ | 259 #if defined (TIOCGPGRP) |
260 /* But HPUX people say it does, so I've removed it. --ben */ | 260 |
261 # ifdef TIOCGPGRP | 261 #define EMACS_GET_TTY_PROCESS_GROUP(fd, pgid) ioctl (fd, TIOCGPGRP, pgid) |
262 # define EMACS_HAVE_TTY_PGRP | 262 #define EMACS_SET_TTY_PROCESS_GROUP(fd, pgid) ioctl (fd, TIOCSPGRP, pgid) |
263 # else | 263 |
264 # ifdef HAVE_TERMIOS | 264 #elif defined (HAVE_TCGETPGRP) |
265 # define EMACS_HAVE_TTY_PGRP | 265 |
266 # endif | 266 #define EMACS_GET_TTY_PROCESS_GROUP(fd, pgid) (*(pgid) = tcgetpgrp (fd)) |
267 # endif | 267 #define EMACS_SET_TTY_PROCESS_GROUP(fd, pgid) tcsetpgrp (fd, *(pgid)) |
268 | 268 |
269 #ifdef EMACS_HAVE_TTY_PGRP | 269 #else |
270 | |
271 #if defined (HAVE_TERMIOS) && ! defined (BSD_TERMIOS) | |
272 | |
273 /* Resist the urge to insert needless extra parentheses. */ | |
274 #define EMACS_GET_TTY_PGRP(fd, pgid) (*(pgid) = tcgetpgrp (fd)) | |
275 #define EMACS_SET_TTY_PGRP(fd, pgid) tcsetpgrp (fd, *(pgid)) | |
276 | |
277 #elif defined (TIOCSPGRP) | |
278 | |
279 #define EMACS_GET_TTY_PGRP(fd, pgid) (ioctl ((fd), TIOCGPGRP, (pgid))) | |
280 #define EMACS_SET_TTY_PGRP(fd, pgid) (ioctl ((fd), TIOCSPGRP, (pgid))) | |
281 | |
282 #endif | |
283 | |
284 #endif /* EMACS_HAVE_TTY_PGRP */ | |
285 | |
286 #ifndef EMACS_GET_TTY_PGRP | |
287 | 270 |
288 /* Just ignore this for now and hope for the best */ | 271 /* Just ignore this for now and hope for the best */ |
289 #define EMACS_GET_TTY_PGRP(fd, pgid) 0 | 272 #define EMACS_GET_TTY_PROCESS_GROUP(fd, pgid) 0 |
290 #define EMACS_SET_TTY_PGRP(fd, pgif) 0 | 273 #define EMACS_SET_TTY_PROCESS_GROUP(fd, pgif) 0 |
291 | 274 |
292 #endif | 275 #endif |
293 | |
294 /* XEmacs interim backward-compatibility */ | |
295 #define EMACS_GET_TTY_PROCESS_GROUP EMACS_GET_TTY_PGRP | |
296 #define EMACS_SET_TTY_PROCESS_GROUP EMACS_SET_TTY_PGRP | |
297 | 276 |
298 /* EMACS_GETPGRP (arg) returns the process group of the terminal. */ | 277 /* EMACS_GETPGRP (arg) returns the process group of the terminal. */ |
299 | 278 |
300 #ifdef GETPGRP_VOID | 279 #ifdef GETPGRP_VOID |
301 #define EMACS_GETPGRP(x) getpgrp() | 280 #define EMACS_GETPGRP(x) getpgrp() |
331 # define EMACS_SEPARATE_PROCESS_GROUP() setpgrp () | 310 # define EMACS_SEPARATE_PROCESS_GROUP() setpgrp () |
332 /* old (pre-SVR4) USG's don't provide any way to do this. | 311 /* old (pre-SVR4) USG's don't provide any way to do this. |
333 No big loss -- it just means that ^Z won't work right | 312 No big loss -- it just means that ^Z won't work right |
334 if we're run from sh. */ | 313 if we're run from sh. */ |
335 # define EMACS_SET_PROCESS_GROUP(pg) | 314 # define EMACS_SET_PROCESS_GROUP(pg) |
336 #elif defined(__MINGW32__) | 315 #elif defined(MINGW) |
337 # define EMACS_SEPARATE_PROCESS_GROUP() | 316 # define EMACS_SEPARATE_PROCESS_GROUP() |
338 #else | 317 #else |
339 /* Under NeXTstep, a process group of 0 is not the same as specifying | 318 /* Under NeXTstep, a process group of 0 is not the same as specifying |
340 your own process ID, so we go ahead and specify it explicitly. */ | 319 your own process ID, so we go ahead and specify it explicitly. */ |
341 # define EMACS_SEPARATE_PROCESS_GROUP() setpgrp (0, getpid ()) | 320 # define EMACS_SEPARATE_PROCESS_GROUP() setpgrp (0, getpid ()) |
382 struct termios main; | 361 struct termios main; |
383 #else /* !HAVE_TCATTR */ | 362 #else /* !HAVE_TCATTR */ |
384 #ifdef HAVE_TERMIO | 363 #ifdef HAVE_TERMIO |
385 struct termio main; | 364 struct termio main; |
386 #else /* !HAVE_TERMIO */ | 365 #else /* !HAVE_TERMIO */ |
387 #ifdef DOS_NT | 366 #ifdef WIN32_NATIVE |
388 int main; | 367 int main; |
389 #else /* not DOS_NT */ | 368 #else /* not WIN32_NATIVE */ |
390 struct sgttyb main; | 369 struct sgttyb main; |
391 #endif /* not DOS_NT */ | 370 #endif /* not WIN32_NATIVE */ |
392 #endif /* !HAVE_TERMIO */ | 371 #endif /* !HAVE_TERMIO */ |
393 #endif /* !HAVE_TCATTR */ | 372 #endif /* !HAVE_TCATTR */ |
394 | 373 |
395 /* If we have TERMIOS, we don't need to do this - they're taken care of | 374 /* If we have TERMIOS, we don't need to do this - they're taken care of |
396 by the tc*attr calls. */ | 375 by the tc*attr calls. */ |
426 #ifdef HAVE_TERMIO | 405 #ifdef HAVE_TERMIO |
427 | 406 |
428 #define EMACS_TTY_TABS_OK(p) (((p)->main.c_oflag & TABDLY) != TAB3) | 407 #define EMACS_TTY_TABS_OK(p) (((p)->main.c_oflag & TABDLY) != TAB3) |
429 | 408 |
430 #else /* neither HAVE_TERMIO nor HAVE_TERMIOS */ | 409 #else /* neither HAVE_TERMIO nor HAVE_TERMIOS */ |
431 #ifdef DOS_NT | 410 #ifdef WIN32_NATIVE |
432 #define EMACS_TTY_TABS_OK(p) 0 | 411 #define EMACS_TTY_TABS_OK(p) 0 |
433 #else /* not DOS_NT */ | 412 #else /* not WIN32_NATIVE */ |
434 #define EMACS_TTY_TABS_OK(p) (((p)->main.sg_flags & XTABS) != XTABS) | 413 #define EMACS_TTY_TABS_OK(p) (((p)->main.sg_flags & XTABS) != XTABS) |
435 #endif /* not DOS_NT */ | 414 #endif /* not WIN32_NATIVE */ |
436 | 415 |
437 #endif /* not def HAVE_TERMIO */ | 416 #endif /* not def HAVE_TERMIO */ |
438 #endif /* not def HAVE_TERMIOS */ | 417 #endif /* not def HAVE_TERMIOS */ |
439 | 418 |
440 #endif /* INCLUDED_systty_h_ */ | 419 #endif /* INCLUDED_systty_h_ */ |