+/* Set the logical window size associated with descriptor FD
+ to HEIGHT and WIDTH. This is used mainly with ptys. */
+
+int
+set_window_size (fd, height, width)
+ int fd, height, width;
+{
+#ifdef TIOCSWINSZ
+
+ /* BSD-style. */
+ struct winsize size;
+ size.ws_row = height;
+ size.ws_col = width;
+
+ if (ioctl (fd, TIOCSWINSZ, &size) == -1)
+ return 0; /* error */
+ else
+ return 1;
+
+#else
+#ifdef TIOCSSIZE
+
+ /* SunOS - style. */
+ struct ttysize size;
+ size.ts_lines = height;
+ size.ts_cols = width;
+
+ if (ioctl (fd, TIOCGSIZE, &size) == -1)
+ return 0;
+ else
+ return 1;
+#else
+ return -1;
+#endif /* not SunOS-style */
+#endif /* not BSD-style */
+}
+