9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: rob@plan9.att.com rob@plan9.att.com
Subject: reading selected text in acme
Date: Mon,  9 Oct 1995 02:02:35 -0400	[thread overview]
Message-ID: <19951009060235.BSagiskPPNiu7zbH9YUhodP9tD2YinKUMpAOB6J0x9A@z> (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);
}






             reply	other threads:[~1995-10-09  6:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-10-09  6:02 rob [this message]
1995-10-09 17:29 beto
1995-10-09 23:21 beto

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=19951009060235.BSagiskPPNiu7zbH9YUhodP9tD2YinKUMpAOB6J0x9A@z \
    --to=rob@plan9.att.com \
    /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).