Annotation of libwww/Library/src/HTString.html, revision 2.30
2.11 frystyk 1: <HTML>
2: <HEAD>
2.29 frystyk 3: <TITLE>W3C Reference Library libwww DYNAMIC STRINGS</TITLE>
2.27 frystyk 4: <!-- Changed by: Henrik Frystyk Nielsen, 18-Dec-1995 -->
2.30 ! hallam 5: <!-- Changed by: Eric Prud'hommeaux, 23-Mar-1996 -->
2.11 frystyk 6: </HEAD>
2.6 timbl 7: <BODY>
2.9 frystyk 8:
2.25 frystyk 9: <H1>Generic String Management</H1>
2.11 frystyk 10:
11: <PRE>
12: /*
2.15 frystyk 13: ** (c) COPYRIGHT MIT 1995.
2.11 frystyk 14: ** Please first read the full copyright statement in the file COPYRIGH.
15: */
16: </PRE>
2.9 frystyk 17:
18: These functions provide functionality for case-independent string
19: comparison and allocations with copies etc. <P>
20:
21: This module is implemented by <A HREF="HTString.c">HTString.c</A>, and
22: it is a part of the <A NAME="z10"
2.21 frystyk 23: HREF="http://www.w3.org/pub/WWW/Library/">
2.18 frystyk 24: W3C Reference Library</A>. <P>
2.9 frystyk 25:
2.8 frystyk 26: <PRE>
27: #ifndef HTSTRING_H
2.1 timbl 28: #define HTSTRING_H
2.9 frystyk 29: </PRE>
30:
2.17 frystyk 31: <H2><A NAME="dyn">Dynamic String Manipulation</A></H2>
2.9 frystyk 32:
33: These two functions are dynamic versions of <CODE>strcpy</CODE> and
34: <CODE>strcat</CODE>. They use <CODE>malloc</CODE> for allocating space
35: for the string. If <CODE>StrAllocCopy</CODE> is called with a non-NULL
36: dest, then this is freed before the new value is assigned so that only
37: the <EM>last</EM> string created has to be freed by the user. If
38: <CODE>StrAllocCat</CODE> is called with a NULL pointer as destination
39: then it is equivalent to <CODE>StrAllocCopy</CODE>.
2.1 timbl 40:
2.30 ! hallam 41: <A NAME="HTSACopy"></A>
2.9 frystyk 42: <PRE>
43: #define StrAllocCopy(dest, src) HTSACopy (&(dest), src)
44: #define StrAllocCat(dest, src) HTSACat (&(dest), src)
2.24 frystyk 45:
2.28 frystyk 46: extern char * HTSACopy (char **dest, const char *src);
47: extern char * HTSACat (char **dest, const char *src);
2.6 timbl 48: </PRE>
2.1 timbl 49:
2.30 ! hallam 50: <A NAME="strcasecomp"></A>
! 51: <A NAME="strncasecomp"></A>
2.17 frystyk 52: <H2><A NAME="utils">Case-insensitive String Comparison</A></H2>
2.9 frystyk 53:
54: The usual routines (comp instead of cmp) had some problem.
2.7 luotonen 55:
56: <PRE>
2.28 frystyk 57: extern int strcasecomp (const char *a, const char *b);
58: extern int strncasecomp (const char *a, const char *b, int n);
2.7 luotonen 59: </PRE>
60:
2.24 frystyk 61: <H2>String Comparison with Wild Card Match</H2>
62:
63: String comparison function for file names with one wildcard * in the
64: template. Arguments are:
65:
66: <DL>
67: <DT>tmpl
68: <DD>is a template string to match the name against. agaist, may
69: contain a single wildcard character * which matches zero or more
70: arbitrary characters.
71: <DT>name
72: <DD>is the name to be matched agaist the template.
73: </DL>
74:
2.26 frystyk 75: Returns empty string ("") if perfect match, pointer to part matched by
76: wildcard if any, or NULL if no match. This is basically the same as
77: YES if match, else NO.
2.24 frystyk 78:
79: <PRE>
2.28 frystyk 80: extern char * HTStrMatch (const char * tmpl, const char * name);
81: extern char * HTStrCaseMatch (const char * tmpl, const char * name);
2.24 frystyk 82: </PRE>
83:
2.9 frystyk 84: <H2>Case-insensitive strstr</H2>
2.7 luotonen 85:
2.9 frystyk 86: This works like <CODE>strstr()</CODE> but is not case-sensitive.
2.1 timbl 87:
2.9 frystyk 88: <PRE>
2.24 frystyk 89: extern char * strcasestr (char * s1, char * s2);
2.17 frystyk 90: </PRE>
91:
92: <H2>Strip white space off a string</H2>
93:
94: Return value points to first non-white character, or to '/0' if
95: none. All trailing white space is OVERWRITTEN with zero.
96:
97: <PRE>
2.24 frystyk 98: extern char * HTStrip (char * s);
2.6 timbl 99: </PRE>
2.9 frystyk 100:
2.14 frystyk 101: <PRE>
2.9 frystyk 102: #endif
103: </PRE>
2.14 frystyk 104:
105: End of declaration module
2.1 timbl 106:
2.6 timbl 107: </BODY>
2.9 frystyk 108: </HTML>
Webmaster