lynx-dev
[Top][All Lists]
Advanced

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

Re: LYNX-DEV Lynx2-6 compile error on Solaris2.4


From: Hiram Lester, Jr.
Subject: Re: LYNX-DEV Lynx2-6 compile error on Solaris2.4
Date: Sun, 1 Dec 1996 18:56:01 -0600 (CST)

On Sun, 1 Dec 1996, Drazen Kacar wrote:

> This shouldn't happen. Functions index() and rindex() exist on SunOS 4.x.x,
> but on SunOS 5.x (which people usually call Solaris) they don't exist.
> You have strchr() and strrchr() instead. It looks as if something's wrong
> with the Makefile. I may be wrong, of course, since I don't have Lynx source
> at hand.

Of course index and rindex are the OLD names and they should probably be
changed throughout the source anyway.  See the excerpt from 'man string'
below...

> Anyway, until it's fixed (if fixing is needed), you could:
> a) change all occurances of index and rindex with strchr and strrchr or
> b) write them yourself, like this, for example

Actually, the easiest way to do this would be with preprocessor defines:

#define index   strchr
#define rindex  strrchr

Assuming, of course, that the words index and rindex don't occur anywhere
in the source other than in function calls which might be difficult, so
maybe the functions would still be better... :(

Here's the excerpt from 'man string':
...
 SYNOPSIS
      #include <string.h>
      #include <strings.h>
...
    Remarks:
      All functions except index() and rindex() are declared in both headers,
      so only one of the two headers needs to be included.

      The functions index() and rindex() are declared only in <strings.h>,
      and <strings.h>.  They are provided solely for portability of BSD
      applications, and are not recommended for new applications where
      portability is important.  For portable applications, use <string.h>,
      strchr(), and strrchr() instead.
...

   +------------------------------------+-------------------------------+
   | Hiram W. Lester, Jr.               | E-Mail: address@hidden    |
   | Computer Science                   | Home page:                    |
   | Middle Tennessee State University  |   http://pobox.com/~hwlester/ |
   +------------------------------------+-------------------------------+

;
; To UNSUBSCRIBE:  Send a mail message to address@hidden
;                  with "unsubscribe lynx-dev" (without the
;                  quotation marks) on a line by itself.
;

reply via email to

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