9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "rob pike, esq." <rob@mightycheese.com>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] rc of Unix
Date: Sat,  5 Jul 2003 16:48:11 -0700	[thread overview]
Message-ID: <1a436ddf83596489155de6b026aa0a93@mightycheese.com> (raw)
In-Reply-To: <40F3FBFD-AF3F-11D7-85AC-000393A941BC@ar.aichi-u.ac.jp>

can't resist. here is slightly better code.

/* read that simulate Plan 9 read -- introduced by Kenar */
static void b_read(char **av) {
	char buf[1024];
	if (*++av != NULL) {
		set(FALSE);
		return;
	}
	int i = 0;
	for(;;){
		if(i == sizeof(buf)){
			write(1, buf, i);
			i = 0;
		}
		if(read(0, &buf[i], 1) <= 0)
			break;
		if(buf[i++] == '\n')
			break;
	}
	if(i > 0)
		write(1, buf, i);
	set(TRUE);
}



  reply	other threads:[~2003-07-05 23:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-05 17:45 David Presotto
2003-07-05 23:20 ` Kenji Arisawa
2003-07-05 23:48   ` rob pike, esq. [this message]
2003-07-06  3:19   ` boyd, rounin
  -- strict thread matches above, loose matches on Subject: below --
2003-07-05  2:17 Kenji Arisawa
2003-07-05  2:33 ` Bruce Ellis
2003-07-05 12:15   ` Kenji Arisawa
2003-07-05 14:00     ` boyd, rounin

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=1a436ddf83596489155de6b026aa0a93@mightycheese.com \
    --to=rob@mightycheese.com \
    --cc=9fans@cse.psu.edu \
    /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).