Branch: Tag:

2020-02-26

2020-02-26 15:49:19 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.File: Added tcdrain() and tcsetsize().

It is now possible to set the window size for a pty or other terminal.

Also adds documentation for them as well as tcflush() and tcsendbreak(),
and moves it and the documentation for tc{get,set}attr() from Stdio.File
to Stdio.Fd.

Also some fixes to make the code work on systems with <sys/termios.h>
but no <termios.h>, and preparation to make some of it work on NT.

Fixes some of #10013.

166:   FILE_FUNC("grantpt",file_grantpt, tFunc(tNone,tStr))   #endif    - #if defined(HAVE_TERMIOS_H) + /* From termios.c */ + #if defined(HAVE_TERMIOS_H) || defined(HAVE_SYS_TERMIOS_H)   /* function(void:mapping) */   FILE_FUNC("tcgetattr",file_tcgetattr, tFunc(tNone,tMapping)) - /* function(mapping,void|string:int) */ - FILE_FUNC("tcsetattr",file_tcsetattr, tFunc(tMapping tOr(tVoid,tStr),tInt)) - /* function(int:int) */ - FILE_FUNC("tcsendbreak",file_tcsendbreak, tFunc(tInt,tInt)) - /* function(void:string) */ - FILE_FUNC("tcflush",file_tcflush, tFunc(tNone,tStr)) - /* FILE_FUNC("tcdrain",file_tcdrain,"function(void:int)"); */ + /* function(mapping, void|string: int(0..1)) */ + FILE_FUNC("tcsetattr", file_tcsetattr, tFunc(tMapping tOr(tVoid, tStr), tInt01)) + /* function(int: int(0..1)) */ + FILE_FUNC("tcsendbreak", file_tcsendbreak, tFunc(tInt, tInt01)) + /* function(void|string: int(0..1)) */ + FILE_FUNC("tcflush", file_tcflush, tFunc(tOr(tVoid, tStr), tInt01)) + FILE_FUNC("tcdrain", file_tcdrain, tFunc(tNone, tInt01))   /* FILE_FUNC("tcflow",file_tcflow,"function(string:int)"); */   /* FILE_FUNC("tcgetpgrp",file_tcgetpgrp,"function(void:int)"); */   /* FILE_FUNC("tcsetpgrp",file_tcsetpgrp,"function(int:int)"); */ -  + #ifdef TIOCSWINSZ + FILE_FUNC("tcsetsize", file_tcsetsize, tFunc(tIntPos tIntPos, tInt01))   #endif -  + #endif      #ifdef SO_KEEPALIVE   /* function(int:int) */