<feed xmlns='http://www.w3.org/2005/Atom'>
<title>busybox-w32/win32/termios.c, branch long_paths</title>
<subtitle>A mirror of https://github.com/rmyorston/busybox-w32.git
</subtitle>
<id>https://git.lua4.win/busybox-w32/atom?h=long_paths</id>
<link rel='self' href='https://git.lua4.win/busybox-w32/atom?h=long_paths'/>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/'/>
<updated>2025-07-25T07:55:06+00:00</updated>
<entry>
<title>stty: enable a minimal Windows implementation</title>
<updated>2025-07-25T07:55:06+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2025-07-25T07:55:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=1354c47894a71699ec1fd0086644627a621250ce'/>
<id>urn:sha1:1354c47894a71699ec1fd0086644627a621250ce</id>
<content type='text'>
Implement a minimal stty applet for Windows.

- Display and set terminal rows and columns

- Enable/disable raw/cooked mode

- Enable/disable echo mode

- Implement 'stty sane' to reset raw/cooked/echo

Adds 2120-2304 bytes.

(GitHub issue #58)
</content>
</entry>
<entry>
<title>win32: don't crash the console *and* handle CJK input</title>
<updated>2023-07-02T07:09:05+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2023-07-02T07:09:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=532706d17698b48e68bdbf8905c7d700f181488f'/>
<id>urn:sha1:532706d17698b48e68bdbf8905c7d700f181488f</id>
<content type='text'>
The previous commit prevented the console from crashing with a
UTF8 input code page on Windows 10/11 in the default configuration.
But it broke input in CJK code pages.  Again.

Handle both cases.

Costs 36-72 bytes.

(GitHub issue #335)
</content>
</entry>
<entry>
<title>win32: revert to previous console input method by default</title>
<updated>2023-07-01T11:52:24+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2023-07-01T11:52:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=b5248881cd0d0bd6aa49fdef742d847aed6866b6'/>
<id>urn:sha1:b5248881cd0d0bd6aa49fdef742d847aed6866b6</id>
<content type='text'>
Although the input method used for euro support is no longer
required for that reason it does provide a more lightweight
workaround for the problem with ReadConsoleInputA and UTF8.

Repurpose FEATURE_EURO_INPUT as FEATURE_UTF8_INPUT.
</content>
</entry>
<entry>
<title>win32: code shrink readConsoleInput_utf8</title>
<updated>2023-07-01T11:52:24+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2023-07-01T11:52:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=40217f5588a34d9ddf456307bcd79ce3ef8af2c0'/>
<id>urn:sha1:40217f5588a34d9ddf456307bcd79ce3ef8af2c0</id>
<content type='text'>
Move decision about how to read console input from windows_read_key()
to readConsoleInput_utf8().

Saves 48-64 bytes.
</content>
</entry>
<entry>
<title>win32: the great UTF8 ReadConsoleInput hack</title>
<updated>2023-06-28T15:08:00+00:00</updated>
<author>
<name>Avi Halachmi (:avih)</name>
<email>avihpit@yahoo.com</email>
</author>
<published>2023-06-24T22:42:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=1602a45b797908025dc71e6a07149a39fdb12a48'/>
<id>urn:sha1:1602a45b797908025dc71e6a07149a39fdb12a48</id>
<content type='text'>
Since commit 597d31ee (EURO_INPUT), ReadConsoleInputA is the default.

The main problem with that is that if the console codepage is UTF8,
e.g. after "chcp 65001", then typing or pasting can result in a crash
of the console itself (the Windows Terminal or cmd.exe window closes).

Additionally and regardless of this crash, ReadConsoleInputA is
apparently buggy with UTF8 CP also otherwise.

For instance, on Windows 7 only ASCII values work - others become '?'.
Or sometimes in Windows 10 (cmd.exe console but not Windows terminal)
only key-up events arrive for some non-ASCII codepoints (without
a prior key-down), and more.

So this commit implements readConsoleInput_utf8 which delivers UTF8
Regardless of CP, including of surrogate pairs, and works on win 7/10.

Other than fixing the crash and working much better with UTF8 console
CP, it also allows a build with the UTF8 manifest to capture correctly
arbitrary unicode inputs which are typed or pasted into the console
regardless of the console CP.

However, it doesn't look OK unless the console CP is set to UTF8
(which we don't do automatically, but the user can chcp 65001),
and editing is still lacking due to missing screen-length awareness.

To reproduce the crash: start a new console window, 'chcp 65001', run
this program (or busybox sh), and paste "ಀ" or "😀" (U+0C80, U+1F600)

  #include &lt;windows.h&gt;

  int main() {
      HANDLE h = GetStdHandle(STD_INPUT_HANDLE);
      INPUT_RECORD r;
      DWORD n;

      while (ReadConsoleInputA(h, &amp;r, 1, &amp;n)) /* NOP */;
      return 0;
  }
</content>
</entry>
<entry>
<title>win32: don't assume console CP equals OEM CP</title>
<updated>2023-06-28T14:10:49+00:00</updated>
<author>
<name>Avi Halachmi (:avih)</name>
<email>avihpit@yahoo.com</email>
</author>
<published>2023-06-28T14:10:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=ebe80f3e5c9b612f4d1b6e444c9badc10f9f2745'/>
<id>urn:sha1:ebe80f3e5c9b612f4d1b6e444c9badc10f9f2745</id>
<content type='text'>
Previously, console input was converted to the ANSI codepage using
OemToChar[Buff], and ANSI to console conversion used CharToOem[Buff].

However, while typically true by default, it's not guaranteed that
the console CP is the same as the OEM CP.

Now the code uses the console input/output CP as appropriate instead
of the OEM CP.  It uses full wide-char conversion code, which was
previously limited to FEATURE_EURO, and now may be used also otherwise.

While at it, the code now bypasses the conversion altogether if the
src/dst CPs happen to be identical - which can definitely happen.

Other than saving some CPU cycles, this also happens to fix an issue
with the UTF8 manifest (in both input and output), because apparently
the Oem/Char conversion APIs fail to convert one char at a time (which
is not a complete UTF8 codepoint sequence) even if both the OEM and
the ANSI CPs are UTF8 (as is the case when using UTF8 manifest).

Conversion is also skipped:

- if the converted output would be longer than the input;

- if the input length is 1 and the input is multi-byte.
</content>
</entry>
<entry>
<title>win32: make support for euro input a separate option</title>
<updated>2023-06-22T16:12:25+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2023-06-22T16:12:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=597d31eefb4a41abcf2d3c300c2b910b11a9f98c'/>
<id>urn:sha1:597d31eefb4a41abcf2d3c300c2b910b11a9f98c</id>
<content type='text'>
Commit 93a63809f (win32: add support for the euro currency symbol)
made various changes to enable support for the euro symbol.

One of these changes allows the euro to be entered from the console
even if the current code page doesn't support it.  This is probably
of limited use:  the symbol can be entered but won't be displayed
correctly.

Move this capability into a separate configuration option,
FEATURE_EURO_INPUT, which is disabled by default.

Saves 48-64 bytes in the new default case.

(GitHub issue #335)
</content>
</entry>
<entry>
<title>win32: virtual terminal input fixes</title>
<updated>2023-03-06T12:25:39+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2023-03-06T12:25:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=b50470de96320425adbed82129bdb7f7f5263ddb'/>
<id>urn:sha1:b50470de96320425adbed82129bdb7f7f5263ddb</id>
<content type='text'>
- Disable ENABLE_PROCESSED_INPUT in raw mode.  Otherwise ^C isn't
  immediately detected during shell command line editing with
  virtual terminal input enabled.

- Switch read_key()/unix_readkey() to windows_read_key()/read_key().
  This allows the shell `read` builtin to use windows_read_key().
  Without this change `read` fails when virtual terminal input is
  enabled.
</content>
</entry>
<entry>
<title>win32: enable Unix read_key() for virtual terminal</title>
<updated>2023-03-05T12:33:01+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2023-03-05T12:33:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=9aef4d4d298987437e33bf25bcddd16175148d45'/>
<id>urn:sha1:9aef4d4d298987437e33bf25bcddd16175148d45</id>
<content type='text'>
Until now busybox-w32 has used a native Windows implementation
of read_key().  Build the upstream Unix implementation and use
it instead of the native version when virtual terminal input
mode is enabled.
</content>
</entry>
<entry>
<title>win32: add virtual terminal support to termios(3)</title>
<updated>2023-03-05T12:32:15+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2023-03-05T12:32:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=4020c7689c3f640e8a56edd1a1491403112857ec'/>
<id>urn:sha1:4020c7689c3f640e8a56edd1a1491403112857ec</id>
<content type='text'>
Modify `struct termios` to support Windows virtual terminals.
Native console mode flags replace the Unix `c_?flag` structure
members.  Remove unsupported flags from termios.h.

Add implementations of tcgetattr(3)/tcsetattr(3) to get/set console
flags when virtual terminal input mode is enabled.

Add support for emulating raw mode to get_termios_and_make_raw().
This (and related functions) are exposed but not yet used.
</content>
</entry>
</feed>
