Hello the guy from https://luxferre.top and gopher://hoi.st
has pretty interesting stuff, such as
[ shell specific or other tries to emulate some getchar function ]
Could it be possible to implement a true portable getchar?
On 25.03.2025 10:51, anthk wrote:
Hello the guy from https://luxferre.top and gopher://hoi.st
has pretty interesting stuff, such as
[ shell specific or other tries to emulate some getchar function ]
Could it be possible to implement a true portable getchar?
Those who think that getchar is a useful function may implement that
natively in Awk. (It avoids external dependencies and all the issues
that the posted/quoted code has made obvious.)
On 3/25/25 7:10 AM, Janis Papanagnou wrote:
On 25.03.2025 10:51, anthk wrote:
Hello the guy from https://luxferre.top and gopher://hoi.st
has pretty interesting stuff, such as
[ shell specific or other tries to emulate some getchar function ]
Could it be possible to implement a true portable getchar?
Those who think that getchar is a useful function may implement that
natively in Awk. (It avoids external dependencies and all the issues
that the posted/quoted code has made obvious.)
I know you can iterate over input strings a character at a time in AWK
but I don't think you can read a single character from stdin without
also providing a newline via ENTER, which is perhaps what the OP was
actually wanting to do?
On 3/25/25 7:10 AM, Janis Papanagnou wrote:
On 25.03.2025 10:51, anthk wrote:
Hello the guy from https://luxferre.top and gopher://hoi.st
has pretty interesting stuff, such as
[ shell specific or other tries to emulate some getchar function ]
Could it be possible to implement a true portable getchar?
Those who think that getchar is a useful function may implement that
natively in Awk. (It avoids external dependencies and all the issues
that the posted/quoted code has made obvious.)
I know you can iterate over input strings a character at a time in AWK
but I don't think you can read a single character from stdin without
also providing a newline via ENTER, which is perhaps what the OP was
actually wanting to do?
[...]
I don't know. - When I read 'getchar' I associated a character oriented >function like awk's 'getline'. That would mean not reading from stdin
with some I/O buffered return-terminated input but just processing the
data as Awk would read its input from stdin or using 'getline' would.
You need to maintain some state, though; here the actual read in line
which acts like a buffer in buffered OS reads.
that what most of the posters on the thread are talking about is something more akin to getch() - which is what I assumed in my two posted solutions.
| Sysop: | DaiTengu |
|---|---|
| Location: | Appleton, WI |
| Users: | 1,089 |
| Nodes: | 10 (0 / 10) |
| Uptime: | 153:56:38 |
| Calls: | 13,921 |
| Calls today: | 2 |
| Files: | 187,021 |
| D/L today: |
3,765 files (946M bytes) |
| Messages: | 2,457,163 |