aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1994-04-12 15:08:30 +0000
committerRichard M. Stallman1994-04-12 15:08:30 +0000
commit73d5358fb91d80ebe3cb39d5193c3ed5f335165a (patch)
tree5a82910a1ad13d2fcdf640b98dc855c43cc16dc2 /src
parent86c57d9f8c40c79c7718154d1bd71e397b1f3b0b (diff)
downloademacs-73d5358fb91d80ebe3cb39d5193c3ed5f335165a.tar.gz
emacs-73d5358fb91d80ebe3cb39d5193c3ed5f335165a.zip
(set_window_size): New function.
Diffstat (limited to 'src')
-rw-r--r--src/sysdep.c43
1 files changed, 40 insertions, 3 deletions
diff --git a/src/sysdep.c b/src/sysdep.c
index 9b5ee10749c..3de75eb6dc6 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -1371,10 +1371,10 @@ tabs_safe_p ()
1371 EMACS_GET_TTY (input_fd, &tty); 1371 EMACS_GET_TTY (input_fd, &tty);
1372 return EMACS_TTY_TABS_OK (&tty); 1372 return EMACS_TTY_TABS_OK (&tty);
1373} 1373}
1374 1374
1375/* Get terminal size from system. 1375/* Get terminal size from system.
1376 Store number of lines into *heightp and width into *widthp. 1376 Store number of lines into *HEIGHTP and width into *WIDTHP.
1377 If zero or a negative number is stored, the value is not valid. */ 1377 We store 0 if there's no valid information. */
1378 1378
1379get_frame_size (widthp, heightp) 1379get_frame_size (widthp, heightp)
1380 int *widthp, *heightp; 1380 int *widthp, *heightp;
@@ -1431,6 +1431,43 @@ get_frame_size (widthp, heightp)
1431#endif /* not BSD-style */ 1431#endif /* not BSD-style */
1432} 1432}
1433 1433
1434/* Set the logical window size associated with descriptor FD
1435 to HEIGHT and WIDTH. This is used mainly with ptys. */
1436
1437int
1438set_window_size (fd, height, width)
1439 int fd, height, width;
1440{
1441#ifdef TIOCSWINSZ
1442
1443 /* BSD-style. */
1444 struct winsize size;
1445 size.ws_row = height;
1446 size.ws_col = width;
1447
1448 if (ioctl (fd, TIOCSWINSZ, &size) == -1)
1449 return 0; /* error */
1450 else
1451 return 1;
1452
1453#else
1454#ifdef TIOCSSIZE
1455
1456 /* SunOS - style. */
1457 struct ttysize size;
1458 size.ts_lines = height;
1459 size.ts_cols = width;
1460
1461 if (ioctl (fd, TIOCGSIZE, &size) == -1)
1462 return 0;
1463 else
1464 return 1;
1465#else
1466 return -1;
1467#endif /* not SunOS-style */
1468#endif /* not BSD-style */
1469}
1470
1434 1471
1435/* Prepare the terminal for exiting Emacs; move the cursor to the 1472/* Prepare the terminal for exiting Emacs; move the cursor to the
1436 bottom of the frame, turn off interrupt-driven I/O, etc. */ 1473 bottom of the frame, turn off interrupt-driven I/O, etc. */