Annotation of libwww/Library/src/HTFile.html, revision 2.15

2.7       timbl       1: <HTML>
                      2: <HEAD>
2.6       timbl       3: <TITLE>File access in libwww</TITLE>
2.7       timbl       4: <NEXTID N="z4">
                      5: </HEAD>
2.3       timbl       6: <BODY>
2.6       timbl       7: <H1>File Access</H1>These are routines for local file
                      8: access used by WWW browsers and servers.
2.15    ! frystyk     9: Implemented by <A HREF="HTFile.c">HTFile.c</A>. This module is a part of the
        !            10: <A HREF="Overview.html">CERN Common WWW Library</A>.<P>
        !            11: 
2.6       timbl      12: If the file is not a local file,
                     13: then we pass it on to <A
2.7       timbl      14: NAME="z3" HREF="HTFTP.html">HTFTP</A> in case
2.15    ! frystyk    15: it can be reached by FTP. However, as this is very time consuming when
        !            16: requesting a local file that actually doesn't exist, this redirection will
        !            17: be disabled in the next major release, <EM>www-bug@info.cern.ch</EM>
        !            18: June 1994.<P>
        !            19: 
        !            20: <B>Note:</B> All functions that deal with directory listings etc. have been
        !            21: moved to <A HREF="HTDirBrw.html">HTDirBrw Module</A>.
        !            22: 
        !            23: 
        !            24: 
        !            25: <PRE>
        !            26: #ifndef HTFILE_H
2.1       timbl      27: #define HTFILE_H
                     28: 
                     29: #include "HTFormat.h"
                     30: #include "HTAccess.h"
2.3       timbl      31: #include "HTML.h"              /* SCW */
2.14      frystyk    32: #include "HTDirBrw.h"
2.3       timbl      33: 
2.12      luotonen   34: #ifdef SHORT_NAMES
                     35: #define HTGetCoD       HTGetContentDescription
                     36: #define HTSplFiN       HTSplitFilename
                     37: #endif /*SHORT_NAMES*/
2.3       timbl      38: </PRE>
2.12      luotonen   39: <H2>Multiformat Handling</H2>
                     40: 
                     41: <H3>Split Filename to suffixes</H3>
                     42: <PRE>
                     43: PUBLIC int HTSplitFilename PARAMS((char *      s_str,
                     44:                                   char **      s_arr));
                     45: 
                     46: </PRE>
                     47: 
                     48: <H3>Get Content Description According to Suffixes</H3>
                     49: <PRE>
                     50: PUBLIC HTContentDescription * HTGetContentDescription PARAMS((char ** actual,
                     51:                                                              int         n));
                     52: 
                     53: #define MULTI_SUFFIX ".multi"   /* Extension for scanning formats */
                     54: #define MAX_SUFF 15            /* Maximum number of suffixes for a file */
2.10      luotonen   55: 
                     56: </PRE>
                     57: 
                     58: <H2>Convert filenames between local and WWW formats</H2>
2.3       timbl      59: <PRE>extern char * HTLocalName PARAMS((CONST char * name));
2.1       timbl      60: 
                     61: 
2.3       timbl      62: </PRE>
                     63: <H2>Make a WWW name from a full local
                     64: path name</H2>
                     65: <PRE>extern char * WWW_nameOfFile PARAMS((const char * name));
2.1       timbl      66: 
                     67: 
2.3       timbl      68: </PRE>
                     69: <H2>Generate the name of a cache file</H2>
                     70: <PRE>extern char * HTCacheFileName PARAMS((CONST char * name));
                     71: </PRE>
2.4       timbl      72: 
2.6       timbl      73: <H2><A
2.7       timbl      74: NAME="z1">HTSetSuffix: Define the representation
2.6       timbl      75: for a file suffix</A></H2>This defines a mapping between local
                     76: file suffixes and file content types
                     77: and encodings.
                     78: <H3>On entry,</H3>
                     79: <DL>
                     80: <DT>suffix
                     81: <DD> includes the "." if that is
                     82: important (normally, yes!)
                     83: <DT>representation
                     84: <DD> is MIME-style content-type
                     85: <DT>encoding
                     86: <DD> is MIME-style <A
2.7       timbl      87: NAME="z0" HREF="../../Protocols/rfc1341/5_Content-Transfer-Encoding.html#z0">content-transfer-encoding</A>
2.6       timbl      88: (8bit, 7bit, etc)
2.8       luotonen   89: <DT>language
                     90: <DD>is MIME-style content-language
2.6       timbl      91: <DT>quality
                     92: <DD> an a priori judgement of
                     93: the quality of such files (0.0..1.0)
                     94: </DL>
                     95: 
2.8       luotonen   96: <PRE>
                     97: /*
                     98: ** Example:  HTSetSuffix(".ps", "application/postscript", "8bit", NULL, 1.0);
2.1       timbl      99: */
                    100: 
2.8       luotonen  101: PUBLIC void HTSetSuffix PARAMS((CONST char *   suffix,
                    102:                               CONST char *     representation,
                    103:                               CONST char *     encoding,
                    104:                               CONST char *     language,
                    105:                               float            quality));
                    106: 
                    107: PUBLIC void HTAddType PARAMS((CONST char *     suffix,
                    108:                              CONST char *      representation,
                    109:                              CONST char *      encoding,
                    110:                              float             quality));
                    111: 
                    112: PUBLIC void HTAddEncoding PARAMS((CONST char * suffix,
                    113:                                  CONST char *  encoding,
                    114:                                  float         quality));
                    115: 
                    116: PUBLIC void HTAddLanguage PARAMS((CONST char * suffix,
                    117:                                  CONST char *  language,
                    118:                                  float         quality));
                    119: 
2.1       timbl     120: 
2.3       timbl     121: </PRE>
2.6       timbl     122: <H2>HTFileFormat: Get Representation
                    123: and Encoding from file name</H2>
                    124: <H3>On exit,</H3>
                    125: <DL>
                    126: <DT>return
2.7       timbl     127: <DD> The represntation it imagines
2.6       timbl     128: the file is in
                    129: <DT>*pEncoding
2.7       timbl     130: <DD> The encoding (binary,
                    131: 7bit, etc). See <A
                    132: NAME="z2" HREF="#z1">HTSetSuffix</A> .
2.11      luotonen  133: <DT>*pLanguage
                    134: <DD> The language.
2.6       timbl     135: </DL>
2.3       timbl     136: 
2.6       timbl     137: <PRE>extern HTFormat HTFileFormat PARAMS((
                    138:                CONST char *    filename,
2.11      luotonen  139:                HTAtom **       pEncoding,
                    140:                HTAtom **       pLanguage));
2.3       timbl     141: 
                    142: 
                    143: </PRE>
2.6       timbl     144: <H2>Determine file value from file name</H2>
2.3       timbl     145: <PRE>
                    146: 
                    147: extern float HTFileValue PARAMS((
                    148:                CONST char * filename));
2.1       timbl     149: 
                    150: 
2.3       timbl     151: </PRE>
                    152: <H2>Determine write access to a file</H2>
                    153: <H3>On exit,</H3>
                    154: <DL>
                    155: <DT>return value
                    156: <DD> YES if file can be accessed
                    157: and can be written to.
                    158: </DL>
2.1       timbl     159: 
2.3       timbl     160: <PRE>
                    161: </PRE>
                    162: <H3>Bugs</H3>Isn't there a quicker way?
                    163: <PRE>
2.1       timbl     164: 
2.3       timbl     165: extern BOOL HTEditable PARAMS((CONST char * filename));
2.1       timbl     166: 
                    167: 
2.3       timbl     168: </PRE>
                    169: <H2>Determine a suitable suffix, given
                    170: the representation</H2>
                    171: <H3>On entry,</H3>
                    172: <DL>
                    173: <DT>rep
                    174: <DD> is the atomized MIME style representation
                    175: </DL>
                    176: 
                    177: <H3>On exit,</H3>
                    178: <DL>
                    179: <DT>returns
                    180: <DD> a pointer to a suitable suffix
                    181: string if one has been found, else
                    182: NULL.
                    183: </DL>
2.1       timbl     184: 
2.3       timbl     185: <PRE>extern CONST char * HTFileSuffix PARAMS((
                    186:                HTAtom* rep)); 
2.1       timbl     187: 
                    188: 
                    189: 
2.3       timbl     190: </PRE>
                    191: <H2>The Protocols</H2>
2.7       timbl     192: <PRE>GLOBALREF HTProtocol HTFTP, HTFile;
2.1       timbl     193: 
                    194: #endif /* HTFILE_H */
2.3       timbl     195: 
2.7       timbl     196: </PRE>end of HTFile</A></BODY>
                    197: </HTML>

Webmaster