Annotation of libwww/Library/src/HTWWWStr.html, revision 2.7

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>
                     48:   Reading CRLF
                     49: </H2>
                     50: <P>
                     51: The Library provides a default set of read routines that can handle the most
                     52: common situations. However, before we start we make following definition
                     53: is to make life easier when having a state machine looking for a
                     54: <CODE>&lt;CRLF&gt;</CODE> sequence.
                     55: <PRE>
                     56: typedef enum _HTEOLState {
                     57:     EOL_ERR = -1,
                     58:     EOL_BEGIN = 0,
                     59:     EOL_FCR,
                     60:     EOL_FLF,
                     61:     EOL_DOT,
                     62:     EOL_SCR,
2.6       eric       63:     EOL_SLF,
                     64:     /* intermediate states */
                     65:     EOL_END,
                     66:     EOL_FOLD,
                     67:     EOL_LINE
2.5       frystyk    68: } HTEOLState;
                     69: </PRE>
                     70: <H2>
                     71:   RFC1123 Date/Time Stamp String
                     72: </H2>
                     73: <P>
2.1       frystyk    74: Returns a pointer to a static area!
                     75: <PRE>
2.2       frystyk    76: extern const char *HTDateTimeStr (time_t *calendar, BOOL local);
2.1       frystyk    77: </PRE>
2.5       frystyk    78: <H2>
                     79:   Date used for directory listings
                     80: </H2>
2.1       frystyk    81: <PRE>
                     82: extern BOOL HTDateDirStr (time_t * time, char * str, int len);
                     83: </PRE>
2.5       frystyk    84: <H2>
                     85:   Parse a Date/Time String
                     86: </H2>
                     87: <P>
                     88: Converts a string representation in GMT to a local representation of localtime
                     89: <CODE>time_t</CODE>. The local time zone is taken from the
                     90: <A HREF="HTUser.html">user profile</A> information.
                     91: <PRE>
                     92: extern time_t HTParseTime (const char * str, HTUserProfile * up);
                     93: </PRE>
                     94: <H2>
                     95:   Unique Message-ID String
                     96: </H2>
                     97: <P>
                     98: The message ID string can for example be use as a RFC 822 header. The content
                     99: is based on the information taken from the <A HREF="HTUser.html">user
                    100: profile</A> which can be supplied by the applciation.
                    101: <PRE>extern const char * HTMessageIdStr (HTUserProfile * up);
                    102: </PRE>
                    103: <H2>
2.7     ! frystyk   104:   Matching MIME Content-Types
        !           105: </H2>
        !           106: <P>
        !           107: Matches MIME constructions for <I>content-types</I> and others like them,
        !           108: for example "text/html", "text/plain". It can also match wild cards like
        !           109: "text/<star>" and "<star>/<star>. We use <star> instead of * in order note
        !           110: to make C like comments :-)
        !           111: <PRE>
        !           112: extern BOOL HTMIMEMatch (HTAtom * tmplate, HTAtom * actual);
        !           113: </PRE>
        !           114: <H2>
2.5       frystyk   115:   Converts an Integer to a String using Prefix
                    116: </H2>
                    117: <P>
                    118: In computer-world 1K is 1024 bytes and 1M is 1024K -- however, sprintf()
                    119: still formats in base-10. Therefore I output only until 999, and then start
                    120: using the next unit. This doesn't work wrong, it's just a feature. The conversion
                    121: is done in "str" which must be large enough to contain the result.
2.1       frystyk   122: <PRE>
                    123: extern void HTNumToStr (unsigned long n, char *str, int len);
                    124: </PRE>
2.5       frystyk   125: <H2>
                    126:   Conversion between URLs and Local File Names
                    127: </H2>
                    128: <P>
                    129: These are two functions that separate the URL naming syntax from platform
                    130: dependent file naming schemes. If you are porting the code to a new platform,
                    131: you probably have to do some translation here.
                    132: <H3>
                    133:   Convert file URLs into a local representation
                    134: </H3>
                    135: <P>
                    136: The URL has already been translated through the rules in get_physical in
                    137: HTAccess.c and all we need to do now is to map the path to a local
                    138: representation, for example if must translate '/' to the ones that turn the
                    139: wrong way ;-) Returns local file (that must be freed by caller) if OK, else
                    140: NULL.
                    141: <PRE>
                    142: extern char * HTWWWToLocal (const char * url, const char * base,
                    143:                            HTUserProfile * up);
                    144: </PRE>
                    145: <H3>
                    146:   Convert a local file name into a URL
                    147: </H3>
                    148: <P>
                    149: Generates a WWW URL name from a local file name or NULL if error. Returns
                    150: URL (that must be freed by caller) if OK, else NULL.
2.1       frystyk   151: <PRE>
2.2       frystyk   152: extern char * HTLocalToWWW (const char * local);
2.1       frystyk   153: </PRE>
                    154: <PRE>
                    155: #endif
                    156: </PRE>
2.5       frystyk   157: <P>
                    158:   <HR>
2.4       frystyk   159: <ADDRESS>
2.7     ! frystyk   160:   @(#) $Id: HTWWWStr.html,v 2.6 1996/06/03 19:25:30 eric Exp $
2.4       frystyk   161: </ADDRESS>
2.5       frystyk   162: </BODY></HTML>

Webmaster