home *** CD-ROM | disk | FTP | other *** search
/ Collection of Internet / Collection of Internet.iso / msdos / lynx / source / www / library / implemen / htfile.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-25  |  4.7 KB  |  202 lines

  1. /*                                                                      File access in libwww
  2.                                        FILE ACCESS
  3.                                              
  4.    These are routines for local file access used by WWW browsers and servers. Implemented
  5.    by HTFile.c.
  6.    
  7.    If the file is not a local file, then we pass it on to HTFTP in case it can be reached
  8.    by FTP.
  9.    
  10.  */
  11. #ifndef HTFILE_H
  12. #define HTFILE_H
  13.  
  14. #include "HTFormat.h"
  15. #include "HTAccess.h"
  16. #include "HTML.h"               /* SCW */
  17.  
  18.  
  19. /*
  20.  
  21. Controlling globals
  22.  
  23.    These flags control how directories and files are represented as hypertext, and are
  24.    typically set by the application from command line options, etc.
  25.    
  26.  */
  27. extern int HTDirAccess;         /* Directory access level */
  28.  
  29. #define HT_DIR_FORBID           0       /* Altogether forbidden */
  30. #define HT_DIR_SELECTIVE        1       /* If HT_DIR_ENABLE_FILE exists */
  31. #define HT_DIR_OK               2       /* Any accesible directory */
  32.  
  33. #define HT_DIR_ENABLE_FILE      ".www_browsable" /* If exists, can browse */
  34.  
  35. extern int HTDirReadme;         /* Include readme files in listing? */
  36.                                         /* Values: */
  37. #define HT_DIR_README_NONE      0       /* No */
  38. #define HT_DIR_README_TOP       1       /* Yes, first */
  39. #define HT_DIR_README_BOTTOM    2       /* Yes, at the end */
  40.  
  41. #define HT_DIR_README_FILE              "README"
  42.  
  43.  
  44. /*
  45.  
  46. Convert filenames between local and WWW formats
  47.  
  48.  */
  49. extern char * HTLocalName PARAMS((CONST char * name));
  50.  
  51.  
  52. /*
  53.  
  54. Make a WWW name from a full local path name
  55.  
  56.  */
  57. extern char * WWW_nameOfFile PARAMS((const char * name));
  58.  
  59.  
  60. /*
  61.  
  62. Generate the name of a cache file
  63.  
  64.  */
  65. extern char * HTCacheFileName PARAMS((CONST char * name));
  66.  
  67.  
  68. /*
  69.  
  70. Output directory titles
  71.  
  72.    This is (like the next one) used by HTFTP. It is common code to generate the title and
  73.    heading 1 and the parent directory link for any anchor.
  74.    
  75.  */
  76. extern void HTDirTitles PARAMS((
  77.         HTStructured *  target,
  78.         HTAnchor *      anchor));
  79.  
  80. /*
  81.  
  82. Output a directory entry
  83.  
  84.    This is used by HTFTP.c for example -- it is a common routine for generating a linked
  85.    directory entry.
  86.    
  87.  */
  88. extern void HTDirEntry PARAMS((
  89.         HTStructured *  target,         /* in which to put the linked text */
  90.         CONST char *    tail,           /* last part of directory name */
  91.         CONST char *    entry));        /* name of this entry */
  92.  
  93. /*
  94.  
  95. HTSetSuffix: Define the representation for a file suffix
  96.  
  97.    This defines a mapping between local file suffixes and file content types and
  98.    encodings.
  99.    
  100.   ON ENTRY,
  101.   
  102.   suffix                  includes the "." if that is important (normally, yes!)
  103.                          
  104.   representation          is MIME-style content-type
  105.                          
  106.   encoding                is MIME-style content-transfer-encoding (8bit, 7bit, etc)
  107.                          
  108.   quality                 an a priori judgement of the quality of such files (0.0..1.0)
  109.                          
  110.  */
  111. /* Example:   HTSetSuffix(".ps", "application/postscript", "8bit", 1.0);
  112. **
  113. */
  114.  
  115. extern void HTSetSuffix PARAMS((
  116.         CONST char *    suffix,
  117.         CONST char *    representation,
  118.         CONST char *    encoding,
  119.         float           quality));
  120.         
  121.  
  122. /*
  123.  
  124. HTFileFormat: Get Representation and Encoding from file name
  125.  
  126.   ON EXIT,
  127.   
  128.   return                  The represntation it imagines the file is in
  129.                          
  130.   *pEncoding              The encoding (binary, 7bit, etc). See HTSetSuffix .
  131.                          
  132.  */
  133. extern HTFormat HTFileFormat PARAMS((
  134.                 CONST char *    filename,
  135.                 HTAtom **       pEncoding));
  136.  
  137.  
  138. /*
  139.  
  140. Determine file value from file name
  141.  
  142.  */
  143.  
  144.  
  145. extern float HTFileValue PARAMS((
  146.                 CONST char * filename));
  147.  
  148.  
  149. /*
  150.  
  151. Determine write access to a file
  152.  
  153.   ON EXIT,
  154.   
  155.   return value            YES if file can be accessed and can be written to.
  156.                          
  157.  */
  158.  
  159. /*
  160.  
  161.   BUGS
  162.   
  163.    Isn't there a quicker way?
  164.    
  165.  */
  166.  
  167.  
  168. extern BOOL HTEditable PARAMS((CONST char * filename));
  169.  
  170.  
  171. /*
  172.  
  173. Determine a suitable suffix, given the representation
  174.  
  175.   ON ENTRY,
  176.   
  177.   rep                     is the atomized MIME style representation
  178.                          
  179.   ON EXIT,
  180.   
  181.   returns                 a pointer to a suitable suffix string if one has been found,
  182.                          else NULL.
  183.                          
  184.  */
  185. extern CONST char * HTFileSuffix PARAMS((
  186.                 HTAtom* rep));
  187.  
  188.  
  189.  
  190. /*
  191.  
  192. The Protocols
  193.  
  194.  */
  195. GLOBALREF HTProtocol HTFTP, HTFile;
  196.  
  197. #endif /* HTFILE_H */
  198.  
  199. /*
  200.  
  201.    end of HTFile */
  202.