lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lynx-dev Revised patch for HTFTP.c


From: Duncan Simpson
Subject: Re: lynx-dev Revised patch for HTFTP.c
Date: Sun, 20 Aug 2000 23:49:15 +0100

I might just jump in here and suggets that if lynx'slogic converts CRLF to 
CRCRLF then that logic is broken. The following kludge works nicey on most 
system (modulo assuming you are reading from the start to the end of the file)

int mygetchar()
{
  static int last=-1;
  int c;

  c=getchar();
  if (c=='\r' || c=='\n')
  {
        if (last+c=='\r'+'\n')
        {
           last=-1;
           return mygetchar();
        }
        last=c;
        return '\n';
  }
  last=c;
  return c;
}

and using mygetchar() instead of gerchat everywhere. Similar versions can
be done for FILE * objects (pass the function structure with last and the FILE 
*). This converts CRLF, LFCR, CR, LF or any mixture of them to all single \n 
by automagically absorbing the second character of CRLF and LFCR. Of course if 
the server, or file, is broken and sends CRCRLF it gets truned into two line 
feeds.

Will this technique deal with those pesky files that do not render "correctly" 
at present? If this fixes it then I guess lynx was more broken that the 
servers.

-- 
Duncan (-:
"software industry, the: unique industry where selling substandard goods is
legal and you can charge extra for fixing the problems."



; To UNSUBSCRIBE: Send "unsubscribe lynx-dev" to address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]