mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-07 03:38:31 +00:00
Improve Windows Console I/O
- Blocking read operations on the Windows Console can now EINTR - Blocking read operations on Windows pipes now EINTR more reliably - setitimer() will no longer be inherited across fork() on Windows - It's now possible to use ECHO when the console is in raw mode - The ECHOCTL flag now works correctly on the Windows Console - The ICRNL flag now works correctly on the Windows Console - pread() and pwrite() will now raise ESPIPE on Windows - Opening /dev/tty on Windows is improved (untested) - Overlapped I/O is now implemented in a better way
This commit is contained in:
parent
decf216655
commit
33d280c8ba
34 changed files with 580 additions and 376 deletions
|
@ -30,6 +30,9 @@
|
|||
* The returned memory is owned by the stream. It'll be reused when
|
||||
* fgetln() is called again. It's free()'d upon fclose() / fflush()
|
||||
*
|
||||
* When reading from the console on Windows in `ICANON` mode, the
|
||||
* returned line will end with `\r\n` rather than `\n`.
|
||||
*
|
||||
* @param stream specifies non-null open input stream
|
||||
* @param len optionally receives byte length of line
|
||||
* @return nul-terminated line string, including the `\n` character
|
||||
|
|
|
@ -26,6 +26,9 @@
|
|||
* exceeding size. The line ending marker is included and may be removed
|
||||
* using _chomp().
|
||||
*
|
||||
* When reading from the console on Windows in `ICANON` mode, the
|
||||
* returned line will end with `\r\n` rather than `\n`.
|
||||
*
|
||||
* @param s is output buffer
|
||||
* @param size is capacity of s
|
||||
* @param f is non-null file object stream pointer
|
||||
|
|
|
@ -33,13 +33,16 @@
|
|||
* documentation. Concerning lines, please note the \n or \r\n are
|
||||
* included in results, and can be removed with _chomp().
|
||||
*
|
||||
* @param line is the caller's buffer (in/out) which is extended
|
||||
* automatically. *line may be NULL but only if *n is 0;
|
||||
* When reading from the console on Windows in `ICANON` mode, the
|
||||
* returned line will end with `\r\n` rather than `\n`.
|
||||
*
|
||||
* @param linebuf is the caller's buffer (in/out) which is extended
|
||||
* automatically. *line may be NULL but only if *capacity is 0;
|
||||
* NUL-termination is guaranteed FTMP
|
||||
* @return number of bytes read, including delim, excluding NUL, or -1
|
||||
* w/ errno on EOF or error; see ferror() and feof()
|
||||
* @see fgetln(), xgetline(), getdelim(), gettok_r()
|
||||
*/
|
||||
ssize_t getline(char **line, size_t *n, FILE *f) {
|
||||
return getdelim(line, n, '\n', f);
|
||||
ssize_t getline(char **linebuf, size_t *capacity, FILE *f) {
|
||||
return getdelim(linebuf, capacity, '\n', f);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue