Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #126477
| From | Egor <egor@ruby.local> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Correct way to detect F1 |
| Date | 2018-02-09 15:05 +0200 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <cti0le-io9.ln1@ruby.opensrc.club> (permalink) |
| References | <800430537@f122.n1.z21.fsxnet> <uurtke-ad.ln1@ruby.opensrc.club> <lnh8qrxrle.fsf@kst-u.example.com> |
Keith Thompson <kst-u@mib.org> wrote: > I think you mean > setupterm(NULL, fileno(stdin), NULL); Actually it should be stdout. > And I'd use `const char *const kf1 = ...` (you don't want to modify > either the pointer or what it points to). I'd use `const char*`. There's no need to make pointer itself const, as it is returned by value from the function. I used `char*` in my original post for simplicity, and also because that's what the function returns. > That gives you the appropriate string. Is there support for recognizing > that string on input? (In particular, you want to be able to > distinguish between an escape character that's part of a sequence and > one that's the result of the user hitting the escape key; that requires > timing.) terminfo doesn't have that. curses, however does. You need to turn on keypad() mode (documented in curs_inopts(3X) for ncurses,) and then you can use wgetch() (manpage curs_getch(3X)) to get input, which is either normal characters, or KEY_ constants, e.g. KEY_F1. Full list of those constants is also in curs_getch(3X). > It returns (char*)-1 if capname is not a string capability, or 0 (NULL) > if it is canceled or absent from the terminal description. You are correct. On my system it also returns -1 if setupterm isn't called beforehand.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Correct way to detect F1 shinobi@f122.n1.z21.fsxnet (shinobi) - 2018-01-29 03:44 +1200
Re: Correct way to detect F1 Lorinczy Zsigmond <zsiga@nospam.for.me> - 2018-01-29 10:34 +0100
Re: Correct way to detect F1 Keith Thompson <kst-u@mib.org> - 2018-01-29 09:24 -0800
Re: Correct way to detect F1 "James R. Kuyper" <jameskuyper@verizon.net> - 2018-01-29 12:43 -0500
Re: Correct way to detect F1 scott@slp53.sl.home (Scott Lurndal) - 2018-01-29 18:20 +0000
Re: Correct way to detect F1 ais523 <ais523@nethack4.org> - 2018-01-29 21:03 +0000
Re: Correct way to detect F1 Robert Wessel <robertwessel2@yahoo.com> - 2018-01-29 20:47 -0600
Re: Correct way to detect F1 Keith Thompson <kst-u@mib.org> - 2018-01-29 20:01 -0800
Re: Correct way to detect F1 Robert Wessel <robertwessel2@yahoo.com> - 2018-01-29 22:43 -0600
Re: Correct way to detect F1 Ike Naar <ike@iceland.freeshell.org> - 2018-01-29 10:26 +0000
Re: Correct way to detect F1 "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2018-01-30 14:14 +0800
Re: Correct way to detect F1 luser droog <luser.droog@gmail.com> - 2018-01-30 09:26 -0800
Re: Correct way to detect F1 bartc <bc@freeuk.com> - 2018-01-30 18:39 +0000
Re: Correct way to detect F1 Egor <egor@ruby.local> - 2018-02-08 14:21 +0200
Re: Correct way to detect F1 shinobi@f153.n1.z21.fsxnet (shinobi) - 2018-02-08 16:41 +1200
Re: Correct way to detect F1 Jorgen Grahn <grahn+nntp@snipabacken.se> - 2018-02-08 20:43 +0000
Re: Correct way to detect F1 Keith Thompson <kst-u@mib.org> - 2018-02-08 13:13 -0800
Re: Correct way to detect F1 scott@slp53.sl.home (Scott Lurndal) - 2018-02-08 22:14 +0000
Re: Correct way to detect F1 Keith Thompson <kst-u@mib.org> - 2018-02-08 10:29 -0800
Re: Correct way to detect F1 Egor <egor@ruby.local> - 2018-02-09 15:05 +0200
Re: Correct way to detect F1 Jorgen Grahn <grahn+nntp@snipabacken.se> - 2018-02-09 17:30 +0000
Re: Correct way to detect F1 Keith Thompson <kst-u@mib.org> - 2018-02-09 10:06 -0800
Re: Correct way to detect F1 luser droog <luser.droog@gmail.com> - 2018-02-08 16:31 -0800
csiph-web