Annotation of libwww/Library/src/HTLocal.html, revision 2.7
2.1 frystyk 1: <HTML>
2: <HEAD>
2.2 frystyk 3: <!-- Changed by: Henrik Frystyk Nielsen, 3-Apr-1996 -->
2.4 frystyk 4: <TITLE>W3C Sample Code Library libwww Local File Access</TITLE>
2.1 frystyk 5: </HEAD>
6: <BODY>
2.2 frystyk 7: <H1>
8: Local File Access
9: </H1>
2.1 frystyk 10: <PRE>
11: /*
12: ** (c) COPYRIGHT MIT 1995.
13: ** Please first read the full copyright statement in the file COPYRIGH.
14: */
15: </PRE>
2.2 frystyk 16: <P>
17: This module has the common code for opening and closing local files.
18: <P>
19: This module is implemented by <A HREF="HTTCP.c">HTTCP.c</A>, and it is a
2.5 frystyk 20: part of the <A HREF="http://www.w3.org/Library/"> W3C Sample Code
2.2 frystyk 21: Library</A>.
2.1 frystyk 22: <PRE>
23: #ifndef HTLOCAL_H
24: #define HTLOCAL_H
25:
26: #include "HTNet.h"
2.7 ! vbancrof 27:
! 28: #ifdef __cplusplus
! 29: extern "C" {
! 30: #endif
2.1 frystyk 31: </PRE>
2.2 frystyk 32: <H2>
33: Mode of File
34: </H2>
35: <P>
36: A file can be opened in variuos modes dependent on whether it is to be opened
37: for reading or writing or both. We here define a set that is largely equivalent
38: to what we know from ANSI C file modes and Unix file modes:
2.1 frystyk 39: <PRE>
40: #ifndef NO_UNIX_IO
41: typedef int HTLocalMode;
42:
43: #define HT_FB_RDONLY O_RDONLY
44: #define HT_FT_RDONLY HT_FB_RDONLY
45:
46: #define HT_FB_WRONLY O_WRONLY|O_CREAT
47: #define HT_FT_WRONLY HT_FB_WRONLY
48:
49: #define HT_FB_RDWR O_RDWR
50: #define HT_FT_RDWR HT_FB_RDWR
51:
52: #define HT_FB_APPEND O_APPEND
53: #define HT_FT_APPEND HT_FB_APPEND
54:
55: #else
2.6 kahan 56: typedef const char *HTLocalMode;
2.1 frystyk 57:
58: #define HT_FB_RDONLY "rb"
59: #define HT_FT_RDONLY "r"
60:
61: #define HT_FB_WRONLY "wb"
62: #define HT_FT_WRONLY "w"
63:
64: #define HT_FB_RDWR "r+b"
65: #define HT_FT_RDWR "r+"
66:
67: #define HT_FB_APPEND "ab"
68: #define HT_FT_APPEND "a"
69:
70: #endif
71: </PRE>
2.2 frystyk 72: <H2>
73: Open a Local File
74: </H2>
75: <P>
76: Opens a local file using whatever means are available on the current platform.
77: If we have unix file descriptors then use that as we can use select on them.
78: On windows we want to use asynchrounous handles - just like we handle the
79: socket interface as well. On other platforms, we use ANSI C file descriptors.
2.1 frystyk 80: <PRE>
81: extern int HTFileOpen (HTNet * net, char * local, HTLocalMode mode);
82: </PRE>
2.2 frystyk 83: <H2>
84: Close a Local File
85: </H2>
86: <P>
87: Closes a file descriptor whatever means are available on the current platform.
88: If we have unix file descriptors then use this otherwise use the ANSI C file
89: descriptors
2.1 frystyk 90: <PRE>
2.3 frystyk 91: extern int HTFileClose (HTNet * net);
2.1 frystyk 92: </PRE>
93: <PRE>
2.7 ! vbancrof 94: #ifdef __cplusplus
! 95: }
! 96: #endif
! 97:
2.1 frystyk 98: #endif /* HTLOCAL_H */
99: </PRE>
2.2 frystyk 100: <P>
101: <HR>
2.1 frystyk 102: <ADDRESS>
2.7 ! vbancrof 103: @(#) $Id: HTLocal.html,v 2.6 2000/02/29 14:32:15 kahan Exp $
2.1 frystyk 104: </ADDRESS>
2.2 frystyk 105: </BODY></HTML>
Webmaster