Annotation of libwww/Library/src/HTString.html, revision 2.20
2.11 frystyk 1: <HTML>
2: <HEAD>
2.19 frystyk 3: <TITLE>String Handling</TITLE>
2.20 ! frystyk 4: <!-- Changed by: Henrik Frystyk Nielsen, 1-Sep-1995 -->
2.11 frystyk 5: </HEAD>
2.6 timbl 6: <BODY>
2.9 frystyk 7:
8: <H1>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.18 frystyk 22: HREF="http://www.w3.org/hypertext/WWW/Library/">
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
28:
29: extern CONST char * HTLibraryVersion; /* String for help screen etc */
2.9 frystyk 30: </PRE>
31:
2.17 frystyk 32: <H2><A NAME="dyn">Dynamic String Manipulation</A></H2>
2.9 frystyk 33:
34: These two functions are dynamic versions of <CODE>strcpy</CODE> and
35: <CODE>strcat</CODE>. They use <CODE>malloc</CODE> for allocating space
36: for the string. If <CODE>StrAllocCopy</CODE> is called with a non-NULL
37: dest, then this is freed before the new value is assigned so that only
38: the <EM>last</EM> string created has to be freed by the user. If
39: <CODE>StrAllocCat</CODE> is called with a NULL pointer as destination
40: then it is equivalent to <CODE>StrAllocCopy</CODE>.
2.1 timbl 41:
2.9 frystyk 42: <PRE>
43: #define StrAllocCopy(dest, src) HTSACopy (&(dest), src)
44: #define StrAllocCat(dest, src) HTSACat (&(dest), src)
45: extern char * HTSACopy PARAMS ((char **dest, CONST char *src));
46: extern char * HTSACat PARAMS ((char **dest, CONST char *src));
2.6 timbl 47: </PRE>
2.1 timbl 48:
2.17 frystyk 49: <H2><A NAME="utils">Case-insensitive String Comparison</A></H2>
2.9 frystyk 50:
51: The usual routines (comp instead of cmp) had some problem.
2.7 luotonen 52:
53: <PRE>
2.9 frystyk 54: extern int strcasecomp PARAMS((CONST char *a, CONST char *b));
55: extern int strncasecomp PARAMS((CONST char *a, CONST char *b, int n));
2.7 luotonen 56: </PRE>
57:
2.9 frystyk 58: <H2>Case-insensitive strstr</H2>
2.7 luotonen 59:
2.9 frystyk 60: This works like <CODE>strstr()</CODE> but is not case-sensitive.
2.1 timbl 61:
2.9 frystyk 62: <PRE>
2.10 frystyk 63: extern char * strcasestr PARAMS((char * s1, char * s2));
2.17 frystyk 64: </PRE>
65:
66: <H2>Strip white space off a string</H2>
67:
68: Return value points to first non-white character, or to '/0' if
69: none. All trailing white space is OVERWRITTEN with zero.
70:
71: <PRE>
72: extern char * HTStrip PARAMS((char * s));
2.6 timbl 73: </PRE>
2.9 frystyk 74:
2.6 timbl 75: <H2>Next word or quoted string</H2>
2.14 frystyk 76:
77: This function returns a RFC822 word separated by space, comma, or
78: semi-colons.
79:
2.9 frystyk 80: <PRE>
81: extern char * HTNextField PARAMS ((char** pstr));
2.14 frystyk 82: </PRE>
83:
84: <H2>RFC1123 Date/Time Stamp String</H2>
85:
86: Returns a pointer to a static area!
87:
88: <PRE>
89: extern CONST char *HTDateTimeStr PARAMS((time_t *calendar, BOOL local));
90: </PRE>
91:
92:
93: <H2>Timezone Offset</H2>
94:
95: Calculates the offset from GMT in seconds. This is called from <A
96: HREF="HTAccess.html#Library">HTLibInit()</A>.
97:
98: <PRE>
99: extern long HTGetTimeZoneOffset NOPARAMS;
100: </PRE>
101:
102: <H2>Parse a Date/Time String</H2>
103:
104: Converts a string representation in GMT to a local representation of
105: localtime <CODE>time_t</CODE>.
106:
107: <PRE>
108: extern time_t HTParseTime PARAMS((CONST char * str));
109: </PRE>
110:
111:
112: <H2>Unique Message-ID String</H2>
113:
114: <PRE>
115: extern CONST char *HTMessageIdStr NOPARAMS;
2.9 frystyk 116: #endif
2.20 ! frystyk 117: </PRE>
! 118:
! 119: <H2>Converts an Integer to a String using Prefix</H2>
! 120:
! 121: In computer-world 1K is 1024 bytes and 1M is 1024K -- however,
! 122: sprintf() still formats in base-10. Therefore I output only until
! 123: 999, and then start using the next unit. This doesn't work wrong,
! 124: it's just a feature. The conversion is done in "str" which must be
! 125: large enough to contain the result.
! 126:
! 127: <PRE>
! 128: extern void HTNumToStr PARAMS((unsigned long n, char *str));
2.9 frystyk 129: </PRE>
2.14 frystyk 130:
131: End of declaration module
2.1 timbl 132:
2.6 timbl 133: </BODY>
2.9 frystyk 134: </HTML>
Webmaster