* entering char from keyboard
@ 2002-04-29 4:28 ssams
2002-04-29 5:35 ` Leonardo Di Lella
2002-04-29 10:04 ` Rudolf Marek
0 siblings, 2 replies; 3+ messages in thread
From: ssams @ 2002-04-29 4:28 UTC (permalink / raw)
To: linux-assembly
Assalamu 'alaikum..... everybody
I want to build code to enter some char from keyboard
what syscall i need...?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: entering char from keyboard
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
1 sibling, 0 replies; 3+ messages in thread
From: Leonardo Di Lella @ 2002-04-29 5:35 UTC (permalink / raw)
To: ssams; +Cc: linux-assembly
Re!
* On 29 April, 2002 11:28:55 AM
* "ssams" (ssams@telkom.net) wrote:
> Assalamu 'alaikum..... everybody
Assalamu,
> I want to build code to enter some char from keyboard
> what syscall i need...?
#define __NR_read 3,
for reading, and maybe also __NR_write for writing it at stdout ...
look also at
$ man 2 read
Your file d. should be stdin
myst@xor:/dev$ ls -al stdin
lrwxrwxrwx 1 root root 4 24. Nov 17:38 stdin -> fd/0
bye
--
Leonardo Di Lella
[0x01] http://www.comfire.de
[0x02] http://www.netline-is.de
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: entering char from keyboard
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
1 sibling, 0 replies; 3+ messages in thread
From: Rudolf Marek @ 2002-04-29 10:04 UTC (permalink / raw)
To: ssams; +Cc: linux-assembly
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-04-29 10:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).