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