Other Alias
stSubstituteString, stStrtok, stStrEnterSYNOPSIS
#include <config.h>#include <sttk.h>
char* stConvertPattern (char *pattern);
char* stSubstituteString (char *original, char *old, char *new);
char* stStrtok (char *string);
char* stStrEnter (char *string);
DESCRIPTION
stConvertPattern converts sh(1) filename generation patterns to ed(1) string patterns.- question (?)
- gets converted to period (.)
- asterisk (*)
- gets converted to a period followed by an asterisk (.*)
- period (.)
- will be escaped by a backslash character (\.).
- exclam (!)
- gets converted to circumflex (^) if it follows an left bracket ([). Otherwise it remains unmodified.
The whole pattern will be enclosed in a circumflex (^) as leftmost an a dollar sign ($) as rightmost character.
stSubstituteString replaces all occurrences of substring old in original by string new. It returns a pointer to an allocated string that is the result of this operation. Returns NULL if anything goes seriously wrong.
stStrtok considers the string string to consist of a sequence of zero or more text tokens separated by whitespace. The first call (with pointer string specified) returns a pointer to the first character of the first token, and will have written a null character into string immediately following the returned token. The function keeps track of its position between separate calls, so that subsequent calls (which must be made with the string argument set to NULL) will work through the string immediately following that token. In this way subsequent calls will work through the string until no tokens remain. When no token remains in string, a NULL pointer is returned.
stStrEnter adds the given string to an internal string table and returns a pointer to appropriate string table entry. Equal strings are mapped to equal locations in the table. Equality of two strings in the string table can be checked by simple pointer comparison.