.ig Copyright (C) 1993,1994 by the author(s). This software is published in the hope that it will be useful, but WITHOUT ANY WARRANTY for any part of this software to work correctly or as described in the manuals. See the ShapeTools Public License for details. Permission is granted to use, copy, modify, or distribute any part of this software but only under the conditions described in the ShapeTools Public License. A copy of this license is supposed to have been given to you along with ShapeTools in a file named LICENSE. Among other things, this copyright notice and the Public License must be preserved on all copies. Author: Andreas Lampen (Andreas.Lampen@cs.tu-berlin.de) $Header: ststring.3[4.0] Thu Jun 24 17:43:33 1993 andy@cs.tu-berlin.de frozen $ .. .TH ststring 3 "Thu Jun 24 17:43:33 1993" "sttk-1.7" "ShapeTools Toolkit Library" .SH NAME stConvertPattern, stSubstituteString, stStrtok, stStrEnter \- string handling .SH SYNOPSIS #include .br #include .sp char* stConvertPattern (char *pattern); .sp char* stSubstituteString (char *original, char *old, char *new); .sp char* stStrtok (char *string); .sp char* stStrEnter (char *string); .sp .SH DESCRIPTION \fIstConvertPattern\fP converts sh(1) filename generation patterns to ed(1) string patterns. .TP 2c question (?) gets converted to period (.) .TP asterisk (*) gets converted to a period followed by an asterisk (.*) .TP period (.) will be escaped by a backslash character (\e.). .TP exclam (!) gets converted to circumflex (^) if it follows an left bracket ([). Otherwise it remains unmodified. .LP The whole pattern will be enclosed in a circumflex (^) as leftmost an a dollar sign ($) as rightmost character. .LP \fIstSubstituteString\fP replaces all occurrences of substring \fIold\fP in \fIoriginal\fP by string \fInew\fP. It returns a pointer to an allocated string that is the result of this operation. Returns NULL if anything goes seriously wrong. .LP \fIstStrtok\fP considers the string \fIstring\fP 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. .LP \fIstStrEnter\fP adds the given \fIstring\fP 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. .SH SEE ALSO sh (1), ed (1)