Annotation of libwww/Library/src/HTWWWStr.html, revision 2.8
2.1 frystyk 1: <HTML>
2: <HEAD>
2.7 frystyk 3: <!-- Changed by: Henrik Frystyk Nielsen, 18-May-1996 -->
4: <!-- Changed by: Eric Prud'hommeaux, 28-May-1996 -->
2.5 frystyk 5: <TITLE>W3C Reference Library libwww WWW String Utilities</TITLE>
2.1 frystyk 6: </HEAD>
7: <BODY>
2.5 frystyk 8: <H1>
9: WWW Related String Management
10: </H1>
2.1 frystyk 11: <PRE>
12: /*
13: ** (c) COPYRIGHT MIT 1995.
14: ** Please first read the full copyright statement in the file COPYRIGH.
15: */
16: </PRE>
2.5 frystyk 17: <P>
2.1 frystyk 18: This module is like the <A HREF="HTString.html">generic string utility
2.5 frystyk 19: module</A> but it contains more Web related string utility functions. Examples
20: are functions that return a <I>date string</I>, a <I>Message ID string</I>
21: etc.
22: <P>
23: This module is implemented by <A HREF="HTWWWStr.c">HTWWWStr.c</A>, and it
24: is a part of the <A HREF="http://www.w3.org/pub/WWW/Library/"> W3C Reference
25: Library</A>.
2.1 frystyk 26: <PRE>
27: #ifndef HTWWWSTR_H
28: #define HTWWWSTR_H
2.5 frystyk 29:
30: #include "HTUser.h"
2.7 frystyk 31: #include "HTAtom.h"
2.1 frystyk 32: </PRE>
2.5 frystyk 33: <H2>
34: Next word or quoted string
35: </H2>
36: <P>
37: This function returns a RFC822 word separated by space, comma, or semi-colons.
38: <CODE>pstr</CODE> points to a string containing a word separated by white
39: white space "," ";" or "=". The word can optionally be quoted using
40: <"> or "<" ">" Comments surrrounded by '(' ')' are filtered out. On exit,
41: <CODE>pstr</CODE> has been moved to the first delimiter past the field THE
42: STRING HAS BEEN MUTILATED by a 0 terminator. The function returns a pointer
43: to the first word or NULL on error
2.1 frystyk 44: <PRE>
45: extern char * HTNextField (char** pstr);
46: </PRE>
2.5 frystyk 47: <H2>
2.8 ! frystyk 48: Next S-expression
! 49: </H2>
! 50: <P>
! 51: Find the next s-expression token from a string of characters. We return the
! 52: <CODE>name</CODE> of this expression and the <CODE>param</CODE> points to
! 53: the parameters. Note, that the string has been mutilated by a 0 terminator!
! 54: <PRE>
! 55: extern char * HTNextSExp (char ** exp, char ** param);
! 56: </PRE>
! 57: <H2>
2.5 frystyk 58: Reading CRLF
59: </H2>
60: <P>
61: The Library provides a default set of read routines that can handle the most
62: common situations. However, before we start we make following definition
63: is to make life easier when having a state machine looking for a
64: <CODE><CRLF></CODE> sequence.
65: <PRE>
66: typedef enum _HTEOLState {
67: EOL_ERR = -1,
68: EOL_BEGIN = 0,
69: EOL_FCR,
70: EOL_FLF,
71: EOL_DOT,
72: EOL_SCR,
2.6 eric 73: EOL_SLF,
74: /* intermediate states */
75: EOL_END,
76: EOL_FOLD,
77: EOL_LINE
2.5 frystyk 78: } HTEOLState;
79: </PRE>
80: <H2>
81: RFC1123 Date/Time Stamp String
82: </H2>
83: <P>
2.1 frystyk 84: Returns a pointer to a static area!
85: <PRE>
2.2 frystyk 86: extern const char *HTDateTimeStr (time_t *calendar, BOOL local);
2.1 frystyk 87: </PRE>
2.5 frystyk 88: <H2>
89: Date used for directory listings
90: </H2>
2.1 frystyk 91: <PRE>
92: extern BOOL HTDateDirStr (time_t * time, char * str, int len);
93: </PRE>
2.5 frystyk 94: <H2>
95: Parse a Date/Time String
96: </H2>
97: <P>
98: Converts a string representation in GMT to a local representation of localtime
99: <CODE>time_t</CODE>. The local time zone is taken from the
100: <A HREF="HTUser.html">user profile</A> information.
101: <PRE>
102: extern time_t HTParseTime (const char * str, HTUserProfile * up);
103: </PRE>
104: <H2>
105: Unique Message-ID String
106: </H2>
107: <P>
108: The message ID string can for example be use as a RFC 822 header. The content
109: is based on the information taken from the <A HREF="HTUser.html">user
110: profile</A> which can be supplied by the applciation.
111: <PRE>extern const char * HTMessageIdStr (HTUserProfile * up);
112: </PRE>
113: <H2>
2.7 frystyk 114: Matching MIME Content-Types
115: </H2>
116: <P>
117: Matches MIME constructions for <I>content-types</I> and others like them,
118: for example "text/html", "text/plain". It can also match wild cards like
119: "text/<star>" and "<star>/<star>. We use <star> instead of * in order note
120: to make C like comments :-)
121: <PRE>
122: extern BOOL HTMIMEMatch (HTAtom * tmplate, HTAtom * actual);
123: </PRE>
124: <H2>
2.5 frystyk 125: Converts an Integer to a String using Prefix
126: </H2>
127: <P>
128: In computer-world 1K is 1024 bytes and 1M is 1024K -- however, sprintf()
129: still formats in base-10. Therefore I output only until 999, and then start
130: using the next unit. This doesn't work wrong, it's just a feature. The conversion
131: is done in "str" which must be large enough to contain the result.
2.1 frystyk 132: <PRE>
133: extern void HTNumToStr (unsigned long n, char *str, int len);
134: </PRE>
2.5 frystyk 135: <H2>
136: Conversion between URLs and Local File Names
137: </H2>
138: <P>
139: These are two functions that separate the URL naming syntax from platform
140: dependent file naming schemes. If you are porting the code to a new platform,
141: you probably have to do some translation here.
142: <H3>
143: Convert file URLs into a local representation
144: </H3>
145: <P>
146: The URL has already been translated through the rules in get_physical in
147: HTAccess.c and all we need to do now is to map the path to a local
148: representation, for example if must translate '/' to the ones that turn the
149: wrong way ;-) Returns local file (that must be freed by caller) if OK, else
150: NULL.
151: <PRE>
152: extern char * HTWWWToLocal (const char * url, const char * base,
153: HTUserProfile * up);
154: </PRE>
155: <H3>
156: Convert a local file name into a URL
157: </H3>
158: <P>
159: Generates a WWW URL name from a local file name or NULL if error. Returns
160: URL (that must be freed by caller) if OK, else NULL.
2.1 frystyk 161: <PRE>
2.2 frystyk 162: extern char * HTLocalToWWW (const char * local);
2.1 frystyk 163: </PRE>
164: <PRE>
165: #endif
166: </PRE>
2.5 frystyk 167: <P>
168: <HR>
2.4 frystyk 169: <ADDRESS>
2.8 ! frystyk 170: @(#) $Id: HTWWWStr.html,v 2.7 1996/08/08 02:17:07 frystyk Exp $
2.4 frystyk 171: </ADDRESS>
2.5 frystyk 172: </BODY></HTML>
Webmaster