Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ index(3) — Reliant UNIX 5.44c4

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

bstring(3)

malloc(3C)

string(3C)

index(3)                (BSD Compatibility Package)                index(3)

NAME
     index, rindex - string operations

SYNOPSIS
     /usr/ucb/cc [flag ...] file ... -lucb

     #include <strings.h>

     char *index(s, c)
     char *s, c;

     char *rindex(s, c)
     char *s, c;

DESCRIPTION
     These functions operate on NULL-terminated strings. They do not check
     for overflow of any receiving string.

     index and rindex returns a pointer to the first (last) occurrence of
     character c in string s, or a NULL pointer if c does not occur in the
     string. The NULL character terminating a string is considered to be
     part of the string.

NOTES
     For user convenience, these functions are declared in the optional
     <strings.h> header file.

     On the Sun processor, as well as on many other machines, you can not
     use a NULL pointer to indicate a NULL string. A NULL pointer is an
     error and results in an abort of the program. If you wish to indicate
     a NULL string, you must have a pointer that points to an explicit NULL
     string. On some implementations of the C language on some machines, a
     NULL pointer, if dereferenced, would yield a NULL string; this highly
     non-portable trick was used in some programs. Programmers using a NULL
     pointer to represent an empty string should be aware of this portabil-
     ity issue; even on machines where dereferencing a NULL pointer does
     not cause an abort of the program, it does not necessarily yield a
     NULL string.

     Character movement is performed differently in different implementa-
     tions. Thus overlapping moves may yield surprises.

SEE ALSO
     bstring(3), malloc(3C), string(3C).











Page 1                       Reliant UNIX 5.44                Printed 11/98

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026