Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #90713 > unrolled thread

Parsing multi-byte keystrokes

Started by"R.Wieser" <address@is.invalid>
First post2023-06-25 19:45 +0200
Last post2023-06-26 19:24 +0200
Articles 20 on this page of 143 — 19 participants

Back to article view | Back to comp.lang.c++


Contents

  Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-25 19:45 +0200
    Re: Parsing multi-byte keystrokes "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2023-06-25 20:34 +0200
      Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-25 21:39 +0200
      Re: Parsing multi-byte keystrokes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-06-25 15:06 -0700
        Re: Parsing multi-byte keystrokes Pavel <pauldontspamtolk@removeyourself.dontspam.yahoo> - 2023-06-25 20:18 -0400
          Re: Parsing multi-byte keystrokes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-06-25 19:10 -0700
        Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-26 08:46 +0200
    Re: Parsing multi-byte keystrokes Pavel <pauldontspamtolk@removeyourself.dontspam.yahoo> - 2023-06-25 18:39 -0400
      Re: Parsing multi-byte keystrokes Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-06-26 00:53 +0100
        Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-26 09:11 +0200
          Re: Parsing multi-byte keystrokes Christian Gollwitzer <auriocus@gmx.de> - 2023-06-26 09:32 +0200
          Re: Parsing multi-byte keystrokes Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-06-26 13:50 +0100
            Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-26 15:03 +0200
              Re: Parsing multi-byte keystrokes Christian Gollwitzer <auriocus@gmx.de> - 2023-06-26 22:27 +0200
                Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-26 22:48 +0200
                  Re: Parsing multi-byte keystrokes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-06-26 14:35 -0700
                  Re: Parsing multi-byte keystrokes Christian Gollwitzer <auriocus@gmx.de> - 2023-06-26 23:58 +0200
                    Re: Parsing multi-byte keystrokes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-06-26 16:26 -0700
      Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-26 08:50 +0200
        Re: Parsing multi-byte keystrokes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-06-26 01:39 -0700
          Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-26 13:43 +0200
            Re: Parsing multi-byte keystrokes Muttley@dastardlyhq.com - 2023-06-26 15:26 +0000
              Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-26 18:04 +0200
            Re: Parsing multi-byte keystrokes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-06-26 12:01 -0700
              Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-26 21:59 +0200
                Re: Parsing multi-byte keystrokes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-06-26 14:15 -0700
                Re: Parsing multi-byte keystrokes scott@slp53.sl.home (Scott Lurndal) - 2023-06-26 22:35 +0000
                  Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-29 13:15 +0200
        Re: Parsing multi-byte keystrokes scott@slp53.sl.home (Scott Lurndal) - 2023-06-26 14:03 +0000
          Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-26 17:49 +0200
          Re: Parsing multi-byte keystrokes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-06-26 12:23 -0700
        Re: Parsing multi-byte keystrokes red floyd <no.spam.here@its.invalid> - 2023-06-28 14:35 -0700
          Re: Parsing multi-byte keystrokes gazelle@shell.xmission.com (Kenny McCormack) - 2023-06-29 00:17 +0000
            Re: Parsing multi-byte keystrokes scott@slp53.sl.home (Scott Lurndal) - 2023-06-29 00:43 +0000
              Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-29 14:04 +0200
                Re: Parsing multi-byte keystrokes gazelle@shell.xmission.com (Kenny McCormack) - 2023-06-29 15:44 +0000
                  Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-29 18:37 +0200
                    Re: Parsing multi-byte keystrokes Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-06-30 14:14 +0100
                      Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-30 18:12 +0200
                        Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-30 20:32 +0200
                        Re: Parsing multi-byte keystrokes Paavo Helde <eesnimi@osa.pri.ee> - 2023-06-30 22:57 +0300
                          Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-07-01 09:49 +0200
                        Re: Parsing multi-byte keystrokes Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-06-30 21:36 +0100
                        Re: Parsing multi-byte keystrokes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-06-30 13:45 -0700
                          Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-07-01 10:33 +0200
                            Re: Parsing multi-byte keystrokes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-07-01 11:58 -0700
                              Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-07-02 11:03 +0200
                                Re: Parsing multi-byte keystrokes Christian Gollwitzer <auriocus@gmx.de> - 2023-07-02 23:15 +0200
                                  Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-07-03 09:12 +0200
                                Re: Parsing multi-byte keystrokes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-07-02 15:39 -0700
                                  Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-07-03 10:12 +0200
                                    Re: Parsing multi-byte keystrokes scott@slp53.sl.home (Scott Lurndal) - 2023-07-03 13:28 +0000
                                    Re: Parsing multi-byte keystrokes James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-07-03 12:43 -0400
                                Re: Parsing multi-byte keystrokes Muttley@dastardlyhq.com - 2023-07-03 15:41 +0000
                                  Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-07-03 21:32 +0200
                                    Re: Parsing multi-byte keystrokes gazelle@shell.xmission.com (Kenny McCormack) - 2023-07-03 21:06 +0000
                                    Re: Parsing multi-byte keystrokes James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-07-04 05:20 -0400
                                      Re: Parsing multi-byte keystrokes scott@slp53.sl.home (Scott Lurndal) - 2023-07-04 13:56 +0000
                                        Re: Parsing multi-byte keystrokes James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-07-04 16:03 -0400
                                          Re: Parsing multi-byte keystrokes kalevi@kolttonen.fi (Kalevi Kolttonen) - 2023-07-04 21:03 +0000
                                            Re: Parsing multi-byte keystrokes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-07-04 14:33 -0700
                                              Re: Parsing multi-byte keystrokes kalevi@kolttonen.fi (Kalevi Kolttonen) - 2023-07-04 21:55 +0000
                                                Re: Parsing multi-byte keystrokes scott@slp53.sl.home (Scott Lurndal) - 2023-07-05 13:58 +0000
                                            Re: Parsing multi-byte keystrokes scott@slp53.sl.home (Scott Lurndal) - 2023-07-05 13:56 +0000
                                    Re: Parsing multi-byte keystrokes Muttley@dastardlyhq.com - 2023-07-04 15:54 +0000
                                      Re: Parsing multi-byte keystrokes David Brown <david.brown@hesbynett.no> - 2023-07-04 18:03 +0200
                                        Re: Parsing multi-byte keystrokes kalevi@kolttonen.fi (Kalevi Kolttonen) - 2023-07-04 16:33 +0000
                                          Re: Parsing multi-byte keystrokes gazelle@shell.xmission.com (Kenny McCormack) - 2023-07-04 16:41 +0000
                                            Re: Parsing multi-byte keystrokes kalevi@kolttonen.fi (Kalevi Kolttonen) - 2023-07-04 16:52 +0000
                                          Re: Parsing multi-byte keystrokes David Brown <david.brown@hesbynett.no> - 2023-07-05 09:50 +0200
                                            Re: Parsing multi-byte keystrokes scott@slp53.sl.home (Scott Lurndal) - 2023-07-05 14:00 +0000
                                            Re: Parsing multi-byte keystrokes "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-07-05 11:21 -0700
                                              Re: Parsing multi-byte keystrokes scott@slp53.sl.home (Scott Lurndal) - 2023-07-05 20:24 +0000
                                            Re: Parsing multi-byte keystrokes kalevi@kolttonen.fi (Kalevi Kolttonen) - 2023-07-05 19:31 +0000
                                        Re: Parsing multi-byte keystrokes Muttley@dastardlyhq.com - 2023-07-04 19:05 +0000
                                      Re: Parsing multi-byte keystrokes red floyd <no.spam.here@its.invalid> - 2023-07-05 18:31 -0700
                                        Cars (Was: Parsing what is Linux?) gazelle@shell.xmission.com (Kenny McCormack) - 2023-07-06 08:40 +0000
                                        Re: Parsing multi-byte keystrokes Muttley@dastardlyhq.com - 2023-07-06 08:55 +0000
                                          Cars (Was: Parsing multi-byte keystrokes) gazelle@shell.xmission.com (Kenny McCormack) - 2023-07-06 09:27 +0000
                                            Re: Cars (Was: Parsing multi-byte keystrokes) Muttley@dastardlyhq.com - 2023-07-06 15:43 +0000
                                              Totally insane (Was: Cars (Was: Parsing multi-byte keystrokes)) gazelle@shell.xmission.com (Kenny McCormack) - 2023-07-06 16:53 +0000
                                                Re: Totally insane (Was: Cars (Was: Parsing multi-byte keystrokes)) Muttley@dastardlyhq.com - 2023-07-07 07:15 +0000
                        Re: Parsing multi-byte keystrokes James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-06-30 17:00 -0400
                          Re: Parsing multi-byte keystrokes gazelle@shell.xmission.com (Kenny McCormack) - 2023-07-01 07:53 +0000
                          Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-07-01 10:30 +0200
                            Re: Parsing multi-byte keystrokes James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-07-02 04:04 -0400
                              Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-07-02 11:27 +0200
                                Re: Parsing multi-byte keystrokes James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-07-02 14:51 -0400
                                  Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-07-02 22:49 +0200
                                    Re: Parsing multi-byte keystrokes James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-07-02 18:56 -0400
                                      Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-07-03 10:59 +0200
                                        Re: Parsing multi-byte keystrokes scott@slp53.sl.home (Scott Lurndal) - 2023-07-03 13:34 +0000
                                        Re: Parsing multi-byte keystrokes James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-07-03 12:20 -0400
                                          Re: Parsing multi-byte keystrokes Richard Harnden <richard.nospam@gmail.com> - 2023-07-03 18:02 +0100
                                            Re: Parsing multi-byte keystrokes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-07-03 14:40 -0700
                                          Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-07-03 22:50 +0200
                                            Re: Parsing multi-byte keystrokes James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-07-04 05:47 -0400
                                          Re: Parsing multi-byte keystrokes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-07-03 14:36 -0700
                            Re: Parsing multi-byte keystrokes David Brown <david.brown@hesbynett.no> - 2023-07-03 11:38 +0200
                              Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-07-03 13:04 +0200
                                Re: Parsing multi-byte keystrokes David Brown <david.brown@hesbynett.no> - 2023-07-03 15:11 +0200
                                Re: Parsing multi-byte keystrokes Christian Gollwitzer <auriocus@gmx.de> - 2023-07-03 20:35 +0200
                                  Re: Parsing multi-byte keystrokes gazelle@shell.xmission.com (Kenny McCormack) - 2023-07-03 19:16 +0000
                                  Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-07-03 22:55 +0200
                          Re: Parsing multi-byte keystrokes Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2023-07-01 03:03 -0700
                            Re: Parsing multi-byte keystrokes Muttley@dastardlyhq.com - 2023-07-01 10:30 +0000
                    Re: Parsing multi-byte keystrokes "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2023-07-01 22:37 +0200
                      Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-07-02 09:42 +0200
        Re: Parsing multi-byte keystrokes Pavel <pauldontspamtolk@removeyourself.dontspam.yahoo> - 2023-06-29 22:21 -0400
          Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-30 17:50 +0200
    Re: Parsing multi-byte keystrokes scott@slp53.sl.home (Scott Lurndal) - 2023-06-25 23:20 +0000
      Re: Parsing multi-byte keystrokes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-06-25 17:10 -0700
        Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-26 09:21 +0200
          Re: Parsing multi-byte keystrokes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-06-26 01:29 -0700
            Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-26 13:30 +0200
              Re: Parsing multi-byte keystrokes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-06-26 12:18 -0700
                Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-26 22:37 +0200
                  Re: Parsing multi-byte keystrokes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-06-26 14:32 -0700
                  Re: Parsing multi-byte keystrokes scott@slp53.sl.home (Scott Lurndal) - 2023-06-26 22:41 +0000
                    Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-29 13:58 +0200
                      Re: Parsing multi-byte keystrokes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-06-29 13:59 -0700
          Re: Parsing multi-byte keystrokes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-06-26 01:30 -0700
            Re: Parsing multi-byte keystrokes scott@slp53.sl.home (Scott Lurndal) - 2023-06-26 14:00 +0000
          Re: Parsing multi-byte keystrokes "Fred. Zwarts" <F.Zwarts@HetNet.nl> - 2023-06-26 12:31 +0200
            Re: Parsing multi-byte keystrokes "Fred. Zwarts" <F.Zwarts@HetNet.nl> - 2023-06-26 12:47 +0200
            Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-26 13:56 +0200
        Re: Parsing multi-byte keystrokes scott@slp53.sl.home (Scott Lurndal) - 2023-06-26 13:58 +0000
        Re: Parsing multi-byte keystrokes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-06-26 12:08 -0700
      Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-26 08:56 +0200
        Re: Parsing multi-byte keystrokes scott@slp53.sl.home (Scott Lurndal) - 2023-06-26 14:02 +0000
          Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-26 17:46 +0200
            Re: Parsing multi-byte keystrokes Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-06-26 18:19 +0100
              Re: Parsing multi-byte keystrokes scott@slp53.sl.home (Scott Lurndal) - 2023-06-26 18:36 +0000
              Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-26 21:24 +0200
                Re: Parsing multi-byte keystrokes Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-06-26 22:12 +0100
    Re: Parsing multi-byte keystrokes wij <wyniijj5@gmail.com> - 2023-06-26 02:06 -0700
      Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-26 13:49 +0200
        Re: Parsing multi-byte keystrokes scott@slp53.sl.home (Scott Lurndal) - 2023-06-26 14:05 +0000
          Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-26 17:58 +0200
        Re: Parsing multi-byte keystrokes wij <wyniijj5@gmail.com> - 2023-06-27 13:32 -0700
          Re: Parsing multi-byte keystrokes gazelle@shell.xmission.com (Kenny McCormack) - 2023-06-28 02:17 +0000
            Re: Parsing multi-byte keystrokes wij <wyniijj5@gmail.com> - 2023-06-27 20:26 -0700
      Re: Parsing multi-byte keystrokes "R.Wieser" <address@is.invalid> - 2023-06-26 19:24 +0200

Page 7 of 8 — ← Prev page 1 2 3 4 5 6 [7] 8  Next page →


#90786

FromKeith Thompson <Keith.S.Thompson+u@gmail.com>
Date2023-06-29 13:59 -0700
Message-ID<87bkgyrnmz.fsf@nosuchdomain.example.com>
In reply to#90779
"R.Wieser" <address@is.invalid> writes:
> 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.

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.

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

[toc] | [prev] | [next] | [standalone]


#90730

FromKeith Thompson <Keith.S.Thompson+u@gmail.com>
Date2023-06-26 01:30 -0700
Message-ID<875y7a1v7t.fsf@nosuchdomain.example.com>
In reply to#90727
"R.Wieser" <address@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.)

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 (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

[toc] | [prev] | [next] | [standalone]


#90742

Fromscott@slp53.sl.home (Scott Lurndal)
Date2023-06-26 14:00 +0000
Message-ID<KRgmM.111040$WpOe.9616@fx18.iad>
In reply to#90730
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>"R.Wieser" <address@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.

[toc] | [prev] | [next] | [standalone]


#90733

From"Fred. Zwarts" <F.Zwarts@HetNet.nl>
Date2023-06-26 12:31 +0200
Message-ID<u7bpe1$tnmt$1@dont-email.me>
In reply to#90727
Op 26.jun..2023 om 09:21 schreef R.Wieser:
> 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.
> 
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.

[toc] | [prev] | [next] | [standalone]


#90734

From"Fred. Zwarts" <F.Zwarts@HetNet.nl>
Date2023-06-26 12:47 +0200
Message-ID<u7bqbb$tqaj$1@dont-email.me>
In reply to#90733
Op 26.jun..2023 om 12:31 schreef Fred. Zwarts:
> Op 26.jun..2023 om 09:21 schreef R.Wieser:
>> 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.
>>
> 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.

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.

[toc] | [prev] | [next] | [standalone]


#90738

From"R.Wieser" <address@is.invalid>
Date2023-06-26 13:56 +0200
Message-ID<u7bufa$ue5n$4@dont-email.me>
In reply to#90733
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

[toc] | [prev] | [next] | [standalone]


#90741

Fromscott@slp53.sl.home (Scott Lurndal)
Date2023-06-26 13:58 +0000
Message-ID<KPgmM.111039$WpOe.22384@fx18.iad>
In reply to#90720
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>scott@slp53.sl.home (Scott Lurndal) writes:
>> "R.Wieser" <address@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.

[toc] | [prev] | [next] | [standalone]


#90755

FromKeith Thompson <Keith.S.Thompson+u@gmail.com>
Date2023-06-26 12:08 -0700
Message-ID<87sfaeyrbu.fsf@nosuchdomain.example.com>
In reply to#90720
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
> scott@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 (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

[toc] | [prev] | [next] | [standalone]


#90725

From"R.Wieser" <address@is.invalid>
Date2023-06-26 08:56 +0200
Message-ID<u7bee1$sht9$3@dont-email.me>
In reply to#90718
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

[toc] | [prev] | [next] | [standalone]


#90743

Fromscott@slp53.sl.home (Scott Lurndal)
Date2023-06-26 14:02 +0000
Message-ID<xTgmM.111041$WpOe.4201@fx18.iad>
In reply to#90725
"R.Wieser" <address@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.

[toc] | [prev] | [next] | [standalone]


#90747

From"R.Wieser" <address@is.invalid>
Date2023-06-26 17:46 +0200
Message-ID<u7cd2f$108ec$1@dont-email.me>
In reply to#90743
Scott,

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

Bullshit.

Regards,
Rudy Wieser

[toc] | [prev] | [next] | [standalone]


#90751

FromBen Bacarisse <ben.usenet@bsb.me.uk>
Date2023-06-26 18:19 +0100
Message-ID<874jmu2lbn.fsf@bsb.me.uk>
In reply to#90747
"R.Wieser" <address@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.

[toc] | [prev] | [next] | [standalone]


#90753

Fromscott@slp53.sl.home (Scott Lurndal)
Date2023-06-26 18:36 +0000
Message-ID<RUkmM.12275$33q9.1709@fx35.iad>
In reply to#90751
Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
>"R.Wieser" <address@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.

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.

[toc] | [prev] | [next] | [standalone]


#90758

From"R.Wieser" <address@is.invalid>
Date2023-06-26 21:24 +0200
Message-ID<u7colu$122dt$1@dont-email.me>
In reply to#90751
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

[toc] | [prev] | [next] | [standalone]


#90763

FromBen Bacarisse <ben.usenet@bsb.me.uk>
Date2023-06-26 22:12 +0100
Message-ID<87y1k60vy0.fsf@bsb.me.uk>
In reply to#90758
"R.Wieser" <address@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.

[toc] | [prev] | [next] | [standalone]


#90732

Fromwij <wyniijj5@gmail.com>
Date2023-06-26 02:06 -0700
Message-ID<e992ebdc-2d53-4134-9cfd-fd9339c8ffe5n@googlegroups.com>
In reply to#90713
On Monday, June 26, 2023 at 1:45:54 AM UTC+8, 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 ? 
> 
> 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

/* 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

[toc] | [prev] | [next] | [standalone]


#90737

From"R.Wieser" <address@is.invalid>
Date2023-06-26 13:49 +0200
Message-ID<u7buf9$ue5n$3@dont-email.me>
In reply to#90732
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

[toc] | [prev] | [next] | [standalone]


#90745

Fromscott@slp53.sl.home (Scott Lurndal)
Date2023-06-26 14:05 +0000
Message-ID<rWgmM.111043$WpOe.267@fx18.iad>
In reply to#90737
"R.Wieser" <address@is.invalid> writes:
>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. :-)

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.

[toc] | [prev] | [next] | [standalone]


#90749

From"R.Wieser" <address@is.invalid>
Date2023-06-26 17:58 +0200
Message-ID<u7cd2g$108ec$3@dont-email.me>
In reply to#90745
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

[toc] | [prev] | [next] | [standalone]


#90771

Fromwij <wyniijj5@gmail.com>
Date2023-06-27 13:32 -0700
Message-ID<1dd24214-49c8-4f61-a1b0-95331b82888dn@googlegroups.com>
In reply to#90737
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;
};

[toc] | [prev] | [next] | [standalone]


Page 7 of 8 — ← Prev page 1 2 3 4 5 6 [7] 8  Next page →

Back to top | Article view | comp.lang.c++


csiph-web