Annotation of libwww/Library/src/HTLocal.html, revision 2.5

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"
                     27: </PRE>
2.2       frystyk    28: <H2>
                     29:   Mode of File
                     30: </H2>
                     31: <P>
                     32: A file can be opened in variuos modes dependent on whether it is to be opened
                     33: for reading or writing or both. We here define a set that is largely equivalent
                     34: to what we know from ANSI C file modes and Unix file modes:
2.1       frystyk    35: <PRE>
                     36: #ifndef NO_UNIX_IO
                     37: typedef int HTLocalMode;
                     38: 
                     39: #define HT_FB_RDONLY   O_RDONLY
                     40: #define HT_FT_RDONLY   HT_FB_RDONLY
                     41: 
                     42: #define HT_FB_WRONLY   O_WRONLY|O_CREAT
                     43: #define HT_FT_WRONLY   HT_FB_WRONLY
                     44: 
                     45: #define HT_FB_RDWR     O_RDWR
                     46: #define HT_FT_RDWR     HT_FB_RDWR
                     47: 
                     48: #define HT_FB_APPEND   O_APPEND
                     49: #define HT_FT_APPEND   HT_FB_APPEND
                     50: 
                     51: #else 
                     52: typedef const char HTLocalMode[10];
                     53: 
                     54: #define HT_FB_RDONLY   "rb"
                     55: #define HT_FT_RDONLY   "r"
                     56: 
                     57: #define HT_FB_WRONLY   "wb"
                     58: #define HT_FT_WRONLY   "w"
                     59: 
                     60: #define HT_FB_RDWR     "r+b"
                     61: #define HT_FT_RDWR     "r+"
                     62: 
                     63: #define HT_FB_APPEND   "ab"
                     64: #define HT_FT_APPEND   "a"
                     65: 
                     66: #endif
                     67: </PRE>
2.2       frystyk    68: <H2>
                     69:   Open a Local File
                     70: </H2>
                     71: <P>
                     72: Opens a local file using whatever means are available on the current platform.
                     73: If we have unix file descriptors then use that as we can use select on them.
                     74: On windows we want to use asynchrounous handles - just like we handle the
                     75: socket interface as well. On other platforms, we use ANSI C file descriptors.
2.1       frystyk    76: <PRE>
                     77: extern int HTFileOpen (HTNet * net, char * local, HTLocalMode mode);
                     78: </PRE>
2.2       frystyk    79: <H2>
                     80:   Close a Local File
                     81: </H2>
                     82: <P>
                     83: Closes a file descriptor whatever means are available on the current platform.
                     84: If we have unix file descriptors then use this otherwise use the ANSI C file
                     85: descriptors
2.1       frystyk    86: <PRE>
2.3       frystyk    87: extern int HTFileClose (HTNet * net);
2.1       frystyk    88: </PRE>
                     89: <PRE>
                     90: #endif   /* HTLOCAL_H */
                     91: </PRE>
2.2       frystyk    92: <P>
                     93:   <HR>
2.1       frystyk    94: <ADDRESS>
2.5     ! frystyk    95:   @(#) $Id: HTLocal.html,v 2.4 1997/02/16 18:42:30 frystyk Exp $
2.1       frystyk    96: </ADDRESS>
2.2       frystyk    97: </BODY></HTML>

Webmaster