home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Tools / lynx-2.4 / WWW / Library / Implementation / HTAAFile.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-06-28  |  4.3 KB  |  127 lines

  1. /*                       FILE ROUTINES FOR ACCESS AUTHORIZATION PACKAGE
  2.                                              
  3.    This module implements the routines used for accessing (and parsing) the files used in
  4.    the access authorization:
  5.    
  6.       password file
  7.       
  8.       group file
  9.       
  10.       access control list (ACL) file
  11.       
  12.  */
  13.  
  14.  
  15. #ifndef HTAAFILE_H
  16. #define HTAAFILE_H
  17.  
  18. #ifndef HTUTILS_H
  19. #include "HTUtils.h"            /* BOOL, PARAMS, ARGS */
  20. #endif /* HTUTILS_H */
  21. /*#include <stdio.h> included by HTUtils.h -- FM *//* FILE */
  22. #include "HTList.h"             /* HTList */
  23.  
  24. #ifdef SHORT_NAMES
  25. #define HTAAFnRe        HTAAFile_nextRec
  26. #define HTAAFrFi        HTAAFile_readField
  27. #define HTAAFrLi        HTAAFile_readList
  28. #endif /*SHORT_NAMES*/
  29.  
  30.  
  31. /* Used field separators */
  32.  
  33. #define FIELD_SEPARATOR ':'     /* Used to separate fields              */
  34. #define LIST_SEPARATOR  ','     /* Used to separate items in a list     */
  35.                                 /* in group and ALC files.              */
  36.  
  37. /*
  38.  
  39. Naming conventions
  40.  
  41.   Record                 is an entire line in file.
  42.                          
  43.   Field                  is an entity separated by colons and/or by end-of-line.
  44.                          
  45.   List                   is a field in which there are items separated by commas.
  46.                          
  47. Record-oriented Read Routines
  48.  
  49.    Password, group and ACL are internally read in by the following functions:
  50.    
  51.   HTAAFile_nextRec()      skips to the beginning of the next record (must be called even
  52.                          after the last field of a record is read to proceed to the next
  53.                          record).
  54.                          
  55.   HTAAFile_readField()    reads a field (separated by colons).
  56.                          
  57.   HTAAFile_readList()     reads a field containing a comma-separated list of items.
  58.                          
  59.  */
  60.  
  61. /* PUBLIC                                               HTAAFile_nextRec()
  62. **                      GO TO THE BEGINNING OF THE NEXT RECORD
  63. ** ON ENTRY:
  64. **      fp      is the file from which records are read from.
  65. **
  66. ** ON EXIT:
  67. **      returns nothing. File read pointer is located at the beginning
  68. **              of the next record.
  69. **
  70. */
  71. PUBLIC void HTAAFile_nextRec PARAMS((FILE * fp));
  72.  
  73.  
  74. /* PUBLIC                                               HTAAFile_readField()
  75. **              READ A FIELD FROM A PASSWORD, GROUP
  76. **              OR ACCESS CONTROL LIST FILE
  77. **              i.e. an item terminated by colon,
  78. **              end-of-line, or end-of-file.
  79. ** ON ENTRY:
  80. **      fp              is the file to read the characters from
  81. **      contents        is the character array to put the characters
  82. **      max_len         is the maximum number of characters that may
  83. **                      be read (i.e. the size of dest minus one for
  84. **                      terminating null).
  85. ** ON EXIT:
  86. **      returns         the terminating character
  87. **                      (i.e. either separator or CR or LF or EOF).
  88. **      contents        contains a null-terminated string representing
  89. **                      the read field.
  90. ** NOTE 1:
  91. **                      Ignores leading and trailing blanks and tabs.
  92. ** NOTE 2:
  93. **                      If the field is more than max_len characters
  94. **                      long, the rest of the characters in that item
  95. **                      are ignored.  However, contents is always
  96. **                      null-terminated!
  97. */
  98. PUBLIC int HTAAFile_readField PARAMS((FILE * fp,
  99.                                       char * contents,
  100.                                       int    max_len));
  101.  
  102.  
  103. /* PUBLIC                                               HTAAFile_readList()
  104. **
  105. **                      READ A LIST OF STRINGS SEPARATED BY COMMAS
  106. **                      (FROM A GROUP OR ACCESS CONTROL LIST FILE)
  107. ** ON ENTRY:
  108. **      fp              is a pointer to the input file.
  109. **      result          is the list to which append the read items.
  110. **      max_len         is the maximum number of characters in each
  111. **                      list entry (extra characters are ignored).
  112. ** ON EXIT:
  113. **      returns         the number of items read.
  114. **
  115. */
  116. PUBLIC int HTAAFile_readList PARAMS((FILE *     fp,
  117.                                      HTList *   result,
  118.                                      int        max_len));
  119. /*
  120.  
  121.  */
  122.  
  123. #endif /* not HTAAFILE_H */
  124. /*
  125.  
  126.    End of file HTAAFile.h.  */
  127.