NAME

sops.c - string manipulation functions

Version Tag $Id: sops.c,v 1.15 2006/02/06 19:55:47 db60 Exp $


cistrcmp - CASE-INDEPENDENT STRING COMPARISON

SYNOPSIS

    long cistrcmp(const char *s1, const char *s2);

DESCRIPTION

Compares two strings in a case-independent manner. The strings may have the same or different length. (Strings of nonequal length are always considered different from each other.)

The strings may overlap in memory or occupy the same memory.

PARAMETERS

INPUT

s1

Pointer to the first text character of one of the strings to be compared.

s2

Pointer to the first text character of the other string to be compared.

RETURN

Returns 0 if the string are the same or nonzero if different.


nextnonwspc - FIND NEXT NON-WHITE-SPACE CHARACTER

SYNOPSIS

    char *nextnonwspc(const char *string);

DESCRIPTION

Finds the next non-white-space text character in a string, if any.

PARAMETERS

INPUT

string

Pointer to the first character in the string in question.

RETURN

Pointer to the first non-white-space character in the string, or NULL if all characters in the string are white space.


salloc - STRING ALLOCATION

SYNOPSIS

    char *salloc(long len, const char *msg);

DESCRIPTION

Allocates dynamic heap memory for a string. One may later free this memory using the standard library function free(). The new memory is not initialized.

PARAMETERS

INPUT

len

Length of the string for which memory is being allocated, excluding the terminating '\0'. len must be positive or zero.

msg

Pointer to the first character of a string describing the object being allocated for. On failure, salloc() will crash with message 'out of memory: cannot allocate for ' followed by this string.

RETURN

Pointer to the first character of the newly-allocated memory.


supper - CONVERT TO UPPER CASE

SYNOPSIS

    char *supper(char *s);

DESCRIPTION

Convert a string to upper case.

PARAMETERS

INPUT/OUTPUT

s

Pointer to first text character in the string to be converted.

RETURN

Returns s.