Increasing Line lengths on an SWR codebase.

Posted by RAlen on Sun 07 Jan 2007 01:55 PM — 13 posts, 42,293 views.

#0
This may be a rather simple question, but i'm pretty new to coding, so please bear with me.

What i'm looking to do is expand the line lengths for most channels on an SWR codebase...for instance, a long 'emote' or 'say' will return 'line too long.' and cut it off at a certain point, and i'm looking to prevent that.

Any suggestions?
USA #1
You can try increasing the size of MAX_STRING_LENGTH.
USA #2
I think there's also a variable MAX_INPUT_LENGTH that you can set as well, which controls how long an input line can be.
USA #3
Yup, there is that one as well.
#4
Thanks, one or two others I'd asked had suggested that. However, changing that value in mud.h where it's defined appears to have no effect. Any other ideas?
USA #5
You make sure to do a clean compile?

I know I changed this in the past, but I can't remember how. Maybe try finding the max # of chars and grepping for that.
#6
Yep, compiled each time after trying various suggestions, still no luck. But i'll try the grep and see what I can find, thanks.
USA #7
It's not just a compile that you need. You need to type "make clean", then "make". (That's what a 'clean' compile refers to.)
#8
Yes, I know, that's what I meant. And thanks for all the help, but I found and extended the limit itself in the end in canonical input processing.


USA #9
Care to post how you ended up doing it for the benefit of the next person who runs into this issue?
#10
Certainly.
    /*
     * Canonical input processing.
     */
    for ( i = 0, k = 0; d->inbuf != '\n' && d->inbuf != '\r'; i++ )
    {
	if ( k >= 254 )
	{
	    write_to_descriptor( d->descriptor, "Line too long.\n\r", 0 );


is the actual part we ended up needing to change, in our comm.c file at around line 1052. if ( k >= 254 ) means that anything after 254 characters is ignored. I've heard some people simply change the 254 to MAX_STRING_LENGTH and have done with it, we decided to change it to 650 characters, and see how it worked out.

Thanks again.
USA #11
The 254 was hard-coded in? That's pretty silly... I thought the whole point of MAX_INPUT_LENGTH was to control ... the maximum input length.

Changing it to MSL probably isn't safe, though. I think parts of the code assume that the input buffer is smaller than MSL.
USA #12
Actually I think what you need is the MAX_INBUF_SIZE value instead. d->inbuf[] uses MAX_INBUF_SIZE as it's size limit, so MAX_INPUT_LENGTH may not be safe either as it could be of a larger size than d->inbuf[] is expecting.