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

2.11      frystyk     1: <HTML>
                      2: <HEAD>
2.29      frystyk     3: <TITLE>W3C Reference Library libwww DYNAMIC STRINGS</TITLE>
2.31    ! frystyk     4: <!-- Changed by: Henrik Frystyk Nielsen,  6-Apr-1996 -->
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.30      hallam     40: <A NAME="HTSACopy"></A>
2.9       frystyk    41: <PRE>
                     42: #define StrAllocCopy(dest, src) HTSACopy (&amp;(dest), src)
                     43: #define StrAllocCat(dest, src)  HTSACat  (&amp;(dest), src)
2.24      frystyk    44: 
2.28      frystyk    45: extern char * HTSACopy (char **dest, const char *src);
                     46: extern char * HTSACat  (char **dest, const char *src);
2.6       timbl      47: </PRE>
2.1       timbl      48: 
2.30      hallam     49: <A NAME="strcasecomp"></A>
                     50: <A NAME="strncasecomp"></A>
2.17      frystyk    51: <H2><A NAME="utils">Case-insensitive String Comparison</A></H2>
2.9       frystyk    52: 
                     53: The usual routines (comp instead of cmp) had some problem.
2.7       luotonen   54: 
                     55: <PRE>
2.28      frystyk    56: extern int strcasecomp  (const char *a, const char *b);
                     57: extern int strncasecomp (const char *a, const char *b, int n);
2.7       luotonen   58: </PRE>
                     59: 
2.24      frystyk    60: <H2>String Comparison with Wild Card Match</H2>
                     61: 
                     62: String comparison function for file names with one wildcard * in the
                     63: template. Arguments are:
                     64: 
                     65: <DL>
                     66: <DT>tmpl
                     67: <DD>is a template string to match the name against.  agaist, may
                     68: contain a single wildcard character * which matches zero or more
                     69: arbitrary characters.
                     70: <DT>name
                     71: <DD>is the name to be matched agaist the template.
                     72: </DL>
                     73: 
2.26      frystyk    74: Returns empty string ("") if perfect match, pointer to part matched by
                     75: wildcard if any, or NULL if no match. This is basically the same as
                     76: YES if match, else NO.
2.24      frystyk    77: 
                     78: <PRE>
2.28      frystyk    79: extern char * HTStrMatch       (const char * tmpl, const char * name);
                     80: extern char * HTStrCaseMatch   (const char * tmpl, const char * name);
2.24      frystyk    81: </PRE>
                     82: 
2.9       frystyk    83: <H2>Case-insensitive strstr</H2>
2.7       luotonen   84: 
2.9       frystyk    85: This works like <CODE>strstr()</CODE> but is not case-sensitive.
2.1       timbl      86: 
2.9       frystyk    87: <PRE>
2.24      frystyk    88: extern char * strcasestr (char * s1, char * s2);
2.17      frystyk    89: </PRE>
                     90: 
                     91: <H2>Strip white space off a string</H2>
                     92: 
                     93: Return value points to first non-white character, or to '/0' if
                     94: none. All trailing white space is OVERWRITTEN with zero.
                     95: 
                     96: <PRE>
2.24      frystyk    97: extern char * HTStrip (char * s);
2.6       timbl      98: </PRE>
2.9       frystyk    99: 
2.14      frystyk   100: <PRE>
2.9       frystyk   101: #endif
                    102: </PRE>
2.14      frystyk   103: 
2.31    ! frystyk   104: <HR>
        !           105: <ADDRESS>
        !           106: @(#) $Id: Date Author State $
        !           107: </ADDRESS>
2.6       timbl     108: </BODY>
2.9       frystyk   109: </HTML>

Webmaster