The "st" Package

These routines are meant to supplement the standard C library str* routines Since each version of Unix has a different set of "extra" string functions, this package is meant to bridge the gap, and provides some of the more useful "extras".

Library: karma
Link With: -lkarma

Functions

st_expr_expandExpand an expression using Borne Shell-like unquoted rules.
st_findSearch a list of strings for a string.
st_chrSearch a string for the first occurrence of a character.
st_cmp_wildCompare strings with wildcard support.
st_cspnFind maximum leading segment in string with exclusion.
st_icmpCompare strings, ignoring case.
st_lwrConvert a string to lowercase.
st_nicmpCompare strings, ignoring case, up to a specified length.
st_nuprConvert a string to uppercase, up to a specified length.
st_nlwrConvert a string to lowercase, up to a specified length.
st_pbrkSearch a string for a character from a set.
st_rchrSearch a string for the last occurrence of a character.
st_spnFind maximum leading segment in string with inclusion.
st_tokExtract token from string.
st_tolConvert a string to a long integer.
st_uprConvert a string to uppercase.
st_dupMake a duplicate copy of a string.
st_qsortPerform a quicksort on an array of strings.


Functions


EXPERIMENTAL FUNCTION: subject to change without notice

flag st_expr_expand (char *output, unsigned int length, CONST char *input, CONST char *(*get_variable) (CONST char *variable, void *info), void *info, FILE *errfp)

Expand an expression using Borne Shell-like unquoted rules.

Parameters:

Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe


unsigned int st_find ( CONST char **string_list, unsigned int list_length, CONST char *string, int (*function) () )

Search a list of strings for a string.

Parameters:

Returns: The index of the found string in the string list. If no match is found, the list_length is returned. The routine returns on the first match.
Multithreading Level: Unsafe


CONST char * st_chr (CONST char *string, char c)

Search a string for the first occurrence of a character.

Parameters:

Returns: A pointer to the found character in the string. If no match is found, NULL is returned.
Multithreading Level: Unsafe


int st_cmp_wild (CONST char *a, CONST char *b)

Compare strings with wildcard support.

Parameters:

Returns: The difference between the strings.
Multithreading Level: Unsafe


int st_cspn (CONST char *string, CONST char *charset)

Find maximum leading segment in string with exclusion.

Parameters:

Returns: The number of characters in the leading segment.
Multithreading Level: Unsafe


int st_icmp (CONST char *string1, CONST char *string2)

Compare strings, ignoring case.

Parameters:

Returns: The comparison value. 0 indicates equality.
Multithreading Level: Unsafe


char * st_lwr (char *string)

Convert a string to lowercase.

Parameters:

Returns: The address of the string.
Multithreading Level: Unsafe


int st_nicmp (CONST char *string1, CONST char *string2, int str_len)

Compare strings, ignoring case, up to a specified length.

Parameters:

Returns: The comparison value. 0 indicates equality.
Multithreading Level: Unsafe


char * st_nupr (char *string, int str_len)

Convert a string to uppercase, up to a specified length.

Parameters:

Returns: The address of the string.
Multithreading Level: Unsafe


char * st_nlwr (char *string, int str_len)

Convert a string to lowercase, up to a specified length.

Parameters:

Returns: The address of the string.
Multithreading Level: Unsafe


char * st_pbrk (CONST char *string, CONST char *brkset)

Search a string for a character from a set.

Parameters:

Returns: A pointer to the found character in the string. If no match is found, NULL is returned.
Multithreading Level: Unsafe


CONST char * st_rchr (CONST char *string, char c)

Search a string for the last occurrence of a character.

Parameters:

Returns: A pointer to the found character in the string. If no match is found, NULL is returned.
Multithreading Level: Unsafe


int st_spn (CONST char *string, CONST char *charset)

Find maximum leading segment in string with inclusion.

Parameters:

Returns: The number of characters in the leading segment.
Multithreading Level: Unsafe


char * st_tok (char *string, CONST char *sepset)

This routine will break a string into a series of tokens. This routine should be called until no more tokens are found.

Parameters:

Returns: A pointer to the next token. NULL is returned if no tokens are found.
Multithreading Level: Unsafe


long st_tol (CONST char *str, char **ptr, int base)

Convert a string to a long integer.

Parameters:

Returns: The integer value.
Multithreading Level: Unsafe


char * st_upr (char *string)

Convert a string to uppercase.

Parameters:

Returns: The address of the string.
Multithreading Level: Unsafe


char * st_dup (CONST char *input)

Make a duplicate copy of a string.

Parameters:

Returns: A pointer to a copy of the string (allocated using m_alloc) on success, else NULL.
Multithreading Level: Unsafe


void st_qsort (char **v, int left, int right)

Perform a quicksort on an array of strings.

Parameters:

Returns: Nothing.
Multithreading Level: Unsafe


Back to Karma Home Page
Contact: Richard Gooch
Web Development: Ariel Internet Services