From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <3C4F0480.F8899984@strakt.com> From: Boyd Roberts MIME-Version: 1.0 To: 9fans@cse.psu.edu Subject: Re: [9fans] rc for unix References: <3C4D8FC3.C3C837FB@strakt.com> <87d701neap.fsf@becket.becket.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Wed, 23 Jan 2002 19:44:16 +0100 Topicbox-Message-UUID: 429b5e96-eaca-11e9-9e20-41e7f4b1d025 "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.