[HEDIT] [CODE] strip_cr and strip_string?

From: Patrick M. O'Laughlin (pmolaughlin@home.com)
Date: 06/18/01


I searched the archives to find that the following issue was brought up but
never solved.  Therefore, I'm bringing it up again.

I have installed CircleMUD 3.0 bpl18 with OasisOLC v2.0.  I just finished
fixing all of the compile errors from the heditv2 patch and I've run into a
problem.  After saving help entries to disk then reloading xhelp I find that
every help entry has a new blank line added to it.

One of the errors that popped up during compile was an undefined reference
to the 'strip_string' function in hedit_save_to_disk.  I changed this
'strip_string' call to 'strip_cr' because that is what is used in OasisOLC
v2.0 apparently.  I'm guessing that this is the reason for my problem.
Note: The function is called in hedit_save_to_disk right before writing the
entry to the file.

The strip_cr function follows:

/*
 * NOTE: This changes the buffer passed in.
 */
void strip_cr(char *buffer)
{
  int rpos, wpos;

  if (buffer == NULL)
    return;

  for (rpos = 0, wpos = 0; buffer[rpos]; rpos++) {
    buffer[wpos] = buffer[rpos];
    wpos += (buffer[rpos] != '\r');
  }
  buffer[wpos] = '\0';
}

Does anyone see a problem? Has anyone ever fixed this problem?

Pat

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/05/01 PST