linux-assembly.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rudolf Marek <MAREKR2@cs.felk.cvut.cz>
To: ssams <ssams@telkom.net>
Cc: linux-assembly@vger.kernel.org
Subject: Re: entering char from keyboard
Date: Mon, 29 Apr 2002 12:04:28 +0200	[thread overview]
Message-ID: <aaj62j$13o$2@main.gmane.org> (raw)
In-Reply-To: <web-7206429@m1.plasa.com>


Hello,  (its more neutral I guess)

Any program in unix while running has open the file descriptor (handle) 
for STDIN STDOUT and STDERR (0,1,2).
If you want to read from keyboard you just read(stdin)
via a syscall. But may happen that the syscall returns after
pressing ENTER. If you want just read one ahar without (ENTER) confirming 
it, you should change terminal IOCTL.

look in sh.asm in asmutils


        mov     edx,termattrs
        sys_ioctl STDIN,TCGETS
        mov    eax,[termattrs.c_lflag]
        push    eax
        and     eax,~(ICANON|ECHO)  ; this turns OFF echo also
        mov     [termattrs.c_lflag],eax
        sys_ioctl STDIN, TCSETS

this should work under linux, this under *NIX (maybe)

        sys_fcntl STDIN,F_GETFL
        and     eax,~(O_NONBLOCK)       
        sys_fcntl STDIN,F_SETFL,eax

and the rest is smth like read 1 byte from STDIN

Regards

		Rudolf





      parent reply	other threads:[~2002-04-29 10:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-29  4:28 entering char from keyboard ssams
2002-04-29  5:35 ` Leonardo Di Lella
2002-04-29 10:04 ` Rudolf Marek [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='aaj62j$13o$2@main.gmane.org' \
    --to=marekr2@cs.felk.cvut.cz \
    --cc=linux-assembly@vger.kernel.org \
    --cc=ssams@telkom.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).