comparison src/sysdep.c @ 6829:684201f9fa7f

(set_window_size): New function.
author Richard M. Stallman <rms@gnu.org>
date Tue, 12 Apr 1994 15:08:30 +0000
parents 1f45c2d4ff2c
children 4b8dc0a39b47
comparison
equal deleted inserted replaced
6828:cccf812ed4f2 6829:684201f9fa7f
1369 struct emacs_tty tty; 1369 struct emacs_tty tty;
1370 1370
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
1379 get_frame_size (widthp, heightp) 1379 get_frame_size (widthp, heightp)
1380 int *widthp, *heightp; 1380 int *widthp, *heightp;
1381 { 1381 {
1382 1382
1425 *widthp = 0; 1425 *widthp = 0;
1426 *heightp = 0; 1426 *heightp = 0;
1427 #endif 1427 #endif
1428 1428
1429 #endif /* not VMS */ 1429 #endif /* not VMS */
1430 #endif /* not SunOS-style */
1431 #endif /* not BSD-style */
1432 }
1433
1434 /* Set the logical window size associated with descriptor FD
1435 to HEIGHT and WIDTH. This is used mainly with ptys. */
1436
1437 int
1438 set_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;
1430 #endif /* not SunOS-style */ 1467 #endif /* not SunOS-style */
1431 #endif /* not BSD-style */ 1468 #endif /* not BSD-style */
1432 } 1469 }
1433 1470
1434 1471