Sponsored Content
Top Forums Programming How do you detect keystrokes in canonical mode? Post 302573710 by Corona688 on Tuesday 15th of November 2011 09:55:38 AM
Old 11-15-2011
You don't.

From man termios:

Code:
       In canonical mode:

       * Input  is  made  available  line by line.  An input line is available
         when one of the line delimiters is typed (NL, EOL, EOL2;  or  EOF  at
         the start of line).  Except in the case of EOF, the line delimiter is
         included in the buffer returned by read(2).

You'll get the [[A, etc. as arrow key escape-sequences after you hit ENTER. It's not stripping them out, but you won't get anything until you hit ENTER.

If you want individual keystrokes, use noncanonical (raw) mode.
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

recording keystrokes in vi

What is the syntax for recording command in vi. If I want to repeat a command over and over. My file is 12/01/05,,adsmte,9,0,0 12/02/05,,adsmte,12,0,0 12/03/05,,adsmte,10,0,0 12/04/05,,adsmte,11,0,0 12/05/05,,adsmte,10,0,0 12/06/05,,adsmte,10,0,0 12/01/05,,tsmpc1,57,1,2... (5 Replies)
Discussion started by: reggiej
5 Replies

2. Shell Programming and Scripting

tool to emulate keystrokes out to a ps/2 device?

hey all, i am trying to connect my mac to my sony DVD changer so that i can control one aspect of it with any kind of shell script or program. the DVD player allows you to plug in a PS/2 keyboard to navigate it's on screen menu. what i want to do is use my mac to navigate my own menus, then... (0 Replies)
Discussion started by: drzoomn
0 Replies

3. Programming

Help with stdin and non-canonical mode

I am writing a more command for my class, and have it most of the way done, but with my current implimentation when I pipe stdin to my code it doesnt use my non-canonical/non echo settings I set for the terminal window. Do I need to specify a different terminal in order for this to work ? It works... (1 Reply)
Discussion started by: petricore
1 Replies

4. UNIX for Dummies Questions & Answers

Looking for an X11 Utility - Send Keystrokes to Multiple Clients

A long time ago, I frequently used a small X11 utility that allows you to manage multiple systems at the same time. It worked by opening a small window that had a button you used to "Add" X Clients to it. These would be xterms on different systems for example. You would then type inside that... (5 Replies)
Discussion started by: Alon.Albert
5 Replies

5. Shell Programming and Scripting

Queueing keystrokes

Hello, I have a ksh which can be run interactively with read etc waiting for input and so forth. Do you have an idea how can I invoke the ksh and supply a sequence of keystrokes that will feed the executable flow so that it will automatically run as if someone actually walked through one prompt... (7 Replies)
Discussion started by: gio001
7 Replies

6. OS X (Apple)

Any mac software for recording keystrokes

I'm trying to find a good keylogger that doesn't come with any viruses. It happens to me several times that my browser crashes when I am in article writing or some other thing, very annoying. Thus, I need a keylogger to keep all my keystroke recorded. I 'v tried some, like the Aobo Mac Keylogger,... (1 Reply)
Discussion started by: Bluerosen
1 Replies

7. UNIX for Advanced & Expert Users

Sending keystrokes to another process

The third-party ERP system used by our company has no idle-out facility and we sometimes have issues because users simply walk away from their computers and leave sessions logged in for hours or even go home without logging out. (We are in a factory environment so it is hard to raise the care... (7 Replies)
Discussion started by: Wayne Ivory
7 Replies

8. Solaris

DNS service is in maintenance mode. How to bring it back to online mode?

:confused: when i tried to look the status of DNS-client, it is in maintenance mode..... Please tell me how to bring it back to online mode...PLEASE TELL ME STEP BY STEP.... PLEASE... :wall: (2 Replies)
Discussion started by: vamshigvk475
2 Replies

9. Shell Programming and Scripting

Record and re-use keystrokes

We have a FORTRAN program that creates a report for our client. The client makes a number of selections as to what will appear on the report. However, the client has to repeat this everytime the report is run. I am trying to find a way to record what they've selected (their keystrokes) in UNIX and... (22 Replies)
Discussion started by: KathyB148
22 Replies
line(1)                                                            User Commands                                                           line(1)

NAME
line - read one line SYNOPSIS
line DESCRIPTION
The line utility copies one line (up to and including a new-line) from the standard input and writes it on the standard output. It returns an exit status of 1 on EOF and always prints at least a new-line. It is often used within shell files to read from the user's terminal. EXIT STATUS
Exit status is: 0 Successful completion >0 End-of-file on input. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
sh(1), read(2), attributes(5) SunOS 5.10 1 Feb 1995 line(1)
All times are GMT -4. The time now is 01:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy