* reading back characters from terminal
@ 2003-08-13 18:52 Fekete Gabor
2003-08-13 23:29 ` Glynn Clements
2003-08-14 11:07 ` program killed QingHua Wang
0 siblings, 2 replies; 9+ messages in thread
From: Fekete Gabor @ 2003-08-13 18:52 UTC (permalink / raw)
To: linux-c-programming
hi,
is there a way to read back characters from the terminal (e.g. xterm).
i mean for example running xterm with bash and writing a program that
when run from the bash prompt could read an arbitrary text back from
the xterm window.
e.g.:
$ ls -al
total 16
drwxr-xr-x 4 x users 4096 Jun 20 00:39 ./
drwxr-xr-x 21 x users 4096 Aug 13 21:33 ../
drwxr-xr-x 2 x users 4096 Jun 22 20:45 colors/
drwxr-xr-x 2 x users 4096 Jun 14 20:06 plugin/
$ program
and then the "program" would read back the contents of the terminal, like
ten characters starting from the position row 5, line 7.
WITHOUT NCURSES!
anyone?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: reading back characters from terminal
2003-08-13 18:52 reading back characters from terminal Fekete Gabor
@ 2003-08-13 23:29 ` Glynn Clements
2003-08-14 9:38 ` Fekete Gabor
2003-08-14 11:07 ` program killed QingHua Wang
1 sibling, 1 reply; 9+ messages in thread
From: Glynn Clements @ 2003-08-13 23:29 UTC (permalink / raw)
To: Fekete Gabor; +Cc: linux-c-programming
Fekete Gabor wrote:
> is there a way to read back characters from the terminal (e.g. xterm).
No. There isn't even any guarantee that the characters are actually
stored anywhere. Certainly, hardcopy terminals don't store the text,
nor do graphics terminals (Tek4014 etc).
Even when the terminal (or emulator) does store the text, there isn't
any portable mechanim for reading it. For specific terminals, there
may be specific mechanims to obtain the data; e.g. for the Linux
console, you could read it from video memory, provided you had the
appropriate privileges.
--
Glynn Clements <glynn.clements@virgin.net>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: reading back characters from terminal
2003-08-13 23:29 ` Glynn Clements
@ 2003-08-14 9:38 ` Fekete Gabor
2003-08-14 15:54 ` Fekete Gabor
0 siblings, 1 reply; 9+ messages in thread
From: Fekete Gabor @ 2003-08-14 9:38 UTC (permalink / raw)
To: linux-c-programming
On Thu, 14 Aug 2003, Glynn Clements wrote:
>
> Fekete Gabor wrote:
>
> > is there a way to read back characters from the terminal (e.g. xterm).
>
> No. There isn't even any guarantee that the characters are actually
> stored anywhere. Certainly, hardcopy terminals don't store the text,
sad.
anyway, thanks for the info!
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: program killed
2003-08-14 11:07 ` program killed QingHua Wang
@ 2003-08-14 10:25 ` Tony Clarke
2003-08-14 13:00 ` QingHua Wang
0 siblings, 1 reply; 9+ messages in thread
From: Tony Clarke @ 2003-08-14 10:25 UTC (permalink / raw)
To: qhwang; +Cc: linux-c-programming
Sounds like your system was tight on memory and the Memory Manager
thought your
program was a good one to kill to recoup some scarce memory.
Have a look in /mm/oom_kill.c to see how it figures out who to kill.
>Hi there,
>
>Can anyone give me some hints about why my program is killed by system? I am
>now debugging a program but after it runs for a while, I got a message saying
>"Program terminated with signal SIGKILL, Killed". What's the causes?
>Memory? I am the only user since I disconnected the computer (64 MB RAM) to
>the network. Last night I also run my program on my laptop (256 MB RAM), it
>worked well when I used a part of data set (image). With the whole data the
>program also got killed. I checked the syslog and found "VM: kill the program
>XXX". I used MALLOC_CHECK_ but there is no memory abuse. Any suggestion?
>
>Many thanks in advance.
>
>QingHua
>-
>To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
>
******************************************************************************
The information in this e-mail is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this e-mail by anyone else
is unauthorised. If you are not the intended recipient, any disclosure,
copying, distribution, or any action taken or omitted to be taken in reliance
on it, is prohibited and may be unlawful.
Please note that emails to, from and within RTÉ may be subject to the Freedom
of Information Act 1997 and may be liable to disclosure.
******************************************************************************
-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* program killed
2003-08-13 18:52 reading back characters from terminal Fekete Gabor
2003-08-13 23:29 ` Glynn Clements
@ 2003-08-14 11:07 ` QingHua Wang
2003-08-14 10:25 ` Tony Clarke
1 sibling, 1 reply; 9+ messages in thread
From: QingHua Wang @ 2003-08-14 11:07 UTC (permalink / raw)
To: linux-c-programming
Hi there,
Can anyone give me some hints about why my program is killed by system? I am
now debugging a program but after it runs for a while, I got a message saying
"Program terminated with signal SIGKILL, Killed". What's the causes?
Memory? I am the only user since I disconnected the computer (64 MB RAM) to
the network. Last night I also run my program on my laptop (256 MB RAM), it
worked well when I used a part of data set (image). With the whole data the
program also got killed. I checked the syslog and found "VM: kill the program
XXX". I used MALLOC_CHECK_ but there is no memory abuse. Any suggestion?
Many thanks in advance.
QingHua
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: program killed
2003-08-14 13:00 ` QingHua Wang
@ 2003-08-14 12:54 ` Tony Clarke
0 siblings, 0 replies; 9+ messages in thread
From: Tony Clarke @ 2003-08-14 12:54 UTC (permalink / raw)
To: qhwang; +Cc: linux-c-programming
QingHua Wang wrote:
>Many thanks for your response. I searched the web and found some information.
>I gonna figue this out later as you suggested. Where can I find this file
>/mm/oom_kill.c? I can not find it after searching the two computers. One is
>installed with Mandrake 8.0 and another 9.1. Thanks.
>
>
Have a look here.
http://linuxcompressed.sourceforge.net/vm24/oom_kill.html
http://www.kernel.org/pub/linux/kernel/people/marcelo/linux-2.4/mm/oom_kill.c
You'll need to have the kernel source code installed on the machine to
view it. Usually
thats in /usr/src/linux/
******************************************************************************
The information in this e-mail is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this e-mail by anyone else
is unauthorised. If you are not the intended recipient, any disclosure,
copying, distribution, or any action taken or omitted to be taken in reliance
on it, is prohibited and may be unlawful.
Please note that emails to, from and within RTÉ may be subject to the Freedom
of Information Act 1997 and may be liable to disclosure.
******************************************************************************
-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: program killed
2003-08-14 10:25 ` Tony Clarke
@ 2003-08-14 13:00 ` QingHua Wang
2003-08-14 12:54 ` Tony Clarke
0 siblings, 1 reply; 9+ messages in thread
From: QingHua Wang @ 2003-08-14 13:00 UTC (permalink / raw)
To: Tony Clarke; +Cc: linux-c-programming
Many thanks for your response. I searched the web and found some information.
I gonna figue this out later as you suggested. Where can I find this file
/mm/oom_kill.c? I can not find it after searching the two computers. One is
installed with Mandrake 8.0 and another 9.1. Thanks.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: reading back characters from terminal
2003-08-14 9:38 ` Fekete Gabor
@ 2003-08-14 15:54 ` Fekete Gabor
2003-08-14 22:49 ` Glynn Clements
0 siblings, 1 reply; 9+ messages in thread
From: Fekete Gabor @ 2003-08-14 15:54 UTC (permalink / raw)
To: linux-c-programming
>
>
> On Thu, 14 Aug 2003, Glynn Clements wrote:
>
> >
> > Fekete Gabor wrote:
> >
> > > is there a way to read back characters from the terminal (e.g. xterm).
> >
> > No. There isn't even any guarantee that the characters are actually
> > stored anywhere. Certainly, hardcopy terminals don't store the text,
>
one more question.
then why can I select text with the mouse both in xterm and on a text
console and then paste it somewhere?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: reading back characters from terminal
2003-08-14 15:54 ` Fekete Gabor
@ 2003-08-14 22:49 ` Glynn Clements
0 siblings, 0 replies; 9+ messages in thread
From: Glynn Clements @ 2003-08-14 22:49 UTC (permalink / raw)
To: Fekete Gabor; +Cc: linux-c-programming
Fekete Gabor wrote:
> > > > is there a way to read back characters from the terminal (e.g. xterm).
> > >
> > > No. There isn't even any guarantee that the characters are actually
> > > stored anywhere. Certainly, hardcopy terminals don't store the text,
> >
> one more question.
>
> then why can I select text with the mouse both in xterm and on a text
> console and then paste it somewhere?
Because both of those terminals *do* store the text somewhere.
Unfortunately, exactly where they store it, and in what format, is
specific to the particular terminal.
[Actually, that's only half true for xterm. xterm emulates both a DEC
VT-220 and a Tektronix 4104; you can only paste the text from the
VT-220, not the 4104.]
Theoretically, you could go digging around in the xterm process'
memory, via /proc/<pid>/mem (although, if xterm is running as root,
you'll need root privilege). Or in the framebuffer memory for the
Linux console (again, probably needs root privilege). But that won't
work for a remote login (telnet, ssh, minicom etc).
Similarly, you might be able to get the text from an xterm by OCR'ing
a screen dump, provided that your program can access the X display,
that it can figure out which xterm it is talking to, and that the
xterm itself isn't obscured. But that would be a lot of work, and
wouldn't be particularly reliable.
--
Glynn Clements <glynn.clements@virgin.net>
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2003-08-14 22:49 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-08-13 18:52 reading back characters from terminal Fekete Gabor
2003-08-13 23:29 ` Glynn Clements
2003-08-14 9:38 ` Fekete Gabor
2003-08-14 15:54 ` Fekete Gabor
2003-08-14 22:49 ` Glynn Clements
2003-08-14 11:07 ` program killed QingHua Wang
2003-08-14 10:25 ` Tony Clarke
2003-08-14 13:00 ` QingHua Wang
2003-08-14 12:54 ` Tony Clarke
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).