Annotation of libwww/Library/src/HTFile.html, revision 2.21
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.20 frystyk 42: </PRE>
2.3 timbl 43:
2.12 luotonen 44: <H2>Multiformat Handling</H2>
45:
46: <H3>Split Filename to suffixes</H3>
47: <PRE>
2.16 frystyk 48: extern int HTSplitFilename PARAMS((char * s_str,
2.12 luotonen 49: char ** s_arr));
50: </PRE>
51:
52: <H3>Get Content Description According to Suffixes</H3>
2.18 frystyk 53:
2.12 luotonen 54: <PRE>
2.16 frystyk 55: extern HTContentDescription * HTGetContentDescription PARAMS((char ** actual,
2.12 luotonen 56: int n));
57:
58: #define MULTI_SUFFIX ".multi" /* Extension for scanning formats */
59: #define MAX_SUFF 15 /* Maximum number of suffixes for a file */
2.10 luotonen 60: </PRE>
61:
62: <H2>Convert filenames between local and WWW formats</H2>
2.1 timbl 63:
2.18 frystyk 64: <PRE>
65: extern char * HTLocalName PARAMS((CONST char * name));
2.3 timbl 66: </PRE>
2.1 timbl 67:
2.18 frystyk 68: <H2>Make a WWW name from a full local path name</H2>
2.1 timbl 69:
2.18 frystyk 70: <PRE>
71: extern char * WWW_nameOfFile PARAMS((const char * name));
2.3 timbl 72: </PRE>
2.18 frystyk 73:
2.3 timbl 74: <H2>Generate the name of a cache file</H2>
2.18 frystyk 75:
76: <PRE>
77: extern char * HTCacheFileName PARAMS((CONST char * name));
2.3 timbl 78: </PRE>
2.4 timbl 79:
2.18 frystyk 80: <H2><A NAME="z1">Define the Representation for a File Suffix</A></H2>
81:
82: This defines a mapping between local file suffixes and file content
83: types and encodings.
84:
2.6 timbl 85: <H3>On entry,</H3>
86: <DL>
87: <DT>suffix
88: <DD> includes the "." if that is
89: important (normally, yes!)
90: <DT>representation
91: <DD> is MIME-style content-type
92: <DT>encoding
93: <DD> is MIME-style <A
2.7 timbl 94: NAME="z0" HREF="../../Protocols/rfc1341/5_Content-Transfer-Encoding.html#z0">content-transfer-encoding</A>
2.6 timbl 95: (8bit, 7bit, etc)
2.8 luotonen 96: <DT>language
97: <DD>is MIME-style content-language
2.6 timbl 98: <DT>quality
99: <DD> an a priori judgement of
100: the quality of such files (0.0..1.0)
101: </DL>
102:
2.8 luotonen 103: <PRE>
104: /*
105: ** Example: HTSetSuffix(".ps", "application/postscript", "8bit", NULL, 1.0);
2.1 timbl 106: */
107:
2.16 frystyk 108: extern void HTSetSuffix PARAMS((CONST char * suffix,
2.8 luotonen 109: CONST char * representation,
110: CONST char * encoding,
111: CONST char * language,
2.21 ! frystyk 112: double quality));
2.8 luotonen 113:
2.16 frystyk 114: extern void HTAddType PARAMS((CONST char * suffix,
2.8 luotonen 115: CONST char * representation,
116: CONST char * encoding,
2.21 ! frystyk 117: double quality));
2.8 luotonen 118:
2.16 frystyk 119: extern void HTAddEncoding PARAMS((CONST char * suffix,
2.8 luotonen 120: CONST char * encoding,
2.21 ! frystyk 121: double quality));
2.8 luotonen 122:
2.16 frystyk 123: extern void HTAddLanguage PARAMS((CONST char * suffix,
2.8 luotonen 124: CONST char * language,
2.21 ! frystyk 125: double quality));
2.8 luotonen 126:
2.1 timbl 127:
2.18 frystyk 128: extern void HTFile_deleteSuffixes NOPARAMS;
2.3 timbl 129: </PRE>
2.18 frystyk 130:
131: <H2>Get Representation and Encoding from file name</H2>
132:
2.6 timbl 133: <H3>On exit,</H3>
134: <DL>
135: <DT>return
2.7 timbl 136: <DD> The represntation it imagines
2.6 timbl 137: the file is in
138: <DT>*pEncoding
2.7 timbl 139: <DD> The encoding (binary,
140: 7bit, etc). See <A
141: NAME="z2" HREF="#z1">HTSetSuffix</A> .
2.11 luotonen 142: <DT>*pLanguage
143: <DD> The language.
2.6 timbl 144: </DL>
2.3 timbl 145:
2.6 timbl 146: <PRE>extern HTFormat HTFileFormat PARAMS((
147: CONST char * filename,
2.11 luotonen 148: HTAtom ** pEncoding,
149: HTAtom ** pLanguage));
2.3 timbl 150:
151:
152: </PRE>
2.6 timbl 153: <H2>Determine file value from file name</H2>
2.3 timbl 154: <PRE>
155:
2.21 ! frystyk 156: extern double HTFileValue PARAMS((
2.3 timbl 157: CONST char * filename));
2.1 timbl 158:
159:
2.3 timbl 160: </PRE>
161: <H2>Determine write access to a file</H2>
162: <H3>On exit,</H3>
163: <DL>
164: <DT>return value
165: <DD> YES if file can be accessed
166: and can be written to.
167: </DL>
2.1 timbl 168:
2.3 timbl 169: <PRE>
170: </PRE>
171: <H3>Bugs</H3>Isn't there a quicker way?
172: <PRE>
2.1 timbl 173:
2.3 timbl 174: extern BOOL HTEditable PARAMS((CONST char * filename));
2.1 timbl 175:
176:
2.3 timbl 177: </PRE>
178: <H2>Determine a suitable suffix, given
179: the representation</H2>
180: <H3>On entry,</H3>
181: <DL>
182: <DT>rep
183: <DD> is the atomized MIME style representation
184: </DL>
185:
186: <H3>On exit,</H3>
187: <DL>
188: <DT>returns
189: <DD> a pointer to a suitable suffix
190: string if one has been found, else
191: NULL.
192: </DL>
2.1 timbl 193:
2.3 timbl 194: <PRE>extern CONST char * HTFileSuffix PARAMS((
195: HTAtom* rep));
2.1 timbl 196:
197:
198:
2.3 timbl 199: </PRE>
200: <H2>The Protocols</H2>
2.7 timbl 201: <PRE>GLOBALREF HTProtocol HTFTP, HTFile;
2.1 timbl 202:
203: #endif /* HTFILE_H */
2.3 timbl 204:
2.7 timbl 205: </PRE>end of HTFile</A></BODY>
206: </HTML>
Webmaster