On Mon, Jul 30, 2001 at 02:59:05AM -0400, Kyle Donaldson wrote:
> On Mon, 30 Jul 2001, after playing in traffic, Jeff Raven yelped:
> >
> > Well, the menu parser is currently line-based and rather
> > nasty... some easier solutions would be to either
> > -- put the long command in a script, and just use the
> > script as the command instead
> > -- set up some X resources and use "aterm -name whatever"
> > (at least rxvt uses -name, so aterm probably does)
> >
>
> Here's my 'quick' way of implementing the ability to break lines...
>
> <code snip>
Not a bad idea... I'll keep it in mind if I get a chance
to go through the menu code. A few issues though...
- the code should probably store strlen(buf) rather than
always recomputing it, especially if you allow the chance
of 16K lines
- there's a bit of excessive malloc'ing going on... there's
no need to re-malloc buf, at least.
For simplicity's sake, I'd probably just put a hard 1024-char
limit on the total size of an entry, and just append consecutive
lines using an stpcpy.
Jeff Raven