From: Kenji Arisawa <arisawa@ar.aichi-u.ac.jp>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] rc of Unix
Date: Sun, 6 Jul 2003 08:20:23 +0900 [thread overview]
Message-ID: <40F3FBFD-AF3F-11D7-85AC-000393A941BC@ar.aichi-u.ac.jp> (raw)
In-Reply-To: <c6e9ec2d729fce0291283ee044772336@plan9.bell-labs.com>
Hello,
I introduced builtin function "read" into Unix rc.
bash$ diff builtins.c builtins.c.orig
30,34d29
< #define RC_READ 1
< #if RC_READ
< static void b_read(char **);
< #endif
<
46,48d40
< #if RC_READ
< { b_read, "read" },
< #endif
111,136d102
<
< #if RC_READ
< /* read that simulate Plan 9 read -- introduced by Kenar */
< static void b_read(char **av) {
< char buf[1024];
< int i = 0;
< if (*++av != NULL) {
< set(FALSE);
< return;
< }
< for(;;){
< if(i == sizeof(buf)){
< write(1, buf, i);
< i = 0;
< }
< if(read(0, &buf[i++], 1) <= 0){
< i--;
< break;
< }
< if(buf[i-1] == '\n')
< break;
< }
< write(1, buf, i);
< set(TRUE);
< }
< #endif
where "builtins.c.orig" is of rc-1.7
I hope that does not introduce a bug ( not tested enough).
Kenji Arisawa
next prev parent reply other threads:[~2003-07-05 23:20 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 [this message]
2003-07-05 23:48 ` rob pike, esq.
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=40F3FBFD-AF3F-11D7-85AC-000393A941BC@ar.aichi-u.ac.jp \
--to=arisawa@ar.aichi-u.ac.jp \
--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).