Re: [DG-Script] PL4 available

From: Patrick Dughi (dughi@IMAXX.NET)
Date: 07/15/98


> I also need some help... Since I'm using page_string to send the entire
> list of objects that match the search parameter, the mud does not do an
> overflow and crashes instead when the string gets too long.  What can I
> do to avoid this?  Currently I just prevent immortals from using "vwear
> take". :)

        Simple enough then..

  large_page_buf[MAX_STRING_LEN+1];

  while(something) {
    sprintf(buf,(a string));
    if(length(buf) + length(large_page_buf) > MAX_STRING_LEN) {
     page_string(buf,ch,0); /* i may have the args wrong here*/
     sprintf(large_page_buf,(that string from above..));
    } else {
     strcat(large_page_buf,buf);
    }
  }
  page_string(buf,ch,0);

        or something like that. Just check that you don't go out of
bounds, and if you do, then simply spit out what you have and go on.

        Or, you could make a *char and continually malloc more memory as
required (probably the 'correct' solution) - to a certain point, i'd
assume.

        Or, or, You could have it load into memory only one page at a
time, and the pager-function would procede to the next page... thats
probably best..  You'd have a nice function then, memory nice...

        I'm going to think about that one :)
                                                PjD




     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST