Annotation of libwww/Library/src/HTString.html, revision 2.27

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

Webmaster