* [9fans] rc for unix
@ 2002-01-22 16:13 Boyd Roberts
2002-01-23 18:07 ` Thomas Bushnell, BSG
0 siblings, 1 reply; 3+ messages in thread
From: Boyd Roberts @ 2002-01-22 16:13 UTC (permalink / raw)
To: 9fans
It's at:
http://www.star.le.ac.uk/~tjg/rc
With the fixed =.c called history.c:
/*
history.c -- primitive history mechanism
Paul Haahr & Byron Rakitzis, July 1991.
This program mimics the att v8 = and == history programs.
The edit() algorithm was adapted from a similar program
that Boyd Roberts wrote, but otherwise all the code has
been written from scratch.
edit() was subsequently redone by Hugh Redelmeier in order
to correctly deal with tab characters in the source line.
BUGS:
There is an implicit assumption that commands are no
more than 1k characters long.
*/
The question is whether I can stand another shell game [change] ...
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [9fans] rc for unix
2002-01-22 16:13 [9fans] rc for unix Boyd Roberts
@ 2002-01-23 18:07 ` Thomas Bushnell, BSG
2002-01-23 18:44 ` Boyd Roberts
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Bushnell, BSG @ 2002-01-23 18:07 UTC (permalink / raw)
To: 9fans
boyd@strakt.com (Boyd Roberts) writes:
> Paul Haahr & Byron Rakitzis, July 1991.
> ...
> 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...
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [9fans] rc for unix
2002-01-23 18:07 ` Thomas Bushnell, BSG
@ 2002-01-23 18:44 ` Boyd Roberts
0 siblings, 0 replies; 3+ messages in thread
From: Boyd Roberts @ 2002-01-23 18:44 UTC (permalink / raw)
To: 9fans
"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.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-01-23 18:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-22 16:13 [9fans] rc for unix Boyd Roberts
2002-01-23 18:07 ` Thomas Bushnell, BSG
2002-01-23 18:44 ` Boyd Roberts
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).