9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* reading selected text in acme
@ 1995-10-09  6:02 rob
  0 siblings, 0 replies; 3+ messages in thread
From: rob @ 1995-10-09  6:02 UTC (permalink / raw)


#include <u.h>
#include <libc.h>

/* assumes chars==characters.  fixing this is an exercise for the reader */

void
main(void)
{
	int c, a, d, x1, x2;
	char buf[256];

	c = open("/mnt/acme/1/ctl", ORDWR);
	a = open("/mnt/acme/1/addr", OREAD);
	d = open("/mnt/acme/1/data", OREAD);
	write(c, "addr=dot", 8);
	read(a, buf, sizeof buf);
	x1 = atoi(buf);
	x2 = atoi(buf+12);
	seek(d, x1, 0);
	read(d, buf, x2-x1);
	write(1, buf, x2-x1);
	exits(0);
}






^ permalink raw reply	[flat|nested] 3+ messages in thread

* reading selected text in acme
@ 1995-10-09 23:21 beto
  0 siblings, 0 replies; 3+ messages in thread
From: beto @ 1995-10-09 23:21 UTC (permalink / raw)


In <95Oct9.021146edt.78511@colossus.cse.psu.edu>
	rob@plan9.att.com wrote:

> #include <u.h>
> #include <libc.h>
> 
> /* assumes chars==characters.  fixing this is an exercise for the reader */
> 
> void
> main(void)
> {
> 	int c, a, d, x1, x2;
> 	char buf[256];
> 
> 	c = open("/mnt/acme/1/ctl", ORDWR);
> 	a = open("/mnt/acme/1/addr", OREAD);
> 	d = open("/mnt/acme/1/data", OREAD);
> 	write(c, "addr=dot", 8);
> 	read(a, buf, sizeof buf);
> 	x1 = atoi(buf);
> 	x2 = atoi(buf+12);
> 	seek(d, x1, 0);
> 	read(d, buf, x2-x1);
> 	write(1, buf, x2-x1);
> 	exits(0);
> }
> 
> 
> 
Thanks






^ permalink raw reply	[flat|nested] 3+ messages in thread

* reading selected text in acme
@ 1995-10-09 17:29 beto
  0 siblings, 0 replies; 3+ messages in thread
From: beto @ 1995-10-09 17:29 UTC (permalink / raw)


Hi, 

I've tried to read the selected text in an acme 
window (from an alef program), 
but it reads from the start of the selection while there is
space in the read buffer. I checked the acme manual, and it says
that's the `right behaivor'. So I'm wondering how do we
check the end of the selection. 

To read the selected text I did:

	write(ctl,"addr=dot",strlen("addr=dot"));
	n=read(data,buf,sizeof(buf));

I could use the chorus mecanism, but it only works with
less than 256 bytes, eventhough the manual says that it should
give me the addr to read the runes directly form the file if the
argument is too long.  Acme says "`argument string too long".

thanks









^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1995-10-09 23:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-10-09  6:02 reading selected text in acme rob
1995-10-09 17:29 beto
1995-10-09 23:21 beto

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).