cfht_string(3) manual page
Table of Contents
cfht_string - general purpose string manipulation and sanity checking
routines
#include <cfht/cfht.h>char *cfht_string(in_str, operation, rangeinfo)char
*in_str;int operation;cfht_range_t rangeinfo;
libcfht.a
This routine
provides a number of operations useful for performing sanity checks on
user-supplied input. It is intended as an aid in avoiding such horrors as
whitespace in filenames and unprintable characters in input strings.
The
string may contain any ascii characters. The NULL character terminates the
string. A number of different operations are available.
rangeinfo
provides an array of pointers to strings. The input string is tested against
each of these strings. If an exact match is found, a copy of the input string
is made and the function returns a pointer to this new copy. If an exact
match is not found, the function returns a pointer to a null string. If
an error occurs, the function returns NULL. Possible errors are: INVALID_RANGE
- range structure is bad.
rangeinfo provides a string of
characters. Each character in the input string is tested against the rangeinfo.
If it is found, the character is copied to the output string. If an error
occurs, the function returns NULL. Possible errors are: INVALID_RANGE - range
structure is bad.
rangeinfo provides a string of characters.
Each character in the input string is tested against the rangeinfo. If it
is not found, the character is copied to the output string. If an error
occurs, the function returns NULL. Possible errors are: INVALID_RANGE - range
structure is bad.
Each character in the input string which
is not a whitespace character is copied to the output string. Whitespace
characters are space, tab, carriage return, new line, vertical tab and
form feed. rangeinfo is ignored; it is suggested that NULL be used.
The
input string is copied to the output string, but all whitespace characters
at the end of the string are removed. Whitespace characters are as above.
rangeinfo is ignored; it is suggested that NULL be used.
Currently
unimplemented.
Currently unimplemented.
All
of these routines return a pointer to the result string. The input string
is always left unmodified. Space for the return value is dynamically allocated;
it is the responsibility of the caller to call free(3)
to return the memory
after use. If an error occurs, NULL is returned and cfht_errno is set.
cfht_tok(3)
, cfp_getval(3)
Remember that a NULL pointer and
a pointer to a NULL string are not the same.
Remember to free the memory
used by the output strings.
Table of Contents