Re: mudFTP problems continued

From: Erwin S. Andreasen (erwin@ANDREASEN.COM)
Date: 09/27/98


On Sat, 26 Sep 1998, James Turner wrote:

> Okay I've found the problem.  It's a bug in the interfacing with
> Circle, not explicitly in the client or server (or Circle for that
> matter).  Here's a demonstration of the root of the issue: run circle
> in the foreground, hit ctrl-z, go to a window already connected, hit
> enter 50 times, go back, type "fg", and switch back to the client
> window.  Circle only responds to one carriage return.  Now, suppose
> you have an empty line in the file that is being sent.  It gets
> transmitted just as a "\n".  But if there was a line before it, we end
> up with two \n's in the buffer, which circle skips over.

Not surprising - MERC etc. do the same thing, and I fixed it there - but
the code in Circle is quite different. This seems to be the problem:


    /* find the end of this line */
    while (ISNEWL(*nl_pos))
      nl_pos++;


It should only skip one complete newline. The problem is however, finding
out what a newliny IS. It could be \n, but perhaps also \r\n or \n\r or
\r.

On MERC+, I skip until I get one of each or reach a non-newline. It looks
something like this:

        got_n = got_r = FALSE;

        for (;d->inbuf[i] == '\r' || d->inbuf[i] == '\n';i++)
        {
                if (d->inbuf[i] == '\r' && got_r++)
                        break;

                else if (d->inbuf[i] == '\n' && got_n++)
                        break;
        }



--
 =============================================================================
<erwin@andreasen.com>      Herlev, Denmark              UNIX System Programmer
<URL:http://www.abandoned.org/drylock/>     <*>         (not speaking for) DDE
 =============================================================================


     +------------------------------------------------------------+
     | 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