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