Annotation of libwww/Library/src/HTWWWStr.html, revision 2.6
2.1 frystyk 1: <HTML>
2: <HEAD>
2.5 frystyk 3: <!-- Changed by: Henrik Frystyk Nielsen, 18-May-1996 -->
2.6 ! eric 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.1 frystyk 31: </PRE>
2.5 frystyk 32: <H2>
33: Next word or quoted string
34: </H2>
35: <P>
36: This function returns a RFC822 word separated by space, comma, or semi-colons.
37: <CODE>pstr</CODE> points to a string containing a word separated by white
38: white space "," ";" or "=". The word can optionally be quoted using
39: <"> or "<" ">" Comments surrrounded by '(' ')' are filtered out. On exit,
40: <CODE>pstr</CODE> has been moved to the first delimiter past the field THE
41: STRING HAS BEEN MUTILATED by a 0 terminator. The function returns a pointer
42: to the first word or NULL on error
2.1 frystyk 43: <PRE>
44: extern char * HTNextField (char** pstr);
45: </PRE>
2.5 frystyk 46: <H2>
47: Reading CRLF
48: </H2>
49: <P>
50: The Library provides a default set of read routines that can handle the most
51: common situations. However, before we start we make following definition
52: is to make life easier when having a state machine looking for a
53: <CODE><CRLF></CODE> sequence.
54: <PRE>
55: typedef enum _HTEOLState {
56: EOL_ERR = -1,
57: EOL_BEGIN = 0,
58: EOL_FCR,
59: EOL_FLF,
60: EOL_DOT,
61: EOL_SCR,
2.6 ! eric 62: EOL_SLF,
! 63: /* intermediate states */
! 64: EOL_END,
! 65: EOL_FOLD,
! 66: EOL_LINE
2.5 frystyk 67: } HTEOLState;
68: </PRE>
69: <H2>
70: RFC1123 Date/Time Stamp String
71: </H2>
72: <P>
2.1 frystyk 73: Returns a pointer to a static area!
74: <PRE>
2.2 frystyk 75: extern const char *HTDateTimeStr (time_t *calendar, BOOL local);
2.1 frystyk 76: </PRE>
2.5 frystyk 77: <H2>
78: Date used for directory listings
79: </H2>
2.1 frystyk 80: <PRE>
81: extern BOOL HTDateDirStr (time_t * time, char * str, int len);
82: </PRE>
2.5 frystyk 83: <H2>
84: Parse a Date/Time String
85: </H2>
86: <P>
87: Converts a string representation in GMT to a local representation of localtime
88: <CODE>time_t</CODE>. The local time zone is taken from the
89: <A HREF="HTUser.html">user profile</A> information.
90: <PRE>
91: extern time_t HTParseTime (const char * str, HTUserProfile * up);
92: </PRE>
93: <H2>
94: Unique Message-ID String
95: </H2>
96: <P>
97: The message ID string can for example be use as a RFC 822 header. The content
98: is based on the information taken from the <A HREF="HTUser.html">user
99: profile</A> which can be supplied by the applciation.
100: <PRE>extern const char * HTMessageIdStr (HTUserProfile * up);
101: </PRE>
102: <H2>
103: Converts an Integer to a String using Prefix
104: </H2>
105: <P>
106: In computer-world 1K is 1024 bytes and 1M is 1024K -- however, sprintf()
107: still formats in base-10. Therefore I output only until 999, and then start
108: using the next unit. This doesn't work wrong, it's just a feature. The conversion
109: is done in "str" which must be large enough to contain the result.
2.1 frystyk 110: <PRE>
111: extern void HTNumToStr (unsigned long n, char *str, int len);
112: </PRE>
2.5 frystyk 113: <H2>
114: Conversion between URLs and Local File Names
115: </H2>
116: <P>
117: These are two functions that separate the URL naming syntax from platform
118: dependent file naming schemes. If you are porting the code to a new platform,
119: you probably have to do some translation here.
120: <H3>
121: Convert file URLs into a local representation
122: </H3>
123: <P>
124: The URL has already been translated through the rules in get_physical in
125: HTAccess.c and all we need to do now is to map the path to a local
126: representation, for example if must translate '/' to the ones that turn the
127: wrong way ;-) Returns local file (that must be freed by caller) if OK, else
128: NULL.
129: <PRE>
130: extern char * HTWWWToLocal (const char * url, const char * base,
131: HTUserProfile * up);
132: </PRE>
133: <H3>
134: Convert a local file name into a URL
135: </H3>
136: <P>
137: Generates a WWW URL name from a local file name or NULL if error. Returns
138: URL (that must be freed by caller) if OK, else NULL.
2.1 frystyk 139: <PRE>
2.2 frystyk 140: extern char * HTLocalToWWW (const char * local);
2.1 frystyk 141: </PRE>
142: <PRE>
143: #endif
144: </PRE>
2.5 frystyk 145: <P>
146: <HR>
2.4 frystyk 147: <ADDRESS>
2.6 ! eric 148: @(#) $Id: HTWWWStr.html,v 2.5 1996/05/20 15:07:28 frystyk Exp $
2.4 frystyk 149: </ADDRESS>
2.5 frystyk 150: </BODY></HTML>
Webmaster