Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Parsing multi-byte keystrokes

182 views
Skip to first unread message

R.Wieser

unread,
Jun 25, 2023, 1:45:54 PM6/25/23
to
Hello all,

I've set the console input to raw so I can see keys coming in when they are
pressed.

For that I've been writing a big "switch ... case" to parse the multi-byte
keystrokes into "records" that than can be easily worked with or discarded.

As this parsing needs to be done by pretty-much every console-based program
which wants to do any kind of interactive stuff I was wondering if this
perhaps is already part of Linux ...

If it is (and thats still a big "if"), where can I find it ?

Second question : How do I check for modifier keys (like alt, shift, ctrl)
on the pressed keys or seperatily ? I would like to be able to, as an
example, catch a ctrl-cursor-left as well as a normal or a shift-curor-left.

Regards,
Rudy Wieser


Alf P. Steinbach

unread,
Jun 25, 2023, 2:34:41 PM6/25/23
to
On 2023-06-25 7:45 PM, R.Wieser wrote:
> Hello all,
>
> I've set the console input to raw so I can see keys coming in when they are
> pressed.
>
> For that I've been writing a big "switch ... case" to parse the multi-byte
> keystrokes into "records" that than can be easily worked with or discarded.
>
> As this parsing needs to be done by pretty-much every console-based program
> which wants to do any kind of interactive stuff I was wondering if this
> perhaps is already part of Linux ...
>
> If it is (and thats still a big "if"), where can I find it ?

curses library

R.Wieser

unread,
Jun 25, 2023, 3:40:09 PM6/25/23
to
Alf,

>> If it is (and thats still a big "if"), where can I find it ?
>
> curses library

Thats was the first thing I checked for, but it does not seem to be part of
my "bullseye lite" installation ...

But assuming I go and install it, its "man" page shows that it has got quite
a number of functions. Any suggestions to where to look how to use it for
what I described ?

Regards,
Rudy Wieser


Keith Thompson

unread,
Jun 25, 2023, 6:06:47 PM6/25/23
to
"Alf P. Steinbach" <alf.p.s...@gmail.com> writes:
> On 2023-06-25 7:45 PM, R.Wieser wrote:
>> Hello all,
>>
>> I've set the console input to raw so I can see keys coming in when
>> they are pressed.
>>
>> For that I've been writing a big "switch ... case" to parse the
>> multi-byte keystrokes into "records" that than can be easily worked
>> with or discarded.
>>
>> As this parsing needs to be done by pretty-much every console-based
>> program which wants to do any kind of interactive stuff I was
>> wondering if this perhaps is already part of Linux ...
>>
>> If it is (and thats still a big "if"), where can I find it ?
>
> curses library

curses takes over the entire (text / terminal) screen, keeping track
of what character is shown at each location and using minimal output to
update it as needed.

If that's what you want, that's great, but as far as I can tell curses
is not suitable for, for example, detecting the user pressing an arrow
key *without* controlling the whole screen.

The GNU readline library may be closer, but it's at a higher level; it
handles things like arrow key input, but it doesn't give you information
like "the user just pressed up-arrow". In the past, I've tried and
failed to find a library that gives access to that kind of information.
(The terminfo database gives you the character sequences corresponding
to the various keys, but I don't think it provides code to detect them
on input.)

--
Keith Thompson (The_Other_Keith) Keith.S.T...@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

Pavel

unread,
Jun 25, 2023, 6:40:07 PM6/25/23
to
R.Wieser wrote:
> Hello all,
>
> I've set the console input to raw so I can see keys coming in when they are
> pressed.
>
> For that I've been writing a big "switch ... case" to parse the multi-byte
> keystrokes into "records" that than can be easily worked with or discarded.
>
> As this parsing needs to be done by pretty-much every console-based program
> which wants to do any kind of interactive stuff I was wondering if this
> perhaps is already part of Linux ...
>
> If it is (and thats still a big "if"), where can I find it ?

On Linux (strictly speaking, on a GNU system) specifically, try readline
function.

AFAIK, it is available everywhere bash is so your system should already
have it. Try "man readline".


>
> Second question : How do I check for modifier keys (like alt, shift, ctrl)
> on the pressed keys or seperatily ? I would like to be able to, as an
> example, catch a ctrl-cursor-left as well as a normal or a shift-curor-left.
>
> Regards,
> Rudy Wieser
>
>

HTH
-Pavel

Scott Lurndal

unread,
Jun 25, 2023, 7:21:05 PM6/25/23
to
"R.Wieser" <add...@is.invalid> writes:
>Hello all,
>
>I've set the console input to raw so I can see keys coming in when they are
>pressed.
>
>For that I've been writing a big "switch ... case" to parse the multi-byte
>keystrokes into "records" that than can be easily worked with or discarded.
>
>As this parsing needs to be done by pretty-much every console-based program
>which wants to do any kind of interactive stuff I was wondering if this
>perhaps is already part of Linux ...
>
>If it is (and thats still a big "if"), where can I find it ?

$ man console_ioctl

Ben Bacarisse

unread,
Jun 25, 2023, 7:53:41 PM6/25/23
to
Pavel <pauldont...@removeyourself.dontspam.yahoo> writes:

> R.Wieser wrote:
>> Hello all,
>> I've set the console input to raw so I can see keys coming in when they
>> are
>> pressed.
>> For that I've been writing a big "switch ... case" to parse the
>> multi-byte
>> keystrokes into "records" that than can be easily worked with or discarded.
>> As this parsing needs to be done by pretty-much every console-based
>> program
>> which wants to do any kind of interactive stuff I was wondering if this
>> perhaps is already part of Linux ...
>> If it is (and thats still a big "if"), where can I find it ?
>
> On Linux (strictly speaking, on a GNU system) specifically, try readline
> function.
>
> AFAIK, it is available everywhere bash is so your system should already
> have it. Try "man readline".

I don't know if it's what's wanted but the rlwrap program is not as well
know as it should be. Essentially it "wraps" any interactive program
with a readline-driven editing, completion and history interface.

--
Ben.

Keith Thompson

unread,
Jun 25, 2023, 8:10:26 PM6/25/23
to
sc...@slp53.sl.home (Scott Lurndal) writes:
I believe that only applies to the Linux system console (the text-only
interface you typically get by typing Ctrl-Alt-N, where N is a small
integer). I know the OP wrote "console", but I suspect they're looking
for something that works on a terminal emulator.

Pavel

unread,
Jun 25, 2023, 8:18:39 PM6/25/23
to
Keith Thompson wrote:
> "Alf P. Steinbach" <alf.p.s...@gmail.com> writes:
>> On 2023-06-25 7:45 PM, R.Wieser wrote:
>>> Hello all,
>>>
>>> I've set the console input to raw so I can see keys coming in when
>>> they are pressed.
>>>
>>> For that I've been writing a big "switch ... case" to parse the
>>> multi-byte keystrokes into "records" that than can be easily worked
>>> with or discarded.
>>>
>>> As this parsing needs to be done by pretty-much every console-based
>>> program which wants to do any kind of interactive stuff I was
>>> wondering if this perhaps is already part of Linux ...
>>>
>>> If it is (and thats still a big "if"), where can I find it ?
>>
>> curses library
>
> curses takes over the entire (text / terminal) screen, keeping track
> of what character is shown at each location and using minimal output to
> update it as needed.
>
> If that's what you want, that's great, but as far as I can tell curses
> is not suitable for, for example, detecting the user pressing an arrow
> key *without* controlling the whole screen.
>
> The GNU readline library may be closer, but it's at a higher level; it
> handles things like arrow key input, but it doesn't give you information
> like "the user just pressed up-arrow". In the past, I've tried and
> failed to find a library that gives access to that kind of information.

These codes are terminal-specific but basic things like up-arrww are
more or less standardized in ANSI terminal.

Unsure if this is what you were looking for, but works for me:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <readline/readline.h>

int
up_callback(int count, int key) {
printf ("the user just pressed up-arrow\n");
return 0;
}

int
main(int argc, char *argv[])
{
rl_bind_keyseq ("\\e[A", up_callback);
free(readline("press a button > "));

printf("\n");

return 0;
}

> (The terminfo database gives you the character sequences corresponding
> to the various keys, but I don't think it provides code to detect them
> on input.)
>

HTH
-Pavel

Keith Thompson

unread,
Jun 25, 2023, 10:11:01 PM6/25/23
to
These days, yes, mostly. Termcap, terminfo, and [n]curses were
developed when there were a wide variety of terminals (not just
emulators) with incompatible control sequences. Today if you assume
VT100-compatible codes, you can probably get away with it. But there
are still a lot of libraries that support other terminal types.

R.Wieser

unread,
Jun 26, 2023, 3:24:02 AM6/26/23
to
Scott,

> $ man console_ioctl

Yeah, I found that one too.

Correct me if I'm wrong, but that looks like it only works for the local
keyboard and won't be of much use in a remote session ...

Regards,
Rudy Wieser


R.Wieser

unread,
Jun 26, 2023, 3:24:02 AM6/26/23
to
Pavel,

> On Linux (strictly speaking, on a GNU system) specifically, try readline
> function.

The problem with that is that I need the keys at the moment they are pressed
(and released ?), not only after "enter" is pressed.

Regards,
Rudy Wieser


R.Wieser

unread,
Jun 26, 2023, 3:24:02 AM6/26/23
to
Ben,

> Essentially it "wraps" any interactive program with a
> readline-driven editing, completion and history interface.

Thats pretty-much the opposite of what I currently want/need.

I'm trying to write something thats interactive - For example, imagine a
list of items you can move thru using the cursor keys and select pressing
the spacebar.

Regards,
Rudy Wieser


R.Wieser

unread,
Jun 26, 2023, 3:24:02 AM6/26/23
to
Keith,

> I know the OP wrote "console", but I suspect they're looking
> for something that works on a terminal emulator.

Nope, not an emulator. As said, "bullseye lite" doesn't have a GUI.

As for the difference between a "console" and a "terminal" ? I must say
that its not quite clear (read: confusing) to me , as it seems to be used
interchangably. If you have a good description about the differences
between a "console" and a "terminal" than I would like to hear about it.

Simply said, to me a "console" is the text-based interface you get on a
'puter thats executing the commands. A "terminal" is the program you use
to remotely(?) connect to such a console.

Regards,
Rudy Wieser


R.Wieser

unread,
Jun 26, 2023, 3:24:02 AM6/26/23
to
Keith,

> curses takes over the entire (text / terminal) screen
...
> but as far as I can tell curses is not suitable for, for example,
> detecting the user pressing an arrow key *without* controlling
> the whole screen.

That indeed makes it pretty-much unusable for me.

> In the past, I've tried and failed to find a library that gives access
> to that kind of information.

IOW, it probably doesn't exist and I need to create my own solution for it.
You telling me that saves me a /lot/ of further googeling. Thanks.

> (The terminfo database gives you the character sequences corresponding
> to the various keys, but I don't think it provides code to detect them
> on input.)

Its something to look at and see if it can be used to do the reverse.

Thanks for the info and heads-up.

Regards,
Rudy Wieser


Christian Gollwitzer

unread,
Jun 26, 2023, 3:33:11 AM6/26/23
to
Hi Rudy,

Am 26.06.23 um 09:11 schrieb R.Wieser: >> Essentially it "wraps" any
Then you might want something even more higher level than curses. For
example, CDK gives you widgets in order to program a GUI that runs in
the terminal: https://github.com/lnkgyv/cdk_examples

If you are actually looking to do it on your own, you might want to look
at termcap, which tells you the raw codes involved:
https://www.gnu.org/software/termutils/manual/termcap-1.3/html_node/termcap_37.html

Christian



Keith Thompson

unread,
Jun 26, 2023, 4:30:04 AM6/26/23
to
The term "console", on Unix-like systems, typically refers to the system
console, sometimes accessed via /dev/console, while a "terminal" is a
more general term for a text-based interface, usually accessed via
/dev/tty* or similar. (A typical user might never see the console.)

The details beyond that are probably off-topic here.

Keith Thompson

unread,
Jun 26, 2023, 4:31:16 AM6/26/23
to
The term "console", on Unix-like systems, typically refers to the system
console, sometimes accessed via /dev/console, while a "terminal" is a
more general term for a text-based interface, usually accessed via
/dev/tty* or similar. (A typical user might never see the console.)

Historically, you'd have a single system console (hardware terminal)
connected directly to the computer, and one or more remote terminals for
users. More modern interfaces (virtual consoles and terminal emulators)
are based on that.

The details beyond that are probably off-topic here, if they aren't already.

Keith Thompson

unread,
Jun 26, 2023, 4:40:18 AM6/26/23
to
"R.Wieser" <add...@is.invalid> writes:
>> On Linux (strictly speaking, on a GNU system) specifically, try readline
>> function.
>
> The problem with that is that I need the keys at the moment they are pressed
> (and released ?), not only after "enter" is pressed.

You might take a look at the readline source code to see how it does
that. It's certainly able to recognize the user pressing up-arrow
(which typically sends Esc-[-A) and acting on it immediately,
even if it doesn't expose that ability directly to the user.

wij

unread,
Jun 26, 2023, 5:06:49 AM6/26/23
to
/* Copyright is licensed by GNU LGPL, see file COPYING. by I.J.Wang 2005

Raw mode TTY for keyboard input.

Build: g++ t_kb.cpp -lwy
*/
#include <Wy.stdio.h> // for cin,cout,cerr
#include <Wy.termios.h>
#include <Wy.unistd.h>

using namespace Wy;

// TTY i/o (raw mode terminal)
// RawTerm changes tty attributes so that we can read key stroke without press ENTER
//
// Warning: Many virtual members of ChrFile are not reimplemented for simplicity.
//
class RawTerm : public ChrFile {
Termios m_ptio; // Previous(original) termios setting
public:
WY_DECL_REPLY;
RawTerm() {};
RawTerm(const char*, int);
~RawTerm();
Errno getch(char&);
Errno write(const char);
Errno write(const char*);
} static mtty("/dev/tty",O_RDWR);

RawTerm::RawTerm(const char* pathname, int flag)
: ChrFile(pathname,flag)
{
Errno r=tcflush(*this,TCIFLUSH);
if(r!=Ok) {
WY_THROW( Reply(r) );
}
if((r=tcgetattr(*this,m_ptio))!=Ok) {
WY_THROW( Reply(r) );
}
try {
// Set the terminal mode
//
Termios ntio(m_ptio);
ntio.iflag_and(~(BRKINT| ICRNL| IXON| INPCK | ISTRIP));
ntio.lflag_and(~(ICANON| ECHO| ISIG| TOSTOP| IEXTEN));
ntio.oflag_and( ~(OPOST) );
ntio.cflag_or( CS8 );
ntio.cc_VMIN(1);
ntio.cc_VTIME(0);
if((r=tcsetattr(*this,TCSANOW,ntio))!=Ok) {
WY_THROW( Reply(r) );
}

// Read back check
Termios tmptio;
if((r=tcgetattr(*this,tmptio))!=Ok) {
WY_THROW( Reply(r) );
}

// Omitted: Check termios setting accepted or not
}
catch(const Termios::Reply& e) {
WY_THROW( Reply(r) );
};
};

RawTerm::~RawTerm()
{
// If *this is default, these functions just fail (no effect for any device)
Errno r;
r=tcflush(*this,TCIFLUSH);
r=tcsetattr(*this,TCSANOW,m_ptio);
};

/ Get one char from terminal
//
Errno RawTerm::getch(char& ch)
{
Errno r;
size_t n;
if((r=ChrFile::read(&ch,sizeof(ch),n))!=Ok) {
WY_RETURN(r);
}
if(n==0) {
WY_RETURN(EIO);
}
return r;
};
Errno RawTerm::write(const char ch)
{
Errno r;
size_t n;
if((r=ChrFile::write(&ch,sizeof(ch),n))!=Ok) {
WY_RETURN(r);
}
if(n!=1) {
WY_RETURN(EIO);
}
return r;
};
Errno RawTerm::write(const char* str)
{
if(str==NULL) {
WY_RETURN(EFAULT);
}
const size_t slen=Wy::strlen(str);
Errno r;
size_t n;
if((r=ChrFile::write(str,slen,n))!=Ok) {
WY_RETURN(r);
}
if(n!=slen) {
WY_RETURN(EIO);
}
return r;
};
int main(int, char* [])
try {

Errno r;

if((r=mtty.write("中文"))!=Ok) {
WY_THROW(r);
}
for(;;) {
char ch;
if((r=mtty.getch(ch))!=Ok) {
WY_THROW(r);
}
if((ch=='q')||(ch=='Q')) {
break;
}
/* if((r=mtty.write(ch))!=Ok) {
WY_THROW(r);
}*/
cout << (unsigned char)ch << ',';
}
return 0;
}
catch(const Errno& e) {
cerr << wrd(e) << WY_ENDL;
return e.c_errno();
}
catch(...) {
cerr << "main caught(...)" WY_ENDL;
throw;
};

----------------------------------
[]$ ./a.out
中文27,91,51,126,27,91,51,59,50,126,27,91,51,59,53,126,27,91,51,59,51,126, // keystroke: del, sh-del, ctrl-del, alt-del

Fred. Zwarts

unread,
Jun 26, 2023, 6:31:46 AM6/26/23
to
Op 26.jun..2023 om 09:21 schreef R.Wieser:
Console for Linux is normally used for the console which uses a keyboard
directly connected to the computer, e.g. with USB, or PS2.

A terminal is more generic. E.g., originally terminals where connected
with a serial line to a computer ad the terminal did the interpretation
of the keyboard. This made it impossible to detect certain keypresses,
such as Ctrl, Shift, etc. The terminal in such a case does not send e.g.
a 'Shift' press, an 'a' press, an 'a' release and a 'Shift' release, but
it sends an uppercase 'A'.
Therefore, your request to detect pressing and releasing keys is not
possible for generic terminal software.

Fred. Zwarts

unread,
Jun 26, 2023, 6:47:26 AM6/26/23
to
Op 26.jun..2023 om 12:31 schreef Fred. Zwarts:
And, of course, with software keyboards on a touch screen, the situation
is again completely different. Generic terminal software hides such
differences, but that limits the possible operations.

R.Wieser

unread,
Jun 26, 2023, 7:57:44 AM6/26/23
to
Keith,

> The term "console", on Unix-like systems, typically refers to the
> system console, sometimes accessed via /dev/console, while a "terminal"
> is a more general term for a text-based interface, usually accessed via
> /dev/tty* or similar. (A typical user might never see the console.)

As I said, the difference between them is /at best/ confusing. That you
than introduce "system console" without offering any explanation to it does
not help either. :-|


I found a link which says that all things are terminals, and that a console
is just a special one (your "system console").

In that case I'm working on/in the system console.

Though I'm going to have a hard time remembering that ALT F1 is a console,
but that ALT F2...F6 are terminals (I probably, likely won't. Too little,
if any, distinction).

And it doesn't help that I have a couple of WYSE WY60 terminals standing
behind me. :-)

Regards,
Rudy Wieser


R.Wieser

unread,
Jun 26, 2023, 7:57:44 AM6/26/23
to
Keith,

> You might take a look at the readline source code to see how it
> does that. It's certainly able to recognize the user pressing
> up-arrow (which typically sends Esc-[-A) and acting on it
> immediately, even if it doesn't expose that ability directly
> to the user.

As mentioned in my initial post, I have already switched the console input
to "raw", and as such I can see bytes coming in when I press keys. Thats
not the problem.

What is is turning those streams of bytes into individual keystrokes. I can
and already have parsed most keys for the "$TERM=linux" environment, but
would like *NOT* to use my own code if something build-in is available - and
getting support for other $TERM environments for free. :-)

Regards,
Rudy Wieser


R.Wieser

unread,
Jun 26, 2023, 7:57:44 AM6/26/23
to
Fred,

> Console for Linux is normally used for the console which uses a keyboard
> directly connected to the computer, e.g. with USB, or PS2.
>
> A terminal is more generic. E.g., originally terminals where connected
> with a serial line to a computer ad the terminal did the interpretation of
> the keyboard.

Yep, that is how I defined "console" and "terminal" myself too. The first
one part of the computer (in my case, all the ones behind the ALT F1...F6
keys), the second one remote to it (and talking to it using some kind of
serial connection).

But as you might have noticed, the definition does seem to differ between
the different people (noticed the same while searching the internet)

> Therefore, your request to detect pressing and releasing keys is not
> possible for generic terminal software.

I was already "afraid" of that, but it could not hurt to ask. Perhaps times
have changed and being able to capture a key release was added to (some
versions of) Linux.

Regards,
Rudy Wieser


R.Wieser

unread,
Jun 26, 2023, 7:57:44 AM6/26/23
to
Wij,

[snip code]

Thank you. Looking at the code I'm going to assume that receiving CTRL, ALT
and SHIFT modifier keys too is just a setting added to the "ntio.iflag"
field. I'll just have to check/find out which one it is. :-)

Regards,
Rudy Wiesr


Ben Bacarisse

unread,
Jun 26, 2023, 8:50:50 AM6/26/23
to
"R.Wieser" <add...@is.invalid> writes:

> Ben,
>
>> Essentially it "wraps" any interactive program with a
>> readline-driven editing, completion and history interface.
>
> Thats pretty-much the opposite of what I currently want/need.

Good to know. I suspected it was not the right thing but I had not read
every post carefully.

> I'm trying to write something thats interactive - For example, imagine a
> list of items you can move thru using the cursor keys and select pressing
> the spacebar.

There used to be libraries built on top of curses (and/or ncurses) that
provided higher-level user interaction widgets like this. I can't
remember if any caught on, but it might be worth looking before building
your own.

--
Ben.

R.Wieser

unread,
Jun 26, 2023, 9:29:19 AM6/26/23
to
Ben,

> There used to be libraries built on top of curses (and/or ncurses)
> that provided higher-level user interaction widgets like this.

I'm not looking for specifically the widgets (the example was just that,
something to be able to relate to), but for how to be able to do something
interactive with the keyboard. And for that I need to be able to extract
keystrokes from the input stream.

Regards,
Rudy Wieser


Scott Lurndal

unread,
Jun 26, 2023, 9:58:20 AM6/26/23
to
Keith Thompson <Keith.S.T...@gmail.com> writes:
>sc...@slp53.sl.home (Scott Lurndal) writes:
>> "R.Wieser" <add...@is.invalid> writes:
>>>I've set the console input to raw so I can see keys coming in when they are
>>>pressed.
>>>
>>>For that I've been writing a big "switch ... case" to parse the multi-byte
>>>keystrokes into "records" that than can be easily worked with or discarded.
>>>
>>>As this parsing needs to be done by pretty-much every console-based program
>>>which wants to do any kind of interactive stuff I was wondering if this
>>>perhaps is already part of Linux ...
>>>
>>>If it is (and thats still a big "if"), where can I find it ?
>>
>> $ man console_ioctl
>
>I believe that only applies to the Linux system console (the text-only
>interface you typically get by typing Ctrl-Alt-N, where N is a small
>integer). I know the OP wrote "console", but I suspect they're looking
>for something that works on a terminal emulator.

I thought about that, but "console-based program" pretty much implied
no GUI.

With graphics, the toolkit (X11, GDK) provides interfaces to handle
and parse keystrokes.

Scott Lurndal

unread,
Jun 26, 2023, 10:00:29 AM6/26/23
to
Keith Thompson <Keith.S.T...@gmail.com> writes:
>"R.Wieser" <add...@is.invalid> writes:
>> Keith,
>>
>>> I know the OP wrote "console", but I suspect they're looking
>>> for something that works on a terminal emulator.
>>
>> Nope, not an emulator. As said, "bullseye lite" doesn't have a GUI.
>>
>> As for the difference between a "console" and a "terminal" ? I must say
>> that its not quite clear (read: confusing) to me , as it seems to be used
>> interchangably. If you have a good description about the differences
>> between a "console" and a "terminal" than I would like to hear about it.
>>
>> Simply said, to me a "console" is the text-based interface you get on a
>> 'puter thats executing the commands. A "terminal" is the program you use
>> to remotely(?) connect to such a console.
>
>The term "console", on Unix-like systems, typically refers to the system
>console, sometimes accessed via /dev/console, while a "terminal" is a
>more general term for a text-based interface, usually accessed via
>/dev/tty* or similar. (A typical user might never see the console.)

Although prior to running unix on PC's, all consoles were serial
terminals (or real teletypes or DECwriters), the only difference
between /dev/console and /dev/tty1
was that they were two different serial ports.

Scott Lurndal

unread,
Jun 26, 2023, 10:02:25 AM6/26/23
to
"R.Wieser" <add...@is.invalid> writes:
>Scott,
>
>> $ man console_ioctl
>
>Yeah, I found that one too.
>
>Correct me if I'm wrong, but that looks like it only works for the local
>keyboard and won't be of much use in a remote session ...

There is no way to transmit keystroke metadata over a serial line generally,
so for anything other than the "console" terminal, all you get are ascii
characters.

Scott Lurndal

unread,
Jun 26, 2023, 10:03:53 AM6/26/23
to
Ah, you want "raw" mode rather than "cooked" mode.

You can set that with tcsetattr(3).

Scott Lurndal

unread,
Jun 26, 2023, 10:05:29 AM6/26/23
to
You cannot get CTRL, ALT and SHIFT modifier keys explicitly on serial
ports. The terminal applies them (well except for ALT, which is a PCism)
before transmitting the character over the serial line.

Mut...@dastardlyhq.com

unread,
Jun 26, 2023, 11:26:50 AM6/26/23
to
Other than curses as someone has mentioned there's no library to process
keystrokes other than the code in the terminal/xterm/console itself. YOu'll
have to write your own. Tbh its not that hard , I did it for a telnet client
I wrote. There's a limited number of multibyte sequences you can expect
usually prepended with an ESC, eg "<esc>[A" is *usually* up arrow, "<esc>[B"
is *usually* down arrow. But some terminals can be awkward and send alternative
versions. The Linux console itself tends to differ from dumb terminals.

R.Wieser

unread,
Jun 26, 2023, 12:06:55 PM6/26/23
to
Scott,

> There is no way to transmit keystroke metadata over a serial line
> generally,

Bullshit.

Regards,
Rudy Wieser


R.Wieser

unread,
Jun 26, 2023, 12:06:55 PM6/26/23
to
Scott,

> Ah, you want "raw" mode rather than "cooked" mode.


Yes, but I already did that.

... as I mentioned in the first line of my initial mesage.

Regards,
Rudy Wieser


R.Wieser

unread,
Jun 26, 2023, 12:06:55 PM6/26/23
to
Scott,

> You cannot get CTRL, ALT and SHIFT modifier keys explicitly on
> serial ports.

Is that what the parent of the message you are responding is talking about ?
I think not. So, what are you complaining about ?

Regards,
Rudy Wieser


R.Wieser

unread,
Jun 26, 2023, 12:06:56 PM6/26/23
to
Muttley,

> YOu'll have to write your own. Tbh its not that hard

I already did. But I would like to replace it with something that has been
time tested, as well as being able to cope with a number of other $TERM
types.

Regards,
Rudy Wieser


Ben Bacarisse

unread,
Jun 26, 2023, 1:19:25 PM6/26/23
to
"R.Wieser" <add...@is.invalid> writes:

> Scott,
>
>> There is no way to transmit keystroke metadata over a serial line
>> generally,
>
> Bullshit.

Rather than jump to this sort of conclusion, why not ask about what
Scott said?

Lots of terminals that you used to plug into a serial line simply sent a
sequence of processed characters to the other end. By "keystroke
metadata" I presume Scott means things like "left shift key down" or,
more likely, "key F12 while shift and control down" won't get sent.
Thus historical terminal interfaces would assume that only the processed
character sequence generated by the terminal hardware can be handled.

--
Ben.

R.Wieser

unread,
Jun 26, 2023, 1:25:17 PM6/26/23
to
wij,

[snip code]

Alas. Although I've set the exact flags you've shown I only get the normal
"del" (and other keys), regardless of which modifier keys I also press.

Any idea why ? $TERM setting perhaps (mine is "linux").

Regards,
Rudy Wieser


Scott Lurndal

unread,
Jun 26, 2023, 2:36:50 PM6/26/23
to
Correct. I also qualified the statement with 'generally'.

R didn't specify (other than the generic 'console terminal')
anything about the other end of the 'terminal' - whether it is
an antique glass tty on a 9600 baud serial port, or the other
end of a psuedo-terminal pair, or a kernel console driver.

Keith Thompson

unread,
Jun 26, 2023, 3:01:19 PM6/26/23
to
"R.Wieser" <add...@is.invalid> writes:
> Keith,

Your newsreader should add attribution lines, like the
"R.Wieser" <add...@is.invalid> writes:
line above. Please don't delete those lines. They're there to
show readers who wrote what.

>> You might take a look at the readline source code to see how it
>> does that. It's certainly able to recognize the user pressing
>> up-arrow (which typically sends Esc-[-A) and acting on it
>> immediately, even if it doesn't expose that ability directly
>> to the user.
>
> As mentioned in my initial post, I have already switched the console input
> to "raw", and as such I can see bytes coming in when I press keys. Thats
> not the problem.

So if the user presses the up-arrow key, you see three bytes: Escape,
'[', and 'A', right? And you want to recognize that sequence as
"up-arrow"? I'm saying that readline does exactly that internally, and
examing the readline source code might be helpful.

> What is is turning those streams of bytes into individual keystrokes. I can
> and already have parsed most keys for the "$TERM=linux" environment, but
> would like *NOT* to use my own code if something build-in is available - and
> getting support for other $TERM environments for free. :-)

Keith Thompson

unread,
Jun 26, 2023, 3:08:42 PM6/26/23
to
Keith Thompson <Keith.S.T...@gmail.com> writes:
> sc...@slp53.sl.home (Scott Lurndal) writes:
[...]
>> $ man console_ioctl
>
> I believe that only applies to the Linux system console (the text-only
> interface you typically get by typing Ctrl-Alt-N, where N is a small
> integer). I know the OP wrote "console", but I suspect they're looking
> for something that works on a terminal emulator.

My mistake, the Linux virtual consoles are accessed via Alt-FN or
Ctrl-Alt-FN (function keys), where N is a small integer.

Keith Thompson

unread,
Jun 26, 2023, 3:18:22 PM6/26/23
to
"R.Wieser" <add...@is.invalid> writes:
> Keith,
>
>> The term "console", on Unix-like systems, typically refers to the
>> system console, sometimes accessed via /dev/console, while a "terminal"
>> is a more general term for a text-based interface, usually accessed via
>> /dev/tty* or similar. (A typical user might never see the console.)
>
> As I said, the difference between them is /at best/ confusing. That you
> than introduce "system console" without offering any explanation to it does
> not help either. :-|

Apparently it helped you to find more information.

> I found a link which says that all things are terminals, and that a console
> is just a special one (your "system console").
>
> In that case I'm working on/in the system console.
>
> Though I'm going to have a hard time remembering that ALT F1 is a console,
> but that ALT F2...F6 are terminals (I probably, likely won't. Too little,
> if any, distinction).

It's fairly common to use the word "console" (perhaps incorrectly) to
refer to terminals in general.

On Linux-based systems, and probably others, all the Alt-FN screens are
*virtual consoles*. They're supported by the OS more or less directly,
and they don't depend on any GUI system like X11. Terminal emulators
typically run as windows under X11 (or Wayland, or whatever).

And since this is all specific to Unix-like systems, and perhaps more
specifically to Linux-based systems, you might get better information in
a Unix-specific newsgroup, perhaps comp.unix.programmer. (This is
comp.lang.c++, and I don't think I've seen any C++ code in this thread,
and the libraries we've been discussing are C, not C++.)

[...]

Keith Thompson

unread,
Jun 26, 2023, 3:24:06 PM6/26/23
to
I think R.Wieser was saying that readline doesn't give any information
to the client until you press "enter" -- not because readline uses
cooked mode, but because readline presents a line-oriented interface.
(But examining the readline source code might be useful.)

R.Wieser

unread,
Jun 26, 2023, 3:25:03 PM6/26/23
to
Ben,

>>> There is no way to transmit keystroke metadata over a serial line
>>> generally,
>>
>> Bullshit.
>
> Rather than jump to this sort of conclusion, why not ask about what
> Scott said?

Because I'm getting tired of people who say one thing, but (bloody likely)
mean something *completely* different. And I mean *completely*.

I could ask him. I could even tell him what he (likely) tried to say
instead.

But no. It would be me fighting to get him to say what he actually means,
and I do not care for yet another struggle like that *at all*.


> By "keystroke metadata" I presume Scott means things like "left shift key
> down" or,
> more likely, "key F12 while shift and control down" won't get sent.

Yeah, I figured that its /possible/ that that is what he ment.

But if that is actually what he ment (our guesswork!) than you get the next
problem : By whom/what ?

How many terminal programs does he know of and has checked for that
behaviour ? how many *doesn't* he know and might do just that (absense of
proof is not proof of absense) ? In that regard his reply is *way* to
absolute for its own good.


> Thus historical terminal interfaces would assume that only the
> processed character sequence generated by the terminal hardware
> can be handled.

Disagree. It will, rather likely, make sure that unknown sequences are
silently discarded - leaving it up to newer parsers to handle the extra,
newer keys too.

Think of that as similar to old-style keyboards, and the newer ones with a
slew of fancy keys at the top to shut down the 'puter, change volume, call
up the default browser, etc. An old OS will just ignore those extra keys.

IOW, although I've not yet seen such modifier-key sequences come by, I could
easily imagine that they can be enabled, or that the modifier keys become
part of the keystroke packet as an extra field.

Regards,
Rudy Wieser


Christian Gollwitzer

unread,
Jun 26, 2023, 4:27:38 PM6/26/23
to
Am 26.06.23 um 15:03 schrieb R.Wieser:
As written above, you can use the termcap or terminfo library. It tells
you what keystrokes correspond to which keys.

Christian

R.Wieser

unread,
Jun 26, 2023, 4:48:27 PM6/26/23
to
Keith,

> Your newsreader should add attribution lines, like the
> "R.Wieser" <add...@is.invalid> writes:
> line above. Please don't delete those lines. They're there
> to show readers who wrote what.

Thats why I have name the person I'm talking to at the top of my message -
just like yours now.

Also, my newsreader is more than 20 years old, and even it has got a tree
view with which I can easily go backwards to parent messages and forwards to
replies to my posts. I seldom-if-ever use it though. I could imagine that
yours has the same capability.

> So if the user presses the up-arrow key, you see three bytes: Escape,
> '[', and 'A', right? And you want to recognize that sequence as
> "up-arrow"? I'm saying that readline does exactly that internally,
> and examing the readline source code might be helpful.

As mentioned in my initial post, I already wrote a parser. But I would like
to replace it with something build-in, which is likely to support other
$TERMs than just "linux". If a build-in method doesn't exist I will just
continue using what I currently have.

Regards,
Rudy Wieser


R.Wieser

unread,
Jun 26, 2023, 4:48:27 PM6/26/23
to
Keith,

>> As I said, the difference between them is /at best/ confusing. That you
>> than introduce "system console" without offering any explanation to it
>> does
>> not help either. :-|
>
> Apparently it helped you to find more information.

No, it didn't. I could not care less about what, on my machine, the
difference is between a "system console" and a "console". But I *had* to
search for it, because it *could* have been of importance in regard to the
distinction between a "console" and a "terminal". It wasn't. IOW, I wasted
my time.

> It's fairly common to use the word "console" (perhaps incorrectly)
> to refer to terminals in general.

Thats what I said. They are pretty-much used interchangably.

Currently I still do not know with what I should refer to the
console/terminal/tty/whatever on which the boot-process outputs its progress
and I than use to program in. Or with what I should refer to the ones under
ALT F2...F6.

> Terminal emulators typically run as windows under X11 (or Wayland,
> or whatever).

Any reason for the "emulator" postfix ? Other than by habit I mean ? And
yes, I recognise that a console in a window puts character based content in
a pixel-based environment.

To be honest, I took the "terminal emulator" as being a /program/ which runs
on another computer, translating whatever it gets into screen output, and
translates keyboard input to whatever the other side needs (VT100 codes or
alike).

> And since this is all specific to Unix-like systems, and perhaps more
> specifically to Linux-based systems, you might get better information
> in a Unix-specific newsgroup, perhaps comp.unix.programmer.

I was assuming that there would be linux programmers here too.

But a good one, thanks.

Regards,
Rudy Wieser


R.Wieser

unread,
Jun 26, 2023, 4:48:27 PM6/26/23
to
Christian,

> As written above, you can use the termcap or terminfo library. It tells
> you what keystrokes correspond to which keys.

A quick search shows me that "termcap" is a textfile which as been marked
obsolete and that both are used to translate keystrokes into escape
sequences. There where no results shown in regard to translating escape
sequences back to keystrokes though.

IOW, do you have any link(s) that show how the latter is supposed to be done
?

Regards,
Rudy Wieser


Ben Bacarisse

unread,
Jun 26, 2023, 5:13:00 PM6/26/23
to
"R.Wieser" <add...@is.invalid> writes:

> Ben,
>
>>>> There is no way to transmit keystroke metadata over a serial line
>>>> generally,
>>>
>>> Bullshit.
>>
>> Rather than jump to this sort of conclusion, why not ask about what
>> Scott said?
>
> Because I'm getting tired of people who say one thing, but (bloody likely)
> mean something *completely* different. And I mean *completely*.
>
> I could ask him. I could even tell him what he (likely) tried to say
> instead.

I thought it was quote clear. Oh well...

> But no. It would be me fighting to get him to say what he actually means,
> and I do not care for yet another struggle like that *at all*.
>
>> By "keystroke metadata" I presume Scott means things like "left shift
>> key down" or, more likely, "key F12 while shift and control down"
>> won't get sent.
>
> Yeah, I figured that its /possible/ that that is what he ment.

I can't imagine what else you could think. My more general point is
that it's often worth taking a moment to see whether what was said
makes sense. It's rare the sane people (you have know that Scott is not
a crank) rarely post bullshit.

> But if that is actually what he ment (our guesswork!) than you get the
> next problem : By whom/what ?

It's my turn to ask. I don't know what you mean here, though it's
possible I answer your question below.

> How many terminal programs does he know of and has checked for that
> behaviour ? how many *doesn't* he know and might do just that (absense of
> proof is not proof of absense) ? In that regard his reply is *way* to
> absolute for its own good.

He's explaining why many libraries (like curses) can't tell you about
keys like Alt, Ctrl and so on. They date from an era when terminals
were connected to systems by serial lines, and the system would only
ever get the data the terminal sends.

Personal workstations (that gave rise to X11) and PCs changed all that.
If there was only one keyboard, the programmer should get access to all
the details of key codes and key press/release events.

>> Thus historical terminal interfaces would assume that only the
>> processed character sequence generated by the terminal hardware
>> can be handled.
>
> Disagree. It will, rather likely, make sure that unknown sequences are
> silently discarded - leaving it up to newer parsers to handle the extra,
> newer keys too.

I think you've missed the point. Serial lines were often used to
connect terminals that simply didn't report the metadata. They just
sent character sequences. A VT220 simply does not send anything down
the line when the operator presses the control key, but if they hit the
'A' key with control down, the terminal sends the bit pattern with value
1.

--
Ben.

Keith Thompson

unread,
Jun 26, 2023, 5:16:04 PM6/26/23
to
"R.Wieser" <add...@is.invalid> writes:
> Keith,
>
>> Your newsreader should add attribution lines, like the
>> "R.Wieser" <add...@is.invalid> writes:
>> line above. Please don't delete those lines. They're there
>> to show readers who wrote what.
>
> Thats why I have name the person I'm talking to at the top of my message -
> just like yours now.

Yes, I understand what you're doing and why you're doing it.

I'm asking you not to do that. I'm asking you to leave the generated
attribution lines in place, as everyone else here does. You're
expending extra effort and making your articles more difficult to read.

[...]

>> So if the user presses the up-arrow key, you see three bytes: Escape,
>> '[', and 'A', right? And you want to recognize that sequence as
>> "up-arrow"? I'm saying that readline does exactly that internally,
>> and examing the readline source code might be helpful.
>
> As mentioned in my initial post, I already wrote a parser. But I would like
> to replace it with something build-in, which is likely to support other
> $TERMs than just "linux". If a build-in method doesn't exist I will just
> continue using what I currently have.

If there is such an existing library, comp.lang.c++ is not the place to
ask about it. Nothing you've written here is specific to C++.

Keith Thompson

unread,
Jun 26, 2023, 5:32:58 PM6/26/23
to
"R.Wieser" <add...@is.invalid> writes:
> Keith,
>
>>> As I said, the difference between them is /at best/ confusing. That you
>>> than introduce "system console" without offering any explanation to it
>>> does
>>> not help either. :-|
>>
>> Apparently it helped you to find more information.
>
> No, it didn't. I could not care less about what, on my machine, the
> difference is between a "system console" and a "console". But I *had* to
> search for it, because it *could* have been of importance in regard to the
> distinction between a "console" and a "terminal". It wasn't. IOW, I wasted
> my time.

I do not accept responsibility for that.

>> It's fairly common to use the word "console" (perhaps incorrectly)
>> to refer to terminals in general.
>
> Thats what I said. They are pretty-much used interchangably.

That's not what I said. The term "console", when used correctly for
Linux-based systems and probably some others, refers to the virtual
consoles typically accessed via Ctrl-Alt-FN or Alt-FN -- *not* to
terminal emulators like xterm. Some people are sloppy about the usage
(and it often doesn't matter, since they really are quite similar in
most ways.)

(There's also an "xconsole" command that runs under X11 and displays
messages sent to /dev/console. The fact that these things that were
once handled in hardware are now almost entirely handled in software
does create some confusion.)

> Currently I still do not know with what I should refer to the
> console/terminal/tty/whatever on which the boot-process outputs its progress
> and I than use to program in. Or with what I should refer to the ones under
> ALT F2...F6.

They're called virtual consoles.

>> Terminal emulators typically run as windows under X11 (or Wayland,
>> or whatever).
>
> Any reason for the "emulator" postfix ? Other than by habit I mean ? And
> yes, I recognise that a console in a window puts character based content in
> a pixel-based environment.

Yes. A literal *terminal* is a hardware device that includes a monitor,
a keyboard, and some kind of connector. The VT100 is an example. A
terminal emulator is a software program designed to emulate a terminal.
Terminal emulators are far more common these days than physical
terminals.

> To be honest, I took the "terminal emulator" as being a /program/ which runs
> on another computer, translating whatever it gets into screen output, and
> translates keyboard input to whatever the other side needs (VT100 codes or
> alike).

Right -- except that it doesn't have to run on another computer.

Keith Thompson

unread,
Jun 26, 2023, 5:35:37 PM6/26/23
to
termcap and terminfo are specific to Unix-like systems, not to C++.
I suggest asking elsewhere.

Christian Gollwitzer

unread,
Jun 26, 2023, 5:58:49 PM6/26/23
to
Am 26.06.23 um 22:48 schrieb R.Wieser:
The termcap library is only a way to do the forward translation, i.e.
you can ask it for a key and get back the string that is represented
like this:
https://stackoverflow.com/questions/55090078/termcap-tgetstr-getting-arrow-keys


However, I still believe you are much better off using the ncurses
library, which also does the backwards translation. Look, e.g. at this
example:

https://tldp.org/HOWTO/NCURSES-Programming-HOWTO/keys.html

As you can see here, the getch() function translates the special keys to
their symbolic code liek KEY_UP etc.

But cave: I gave up text mode programming a long time ago.

Christian

Scott Lurndal

unread,
Jun 26, 2023, 6:36:14 PM6/26/23
to
"R.Wieser" <add...@is.invalid> writes:
>Keith,
>
>> Your newsreader should add attribution lines, like the
>> "R.Wieser" <add...@is.invalid> writes:
>> line above. Please don't delete those lines. They're there
>> to show readers who wrote what.
>
>Thats why I have name the person I'm talking to at the top of my message -
>just like yours now.

No, you deleted the standard attribution lines. Which when properly
done, allow easy determination of who wrote what. That convention is
likely older than you are.

>
>Also, my newsreader is more than 20 years old, and even it has got a tree
>view with which I can easily go backwards to parent messages and forwards to
>replies to my posts. I seldom-if-ever use it though. I could imagine that
>yours has the same capability.

You would be wrong.

Scott Lurndal

unread,
Jun 26, 2023, 6:41:57 PM6/26/23
to
"R.Wieser" <add...@is.invalid> writes:
>Keith,
>
>>> As I said, the difference between them is /at best/ confusing. That you
>>> than introduce "system console" without offering any explanation to it
>>> does
>>> not help either. :-|
>>
>> Apparently it helped you to find more information.
>
>No, it didn't. I could not care less about what, on my machine, the
>difference is between a "system console" and a "console". But I *had* to
>search for it, because it *could* have been of importance in regard to the
>distinction between a "console" and a "terminal". It wasn't. IOW, I wasted
>my time.
>
>> It's fairly common to use the word "console" (perhaps incorrectly)
>> to refer to terminals in general.
>
>Thats what I said. They are pretty-much used interchangably.
>
>Currently I still do not know with what I should refer to the
>console/terminal/tty/whatever on which the boot-process outputs its progress
>and I than use to program in. Or with what I should refer to the ones under
>ALT F2...F6.

The unix 'tty' command will tell you the name of
the node in /dev that corresponds to your controlling
terminal. That name might be /dev/console for the
device that owns the host keyboard/mouse/graphic card;
normally known as the system console.

The name might instead be /dev/ttys0, or /dev/usbtty0, or
/dev/serial/0 for a serial attached device, or may be
/dev/pts/17 for a pseudo-terminal pair (e.g. used by
xterm, gnome terminal and other gui and non-gui
terminal emulators.

Keith Thompson

unread,
Jun 26, 2023, 7:26:58 PM6/26/23
to
Christian Gollwitzer <auri...@gmx.de> writes:
> Am 26.06.23 um 22:48 schrieb R.Wieser:
>> Christian,
>>
>>> As written above, you can use the termcap or terminfo library. It tells
>>> you what keystrokes correspond to which keys.
>> A quick search shows me that "termcap" is a textfile which as been
>> marked
>> obsolete and that both are used to translate keystrokes into escape
>> sequences. There where no results shown in regard to translating escape
>> sequences back to keystrokes though.
>> IOW, do you have any link(s) that show how the latter is supposed to
>> be done
>> ?
>
> The termcap library is only a way to do the forward translation,
> i.e. you can ask it for a key and get back the string that is
> represented like this:
> https://stackoverflow.com/questions/55090078/termcap-tgetstr-getting-arrow-keys

No, terminfo is newer and is intended to replace termcap, and provides
the same information. If you're starting something new, ignore termcap
and use terminfo (unless you have some specific requirement to use
termcap).

> However, I still believe you are much better off using the ncurses
> library, which also does the backwards translation. Look, e.g. at this
> example:
>
> https://tldp.org/HOWTO/NCURSES-Programming-HOWTO/keys.html
>
> As you can see here, the getch() function translates the special keys
> to their symbolic code liek KEY_UP etc.

Yes, but it's not suitable for the OP's purposes. getch() implicitly
refers to the current ncurses screen (stdscr), and it can't be used
without first setting things up properly, which takes over the terminal
screen. (And comp.lang.c++ isn't the place to ask about it.)

wij

unread,
Jun 27, 2023, 4:32:51 PM6/27/23
to
On Monday, June 26, 2023 at 7:57:44 PM UTC+8, R.Wieser wrote:
> Wij,
>
> [snip code]
>
> Thank you. Looking at the code I'm going to assume that receiving CTRL, ALT
> and SHIFT modifier keys too is just a setting added to the "ntio.iflag"
> field. I'll just have to check/find out which one it is. :-)
>
> Regards,
> Rudy Wiesr

Class RawTerm was revised from the previous post, because I felt class RawTerm
could be quite reusable for terminals and keyboard input(set open flags to O_RDONLY).
So I revised RawTerm, added a member function kbhit().

------------------------
#include <Wy.stdio.h> // for cin,cout,cerr
#include <Wy.termios.h>
#include <Wy.unistd.h>
#include <Wy.select.h>

using namespace Wy;

// TTY i/o (raw mode terminal)
// RawTerm changes tty attributes so that we can read key stroke without press ENTER
//
// Warning: Many virtual members of ChrFile are not reimplemented for simplicity.
//
class RawTerm : public ChrFile {
Termios m_ptio; // Previous(original) termios setting
public:
WY_DECL_REPLY;
RawTerm() {};
RawTerm(const char*, int);
~RawTerm();
Errno getch(char&);
Errno kbhit();
};
RawTerm::RawTerm(const char* pathname, int flag)
try : ChrFile(pathname,flag)
{
Errno r=tcflush(*this,TCIFLUSH);
if(r!=Ok) {
WY_THROW(r);
}
if((r=tcgetattr(*this,m_ptio))!=Ok) {
WY_THROW(r);
}

// Set the terminal mode
//
Termios ntio(m_ptio);
ntio.iflag_and(~(BRKINT| ICRNL| IXON| INPCK | ISTRIP));
ntio.lflag_and(~(ICANON| ECHO| ISIG| TOSTOP| IEXTEN));
ntio.oflag_and( ~(OPOST) );
ntio.cflag_or( CS8 );
ntio.cc_VMIN(1);
ntio.cc_VTIME(0);
if((r=tcsetattr(*this,TCSANOW,ntio))!=Ok) {
WY_THROW(r);
}

// Read back check
Termios tmptio;
if((r=tcgetattr(*this,tmptio))!=Ok) {
WY_THROW(r);
}

// Omitted: Check termios setting accepted or not
}
catch(const Errno& e) {
throw Reply(e);
};

RawTerm::~RawTerm()
{
// If *this is default, these functions just fail (no effect for any device)
Errno r;
r=tcflush(*this,TCIFLUSH);
r=tcsetattr(*this,TCSANOW,m_ptio);
};

// Get one char from terminal
//
Errno RawTerm::getch(char& ch)
{
Errno r;
size_t n;
if((r=ChrFile::read(&ch,sizeof(ch),n))!=Ok) {
WY_RETURN(r);
}
if(n!=sizeof(ch)) {
WY_RETURN(EIO);
}
return r;
};

Errno RawTerm::kbhit()
{
FdSet fds;
fds.set(*this);
return pselect(&fds,NULL,NULL,NULL,NULL);
};

int main(int, char* [])
try {
RawTerm mtty("/dev/tty",O_RDWR);
Errno r;

mtty << "Press any key. 'q' to quit:";
for(;;) {
char ch;
if((r=mtty.getch(ch))!=Ok) {
WY_THROW(r);
}
if((ch=='q')||(ch=='Q')) {
break;
}
mtty << (unsigned char)ch << " ";
}

// cin.reset(mtty); // dup2 cin to use mtty
return 0;
}
catch(const Errno& e) {
cerr << wrd(e) << WY_ENDL;
return e.c_errno();
}
catch(...) {
cerr << "main caught(...)" WY_ENDL;
throw;
};

Kenny McCormack

unread,
Jun 27, 2023, 10:17:57 PM6/27/23
to
In article <1dd24214-49c8-4f61...@googlegroups.com>,
wij <wyni...@gmail.com> wrote:
...
>Class RawTerm was revised from the previous post, because I felt class
>RawTerm could be quite reusable for terminals and keyboard input(set open
>flags to O_RDONLY). So I revised RawTerm, added a member function kbhit().

This is actually an interesting post, in terms of newsgroup politics.

This post is actually on-topic for the newsgroup, since it contains actual,
real, live C++ code, but entirely off-topic for the thread, since it has
nothing to do with OP's problem (which, in fact, has nothing to do with C++).

Interesting, that.

--
Modern Christian: Someone who can take time out from using Leviticus
to defend homophobia and Exodus to plaster the Ten Commandments on
every school and courthouse to claim that the Old Testament is merely
"ancient laws" that "only applies to Jews".

wij

unread,
Jun 27, 2023, 11:27:06 PM6/27/23
to
It is pretty much on topic in various ways, esp. in the early days.
C++ language is (should?) not confined to the words of 'the standard' book
(E.g. previously, there were c++.moderated, c++.standard. They are gone now).
Without the real usage, the language is purely manipulation of words as many
people are fond of.

I admit my reply might not be what the OP want, but who knows what the OP need?
I was suggesting, many 'keyboard' problems could be solved by using RawTerm like
class. The capability including serial line communication,..., 'remote debug'..etc.
One point here reminded is: many C++ programmer have no idea of OOD, lost in
the language syntax.

red floyd

unread,
Jun 28, 2023, 5:35:29 PM6/28/23
to
On 6/25/2023 11:50 PM, R.Wieser wrote:


> The problem with that is that I need the keys at the moment they are pressed
> (and released ?), not only after "enter" is pressed.


Then you need to put the terminal into non-canonical mode (~ICANON).

See "man tcsetattr"



Kenny McCormack

unread,
Jun 28, 2023, 8:17:47 PM6/28/23
to
In article <u7i92g$1scnm$1...@redfloyd.dont-email.me>,
Totally missing the point.

OP certainly knows all about setting the terminal modes (to RAW and/or ~ICANON).

The comment quoted above was in the context of the OP responding to a
suggestion by another user. Other user had suggested using the GNU
"readline" library as a way of getting keystrokes. OP noted that readline,
as its name implies, only returns when it has a full line - i.e., when the
user has pressed the "enter" key to send the line.

Hope that clears things up for you.

--
12% of Americans think that Joan of Arc was Noah's wife.

Scott Lurndal

unread,
Jun 28, 2023, 8:43:56 PM6/28/23
to
gaz...@shell.xmission.com (Kenny McCormack) writes:
>In article <u7i92g$1scnm$1...@redfloyd.dont-email.me>,
>red floyd <no.spa...@its.invalid> wrote:
>>On 6/25/2023 11:50 PM, R.Wieser wrote:
>>
>>
>>> The problem with that is that I need the keys at the moment they are pressed
>>> (and released ?), not only after "enter" is pressed.
>>
>>
>>Then you need to put the terminal into non-canonical mode (~ICANON).
>>
>>See "man tcsetattr"
>>
>>
>>
>
>Totally missing the point.
>
>OP certainly knows all about setting the terminal modes (to RAW and/or ~ICANON).
>
>The comment quoted above was in the context of the OP responding to a
>suggestion by another user. Other user had suggested using the GNU
>"readline" library as a way of getting keystrokes. OP noted that readline,
>as its name implies, only returns when it has a full line - i.e., when the
>user has pressed the "enter" key to send the line.

However, readline and libedit internally handle vim and emacs line editing, for
which they must set the terminal to RAW mode, so the library sources
would be a useful resource for someone who wishes similar functionality.

R.Wieser

unread,
Jun 29, 2023, 8:05:53 AM6/29/23
to
Scott,

>>Currently I still do not know with what I should refer to the
>>console/terminal/tty/whatever on which the boot-process outputs its
>>progress
>>and I than use to program in. Or with what I should refer to the ones
>>under
>>ALT F2...F6.
>
> The unix 'tty' command will tell [snip]

Alas, I thought that my above question (in the above quote) was clear
enough. But no.

I'll try again, but now dotting some "i"s.


1) The screen the boot process is outputting its progress into is called :

a) a console
b) a system console
c) a terminal
d) a virtual terminal
e) a tty
f) something else altogether.

Explain why.

2)The screen that becomes visible when the ALT F2...F6 keys is pressed is
called :

a) a console
b) a system console
c) a terminal
d) a virtual terminal
e) a tty
f) something else altogether.

Explain why.

Bonus question :

For any of the choices in the above that have not already been used explain
when those are used and why.

Regards,
Rudy Wieser


R.Wieser

unread,
Jun 29, 2023, 8:05:53 AM6/29/23
to
Scott,

>> Also, my newsreader is more than 20 years old, and even it has got a
>> tree view with which I can easily go backwards to parent messages
>> and forwards to replies to my posts. I seldom-if-ever use it
>> though. I could imagine that yours has the same capability.
>
> You would be wrong.

No, I don't think so. It could really easily imagine that.

/s

Regards,
Rudy Wieser


R.Wieser

unread,
Jun 29, 2023, 8:05:53 AM6/29/23
to
Scott,

> However, readline and libedit internally handle vim and emacs line
> editing, for which they must set the terminal to RAW mode, so the
> library sources would be a useful resource for someone who wishes
> similar functionality.

But of little, if any, use to someone who started his initial post with
"I've set the console input to raw so I can see keys coming in when they are
pressed."

Indicating both already having done that /and/ getting a result he can work
with.

Regards,
Rudy Wieser


Kenny McCormack

unread,
Jun 29, 2023, 11:44:28 AM6/29/23
to
Indeed. Well put. There have been several responses on this thread that
have "totally missed the point" - assuming that your issue was "How do I
set the terminal to raw mode?" - when, obviously, you'd already done that.

Maybe a language barrier problem. English not being their first language.

Aside: Some have suggested, as above, that you read/study the readline
source code for inspiration. I doubt that will help, as that code is
pretty opaque.

What this all boils down to is that there really should be an off-the-shelf
solution to this all-too-common problem. There apparently isn't. It should
be possible for someone to rip that functionality out of (n)curses, so that
you could use it, without the full-on commitment to (n)curses.

--
No puppet.
No puppet.
You're a puppet.

R.Wieser

unread,
Jun 29, 2023, 12:38:05 PM6/29/23
to
Kenny,

> Maybe a language barrier problem. English not being their first
> language.

There is also a good possibility that, as you mentioned yourself, the
responder just read a single post and took their (absense of a) clue from
there. Not bothering to even check out the threads starting post.

> What this all boils down to is that there really should be an off-
> the-shelf solution to this all-too-common problem.

:-) and that was/is pretty-much exactly what I was thinking, and tried to
find out, thru this newsgroup, if it exists.

Color me surprised that I now have to conclude a programmer has to write,
for *every program* which does not use a line-based input method, such a
parser himself.

> It should be possible for someone to rip that functionality out of
> (n)curses, so that you could use it, without the full-on commitment
> to (n)curses.

Depends on how it needs to be used. Currently I've got some code which
times out if nothing comes in or something incomplete has been parsed (it
doesn't block).

And by the way: I have quite a problem with the ^Z (26) being send as the
start of a command sequence as well on its own when the ESC key is pressed
(IOW, no escaping of the ESC key). I do not see any way to, in a stream,
detect if its one or the other. Its just asking for trouble. :-(

Regards,
Rudy Wieser


Keith Thompson

unread,
Jun 29, 2023, 4:59:19 PM6/29/23
to
None of these questions are about C++.

I can understand that you might think attribution lines are
unnecessary, but you refuse to leave them in place after being asked
to do so. It's *easier* to leave them alone than to delete them,
and for many of us it makes it easier to follow the discussion.
You even delete attribution lines from quoted text; there's no
indication who wrote the text above starting with "Currently I
still do not know".

You continue to post here in comp.lang.c++ when it's clear that
another forum such as comp.unix.programmer would be more appropriate
and more likely to get you the information you're looking for.

You want answers? Learn where and how to ask.

Pavel

unread,
Jun 29, 2023, 10:22:39 PM6/29/23
to
R.Wieser wrote:
> Pavel,
>
>> On Linux (strictly speaking, on a GNU system) specifically, try readline
>> function.
>
> The problem with that is that I need the keys at the moment they are pressed
> (and released ?), not only after "enter" is pressed.
I got it from your first post :-).

With readline, you *don't have to wait till <enter> is pressed* to get
the key.

I have posted this example in my response to Keith Thompson on 6/25/23
10:18 pm, it might just work for your purpose.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <readline/readline.h>

int
up_callback(int count, int key) {
printf ("the user just pressed up-arrow\n");
return 0;
}

int
main(int argc, char *argv[])
{
rl_bind_keyseq ("\\e[A", up_callback);
free(readline("press a button > "));

printf("\n");

return 0;
}



>
> Regards,
> Rudy Wieser
>
>

HTH
-Pavel

Ben Bacarisse

unread,
Jun 30, 2023, 9:15:17 AM6/30/23
to
"R.Wieser" <add...@is.invalid> writes:

>> What this all boils down to is that there really should be an off-
>> the-shelf solution to this all-too-common problem.
>
> :-) and that was/is pretty-much exactly what I was thinking, and tried to
> find out, thru this newsgroup, if it exists.

As far as I can tell there /is/ a solution, but this, being a C++ group,
is not the best one for the question so maybe no one has given the
details.

> Color me surprised that I now have to conclude a programmer has to write,
> for *every program* which does not use a line-based input method, such a
> parser himself.
>
>> It should be possible for someone to rip that functionality out of
>> (n)curses, so that you could use it, without the full-on commitment
>> to (n)curses.

I think the solution is right there in ncurses.

> Depends on how it needs to be used. Currently I've got some code which
> times out if nothing comes in or something incomplete has been parsed (it
> doesn't block).

ncurses provides a function to do this parsing with and without a
timeout. If that is not, in fact, what you want then you should explain
why ncurses's "keypad" setting does not do what you want.

--
Ben.

R.Wieser

unread,
Jun 30, 2023, 12:13:17 PM6/30/23
to
Ben,

> As far as I can tell there /is/ a solution, but this, being a C++
> group, is not the best one for the question so maybe no one has
> given the details.

I assumed that a good percentage of users here would be using Linux, and the
question would make sense to them. I must have assumed wrong.

> ncurses provides a function to do this parsing with and without
> a timeout. If that is not, in fact, what you want then you should
> explain why ncurses's "keypad" setting does not do what you want.

I would need to install it (its not part of the OS installation) and I've
heard that its a bit "demanding" :

[quote=Alf P. Steinbach, Sun, 25 Jun 2023 15:06:29 -0700]
curses takes over the entire (text / terminal) screen, keeping track of what
character is shown at each location and using minimal output to update it as
needed.
[/quote]

Which is /absolutily not/ what I'm currently looking for. Thats like using
a cannon to kill a mosquito.

Regards,
Rudy Wieser


R.Wieser

unread,
Jun 30, 2023, 12:13:17 PM6/30/23
to
Pavel,

> With readline, you *don't have to wait till <enter> is pressed* to get the
> key.

[snip code]

Thank you very much. I'm certainly going to check that out. If that works
the way it looks it saves me a /lot/ of work.

... though to be honest, I feel like I'm back in dos batch, abusing stuff
left and right to get things done. :-| :-)

Regards,
Rudy Wieser


Scott Lurndal

unread,
Jun 30, 2023, 12:46:11 PM6/30/23
to
"R.Wieser" <add...@is.invalid> writes:
>Ben,
>
>> As far as I can tell there /is/ a solution, but this, being a C++
>> group, is not the best one for the question so maybe no one has
>> given the details.
>
>I assumed that a good percentage of users here would be using Linux, and the
>question would make sense to them. I must have assumed wrong.
>
>> ncurses provides a function to do this parsing with and without
>> a timeout. If that is not, in fact, what you want then you should
>> explain why ncurses's "keypad" setting does not do what you want.
>
>I would need to install it (its not part of the OS installation) and I've
>heard that its a bit "demanding" :
>
>[quote=Alf P. Steinbach, Sun, 25 Jun 2023 15:06:29 -0700]
>curses takes over the entire (text / terminal) screen, keeping track of what
>character is shown at each location and using minimal output to update it as
>needed.
>[/quote]

Not everything you "hear" is accurate. Nor is this group a bastion
of linux expertise, most posters are windows users near as I can tell.

curses/ncurses is library with a wide range of functionality,
the manual pages can be informative.

$ man -k curses
BC (3x) - direct curses interface to the terminfo capability database
COLORS (3x) - curses global variables
_nc_free_and_exit (3x) - curses memory-leak checking
_nc_freeall (3x) - curses memory-leak checking
_nc_tracebits (3x) - curses debugging routines
_traceattr (3x) - curses debugging routines
_traceattr2 (3x) - curses debugging routines
_tracecchar_t (3x) - curses debugging routines
_tracecchar_t2 (3x) - curses debugging routines
_tracechar (3x) - curses debugging routines
_tracechtype (3x) - curses debugging routines
_tracechtype2 (3x) - curses debugging routines
_tracedump (3x) - curses debugging routines
_tracef (3x) - curses debugging routines
_tracemouse (3x) - curses debugging routines
acs_map (3x) - curses terminfo global variables
add_wch (3x) - add a complex character and rendition to a curses window, then advance the cursor
add_wchnstr (3x) - add an array of complex characters (and attributes) to a curses window
add_wchstr (3x) - add an array of complex characters (and attributes) to a curses window
addch (3x) - add a character (with attributes) to a curses window, then advance the cursor
addchnstr (3x) - add a string of characters (and attributes) to a curses window
addchstr (3x) - add a string of characters (and attributes) to a curses window
addnstr (3x) - add a string of characters to a curses window and advance cursor
addnwstr (3x) - add a string of wide characters to a curses window and advance cursor
addstr (3x) - add a string of characters to a curses window and advance cursor
addwstr (3x) - add a string of wide characters to a curses window and advance cursor
alsamixer (1) - soundcard mixer for ALSA soundcard driver, with ncurses interface
assume_default_colors_sp (3x) - curses screen-pointer extension
attr_get (3x) - curses character and window attribute control routines
attr_off (3x) - curses character and window attribute control routines
attr_on (3x) - curses character and window attribute control routines
attr_set (3x) - curses character and window attribute control routines
attroff (3x) - curses character and window attribute control routines
attron (3x) - curses character and window attribute control routines
attrset (3x) - curses character and window attribute control routines
baudrate (3x) - curses environment query routines
baudrate_sp (3x) - curses screen-pointer extension
beep (3x) - curses bell and screen flash routines
beep_sp (3x) - curses screen-pointer extension
bkgd (3x) - curses window background manipulation routines
bkgdset (3x) - curses window background manipulation routines
bkgrnd (3x) - curses window complex background manipulation routines
bkgrndset (3x) - curses window complex background manipulation routines
boolcodes (3x) - curses terminfo global variables
boolfnames (3x) - curses terminfo global variables
boolnames (3x) - curses terminfo global variables
border (3x) - create curses borders, horizontal and vertical lines
border_set (3x) - create curses borders or lines using complex characters and renditions
bottom_panel (3x) - panel stack extension for curses
box (3x) - create curses borders, horizontal and vertical lines
box_set (3x) - create curses borders or lines using complex characters and renditions
can_change_color (3x) - curses color manipulation routines
can_change_color_sp (3x) - curses screen-pointer extension
cbreak (3x) - curses input options
cbreak_sp (3x) - curses screen-pointer extension
ccmake (1) - Curses Interface for CMake.
ceiling_panel (3x) - curses screen-pointer extension
cgdisk (8) - Curses-based GUID partition table (GPT) manipulator
chgat (3x) - curses character and window attribute control routines
clear (3x) - clear all or part of a curses window
clearok (3x) - curses output options
clrtobot (3x) - clear all or part of a curses window
clrtoeol (3x) - clear all or part of a curses window
color_content (3x) - curses color manipulation routines
color_content_sp (3x) - curses screen-pointer extension
COLOR_PAIR (3x) - curses color manipulation routines
COLOR_PAIRS (3x) - curses global variables
color_set (3x) - curses character and window attribute control routines
COLS (3x) - curses global variables
copywin (3x) - overlay and manipulate overlapped curses windows
cur_term (3x) - curses terminfo global variables
curs_add_wch (3x) - add a complex character and rendition to a curses window, then advance the cursor
curs_add_wchstr (3x) - add an array of complex characters (and attributes) to a curses window
curs_addch (3x) - add a character (with attributes) to a curses window, then advance the cursor
curs_addchstr (3x) - add a string of characters (and attributes) to a curses window
curs_addstr (3x) - add a string of characters to a curses window and advance cursor
curs_addwstr (3x) - add a string of wide characters to a curses window and advance cursor
curs_attr (3x) - curses character and window attribute control routines
curs_beep (3x) - curses bell and screen flash routines
curs_bkgd (3x) - curses window background manipulation routines
curs_bkgrnd (3x) - curses window complex background manipulation routines
curs_border (3x) - create curses borders, horizontal and vertical lines
curs_border_set (3x) - create curses borders or lines using complex characters and renditions
curs_clear (3x) - clear all or part of a curses window
curs_color (3x) - curses color manipulation routines
curs_delch (3x) - delete character under the cursor in a curses window
curs_deleteln (3x) - delete and insert lines in a curses window
curs_extend (3x) - miscellaneous curses extensions
curs_get_wch (3x) - get (or push back) a wide character from curses terminal keyboard
curs_get_wstr (3x) - get an array of wide characters from a curses terminal keyboard
curs_getch (3x) - get (or push back) characters from curses terminal keyboard
curs_getstr (3x) - accept character strings from curses terminal keyboard
curs_getyx (3x) - get curses cursor and window coordinates
curs_in_wchstr (3x) - get an array of complex characters and renditions from a curses window
curs_inch (3x) - get a character and attributes from a curses window
curs_inchstr (3x) - get a string of characters (and attributes) from a curses window
curs_initscr (3x) - curses screen initialization and manipulation routines
curs_inopts (3x) - curses input options
curs_ins_wstr (3x) - insert a wide-character string into a curses window
curs_insch (3x) - insert a character before cursor in a curses window
curs_insstr (3x) - insert string before cursor in a curses window
curs_instr (3x) - get a string of characters from a curses window
curs_inwstr (3x) - get a string of wchar_t characters from a curses window
curs_kernel (3x) - low-level curses routines
curs_legacy (3x) - get curses cursor and window coordinates, attributes
curs_memleaks (3x) - curses memory-leak checking
curs_mouse (3x) - mouse interface through curses
curs_move (3x) - move curses window cursor
curs_opaque (3x) - curses window properties
curs_outopts (3x) - curses output options
curs_overlay (3x) - overlay and manipulate overlapped curses windows
curs_pad (3x) - create and display curses pads
curs_printw (3x) - print formatted output in curses windows
curs_refresh (3x) - refresh curses windows and lines
curs_scanw (3x) - convert formatted input from a curses window
curs_scr_dump (3x) - read (write) a curses screen from (to) a file
curs_scroll (3x) - scroll a curses window
curs_set (3x) - low-level curses routines
curs_set_sp (3x) - curses screen-pointer extension
curs_slk (3x) - curses soft label routines
curs_sp_funcs (3x) - curses screen-pointer extension
curs_termattrs (3x) - curses environment query routines
curs_termcap (3x) - direct curses interface to the terminfo capability database
curs_terminfo (3x) - curses interfaces to terminfo database
curs_threads (3x) - curses thread support
curs_touch (3x) - curses refresh control routines
curs_trace (3x) - curses debugging routines
curs_util (3x) - miscellaneous curses utility routines
curs_variables (3x) - curses global variables
curs_window (3x) - create curses windows
curscr (3x) - curses global variables
curses_version (3x) - miscellaneous curses extensions
def_prog_mode (3x) - low-level curses routines
def_prog_mode_sp (3x) - curses screen-pointer extension
def_shell_mode (3x) - low-level curses routines
def_shell_mode_sp (3x) - curses screen-pointer extension
define_key_sp (3x) - curses screen-pointer extension
del_curterm (3x) - curses interfaces to terminfo database
del_curterm_sp (3x) - curses screen-pointer extension
del_panel (3x) - panel stack extension for curses
delay_output (3x) - miscellaneous curses utility routines
delay_output_sp (3x) - curses screen-pointer extension
delch (3x) - delete character under the cursor in a curses window
deleteln (3x) - delete and insert lines in a curses window
delscreen (3x) - curses screen initialization and manipulation routines
delwin (3x) - create curses windows
derwin (3x) - create curses windows
doupdate (3x) - refresh curses windows and lines
doupdate_sp (3x) - curses screen-pointer extension
dupwin (3x) - create curses windows
echo (3x) - curses input options
echo_sp (3x) - curses screen-pointer extension
echo_wchar (3x) - add a complex character and rendition to a curses window, then advance the cursor
echochar (3x) - add a character (with attributes) to a curses window, then advance the cursor
endwin (3x) - curses screen initialization and manipulation routines
endwin_sp (3x) - curses screen-pointer extension
erase (3x) - clear all or part of a curses window
erasechar (3x) - curses environment query routines
erasechar_sp (3x) - curses screen-pointer extension
erasewchar (3x) - curses environment query routines
ESCDELAY (3x) - curses global variables
filter (3x) - miscellaneous curses utility routines
filter_sp (3x) - curses screen-pointer extension
flash (3x) - curses bell and screen flash routines
flash_sp (3x) - curses screen-pointer extension
flushinp (3x) - miscellaneous curses utility routines
flushinp_sp (3x) - curses screen-pointer extension
form (3x) - curses extension for programming forms
get_escdelay (3x) - curses thread support
get_escdelay_sp (3x) - curses screen-pointer extension
get_wch (3x) - get (or push back) a wide character from curses terminal keyboard
get_wstr (3x) - get an array of wide characters from a curses terminal keyboard
getattrs (3x) - get curses cursor and window coordinates, attributes
getbegx (3x) - get curses cursor and window coordinates, attributes
getbegy (3x) - get curses cursor and window coordinates, attributes
getbegyx (3x) - get curses cursor and window coordinates
getbkgd (3x) - curses window background manipulation routines
getbkgrnd (3x) - curses window complex background manipulation routines
getch (3x) - get (or push back) characters from curses terminal keyboard
getcurx (3x) - get curses cursor and window coordinates, attributes
getcury (3x) - get curses cursor and window coordinates, attributes
getmaxx (3x) - get curses cursor and window coordinates, attributes
getmaxy (3x) - get curses cursor and window coordinates, attributes
getmaxyx (3x) - get curses cursor and window coordinates
getmouse (3x) - mouse interface through curses
getmouse_sp (3x) - curses screen-pointer extension
getn_wstr (3x) - get an array of wide characters from a curses terminal keyboard
getnstr (3x) - accept character strings from curses terminal keyboard
getparx (3x) - get curses cursor and window coordinates, attributes
getpary (3x) - get curses cursor and window coordinates, attributes
getparyx (3x) - get curses cursor and window coordinates
getstr (3x) - accept character strings from curses terminal keyboard
getsyx (3x) - low-level curses routines
getwin (3x) - miscellaneous curses utility routines
getwin_sp (3x) - curses screen-pointer extension
getyx (3x) - get curses cursor and window coordinates
ground_panel (3x) - curses screen-pointer extension
halfdelay (3x) - curses input options
halfdelay_sp (3x) - curses screen-pointer extension
has_colors (3x) - curses color manipulation routines
has_colors_sp (3x) - curses screen-pointer extension
has_ic (3x) - curses environment query routines
has_ic_sp (3x) - curses screen-pointer extension
has_il (3x) - curses environment query routines
has_il_sp (3x) - curses screen-pointer extension
has_key (3x) - get (or push back) characters from curses terminal keyboard
has_key_sp (3x) - curses screen-pointer extension
has_mouse (3x) - mouse interface through curses
has_mouse_sp (3x) - curses screen-pointer extension
hide_panel (3x) - panel stack extension for curses
hline (3x) - create curses borders, horizontal and vertical lines
hline_set (3x) - create curses borders or lines using complex characters and renditions
idcok (3x) - curses output options
idlok (3x) - curses output options
immedok (3x) - curses output options
in_wchnstr (3x) - get an array of complex characters and renditions from a curses window
in_wchstr (3x) - get an array of complex characters and renditions from a curses window
inch (3x) - get a character and attributes from a curses window
inchnstr (3x) - get a string of characters (and attributes) from a curses window
inchstr (3x) - get a string of characters (and attributes) from a curses window
init_color (3x) - curses color manipulation routines
init_color_sp (3x) - curses screen-pointer extension
init_pair (3x) - curses color manipulation routines
init_pair_sp (3x) - curses screen-pointer extension
initscr (3x) - curses screen initialization and manipulation routines
innstr (3x) - get a string of characters from a curses window
innwstr (3x) - get a string of wchar_t characters from a curses window
ins_nwstr (3x) - insert a wide-character string into a curses window
ins_wstr (3x) - insert a wide-character string into a curses window
insch (3x) - insert a character before cursor in a curses window
insdelln (3x) - delete and insert lines in a curses window
insertln (3x) - delete and insert lines in a curses window
insnstr (3x) - insert string before cursor in a curses window
insstr (3x) - insert string before cursor in a curses window
instr (3x) - get a string of characters from a curses window
intrflush (3x) - curses input options
intrflush_sp (3x) - curses screen-pointer extension
inwstr (3x) - get a string of wchar_t characters from a curses window
is_cleared (3x) - curses window properties
is_idcok (3x) - curses window properties
is_idlok (3x) - curses window properties
is_immedok (3x) - curses window properties
is_keypad (3x) - curses window properties
is_leaveok (3x) - curses window properties
is_linetouched (3x) - curses refresh control routines
is_nodelay (3x) - curses window properties
is_notimeout (3x) - curses window properties
is_pad (3x) - curses window properties
is_scrollok (3x) - curses window properties
is_subwin (3x) - curses window properties
is_syncok (3x) - curses window properties
is_term_resized (3x) - change the curses terminal size
is_term_resized_sp (3x) - curses screen-pointer extension
is_wintouched (3x) - curses refresh control routines
isendwin (3x) - curses screen initialization and manipulation routines
isendwin_sp (3x) - curses screen-pointer extension
key_defined_sp (3x) - curses screen-pointer extension
key_name (3x) - miscellaneous curses utility routines
keybound_sp (3x) - curses screen-pointer extension
keyname (3x) - miscellaneous curses utility routines
keyname_sp (3x) - curses screen-pointer extension
keyok_sp (3x) - curses screen-pointer extension
keypad (3x) - curses input options
killchar (3x) - curses environment query routines
killchar_sp (3x) - curses screen-pointer extension
killwchar (3x) - curses environment query routines
leaveok (3x) - curses output options
LINES (3x) - curses global variables
longname (3x) - curses environment query routines
mcprint_sp (3x) - curses screen-pointer extension
menu (3x) - curses extension for programming menus
meta (3x) - curses input options
mouse_trafo (3x) - mouse interface through curses
mouseinterval (3x) - mouse interface through curses
mouseinterval_sp (3x) - curses screen-pointer extension
mousemask (3x) - mouse interface through curses
mousemask_sp (3x) - curses screen-pointer extension
move (3x) - move curses window cursor
move_panel (3x) - panel stack extension for curses
mvadd_wch (3x) - add a complex character and rendition to a curses window, then advance the cursor
mvadd_wchnstr (3x) - add an array of complex characters (and attributes) to a curses window
mvadd_wchstr (3x) - add an array of complex characters (and attributes) to a curses window
mvaddch (3x) - add a character (with attributes) to a curses window, then advance the cursor
mvaddchnstr (3x) - add a string of characters (and attributes) to a curses window
mvaddchstr (3x) - add a string of characters (and attributes) to a curses window
mvaddnstr (3x) - add a string of characters to a curses window and advance cursor
mvaddnwstr (3x) - add a string of wide characters to a curses window and advance cursor
mvaddstr (3x) - add a string of characters to a curses window and advance cursor
mvaddwstr (3x) - add a string of wide characters to a curses window and advance cursor
mvchgat (3x) - curses character and window attribute control routines
mvcur (3x) - curses interfaces to terminfo database
mvcur_sp (3x) - curses screen-pointer extension
mvdelch (3x) - delete character under the cursor in a curses window
mvderwin (3x) - create curses windows
mvget_wch (3x) - get (or push back) a wide character from curses terminal keyboard
mvget_wstr (3x) - get an array of wide characters from a curses terminal keyboard
mvgetch (3x) - get (or push back) characters from curses terminal keyboard
mvgetn_wstr (3x) - get an array of wide characters from a curses terminal keyboard
mvgetnstr (3x) - accept character strings from curses terminal keyboard
mvgetstr (3x) - accept character strings from curses terminal keyboard
mvhline (3x) - create curses borders, horizontal and vertical lines
mvhline_set (3x) - create curses borders or lines using complex characters and renditions
mvin_wchnstr (3x) - get an array of complex characters and renditions from a curses window
mvin_wchstr (3x) - get an array of complex characters and renditions from a curses window
mvinch (3x) - get a character and attributes from a curses window
mvinchnstr (3x) - get a string of characters (and attributes) from a curses window
mvinchstr (3x) - get a string of characters (and attributes) from a curses window
mvinnstr (3x) - get a string of characters from a curses window
mvinnwstr (3x) - get a string of wchar_t characters from a curses window
mvins_nwstr (3x) - insert a wide-character string into a curses window
mvins_wstr (3x) - insert a wide-character string into a curses window
mvinsch (3x) - insert a character before cursor in a curses window
mvinsnstr (3x) - insert string before cursor in a curses window
mvinsstr (3x) - insert string before cursor in a curses window
mvinstr (3x) - get a string of characters from a curses window
mvinwstr (3x) - get a string of wchar_t characters from a curses window
mvprintw (3x) - print formatted output in curses windows
mvscanw (3x) - convert formatted input from a curses window
mvvline (3x) - create curses borders, horizontal and vertical lines
mvvline_set (3x) - create curses borders or lines using complex characters and renditions
mvwadd_wch (3x) - add a complex character and rendition to a curses window, then advance the cursor
mvwadd_wchnstr (3x) - add an array of complex characters (and attributes) to a curses window
mvwadd_wchstr (3x) - add an array of complex characters (and attributes) to a curses window
mvwaddch (3x) - add a character (with attributes) to a curses window, then advance the cursor
mvwaddchnstr (3x) - add a string of characters (and attributes) to a curses window
mvwaddchstr (3x) - add a string of characters (and attributes) to a curses window
mvwaddnstr (3x) - add a string of characters to a curses window and advance cursor
mvwaddnwstr (3x) - add a string of wide characters to a curses window and advance cursor
mvwaddstr (3x) - add a string of characters to a curses window and advance cursor
mvwaddwstr (3x) - add a string of wide characters to a curses window and advance cursor
mvwchgat (3x) - curses character and window attribute control routines
mvwdelch (3x) - delete character under the cursor in a curses window
mvwget_wch (3x) - get (or push back) a wide character from curses terminal keyboard
mvwget_wstr (3x) - get an array of wide characters from a curses terminal keyboard
mvwgetch (3x) - get (or push back) characters from curses terminal keyboard
mvwgetn_wstr (3x) - get an array of wide characters from a curses terminal keyboard
mvwgetnstr (3x) - accept character strings from curses terminal keyboard
mvwgetstr (3x) - accept character strings from curses terminal keyboard
mvwhline (3x) - create curses borders, horizontal and vertical lines
mvwhline_set (3x) - create curses borders or lines using complex characters and renditions
mvwin (3x) - create curses windows
mvwin_wchnstr (3x) - get an array of complex characters and renditions from a curses window
mvwin_wchstr (3x) - get an array of complex characters and renditions from a curses window
mvwinch (3x) - get a character and attributes from a curses window
mvwinchnstr (3x) - get a string of characters (and attributes) from a curses window
mvwinchstr (3x) - get a string of characters (and attributes) from a curses window
mvwinnstr (3x) - get a string of characters from a curses window
mvwinnwstr (3x) - get a string of wchar_t characters from a curses window
mvwins_nwstr (3x) - insert a wide-character string into a curses window
mvwins_wstr (3x) - insert a wide-character string into a curses window
mvwinsch (3x) - insert a character before cursor in a curses window
mvwinsnstr (3x) - insert string before cursor in a curses window
mvwinsstr (3x) - insert string before cursor in a curses window
mvwinstr (3x) - get a string of characters from a curses window
mvwinwstr (3x) - get a string of wchar_t characters from a curses window
mvwprintw (3x) - print formatted output in curses windows
mvwscanw (3x) - convert formatted input from a curses window
mvwvline (3x) - create curses borders, horizontal and vertical lines
mvwvline_set (3x) - create curses borders or lines using complex characters and renditions
napms (3x) - low-level curses routines
napms_sp (3x) - curses screen-pointer extension
ncurses (3x) - CRT screen handling and optimization package
ncursesw5-config (1) - helper script for ncurses libraries
new_form_sp (3x) - curses screen-pointer extension
new_menu_sp (3x) - curses screen-pointer extension
new_panel (3x) - panel stack extension for curses
new_prescr (3x) - curses screen-pointer extension
newpad (3x) - create and display curses pads
newpad_sp (3x) - curses screen-pointer extension
newscr (3x) - curses global variables
newterm (3x) - curses screen initialization and manipulation routines
newterm_sp (3x) - curses screen-pointer extension
newwin (3x) - create curses windows
newwin_sp (3x) - curses screen-pointer extension
nl (3x) - curses output options
nl_sp (3x) - curses screen-pointer extension
nocbreak (3x) - curses input options
nocbreak_sp (3x) - curses screen-pointer extension
nodelay (3x) - curses input options
noecho (3x) - curses input options
noecho_sp (3x) - curses screen-pointer extension
nofilter (3x) - miscellaneous curses utility routines
nofilter_sp (3x) - curses screen-pointer extension
nonl (3x) - curses output options
nonl_sp (3x) - curses screen-pointer extension
noqiflush (3x) - curses input options
noqiflush_sp (3x) - curses screen-pointer extension
noraw (3x) - curses input options
noraw_sp (3x) - curses screen-pointer extension
notimeout (3x) - curses input options
numcodes (3x) - curses terminfo global variables
numfnames (3x) - curses terminfo global variables
numnames (3x) - curses terminfo global variables
ospeed (3x) - direct curses interface to the terminfo capability database
overlay (3x) - overlay and manipulate overlapped curses windows
overwrite (3x) - overlay and manipulate overlapped curses windows
pair_content (3x) - curses color manipulation routines
pair_content_sp (3x) - curses screen-pointer extension
PAIR_NUMBER (3x) - curses character and window attribute control routines
panel (3x) - panel stack extension for curses
panel_above (3x) - panel stack extension for curses
panel_below (3x) - panel stack extension for curses
panel_hidden (3x) - panel stack extension for curses
panel_userptr (3x) - panel stack extension for curses
panel_window (3x) - panel stack extension for curses
PC (3x) - direct curses interface to the terminfo capability database
pecho_wchar (3x) - create and display curses pads
pechochar (3x) - create and display curses pads
pinfo (1) - curses based lynx-style info browser
pnoutrefresh (3x) - create and display curses pads
prefresh (3x) - create and display curses pads
printw (3x) - print formatted output in curses windows
putp (3x) - curses interfaces to terminfo database
putp_sp (3x) - curses screen-pointer extension
putwin (3x) - miscellaneous curses utility routines
qiflush (3x) - curses input options
qiflush_sp (3x) - curses screen-pointer extension
raw (3x) - curses input options
raw_sp (3x) - curses screen-pointer extension
redrawwin (3x) - refresh curses windows and lines
refresh (3x) - refresh curses windows and lines
replace_panel (3x) - panel stack extension for curses
reset_prog_mode (3x) - low-level curses routines
reset_prog_mode_sp (3x) - curses screen-pointer extension
reset_shell_mode (3x) - low-level curses routines
reset_shell_mode_sp (3x) - curses screen-pointer extension
resetty (3x) - low-level curses routines
resetty_sp (3x) - curses screen-pointer extension
resize_term (3x) - change the curses terminal size
resize_term_sp (3x) - curses screen-pointer extension
resizeterm (3x) - change the curses terminal size
resizeterm_sp (3x) - curses screen-pointer extension
restartterm (3x) - curses interfaces to terminfo database
restartterm_sp (3x) - curses screen-pointer extension
ripoffline (3x) - low-level curses routines
ripoffline_sp (3x) - curses screen-pointer extension
samba-regedit (8) - ncurses based tool to manage the Samba registry
savetty (3x) - low-level curses routines
savetty_sp (3x) - curses screen-pointer extension
scanw (3x) - convert formatted input from a curses window
scr_dump (3x) - read (write) a curses screen from (to) a file
scr_init (3x) - read (write) a curses screen from (to) a file
scr_init_sp (3x) - curses screen-pointer extension
scr_restore (3x) - read (write) a curses screen from (to) a file
scr_restore_sp (3x) - curses screen-pointer extension
scr_set (3x) - read (write) a curses screen from (to) a file
scr_set_sp (3x) - curses screen-pointer extension
scrl (3x) - scroll a curses window
scroll (3x) - scroll a curses window
scrollok (3x) - curses output options
set_curterm (3x) - curses interfaces to terminfo database
set_curterm_sp (3x) - curses screen-pointer extension
set_escdelay (3x) - curses thread support
set_escdelay_sp (3x) - curses screen-pointer extension
set_panel_userptr (3x) - panel stack extension for curses
set_tabsize (3x) - curses thread support
set_tabsize_sp (3x) - curses screen-pointer extension
set_term (3x) - curses screen initialization and manipulation routines
setscrreg (3x) - curses output options
setsyx (3x) - low-level curses routines
setterm (3x) - curses interfaces to terminfo database
setupterm (3x) - curses interfaces to terminfo database
show_panel (3x) - panel stack extension for curses
slk_attr (3x) - curses soft label routines
slk_attr_off (3x) - curses soft label routines
slk_attr_on (3x) - curses soft label routines
slk_attr_set (3x) - curses soft label routines
slk_attr_set_sp (3x) - curses screen-pointer extension
slk_attr_sp (3x) - curses screen-pointer extension
slk_attroff (3x) - curses soft label routines
slk_attroff_sp (3x) - curses screen-pointer extension
slk_attron (3x) - curses soft label routines
slk_attron_sp (3x) - curses screen-pointer extension
slk_attrset (3x) - curses soft label routines
slk_attrset_sp (3x) - curses screen-pointer extension
slk_clear (3x) - curses soft label routines
slk_clear_sp (3x) - curses screen-pointer extension
slk_color (3x) - curses soft label routines
slk_color_sp (3x) - curses screen-pointer extension
slk_init (3x) - curses soft label routines
slk_init_sp (3x) - curses screen-pointer extension
slk_label (3x) - curses soft label routines
slk_label_sp (3x) - curses screen-pointer extension
slk_noutrefresh (3x) - curses soft label routines
slk_noutrefresh_sp (3x) - curses screen-pointer extension
slk_refresh (3x) - curses soft label routines
slk_refresh_sp (3x) - curses screen-pointer extension
slk_restore (3x) - curses soft label routines
slk_restore_sp (3x) - curses screen-pointer extension
slk_set (3x) - curses soft label routines
slk_set_sp (3x) - curses screen-pointer extension
slk_touch (3x) - curses soft label routines
slk_touch_sp (3x) - curses screen-pointer extension
slk_wset (3x) - curses soft label routines
SP (3x) - curses terminfo global variables
standend (3x) - curses character and window attribute control routines
standout (3x) - curses character and window attribute control routines
start_color (3x) - curses color manipulation routines
start_color_sp (3x) - curses screen-pointer extension
stdscr (3x) - curses global variables
strcodes (3x) - curses terminfo global variables
strfnames (3x) - curses terminfo global variables
strnames (3x) - curses terminfo global variables
subpad (3x) - create and display curses pads
subwin (3x) - create curses windows
syncok (3x) - create curses windows
TABSIZE (3x) - curses global variables
term_attrs (3x) - curses environment query routines
term_attrs_sp (3x) - curses screen-pointer extension
term_variables (3x) - curses terminfo global variables
termattrs (3x) - curses environment query routines
termattrs_sp (3x) - curses screen-pointer extension
termname (3x) - curses environment query routines
termname_sp (3x) - curses screen-pointer extension
tgetent (3x) - direct curses interface to the terminfo capability database
tgetent_sp (3x) - curses screen-pointer extension
tgetflag (3x) - direct curses interface to the terminfo capability database
tgetflag_sp (3x) - curses screen-pointer extension
tgetnum (3x) - direct curses interface to the terminfo capability database
tgetnum_sp (3x) - curses screen-pointer extension
tgetstr (3x) - direct curses interface to the terminfo capability database
tgetstr_sp (3x) - curses screen-pointer extension
tgoto (3x) - direct curses interface to the terminfo capability database
tigetflag (3x) - curses interfaces to terminfo database
tigetflag_sp (3x) - curses screen-pointer extension
tigetnum (3x) - curses interfaces to terminfo database
tigetnum_sp (3x) - curses screen-pointer extension
tigetstr (3x) - curses interfaces to terminfo database
tigetstr_sp (3x) - curses screen-pointer extension
timeout (3x) - curses input options
tiparm (3x) - curses interfaces to terminfo database
top_panel (3x) - panel stack extension for curses
touchline (3x) - curses refresh control routines
touchwin (3x) - curses refresh control routines
tparm (3x) - curses interfaces to terminfo database
tputs (3x) - curses interfaces to terminfo database
tputs_sp (3x) - curses screen-pointer extension
trace (3x) - curses debugging routines
ttytype (3x) - curses terminfo global variables
typeahead (3x) - curses input options
typeahead_sp (3x) - curses screen-pointer extension
unctrl (3x) - miscellaneous curses utility routines
unctrl_sp (3x) - curses screen-pointer extension
unget_wch (3x) - get (or push back) a wide character from curses terminal keyboard
unget_wch_sp (3x) - curses screen-pointer extension
ungetch (3x) - get (or push back) characters from curses terminal keyboard
ungetch_sp (3x) - curses screen-pointer extension
ungetmouse (3x) - mouse interface through curses
ungetmouse_sp (3x) - curses screen-pointer extension
untouchwin (3x) - curses refresh control routines
UP (3x) - direct curses interface to the terminfo capability database
update_panels (3x) - panel stack extension for curses
update_panels_sp (3x) - curses screen-pointer extension
use_default_colors_sp (3x) - curses screen-pointer extension
use_env (3x) - miscellaneous curses utility routines
use_env_sp (3x) - curses screen-pointer extension
use_extended_names (3x) - miscellaneous curses extensions
use_legacy_coding_sp (3x) - curses screen-pointer extension
use_screen (3x) - curses thread support
use_tioctl (3x) - miscellaneous curses utility routines
use_window (3x) - curses thread support
vid_attr (3x) - curses interfaces to terminfo database
vid_attr_sp (3x) - curses screen-pointer extension
vid_puts (3x) - curses interfaces to terminfo database
vid_puts_sp (3x) - curses screen-pointer extension
vidattr (3x) - curses interfaces to terminfo database
vidattr_sp (3x) - curses screen-pointer extension
vidputs (3x) - curses interfaces to terminfo database
vidputs_sp (3x) - curses screen-pointer extension
vline (3x) - create curses borders, horizontal and vertical lines
vline_set (3x) - create curses borders or lines using complex characters and renditions
vw_printw (3x) - print formatted output in curses windows
vw_scanw (3x) - convert formatted input from a curses window
vwprintw (3x) - print formatted output in curses windows
vwscanw (3x) - convert formatted input from a curses window
wadd_wch (3x) - add a complex character and rendition to a curses window, then advance the cursor
wadd_wchnstr (3x) - add an array of complex characters (and attributes) to a curses window
wadd_wchstr (3x) - add an array of complex characters (and attributes) to a curses window
waddch (3x) - add a character (with attributes) to a curses window, then advance the cursor
waddchnstr (3x) - add a string of characters (and attributes) to a curses window
waddchstr (3x) - add a string of characters (and attributes) to a curses window
waddnstr (3x) - add a string of characters to a curses window and advance cursor
waddnwstr (3x) - add a string of wide characters to a curses window and advance cursor
waddstr (3x) - add a string of characters to a curses window and advance cursor
waddwstr (3x) - add a string of wide characters to a curses window and advance cursor
wattr_get (3x) - curses character and window attribute control routines
wattr_off (3x) - curses character and window attribute control routines
wattr_on (3x) - curses character and window attribute control routines
wattr_set (3x) - curses character and window attribute control routines
wattroff (3x) - curses character and window attribute control routines
wattron (3x) - curses character and window attribute control routines
wattrset (3x) - curses character and window attribute control routines
wbkgd (3x) - curses window background manipulation routines
wbkgdset (3x) - curses window background manipulation routines
wbkgrnd (3x) - curses window complex background manipulation routines
wbkgrndset (3x) - curses window complex background manipulation routines
wborder (3x) - create curses borders, horizontal and vertical lines
wborder_set (3x) - create curses borders or lines using complex characters and renditions
wchgat (3x) - curses character and window attribute control routines
wclear (3x) - clear all or part of a curses window
wclrtobot (3x) - clear all or part of a curses window
wclrtoeol (3x) - clear all or part of a curses window
wcolor_set (3x) - curses character and window attribute control routines
wcursyncup (3x) - create curses windows
wdelch (3x) - delete character under the cursor in a curses window
wdeleteln (3x) - delete and insert lines in a curses window
wecho_wchar (3x) - add a complex character and rendition to a curses window, then advance the cursor
wechochar (3x) - add a character (with attributes) to a curses window, then advance the cursor
wenclose (3x) - mouse interface through curses
werase (3x) - clear all or part of a curses window
wget_wch (3x) - get (or push back) a wide character from curses terminal keyboard
wget_wstr (3x) - get an array of wide characters from a curses terminal keyboard
wgetbkgrnd (3x) - curses window complex background manipulation routines
wgetch (3x) - get (or push back) characters from curses terminal keyboard
wgetn_wstr (3x) - get an array of wide characters from a curses terminal keyboard
wgetnstr (3x) - accept character strings from curses terminal keyboard
wgetparent (3x) - curses window properties
wgetscrreg (3x) - curses window properties
wgetstr (3x) - accept character strings from curses terminal keyboard
whline (3x) - create curses borders, horizontal and vertical lines
whline_set (3x) - create curses borders or lines using complex characters and renditions
win_wchnstr (3x) - get an array of complex characters and renditions from a curses window
win_wchstr (3x) - get an array of complex characters and renditions from a curses window
winch (3x) - get a character and attributes from a curses window
winchnstr (3x) - get a string of characters (and attributes) from a curses window
winchstr (3x) - get a string of characters (and attributes) from a curses window
winnstr (3x) - get a string of characters from a curses window
winnwstr (3x) - get a string of wchar_t characters from a curses window
wins_nwstr (3x) - insert a wide-character string into a curses window
wins_wstr (3x) - insert a wide-character string into a curses window
winsch (3x) - insert a character before cursor in a curses window
winsdelln (3x) - delete and insert lines in a curses window
winsertln (3x) - delete and insert lines in a curses window
winsnstr (3x) - insert string before cursor in a curses window
winsstr (3x) - insert string before cursor in a curses window
winstr (3x) - get a string of characters from a curses window
winwstr (3x) - get a string of wchar_t characters from a curses window
wmouse_trafo (3x) - mouse interface through curses
wmove (3x) - move curses window cursor
wnoutrefresh (3x) - refresh curses windows and lines
wprintw (3x) - print formatted output in curses windows
wredrawln (3x) - refresh curses windows and lines
wrefresh (3x) - refresh curses windows and lines
wresize (3x) - resize a curses window
wscanw (3x) - convert formatted input from a curses window
wscrl (3x) - scroll a curses window
wsetscrreg (3x) - curses output options
wstandend (3x) - curses character and window attribute control routines
wstandout (3x) - curses character and window attribute control routines
wsyncdown (3x) - create curses windows
wsyncup (3x) - create curses windows
wtimeout (3x) - curses input options
wtouchln (3x) - curses refresh control routines
wunctrl (3x) - miscellaneous curses utility routines
wunctrl_sp (3x) - curses screen-pointer extension
wvline (3x) - create curses borders, horizontal and vertical lines
wvline_set (3x) - create curses borders or lines using complex characters and renditions

R.Wieser

unread,
Jun 30, 2023, 2:35:25 PM6/30/23
to
Scott,

> Not everything you "hear" is accurate.

I hope you are aware that the same thing goes for what I "hear" from you
too.

[snip long list of (mostly) functions]

I don't see anything there contradicting Alfs statement.

And as you did not bother to point anything out that does ... You lose.

Regards,
Rudy Wieser


Paavo Helde

unread,
Jun 30, 2023, 3:58:17 PM6/30/23
to
30.06.2023 19:12 R.Wieser kirjutas:

> [quote=Alf P. Steinbach, Sun, 25 Jun 2023 15:06:29 -0700]
> curses takes over the entire (text / terminal) screen, keeping track of what
> character is shown at each location and using minimal output to update it as
> needed.
> [/quote]
>
> Which is /absolutily not/ what I'm currently looking for. Thats like using
> a cannon to kill a mosquito.

Yes, that's the way it goes nowadays. But ncurses is not really a
cannon, maybe a water pistol.

$ cat `find ncurses/ -name '*.c' -o -name '*.cpp' -o -name '*.h'` | wc -l
129139

For comparison, this is a cannon:

$ cat `find aws-sdk-cpp/ -name '*.c' -o -name '*.cpp' -o -name '*.h'` |
wc -l
15210261

That's pretty impressive for a library which just copies files from one
place to other (at least that's what we are using it for).






Ben Bacarisse

unread,
Jun 30, 2023, 4:36:29 PM6/30/23
to
"R.Wieser" <add...@is.invalid> writes:

>> As far as I can tell there /is/ a solution, but this, being a C++
>> group, is not the best one for the question so maybe no one has
>> given the details.
>
> I assumed that a good percentage of users here would be using Linux, and the
> question would make sense to them. I must have assumed wrong.

Someone using Linux will not necessarily know about the details of
programming with curses. It's just odd to think that an interest in C++
will correlate, significantly, with detailed knowledge about curses.

>> ncurses provides a function to do this parsing with and without
>> a timeout. If that is not, in fact, what you want then you should
>> explain why ncurses's "keypad" setting does not do what you want.
>
> I would need to install it (its not part of the OS installation) and I've
> heard that its a bit "demanding" :

You don't have to install it to read about it!

> [quote=Alf P. Steinbach, Sun, 25 Jun 2023 15:06:29 -0700]
> curses takes over the entire (text / terminal) screen, keeping track of what
> character is shown at each location and using minimal output to update it as
> needed.
> [/quote]
>
> Which is /absolutily not/ what I'm currently looking for. Thats like using
> a cannon to kill a mosquito.

It may not do /only/ what you want, but wanting to parse input into keys
and /not/ wanting the other stuff if rare enough that it's a reasonable
starting point.

--
Ben.

Keith Thompson

unread,
Jun 30, 2023, 4:46:10 PM6/30/23
to
"R.Wieser" <add...@is.invalid> writes:
>> As far as I can tell there /is/ a solution, but this, being a C++
>> group, is not the best one for the question so maybe no one has
>> given the details.
>
> I assumed that a good percentage of users here would be using Linux, and the
> question would make sense to them. I must have assumed wrong.

And yet you're still posting here and *not* posting in an appropriate
place. Why?

>> ncurses provides a function to do this parsing with and without
>> a timeout. If that is not, in fact, what you want then you should
>> explain why ncurses's "keypad" setting does not do what you want.
>
> I would need to install it (its not part of the OS installation) and I've
> heard that its a bit "demanding" :
>
> [quote=Alf P. Steinbach, Sun, 25 Jun 2023 15:06:29 -0700]
> curses takes over the entire (text / terminal) screen, keeping track of what
> character is shown at each location and using minimal output to update it as
> needed.
> [/quote]

You see, this is why you should leave attribution lines alone. Alf
Steinbach didn't write that. I did. (He quoted it in a followup.)

> Which is /absolutily not/ what I'm currently looking for. Thats like using
> a cannon to kill a mosquito.

I have no problem with using a cannon to kill a mosquito. If ncurses
had a good way to detect arrow key input without taking over the whole
screen, I'd recommend that.

Thomas Dickey, in response to a question I posted on Stack Overflow a
few years ago, suggested something that might be the basis of a
solution:

https://stackoverflow.com/q/48715793/827263
https://stackoverflow.com/a/48716136/827263

James Kuyper

unread,
Jun 30, 2023, 5:00:37 PM6/30/23
to
On 6/30/23 12:12, R.Wieser wrote:
> Ben,
>
>> As far as I can tell there /is/ a solution, but this, being a C++
>> group, is not the best one for the question so maybe no one has
>> given the details.
>
> I assumed that a good percentage of users here would be using Linux, and the
> question would make sense to them. I must have assumed wrong.

Why would you go to a forum where "a good percentage of users would be
using Linux", rather than a forum devoted to Linux, where that
percentage could reasonably be assumed to be 100? It's significantly
less than 100% here - several of the people who post here dismiss any
Linux-specific comment in the belief that Linux is unimportant compared
to Windows.

Kenny McCormack

unread,
Jul 1, 2023, 3:53:28 AM7/1/23
to
In article <u7nfp3$2kvh5$1...@dont-email.me>,
Those people are mostly idiots and can (and should) be ignored. So,
really, no worries on that front.

--
A Catholic woman tells her husband to buy Viagra.

A Jewish woman tells her husband to buy Pfizer.

R.Wieser

unread,
Jul 1, 2023, 4:47:33 AM7/1/23
to
James,

> Why would you go to a forum where "a good percentage of users would
> be using Linux", rather than a forum devoted to Linux, where that
> percentage could reasonably be assumed to be 100?

If I would know everything (including the knowledge of a more apropriate
newsgroup ) than I would not have needed to post a question to begin with.
Ever thought about that ?

> It's significantly less than 100% here

You don't say.

> several of the people who post here dismiss any Linux-specific comment in
> the belief that Linux is unimportant compared to Windows.

And those are not the ones who would have the Linux knowledge to answer my
current question, so thats fine by me.

But thank you for the warning.

And for the record, if I would have had that other newsgroup in my shortlist
I would have posted there.

Regards,
Rudy Wieser


R.Wieser

unread,
Jul 1, 2023, 4:47:33 AM7/1/23
to
Keith,

>> I assumed that a good percentage of users here would be using Linux,
>> and the question would make sense to them. I must have assumed wrong.
>
> And yet you're still posting here and *not* posting in an appropriate
> place. Why?

Are you telling me I should just have stopped responding here and taken off
to that other newsgroup ? Where I live thats considered rude going on
offensive.

> You see, this is why you should leave attribution lines alone. Alf
> Steinbach didn't write that. I did. (He quoted it in a followup.)

Funny, I took his name from your post, where the attribution lines where
(ofcourse) present ...

But yes, I made a mistake. As you say, it was you who wrote that, in a
response to Alf. My apologies.

... But do I at least get points for using the correct date ? :-)

> I have no problem with using a cannon to kill a mosquito. If
> ncurses had a good way to detect arrow key input without taking
> over the whole screen, I'd recommend that.

And in that "no taking over of stuff" case I would most likely have used it.

> Thomas Dickey, in response to a question I posted on Stack Overflow
> a few years ago, suggested something that might be the basis of a
> solution:

Both of those links seem to end up showing the same content.

I skipped the ncurses part, as it, as mentioned by yours truly, wants to
take over the screen. The "How to distinguish between escape and escape
sequence" link shows some code, but as mentioned, I've already got that part
down.

Thanks nonetheless.

Regards,
Rudy Wieser



R.Wieser

unread,
Jul 1, 2023, 4:47:33 AM7/1/23
to
Paavo,

> $ cat `find aws-sdk-cpp/ -name '*.c' -o -name '*.cpp' -o -name '*.h'` |
> wc -l
> 15210261
>
> That's pretty impressive for a library which just copies files from one
> place to other (at least that's what we are using it for).

With that size I can only assume that it supports copying those files by
"avian carrier" (rfc 1149) for the transport. :-)

> $ cat `find ncurses/ -name '*.c' -o -name '*.cpp' -o -name '*.h'` | wc -l
> 129139

but its not about the size, but about the "side" effects. I don't want to
have to relinquish control of the screen just to be able to get access to
preparsed keystrokes. Thats not an acceptable solution.

Regards,
Rudy Wieser


Malcolm McLean

unread,
Jul 1, 2023, 6:04:09 AM7/1/23
to
Actually the usual pattern is that Linux programmers consider themselves to be technically
and even morally superior to those who program for some other proprietary platforms.
And so Linux-specific discussions get a free pass, unlike those on other operating
systems.

Mut...@dastardlyhq.com

unread,
Jul 1, 2023, 6:30:18 AM7/1/23
to
I disagree. We may be snooty about Windows compared to other OS's - not just
linux - but a C++ dev is a C++ dev regardless of platform. Having written C++
on both I am in no wish to hurry back to Windows due to the hoops you often
have to jump through to do basic (for *nix) stuff such as process forking,
multiplexing sockets and the absurd distinction between console and GUI apps.
That said Visual Studio is definately superior as an IDE to anything Linux has
to offer and blows the bug ridden abortion known as Eclipse out of the water.

Keith Thompson

unread,
Jul 1, 2023, 2:59:08 PM7/1/23
to
"R.Wieser" <add...@is.invalid> writes:
> Keith,
>
>>> I assumed that a good percentage of users here would be using Linux,
>>> and the question would make sense to them. I must have assumed wrong.
>>
>> And yet you're still posting here and *not* posting in an appropriate
>> place. Why?
>
> Are you telling me I should just have stopped responding here and taken off
> to that other newsgroup ? Where I live thats considered rude going on
> offensive.

You could post a single message on this thread saying that you're going
to continue the discussion in comp.unix.programmer. Or you could
cross-post a message to comp.lang.c++ and comp.unix.programmer, with
followups directed to comp.unix.programmer.

You can still do that. It would be far less rude than what you're
doing now.

>> You see, this is why you should leave attribution lines alone. Alf
>> Steinbach didn't write that. I did. (He quoted it in a followup.)
>
> Funny, I took his name from your post, where the attribution lines where
> (ofcourse) present ...
>
> But yes, I made a mistake. As you say, it was you who wrote that, in a
> response to Alf. My apologies.
>
> ... But do I at least get points for using the correct date ? :-)

You get no points for continuing to deliberately flout longstanding
Usenet conventions.

>> I have no problem with using a cannon to kill a mosquito. If
>> ncurses had a good way to detect arrow key input without taking
>> over the whole screen, I'd recommend that.
>
> And in that "no taking over of stuff" case I would most likely have used it.
>
>> Thomas Dickey, in response to a question I posted on Stack Overflow
>> a few years ago, suggested something that might be the basis of a
>> solution:
>
> Both of those links seem to end up showing the same content.

The first link was to my question, the second to Thomas Dickey's
answer. They both appear on the same web page.

> I skipped the ncurses part, as it, as mentioned by yours truly, wants to
> take over the screen. The "How to distinguish between escape and escape
> sequence" link shows some code, but as mentioned, I've already got that part
> down.

You skipped the part where Thomas Dickey demonstrated using ncurses
without taking over the screen.

Alf P. Steinbach

unread,
Jul 1, 2023, 4:38:11 PM7/1/23
to
On 2023-06-29 6:37 PM, R.Wieser wrote:
>
> And by the way: I have quite a problem with the ^Z (26) being send as the
> start of a command sequence as well on its own when the ESC key is pressed
> (IOW, no escaping of the ESC key). I do not see any way to, in a stream,
> detect if its one or the other. Its just asking for trouble. :-(

Timing.

- Alf

James Kuyper

unread,
Jul 2, 2023, 4:04:39 AM7/2/23
to
On 7/1/23 04:30, R.Wieser wrote:
> James,
>
>> Why would you go to a forum where "a good percentage of users would
>> be using Linux", rather than a forum devoted to Linux, where that
>> percentage could reasonably be assumed to be 100?
>
> If I would know everything
...
> than I would not have needed to post a question to begin with.

Of course.

[Rearranging slightly]
> (including the knowledge of a more appropriate
> newsgroup )

However, I did expect you to know how to search for an appropriate
newsgroup.

...
> And for the record, if I would have had that other newsgroup in my shortlist
> I would have posted there.

Your message headers indicate that your newsreader is Microsoft Outlook
Express. I use the Outlook app on my smartphone, which has no obvious
way to access usenet newsgroups. I don't know how Outlook works on it's
native platform, Windows, so I'm afraid I can't help you with that.

However, most newsreaders have some way of searching for appropriate
newsgroups on a specified news server. I use Mozilla Thunderbird to
access the Eternal September news server. When I select that server,
right click and select "Subscribe" from the pop-up menu, and type
"Linux" in the search box, it lists several hundred newsgroups, many of
which would be a more appropriate place to post this question than this
newsgroup. I also use Google Groups, which has a similar capability. I
would expect the same would be true of Outlook.

You'll get better answers from people with more Linux-specific knowledge
in those newsgroups than here.

And of course, usenet newsgroups are far from being the only forums for
discussing Linux. See <https://www.linux.org/forums/>, for instance.

R.Wieser

unread,
Jul 2, 2023, 5:04:18 AM7/2/23
to
Alf,

>> And by the way: I have quite a problem with the ^Z (26) being send as the
>> start of a command sequence as well on its own when the ESC key is
>> pressed
>> (IOW, no escaping of the ESC key). I do not see any way to, in a stream,
>> detect if its one or the other. Its just asking for trouble. :-(
>
> Timing.

Yep, thats what I used.

But now imagine that I'm not using it to parse a raw, but instead a cooked
(line-based) input. Bye-bye timing. :-(

Granted, I did not indicate I would be using my/the parser for that (quite
the opposite actually), but it did already enter my mind.

Regards,
Rudy Wieser


R.Wieser

unread,
Jul 2, 2023, 5:04:18 AM7/2/23
to
Keith,

> You could post a single message on this thread saying that
> you're going to continue the discussion in comp.unix.programmer.

Ah yes, about that : Are you aware that Linux != Unix ? I might well be
told to leave that group for the same reason you are trying to eject me from
this one ...

> You can still do that. It would be far less rude than what
> you're doing now.

Which is ? That I ignore your "I'm a Windows C++ programmer and could not
care less about the Linux C++ programmers that are here" attitude ?

Something about the pot calling the kettle black ...

> You get no points for continuing to deliberately flout longstanding
> Usenet conventions.

And you get no points from trying to push such conventions upon others as if
they are Laws.

You also should re-read it. It rather specifically tells you that what
they say in there are /not/ strict rules, but *guidelines* for keeping
usenet conversations running smoothly.

And seeing how you are able to pick out my responses to you without showing
any problems with it I think that my "just the posters name" works quite
well.

And to be frank about it, in this newsgroup (and several others that I
visit) you are one of less than a handfull in many years having a problem
with it. What does that tell you ?

IOW, you're behaving like the equivalent of a "grammar nazi". And I don't
like them either.

> You skipped the part where Thomas Dickey demonstrated using
> ncurses without taking over the screen.

Lol.

Third paragraph, first sentence :

"Here's a *non-working* example of what I'm trying to do."

(bolding by me).

A quick peek at the result could have told you the same :

"
Press UP, DOWN, Escape, LEFT, RIGHT
Incorrect input: (-1, -1, -1, -1, -1)
"

He even mentions the "intimately tied to taking over the entire screen" as a
standing problem in his "update" paragraph.

Regards,
Rudy Wieser


R.Wieser

unread,
Jul 2, 2023, 5:27:53 AM7/2/23
to
James,

> However, I did expect you to know how to search for an appropriate
> newsgroup.
...
> it lists several hundred newsgroups,

Yeah, when I did ask my newsreader I got such a long list too.

> many of which would be a more appropriate place

And you know that one of those others would be more apropriate .... how ?
Just by looking at the name ? I did, and I by it posted here.

IOW, I (and you too) have to make a choice on very limited information. And
when I than do I get people like keith and you telling me I did it wrong
*and wave me off* (1) to find another - which I would need to choose on the
same, limited info I used for this one.

(1) As in : I could not care where you go as long as its not here. Which is
a few notches below being helpfull and causes me to ignore it. Sorry (not
sorry).

And I'll be damned if I would just subscribe to all of them, follow them for
a few weeks to figure out what they are all about, and than pick one (with
possibly still getting a "not here" response).

Besides, keith isn't all that good in picking a "more apropriate" newsgroup
either, and you are not even trying ...

> You'll get better answers from people with more Linux-specific knowledge
> in those newsgroups than here.

:-) The Linux people here will /really/ like you for implicitily calling
them non-knowledgable.

Regards,
Rudy Wieser


James Kuyper

unread,
Jul 2, 2023, 2:52:03 PM7/2/23
to
On 7/2/23 05:27, R.Wieser wrote:
> James,
>
>> However, I did expect you to know how to search for an appropriate
>> newsgroup.
> ...
>> it lists several hundred newsgroups,
>
> Yeah, when I did ask my newsreader I got such a long list too.
>
>> many of which would be a more appropriate place
>
> And you know that one of those others would be more apropriate .... how ?

Primarily because I know that this is outside the scope of this newsgroup.

> Just by looking at the name ? I did, and I by it posted here.

You came here with a question that was primarily about Linux
functionality, because you thought that "C++" in the newsgroup name was
a stronger indication of appropriateness than "Linux"?

> IOW, I (and you too) have to make a choice on very limited information.

No, we don't. One of the best ways to find out which newsgroup is most
appropriate for a given topic is to do a search for messages containing
relevant keywords in Google Groups. Not all such messages will be about
the topic you're actually interested in, but you should be able to scan
the first several pages of search results to identify a newsgroup that's
appropriate.
On the other hand, if "C++" strikes you as a more relevant keyword than
"linux", your judgement of such matters is not to be trusted, so perhaps
asking for advice would be a better idea.

> Besides, keith isn't all that good in picking a "more apropriate" newsgroup
> either, and you are not even trying ...

It's your search, I was just explaining how to conduct it. I've used and
programmed exclusively on Linux, both at work and at home, for nearly
three decades, but I've never had any reason to worry about the issues
you're worrying about, so I'm not sure where to direct you.
More importantly, as a general rule, when I am looking for OS-specific
solutions, I'm more interested in a POSIX generic solution rather than a
Linux-specific one. If such a solution would be acceptable to you, I'd
recommend going to comp.unix.programmer

>> You'll get better answers from people with more Linux-specific knowledge
>> in those newsgroups than here.
>
> :-) The Linux people here will /really/ like you for implicitily calling
> them non-knowledgable.

Huh?
I suggested nothing of the kind. Only that there are far fewer Linux
experts here than you could expect to find in an active Linux oriented
group. The average level of Linux expertise in this group is lower that
of the linux groups. The minimum level of linux expertise in this
newsgroup is 0, but should be non-zero in those newsgreups.

R.Wieser

unread,
Jul 2, 2023, 4:49:50 PM7/2/23
to
James,

>> And you know that one of those others would be more apropriate .... how ?
>
> Primarily because I know that this is outside the scope of this newsgroup.

Wrong answer. Perhaps this is, outof all the newsgroups, the most
apropriate. But you would not know and you do not care. As long as I
believe your claim and leave.

> You came here with a question that was primarily about Linux
> functionality,
> because you thought that "C++" in the newsgroup name was a stronger
> indication of appropriateness than "Linux"?

I already answered that. At least twice. You going in circles doesn't work
for me. Sorry.

> One of the best ways to find out which newsgroup is most appropriate for
> a given topic is to do a search for messages containing relevant keywords
> in Google Groups.

Nice. So you are going to do that for me ? 'Cause I have zero wish to sign
up for "google groups". Or any other like it. I already have to see them
necro-bumping multiple years old posts or adverts for viagra, hacking
services and crap like that.

besides, I already did my searching. Quite a bit of it actually. If my
answer would have been in there I would have already found it, and not have
posted here.

> On the other hand, if "C++" strikes you as a more relevant keyword than
> "linux", your judgement of such matters is not to be trusted, so perhaps
> asking for advice would be a better idea.

Good, than we are now on the same page. I seek advice, and you think me
asking for advice is a good idea. So ? Or are you no Linux person ?
Actualy, I don't think I have to ask that.

>> Besides, keith isn't all that good in picking a "more apropriate"
>> newsgroup
>> either, and you are not even trying ...
>
> It's your search, I was just explaining how to conduct it.

As I already explained to you, no you didn't.

> If such a solution would be acceptable to you, I'd recommend going to
> comp.unix.programmer

Another nitwit who doesn't seem to understand that Unix != Linux.

As I said it to Keith, I might there well be asked to leave for the same
reason you use to try to eject me here. And where you don't, they would
actualy have a point.

>> :-) The Linux people here will /really/ like you for implicitily calling
>> them non-knowledgable.
>
> Huh?
> I suggested nothing of the kind.

You're not really smart, are you ? I ask a Linux and programming related
question as I assume that there would also be linux people here, some of
which might well know what the answer to my question is.

But you're saying that my question is not apropriate here. I can only
assume that you do not think the Linux people could know the answer.

Actually, someone has already proven you wrong in that regard.

> The minimum level of linux expertise in this newsgroup is 0

You like to throw some great-sounding but actually meaning absolutily
nothing blurbs like that around, do you ? First the "significantly less
than a 100%" - from a 100% you can only go down, and "significantly" can
mean about /anything/ in that 100% range. Is "5% less" significant ? Is
"50% less" significant ? Well, that depends on what that "significant" is
applied.

Yes, ofcourse the mininmum level is Zero. Perhaps one of the Windows people
has not ever heard about that OS (hard to imagine, but hey, its possible).

In the same vein I can, with absolute certainty, tell you that the maximum
level of linux expertise here is 100%.

Next you will probably try to tell me that water is wet. Or is that a bit
of a spoiler ?

Regards,
Rudy Wieser


Christian Gollwitzer

unread,
Jul 2, 2023, 5:15:23 PM7/2/23
to
Am 02.07.23 um 11:03 schrieb R.Wieser:
> Keith,
>> You skipped the part where Thomas Dickey demonstrated using
>> ncurses without taking over the screen.
>
> Lol.
>
> Third paragraph, first sentence :
>
> "Here's a *non-working* example of what I'm trying to do."
>
> (bolding by me).

Is it your first time you read StackOverflow? Of course, the one who
asks the question has a non-working solution. You should read the
answer, not the question.



Christian

Keith Thompson

unread,
Jul 2, 2023, 6:40:03 PM7/2/23
to
"R.Wieser" <add...@is.invalid> writes:
> Keith,
>
>> You could post a single message on this thread saying that
>> you're going to continue the discussion in comp.unix.programmer.
>
> Ah yes, about that : Are you aware that Linux != Unix ? I might well be
> told to leave that group for the same reason you are trying to eject me from
> this one ...

Yes, I'm aware. At least the first part of your original question was
not specific to Linux. Recognizing arrow keys on input, for example,
can be done using interfaces defined by POSIX, which is supported by all
Unix-like systems. The curses interface (which provides similar
functionality in a way that doesn't quite meet your requirements) is
defined by POSIX.

You mentioned the "console", apparently referring to the Linux virtual
console, but in most ways it behaves very similarly to any other modern
terminal emulator.

I'm not the only person who has suggested that comp.unix.programmer
would be a better place for your question. Apparently you'd rather
stay here and argue with people who are trying to help you.

Detecting modifier keys (shift, control, alt) separately is another
matter. It's impossible in some contexts. Detecting them on a
Linux virtual console is probably possible, but I don't know how.
That might be a question for a Linux-specific newsgroup; I don't know
which one, but perhaps something under the comp.os.linux.* hierarchy.
"man console_codes" might be helpful; it does discuss modifier keys.

>> You can still do that. It would be far less rude than what
>> you're doing now.
>
> Which is ? That I ignore your "I'm a Windows C++ programmer and could not
> care less about the Linux C++ programmers that are here" attitude ?

No, you've been posting here repeatedly without asking anything that's
specific to C++.

[...]

>> You skipped the part where Thomas Dickey demonstrated using
>> ncurses without taking over the screen.
>
> Lol.
>
> Third paragraph, first sentence :
>
> "Here's a *non-working* example of what I'm trying to do."
>
> (bolding by me).

Yes, I know. I wrote that in my question.

> A quick peek at the result could have told you the same :
>
> "
> Press UP, DOWN, Escape, LEFT, RIGHT
> Incorrect input: (-1, -1, -1, -1, -1)
> "
>
> He even mentions the "intimately tied to taking over the entire screen" as a
> standing problem in his "update" paragraph.

Yes, *I* wrote that as part of the *question*. I was suggesting
that you read Thomas Dickey's *answer*. (FYI, he's been maintaining
ncurses since 1996.)

Don't expect any more help from me.

James Kuyper

unread,
Jul 2, 2023, 6:57:04 PM7/2/23
to
On 7/2/23 16:49, R.Wieser wrote:
...
> Nice. So you are going to do that for me ? 'Cause I have zero wish to sign
> up for "google groups". Or any other like it. I already have to see them
> necro-bumping multiple years old posts or adverts for viagra, hacking
> services and crap like that.

"comp.os.linux.answers" appears to be a fairly active linux oriented
group, which frequently contains messages matching my search terms
"linux console raw keyboard terminal". I would still suggest that
<https://www.linux.org/forums/> might be more useful than any Usenet
Newsgroup.

Interestingly enough, when I also included "multi-byte", the messages
retrieved were posted almost exclusively in various newsgroups that had
"freebsd" rather than "linux" in their names. The reason might be
obvious to someone who knows more than I do about the relationship
between freebsd and linux.


> Good, than we are now on the same page. I seek advice, and you think me
> asking for advice is a good idea. So ? Or are you no Linux person ?

As I indicated, I have been using almost exclusively Linux for 30 years
now. I also don't know how to solve your problem to your satisfaction.
If there is in fact a solution, you'll need someone with more Linux
expertise than me.

[Restoring snipped context]
>> I'm more interested in a POSIX generic solution rather than a Linux-specific one.
[End of restored context]
>> If such a solution would be acceptable to you, I'd recommend going to
>> comp.unix.programmer
>
> Another nitwit who doesn't seem to understand that Unix != Linux.

I very clearly distinguished Unix and Linux in the part of my message
that you chose to snip - how could you derive from that the conclusion
that I was confusing them?

>>> :-) The Linux people here will /really/ like you for implicitily calling
>>> them non-knowledgable.
>>
>> Huh?
>> I suggested nothing of the kind.
>
> You're not really smart, are you ? I ask a Linux and programming related
> question as I assume that there would also be linux people here, some of
> which might well know what the answer to my question is.
>
> But you're saying that my question is not apropriate here. I can only
> assume that you do not think the Linux people could know the answer.

No, I think you'll get answers of varying quality, depending upon how
subtle the issue is. The biggest danger is that if a linux issue is too
subtle, an answer given by a Linux user in a C++ group might be wrong in
a way that's too subtle for any of the other Linux users here to catch.
That's less likely to be the case in a newsgroup devoted to Linux.

> Actually, someone has already proven you wrong in that regard.

Oh - who? The only response you've received that you haven't denigrated
yet was the one suggesting that you use readline(), and you haven't
posted any follow-up indicating that it actually met your needs. If
that's the solution to your problem, then your description of your
problem made it seem far more complicated than it actually was.

...
> Yes, ofcourse the mininmum level is Zero. Perhaps one of the Windows people
> has not ever heard about that OS (hard to imagine, but hey, its possible).

It's not just one such person - there's many people here who have made
it quite clear that they don't know much of anything about Linux, and
couldn't care less.

> In the same vein I can, with absolute certainty, tell you that the maximum
> level of linux expertise here is 100%.

That seems incredibly unlikely to me. I've seen the levels of Linux
expertise displayed both here and in comp.UNIX.programmer - those levels
are much higher in c.u.p., which is entirely reasonable. If a lowly UNIX
group displays more linux expertise than a c.l.c++, how much higher
should the Linux expertise be in a group that actually has "linux" in
the group name?

R.Wieser

unread,
Jul 3, 2023, 5:00:45 AM7/3/23
to
Christian,

> You should read the answer, not the question.

Can you tell me what the first line of that answer was ? Was it something
like

[quote]
The filter function, called before initscr, tells curses to use a single
line (rather than the whole screen).
[/quote]

?

Yeah, no. I have been quite clear I can't use cooked input, and it still
messes with the screen.

Luckily Pavel was a bit more forthcoming than you, and made it clear that
there was a bit of a trick involved. Which ofcourse was not mentioned
there.

But if it actually does grab a screenline (and displays any output and/or
restores that screenline after exiting the call) while allowing me to grab
keystrokes (does the callback have a "ignore this keystroke" return value ?
I have not looked yet) than I again can't use it.

Bottom line : Yes, I ready that answer. To me it looks that you didn't.
Or perhaps just ignored the "side effects" of that method, because they do
not matter to you.

If I'm wrong and that method actually doesn't mess with the screen *at all*
than you're welcome to point out how thats been done.

Regards,
Rudy Wieser


R.Wieser

unread,
Jul 3, 2023, 5:00:45 AM7/3/23
to
James,

> "comp.os.linux.answers" appears to be a fairly active linux oriented
> group

Thank you for that suggestion. Alas, ethernal september (my newsgroup host)
doesn't seem to carry it. :-\

> I would still suggest that <https://www.linux.org/forums/>

Thank you again for that suggestion. Alas, I'm quite reluctant to sign up
to anything just to get a single answer.

Also, when I try to have a peek at what they are offering I 1) get an
"insecure connection". When I than bypass the certificate problem I 2) end
up on a cloudflare server which returns a "403 Forbidden". It also
doesn't help that 3) it demands JS to be enabled, which I keep disabled.

> As I indicated, I have been using almost exclusively Linux for 30 years
> now. I also don't know how to solve your problem to your satisfaction.

*Thank you* for saying that. It means that I can stop trying to search
for it (and just use whatever I already came up with myself).

>> Actually, someone has already proven you wrong in that regard.
>
> Oh - who? The only response you've received that you haven't denigrated
> yet was the one suggesting that you use readline(),

I rejected it the first time, as I have no use for cooked input. It was
Pavel who clarified it and showed that I could possibly use its callback to
get what I wanted.

... though a more recent post seems to indicate that that call still grabs
part of the the screen, which again/still makes it (way) less usable to me.

As for "denigrated" ? Think (read) again. I'm not known for just saying
"no" to something, I tend to describe why there is a mismatch between the
offered solution and what I am after. If you can't handle a "thats not
quite it and {this} is the reason why" than thats your problem, not mine.

> I very clearly distinguished Unix and Linux in the part of my message
> that you chose to snip - how could you derive from that the conclusion
> that I was confusing them?

By trying to push my Linux related question into a Unix related newsgroup.
Are you daft or something ? Or just suffering from dementia ?

> No, I think you'll get answers of varying quality,

Which is another "water is wet" kind of thing. Skipped.

> That's less likely to be the case in a newsgroup devoted to Linux.

I recently asked a RPi platform-specific hardware and Linux OS specific
question in an RPi specific newsgroup. For some reason people there where,
for whatever reason, coming up with all kinds of Non-RPi references. You
where saying ?

IOW, that pendulum swings both ways.

But granted, there is a distinct possibility, and I'm open to suggestions.
Just not bogus ones. :-(

>> In the same vein I can, with absolute certainty, tell you that the
>> maximum
>> level of linux expertise here is 100%.
>
> That seems incredibly unlikely to me. I've seen the levels of Linux
> expertise displayed both here and in comp.UNIX.programmer

:-) Thats the problem with grabbing the correct interpretation of what
you're reading. As I tried to explain as reponse to your "less than a 100%"
and "minimum is 0" blurbs.

Knowledge-wise you /cannot/ go under zero, just as your "significantly less
than 100%" /cannot/ be anything than being less than that 100% (besides what
"significantly" might actually be).

IOW, just like your "minimum is 0" blurb, the maximum is 100%. And water is
wet. But while the minimum might actually be reached by just having a
single nincompoop in the group, I grant you that the opposite will be much
harder to reach - even for just a single person.

Regards,
Rudy Wieser.


R.Wieser

unread,
Jul 3, 2023, 5:00:45 AM7/3/23
to
Keith,

>> Ah yes, about that : Are you aware that Linux != Unix ?
...
> Yes, I'm aware.

Than why did you try to push me to that newsgroup. It makes zero sense.

> At least the first part of your original question was
> not specific to Linux.

You mean the part above the "second question" ? If so, what *didn't* you
understand about

[quote=me, initial message]
I was wondering if this perhaps is already part of Linux ...
[/quote]

?

Also, thruout the thread there are multiple mentionings of Linux specific
usage, some of which I acknowledged to having found them myself. If
nothing than that should have given you a clue to what OS I was working on.

You complain abut me not reading everything and thus missing stuff ? I
suggest you take a long, hard look in the mirror.

> You mentioned the "console", apparently referring to the Linux virtual
> console

I have no idea, as my "/please/ tell me the difference between them"
requests have never been answered. Which, by the way, feels to me like
nobody here actually knows the distinction themselves.

... and you have now introduced yet another phrase to that list, bringing it
up to ... six?

But looking at the "virtual" part of it, isn't that not something that can
only be true when you use a GUI ? In that case I think you might also have
missed my mentioning (in my second post) of "my "bullseye lite"
installation".

... Which also should have been a clue-by-four that I was indeed using
Linux.

> I'm not the only person who has suggested that comp.unix.programmer
> would be a better place for your question.

True. You're one of exactly two who said that. And that makes it better
... how exactly ? How many people are there in this newsgroup ?

Besides ofcourse that you tried to dump me into a non-Linux newsgroup. :-(

> Apparently you'd rather stay here and argue with people who are
> trying to help you.

The people who wanted to help me already did. You and james are just
keeping on claiming I should not be here. Other than some "because I say
so" I have not gotten any clarification of that.

> I was suggesting that you read Thomas Dickey's *answer*.

I refer you to my reply to 'Christian', just before my reply to you.

> Don't expect any more help from me.

Like you trying to set me up to fail by suggesting I (re)post in a Unix
related group ? Yeah, I surely could do without such shennigans.

But, thank you for your (initial) attempts to come up with something
workable. Alas, as I've mentioned, something with a "side" effect of
touching the screen is unusable to me.

Regards,
Rudy Wieser


It is loading more messages.
0 new messages