File tree 2 files changed +19
-2
lines changed
2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -272,12 +272,28 @@ static void Close_Stdio(void)
272
272
**
273
273
***********************************************************************/
274
274
{
275
+ #ifdef TIOCGWINSZ
275
276
struct winsize w ;
276
- ioctl (STDOUT_FILENO , TIOCGWINSZ , & w );
277
+ if (ioctl (Std_Out , TIOCGWINSZ , & w ) != 0 ) {
278
+ req -> error = errno ;
279
+ return DR_ERROR ;
280
+ }
277
281
req -> console .window_rows =
278
282
req -> console .buffer_rows = w .ws_row ;
279
283
req -> console .window_cols =
280
284
req -> console .buffer_cols = w .ws_col ;
285
+ #else
286
+ #ifdef WIOCGETD
287
+ struct uwdata w ;
288
+ if (ioctl (Std_Out , WIOCGETD , & w ) != 0 ) {
289
+ req -> error = errno ;
290
+ return DR_ERROR ;
291
+ }
292
+ req -> console .window_rows =
293
+ req -> console .buffer_rows = w .uw_height / w .uw_vs ;
294
+ req -> console .window_cols =
295
+ req -> console .buffer_cols = w .uw_width / w .uw_hs ;
296
+ #endif
281
297
return DR_DONE ;
282
298
}
283
299
Original file line number Diff line number Diff line change @@ -24,7 +24,8 @@ Rebol [
24
24
--test-- "query input port"
25
25
--assert port? system/ports/input
26
26
--assert object? console-info: query system/ports/input
27
- ?? console-info
27
+ --assert pair? try [console-info/window-size ]
28
+ ;?? console-info
28
29
===end-group===
29
30
30
31
~~~end-file~~~
You can’t perform that action at this time.
0 commit comments