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