9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Boyd Roberts <boyd@strakt.com>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] rc for unix
Date: Wed, 23 Jan 2002 19:44:16 +0100	[thread overview]
Message-ID: <3C4F0480.F8899984@strakt.com> (raw)
In-Reply-To: <87d701neap.fsf@becket.becket.net>

"Thomas Bushnell, BSG" wrote:
> >       BUGS:
> >       There is an implicit assumption that commands are no
> >       more than 1k characters long.
>
> You'd think by 1991 poeple would have stopped making such
> assumptions...

Exactly.

The original code didn't care, until you ran out of memory:

#define FLEXZ       128

#define flex_char(f, c)  (*((f)->f_ptr == (f)->f_end ? flex_fill(f) :
(f)->f_ptr++) = (c))

typedef struct
{
     char *f_str;
     char *f_end;
     char *f_ptr;
}
          flex;

void
flex_init(f)
register flex  *f;
{
     f->f_str = f->f_ptr = salloc(FLEXZ);
     f->f_end = f->f_ptr + FLEXZ;
}

char *
flex_fill(f)
register flex  *f;
{
     register int   s;

     s = f->f_end - f->f_str + FLEXZ;

     f->f_str = srealloc(f->f_str, s);
     f->f_end = f->f_str + s;
     f->f_ptr = f->f_end - FLEXZ;

     return f->f_ptr++;
}

...

You get the picture.


      reply	other threads:[~2002-01-23 18:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-22 16:13 Boyd Roberts
2002-01-23 18:07 ` Thomas Bushnell, BSG
2002-01-23 18:44   ` Boyd Roberts [this message]

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=3C4F0480.F8899984@strakt.com \
    --to=boyd@strakt.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).