lynx-dev
[Top][All Lists]
Advanced

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

Re: lynx-dev strange index display error


From: Bela Lubkin
Subject: Re: lynx-dev strange index display error
Date: Thu, 22 Oct 1998 15:18:22 -0700

(Patch included below, Tom -- not for this bug, just incidental stuff I
found.)

Larry W. Virden wrote:

> > > When I visit <http://www.it.kth.se/docs/rfc/rfcs/> and then
> > > move my mouse down the page of RFCs, I notice the URL reported by
> > > lynx's expert mode is displayed incorrectly.

The problem is clearly visible in the script output.  Something in your
Lynx is causing it to mis-handle '.' characters, both in the field
editor and now in displaying URLs.

Unfortunately, there are 131 references to '.' in the Lynx source,
ignoring VMS and DOS-specific files.  It's a lot to narrow down; and
since nobody else is running into the problem, it's likely not in Lynx
at all, but in one of the libraries you're compiling with.  Ok, I've
just gone and looked at those 131 references and I don't see anything
that would relate to your problem.

My guess is that one of the ctype functions (isascii(), etc.) is
returning an unexpected value for '.'.  Compile and run this trivial
program, which tries all the ctype functions that Lynx uses:

  #include <ctype.h>
  main()
  {
    printf("isalnum('.') = %d\n", isalnum('.'));
    printf("isalpha('.') = %d\n", isalpha('.'));
    printf("isascii('.') = %d\n", isascii('.'));
    printf("isdigit('.') = %d\n", isdigit('.'));
    printf("islower('.') = %d\n", islower('.'));
    printf("isprint('.') = %d\n", isprint('.'));
    printf("isspace('.') = %d\n", isspace('.'));
    printf("isupper('.') = %d\n", isupper('.'));
    printf("isxdigit('.') = %d\n", isxdigit('.'));
  }

On my SCO OpenServer Release 5.0.5 system it says:

  isalnum('.') = 0
  isalpha('.') = 0
  isascii('.') = 1
  isdigit('.') = 0
  islower('.') = 0
  isprint('.') = 4
  isspace('.') = 0
  isupper('.') = 0
  isxdigit('.') = 0

(the return value is defined to be 0 or nonzero, no specific value, so
this is reasonable).  What do you get on your system?

While looking this over, I found a potential bug in src/GridText.c:

  6035          if ((cp && *cp && *cp++ == '(') &&
  6036              *cp && isdigit(*cp++)) {            <----
  6037              while (*cp && isdigit(*cp))
  6038                  ++cp;

The ctype functions can be defined as macros, and a faulty
implementation might evaluate its argument more than once.  This should
be changed to:

  6035          if ((cp && *cp && *cp++ == '(') &&
  6036              *cp && isdigit(*cp)) {
  6037              while (*++cp && isdigit(*cp))
  6038                  ;

(Such "faulty" implementations are common in the field, at least in
older OSes...)

>Bela<

reply via email to

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