[PATCH] Reworks for console code

Takashi Yano takashi.yano@nifty.ne.jp
Sun Mar 31 06:20:00 GMT 2019


Hi,

I would like to propose 3 patches attached to improve console code.

Patch 0001:
This revises console code for better color handling. This provides
24 bit color support for Windows 10 build 14931 or later. For legacy
console, fake 24 bit color support is implemented, which use the
nearest color from 16 system colors.

To check the color handling, use:
https://gist.github.com/hSATAC/1095100

Results are at:
http://tyan0.dip.jp/cgi-bin/FSWiki/wiki.cgi?page=24+bit+color+support+for+cygwin+console

Patch 0002:
Previously, select() would return by typing only one key even in
canonical mode. With this patch, it returns after one line is
completed.

To check this behaviour, use attached STC (confirm-select.c) and
type something and [Enter]. Type ^D to exit from the STC.

Expected result:
This is one line.
select() returns 1
read() returns 18
54, 68, 69, 73, 20, 69, 73, 20, 6f, 6e, 65, 20, 6c, 69, 6e, 65, 2e, 0a,
select() returns 1
read() returns 0

Cygwin current version:
select() returns 1
This is one line.
read() returns 18
54, 68, 69, 73, 20, 69, 73, 20, 6f, 6e, 65, 20, 6c, 69, 6e, 65, 2e, 0a,
select() returns 1
read() returns 0

Patch 0003:
POSIX states I/O functions shall be thread-safe, however, cygwin
console I/O functions were not. This patch makes console I/O
functions thread-safe.

To check this, use attached STC (confirm-thread-safe.c).
Expected resut is red 'A's at the first 12 lines and green 'B's
at the second 12 lines. However, the result is completely broken
in current cygwin.

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Cygwin-console-support-24-bit-color.patch
Type: application/octet-stream
Size: 15036 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20190331/37335d4a/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Cygwin-console-fix-select-behaviour.patch
Type: application/octet-stream
Size: 30005 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20190331/37335d4a/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Cygwin-console-Make-I-O-functions-thread-safe.patch
Type: application/octet-stream
Size: 13173 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20190331/37335d4a/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: confirm-select.c
Type: text/x-csrc
Size: 540 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20190331/37335d4a/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: confirm-thread-safe.c
Type: text/x-csrc
Size: 821 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20190331/37335d4a/attachment-0001.bin>


More information about the Cygwin-patches mailing list