diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/dispextern.h | 6 | ||||
| -rw-r--r-- | src/dispnew.c | 2 | ||||
| -rw-r--r-- | src/frame.c | 2 | ||||
| -rw-r--r-- | src/keyboard.c | 4 | ||||
| -rw-r--r-- | src/sysdep.c | 58 | ||||
| -rw-r--r-- | src/term.c | 10 |
6 files changed, 39 insertions, 43 deletions
diff --git a/src/dispextern.h b/src/dispextern.h index e53f36d4a01..a4864068eda 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -2562,11 +2562,11 @@ extern int x_intersect_rectangles P_ ((XRectangle *, XRectangle *, | |||
| 2562 | 2562 | ||
| 2563 | /* Defined in sysdep.c */ | 2563 | /* Defined in sysdep.c */ |
| 2564 | 2564 | ||
| 2565 | void get_tty_size P_ ((struct tty_output *, int *, int *)); | 2565 | void get_tty_size P_ ((int, int *, int *)); |
| 2566 | void request_sigio P_ ((void)); | 2566 | void request_sigio P_ ((void)); |
| 2567 | void unrequest_sigio P_ ((void)); | 2567 | void unrequest_sigio P_ ((void)); |
| 2568 | int tabs_safe_p P_ ((struct tty_output *)); | 2568 | int tabs_safe_p P_ ((int)); |
| 2569 | void init_baud_rate P_ ((struct tty_output *)); | 2569 | void init_baud_rate P_ ((int)); |
| 2570 | void init_sigio P_ ((int)); | 2570 | void init_sigio P_ ((int)); |
| 2571 | 2571 | ||
| 2572 | /* Defined in xfaces.c */ | 2572 | /* Defined in xfaces.c */ |
diff --git a/src/dispnew.c b/src/dispnew.c index 3cf15deeab6..593067eae92 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -5927,7 +5927,7 @@ window_change_signal (signalnum) /* If we don't have an argument, */ | |||
| 5927 | if (! tty->term_initted) | 5927 | if (! tty->term_initted) |
| 5928 | continue; | 5928 | continue; |
| 5929 | 5929 | ||
| 5930 | get_tty_size (tty, &width, &height); | 5930 | get_tty_size (fileno (TTY_INPUT (tty)), &width, &height); |
| 5931 | 5931 | ||
| 5932 | { | 5932 | { |
| 5933 | Lisp_Object tail, frame; | 5933 | Lisp_Object tail, frame; |
diff --git a/src/frame.c b/src/frame.c index 9a532bfdd2d..f26bf9ae9ca 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -656,7 +656,7 @@ Note that changing the size of one terminal frame automatically affects all. */ | |||
| 656 | 656 | ||
| 657 | { | 657 | { |
| 658 | int width, height; | 658 | int width, height; |
| 659 | get_tty_size (FRAME_TTY (f), &width, &height); | 659 | get_tty_size (fileno (TTY_INPUT (FRAME_TTY (f))), &width, &height); |
| 660 | change_frame_size (f, height, width, 0, 0, 0); | 660 | change_frame_size (f, height, width, 0, 0, 0); |
| 661 | } | 661 | } |
| 662 | 662 | ||
diff --git a/src/keyboard.c b/src/keyboard.c index 1bb9564060f..c9124f0f594 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -10127,7 +10127,7 @@ On such systems, Emacs starts a subshell instead of suspending. */) | |||
| 10127 | call1 (Vrun_hooks, intern ("suspend-hook")); | 10127 | call1 (Vrun_hooks, intern ("suspend-hook")); |
| 10128 | 10128 | ||
| 10129 | GCPRO1 (stuffstring); | 10129 | GCPRO1 (stuffstring); |
| 10130 | get_tty_size (CURTTY (), &old_width, &old_height); | 10130 | get_tty_size (fileno (TTY_INPUT (CURTTY ())), &old_width, &old_height); |
| 10131 | reset_all_sys_modes (); | 10131 | reset_all_sys_modes (); |
| 10132 | /* sys_suspend can get an error if it tries to fork a subshell | 10132 | /* sys_suspend can get an error if it tries to fork a subshell |
| 10133 | and the system resources aren't available for that. */ | 10133 | and the system resources aren't available for that. */ |
| @@ -10143,7 +10143,7 @@ On such systems, Emacs starts a subshell instead of suspending. */) | |||
| 10143 | /* Check if terminal/window size has changed. | 10143 | /* Check if terminal/window size has changed. |
| 10144 | Note that this is not useful when we are running directly | 10144 | Note that this is not useful when we are running directly |
| 10145 | with a window system; but suspend should be disabled in that case. */ | 10145 | with a window system; but suspend should be disabled in that case. */ |
| 10146 | get_tty_size (CURTTY (), &width, &height); | 10146 | get_tty_size (fileno (TTY_INPUT (CURTTY ())), &width, &height); |
| 10147 | if (width != old_width || height != old_height) | 10147 | if (width != old_width || height != old_height) |
| 10148 | change_frame_size (SELECTED_FRAME (), height, width, 0, 0, 0); | 10148 | change_frame_size (SELECTED_FRAME (), height, width, 0, 0, 0); |
| 10149 | 10149 | ||
diff --git a/src/sysdep.c b/src/sysdep.c index b3a46c77eb3..7453be6e3a7 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -309,10 +309,13 @@ discard_tty_input () | |||
| 309 | #endif /* not WINDOWSNT */ | 309 | #endif /* not WINDOWSNT */ |
| 310 | } | 310 | } |
| 311 | 311 | ||
| 312 | |||
| 312 | #ifdef SIGTSTP | 313 | #ifdef SIGTSTP |
| 313 | 314 | ||
| 314 | /* Arrange for character C to be read as the next input from | 315 | /* Arrange for character C to be read as the next input from |
| 315 | the terminal. */ | 316 | the terminal. |
| 317 | XXX What if we have multiple ttys? | ||
| 318 | */ | ||
| 316 | 319 | ||
| 317 | void | 320 | void |
| 318 | stuff_char (char c) | 321 | stuff_char (char c) |
| @@ -331,7 +334,7 @@ stuff_char (char c) | |||
| 331 | #endif /* SIGTSTP */ | 334 | #endif /* SIGTSTP */ |
| 332 | 335 | ||
| 333 | void | 336 | void |
| 334 | init_baud_rate (struct tty_output *tty) | 337 | init_baud_rate (int fd) |
| 335 | { | 338 | { |
| 336 | if (noninteractive) | 339 | if (noninteractive) |
| 337 | emacs_ospeed = 0; | 340 | emacs_ospeed = 0; |
| @@ -346,7 +349,7 @@ init_baud_rate (struct tty_output *tty) | |||
| 346 | #ifdef VMS | 349 | #ifdef VMS |
| 347 | struct sensemode sg; | 350 | struct sensemode sg; |
| 348 | 351 | ||
| 349 | SYS$QIOW (0, fileno (TTY_INPUT (tty)), IO$_SENSEMODE, &sg, 0, 0, | 352 | SYS$QIOW (0, fd, IO$_SENSEMODE, &sg, 0, 0, |
| 350 | &sg.class, 12, 0, 0, 0, 0 ); | 353 | &sg.class, 12, 0, 0, 0, 0 ); |
| 351 | emacs_ospeed = sg.xmit_baud; | 354 | emacs_ospeed = sg.xmit_baud; |
| 352 | #else /* not VMS */ | 355 | #else /* not VMS */ |
| @@ -354,7 +357,7 @@ init_baud_rate (struct tty_output *tty) | |||
| 354 | struct termios sg; | 357 | struct termios sg; |
| 355 | 358 | ||
| 356 | sg.c_cflag = B9600; | 359 | sg.c_cflag = B9600; |
| 357 | tcgetattr (fileno (TTY_INPUT (tty)), &sg); | 360 | tcgetattr (fd, &sg); |
| 358 | emacs_ospeed = cfgetospeed (&sg); | 361 | emacs_ospeed = cfgetospeed (&sg); |
| 359 | #if defined (USE_GETOBAUD) && defined (getobaud) | 362 | #if defined (USE_GETOBAUD) && defined (getobaud) |
| 360 | /* m88k-motorola-sysv3 needs this (ghazi@noc.rutgers.edu) 9/1/94. */ | 363 | /* m88k-motorola-sysv3 needs this (ghazi@noc.rutgers.edu) 9/1/94. */ |
| @@ -367,16 +370,16 @@ init_baud_rate (struct tty_output *tty) | |||
| 367 | 370 | ||
| 368 | sg.c_cflag = B9600; | 371 | sg.c_cflag = B9600; |
| 369 | #ifdef HAVE_TCATTR | 372 | #ifdef HAVE_TCATTR |
| 370 | tcgetattr (fileno (TTY_INPUT (tty)), &sg); | 373 | tcgetattr (fd, &sg); |
| 371 | #else | 374 | #else |
| 372 | ioctl (fileno (TTY_INPUT (tty)), TCGETA, &sg); | 375 | ioctl (fd, TCGETA, &sg); |
| 373 | #endif | 376 | #endif |
| 374 | emacs_ospeed = sg.c_cflag & CBAUD; | 377 | emacs_ospeed = sg.c_cflag & CBAUD; |
| 375 | #else /* neither VMS nor TERMIOS nor TERMIO */ | 378 | #else /* neither VMS nor TERMIOS nor TERMIO */ |
| 376 | struct sgttyb sg; | 379 | struct sgttyb sg; |
| 377 | 380 | ||
| 378 | sg.sg_ospeed = B9600; | 381 | sg.sg_ospeed = B9600; |
| 379 | if (ioctl (fileno (TTY_INPUT (tty)), TIOCGETP, &sg) < 0) | 382 | if (ioctl (fd, TIOCGETP, &sg) < 0) |
| 380 | abort (); | 383 | abort (); |
| 381 | emacs_ospeed = sg.sg_ospeed; | 384 | emacs_ospeed = sg.sg_ospeed; |
| 382 | #endif /* not HAVE_TERMIO */ | 385 | #endif /* not HAVE_TERMIO */ |
| @@ -392,6 +395,7 @@ init_baud_rate (struct tty_output *tty) | |||
| 392 | baud_rate = 1200; | 395 | baud_rate = 1200; |
| 393 | } | 396 | } |
| 394 | 397 | ||
| 398 | |||
| 395 | /*ARGSUSED*/ | 399 | /*ARGSUSED*/ |
| 396 | void | 400 | void |
| 397 | set_exclusive_use (fd) | 401 | set_exclusive_use (fd) |
| @@ -976,7 +980,7 @@ request_sigio () | |||
| 976 | } | 980 | } |
| 977 | 981 | ||
| 978 | void | 982 | void |
| 979 | unrequest_sigio (struct tty_output *tty) | 983 | unrequest_sigio () |
| 980 | { | 984 | { |
| 981 | int off = 0; | 985 | int off = 0; |
| 982 | 986 | ||
| @@ -1078,23 +1082,23 @@ int inherited_pgroup; | |||
| 1078 | group, redirect the TTY to point to our own process group. We need | 1082 | group, redirect the TTY to point to our own process group. We need |
| 1079 | to be in our own process group to receive SIGIO properly. */ | 1083 | to be in our own process group to receive SIGIO properly. */ |
| 1080 | void | 1084 | void |
| 1081 | narrow_foreground_group (struct tty_output *tty) | 1085 | narrow_foreground_group (int fd) |
| 1082 | { | 1086 | { |
| 1083 | int me = getpid (); | 1087 | int me = getpid (); |
| 1084 | 1088 | ||
| 1085 | setpgrp (0, inherited_pgroup); | 1089 | setpgrp (0, inherited_pgroup); |
| 1086 | /* XXX This only works on the controlling tty. */ | 1090 | /* XXX This only works on the controlling tty. */ |
| 1087 | if (inherited_pgroup != me) | 1091 | if (inherited_pgroup != me) |
| 1088 | EMACS_SET_TTY_PGRP (fileno (TTY_INPUT (tty)), &me); | 1092 | EMACS_SET_TTY_PGRP (fd, &me); |
| 1089 | setpgrp (0, me); | 1093 | setpgrp (0, me); |
| 1090 | } | 1094 | } |
| 1091 | 1095 | ||
| 1092 | /* Set the tty to our original foreground group. */ | 1096 | /* Set the tty to our original foreground group. */ |
| 1093 | void | 1097 | void |
| 1094 | widen_foreground_group (struct tty_output *tty) | 1098 | widen_foreground_group (int fd) |
| 1095 | { | 1099 | { |
| 1096 | if (inherited_pgroup != getpid ()) | 1100 | if (inherited_pgroup != getpid ()) |
| 1097 | EMACS_SET_TTY_PGRP (fileno (TTY_INPUT (tty)), &inherited_pgroup); | 1101 | EMACS_SET_TTY_PGRP (fd, &inherited_pgroup); |
| 1098 | setpgrp (0, inherited_pgroup); | 1102 | setpgrp (0, inherited_pgroup); |
| 1099 | } | 1103 | } |
| 1100 | 1104 | ||
| @@ -1289,11 +1293,9 @@ static struct tchars new_tchars = {-1,-1,-1,-1,-1,-1}; | |||
| 1289 | void | 1293 | void |
| 1290 | init_all_sys_modes (void) | 1294 | init_all_sys_modes (void) |
| 1291 | { | 1295 | { |
| 1292 | struct tty_output *tty = tty_list; | 1296 | struct tty_output *tty; |
| 1293 | while (tty) { | 1297 | for (tty = tty_list; tty; tty = tty->next) |
| 1294 | init_sys_modes (tty); | 1298 | init_sys_modes (tty); |
| 1295 | tty = tty->next; | ||
| 1296 | } | ||
| 1297 | } | 1299 | } |
| 1298 | 1300 | ||
| 1299 | void | 1301 | void |
| @@ -1358,7 +1360,7 @@ nil means don't delete them until `list-processes' is run. */); | |||
| 1358 | 1360 | ||
| 1359 | #ifdef BSD_PGRPS | 1361 | #ifdef BSD_PGRPS |
| 1360 | if (! read_socket_hook && EQ (Vwindow_system, Qnil)) | 1362 | if (! read_socket_hook && EQ (Vwindow_system, Qnil)) |
| 1361 | narrow_foreground_group (tty_out); | 1363 | narrow_foreground_group (fileno (TTY_INPUT (tty_out))); |
| 1362 | #endif | 1364 | #endif |
| 1363 | 1365 | ||
| 1364 | #ifdef HAVE_WINDOW_SYSTEM | 1366 | #ifdef HAVE_WINDOW_SYSTEM |
| @@ -1683,11 +1685,11 @@ nil means don't delete them until `list-processes' is run. */); | |||
| 1683 | At the time this is called, init_sys_modes has not been done yet. */ | 1685 | At the time this is called, init_sys_modes has not been done yet. */ |
| 1684 | 1686 | ||
| 1685 | int | 1687 | int |
| 1686 | tabs_safe_p (struct tty_output *tty) | 1688 | tabs_safe_p (int fd) |
| 1687 | { | 1689 | { |
| 1688 | struct emacs_tty etty; | 1690 | struct emacs_tty etty; |
| 1689 | 1691 | ||
| 1690 | EMACS_GET_TTY (fileno (TTY_INPUT (tty)), &etty); | 1692 | EMACS_GET_TTY (fd, &etty); |
| 1691 | return EMACS_TTY_TABS_OK (&etty); | 1693 | return EMACS_TTY_TABS_OK (&etty); |
| 1692 | } | 1694 | } |
| 1693 | 1695 | ||
| @@ -1696,9 +1698,7 @@ tabs_safe_p (struct tty_output *tty) | |||
| 1696 | We store 0 if there's no valid information. */ | 1698 | We store 0 if there's no valid information. */ |
| 1697 | 1699 | ||
| 1698 | void | 1700 | void |
| 1699 | get_tty_size (tty_out, widthp, heightp) | 1701 | get_tty_size (int fd, int *widthp, int *heightp) |
| 1700 | struct tty_output *tty_out; | ||
| 1701 | int *widthp, *heightp; | ||
| 1702 | { | 1702 | { |
| 1703 | 1703 | ||
| 1704 | #ifdef TIOCGWINSZ | 1704 | #ifdef TIOCGWINSZ |
| @@ -1706,7 +1706,7 @@ get_tty_size (tty_out, widthp, heightp) | |||
| 1706 | /* BSD-style. */ | 1706 | /* BSD-style. */ |
| 1707 | struct winsize size; | 1707 | struct winsize size; |
| 1708 | 1708 | ||
| 1709 | if (ioctl (fileno (TTY_INPUT (tty_out)), TIOCGWINSZ, &size) == -1) | 1709 | if (ioctl (fd, TIOCGWINSZ, &size) == -1) |
| 1710 | *widthp = *heightp = 0; | 1710 | *widthp = *heightp = 0; |
| 1711 | else | 1711 | else |
| 1712 | { | 1712 | { |
| @@ -1720,7 +1720,7 @@ get_tty_size (tty_out, widthp, heightp) | |||
| 1720 | /* SunOS - style. */ | 1720 | /* SunOS - style. */ |
| 1721 | struct ttysize size; | 1721 | struct ttysize size; |
| 1722 | 1722 | ||
| 1723 | if (ioctl (fileno (TTY_INPUT (tty_out)), TIOCGSIZE, &size) == -1) | 1723 | if (ioctl (fd, TIOCGSIZE, &size) == -1) |
| 1724 | *widthp = *heightp = 0; | 1724 | *widthp = *heightp = 0; |
| 1725 | else | 1725 | else |
| 1726 | { | 1726 | { |
| @@ -1733,7 +1733,7 @@ get_tty_size (tty_out, widthp, heightp) | |||
| 1733 | 1733 | ||
| 1734 | struct sensemode tty; | 1734 | struct sensemode tty; |
| 1735 | 1735 | ||
| 1736 | SYS$QIOW (0, fileno (TTY_INPUT (tty_out)), IO$_SENSEMODE, &tty, 0, 0, | 1736 | SYS$QIOW (0, fd, IO$_SENSEMODE, &tty, 0, 0, |
| 1737 | &tty.class, 12, 0, 0, 0, 0); | 1737 | &tty.class, 12, 0, 0, 0, 0); |
| 1738 | *widthp = tty.scr_wid; | 1738 | *widthp = tty.scr_wid; |
| 1739 | *heightp = tty.scr_len; | 1739 | *heightp = tty.scr_len; |
| @@ -1793,11 +1793,9 @@ set_window_size (fd, height, width) | |||
| 1793 | void | 1793 | void |
| 1794 | reset_all_sys_modes (void) | 1794 | reset_all_sys_modes (void) |
| 1795 | { | 1795 | { |
| 1796 | struct tty_output *tty = tty_list; | 1796 | struct tty_output *tty; |
| 1797 | while (tty) { | 1797 | for (tty = tty_list; tty; tty = tty->next) |
| 1798 | reset_sys_modes (tty); | 1798 | reset_sys_modes (tty); |
| 1799 | tty = tty->next; | ||
| 1800 | } | ||
| 1801 | } | 1799 | } |
| 1802 | 1800 | ||
| 1803 | /* Prepare the terminal for closing it; move the cursor to the | 1801 | /* Prepare the terminal for closing it; move the cursor to the |
| @@ -1889,7 +1887,7 @@ reset_sys_modes (tty_out) | |||
| 1889 | #endif | 1887 | #endif |
| 1890 | 1888 | ||
| 1891 | #ifdef BSD_PGRPS | 1889 | #ifdef BSD_PGRPS |
| 1892 | widen_foreground_group (tty_out); | 1890 | widen_foreground_group (fileno (TTY_INPUT (tty_out))); |
| 1893 | #endif | 1891 | #endif |
| 1894 | } | 1892 | } |
| 1895 | 1893 | ||
diff --git a/src/term.c b/src/term.c index 3b029da0b7f..72698ed3b2c 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -2403,7 +2403,7 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", | |||
| 2403 | /* Get frame size from system, or else from termcap. */ | 2403 | /* Get frame size from system, or else from termcap. */ |
| 2404 | { | 2404 | { |
| 2405 | int height, width; | 2405 | int height, width; |
| 2406 | get_tty_size (tty, &width, &height); | 2406 | get_tty_size (fileno (TTY_INPUT (tty)), &width, &height); |
| 2407 | FrameCols (tty) = width; | 2407 | FrameCols (tty) = width; |
| 2408 | FrameRows (tty) = height; | 2408 | FrameRows (tty) = height; |
| 2409 | } | 2409 | } |
| @@ -2609,7 +2609,7 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", | |||
| 2609 | && tty->TS_end_standout_mode | 2609 | && tty->TS_end_standout_mode |
| 2610 | && !strcmp (tty->TS_standout_mode, tty->TS_end_standout_mode)); | 2610 | && !strcmp (tty->TS_standout_mode, tty->TS_end_standout_mode)); |
| 2611 | 2611 | ||
| 2612 | UseTabs (tty) = tabs_safe_p (tty) && TabWidth (tty) == 8; | 2612 | UseTabs (tty) = tabs_safe_p (fileno (TTY_INPUT (tty))) && TabWidth (tty) == 8; |
| 2613 | 2613 | ||
| 2614 | TTY_SCROLL_REGION_OK (tty) | 2614 | TTY_SCROLL_REGION_OK (tty) |
| 2615 | = (tty->Wcm->cm_abs | 2615 | = (tty->Wcm->cm_abs |
| @@ -2628,7 +2628,7 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", | |||
| 2628 | 2628 | ||
| 2629 | TTY_FAST_CLEAR_END_OF_LINE (tty) = tty->TS_clr_line != 0; | 2629 | TTY_FAST_CLEAR_END_OF_LINE (tty) = tty->TS_clr_line != 0; |
| 2630 | 2630 | ||
| 2631 | init_baud_rate (tty); | 2631 | init_baud_rate (fileno (TTY_INPUT (tty))); |
| 2632 | if (read_socket_hook) /* Baudrate is somewhat | 2632 | if (read_socket_hook) /* Baudrate is somewhat |
| 2633 | meaningless in this case */ | 2633 | meaningless in this case */ |
| 2634 | baud_rate = 9600; | 2634 | baud_rate = 9600; |
| @@ -2737,7 +2737,7 @@ delete_tty (struct tty_output *tty) | |||
| 2737 | 2737 | ||
| 2738 | if (tty->input) | 2738 | if (tty->input) |
| 2739 | fclose (tty->input); | 2739 | fclose (tty->input); |
| 2740 | if (tty->output) | 2740 | if (tty->output && tty->output != tty->input) |
| 2741 | fclose (tty->output); | 2741 | fclose (tty->output); |
| 2742 | if (tty->termscript) | 2742 | if (tty->termscript) |
| 2743 | fclose (tty->termscript); | 2743 | fclose (tty->termscript); |
| @@ -2745,10 +2745,8 @@ delete_tty (struct tty_output *tty) | |||
| 2745 | if (tty->old_tty) | 2745 | if (tty->old_tty) |
| 2746 | xfree (tty->old_tty); | 2746 | xfree (tty->old_tty); |
| 2747 | 2747 | ||
| 2748 | #if 0 /* XXX There is a dangling reference somewhere into this. */ | ||
| 2749 | if (tty->Wcm) | 2748 | if (tty->Wcm) |
| 2750 | xfree (tty->Wcm); | 2749 | xfree (tty->Wcm); |
| 2751 | #endif | ||
| 2752 | 2750 | ||
| 2753 | bzero (tty, sizeof (struct tty_output)); | 2751 | bzero (tty, sizeof (struct tty_output)); |
| 2754 | xfree (tty); | 2752 | xfree (tty); |