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