about summary refs log tree commit diff stats
path: root/WWW/Library/Implementation/HTAAFile.h
blob: f6f8ac5053ea6f70a65936dd722db6387e2368e7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/*                       FILE ROUTINES FOR ACCESS AUTHORIZATION PACKAGE
                                             
   This module implements the routines used for accessing (and parsing) the files used in
   the access authorization:
   
      password file
      
      group file
      
      access control list (ACL) file
      
 */


#ifndef HTAAFILE_H
#define HTAAFILE_H

#ifndef HTUTILS_H
#include "HTUtils.h"            /* BOOL, PARAMS, ARGS */
#endif /* HTUTILS_H */
/*#include <stdio.h> included by HTUtils.h -- FM *//* FILE */
#include "HTList.h"             /* HTList */

#ifdef SHORT_NAMES
#define HTAAFnRe        HTAAFile_nextRec
#define HTAAFrFi        HTAAFile_readField
#define HTAAFrLi        HTAAFile_readList
#endif /*SHORT_NAMES*/


/* Used field separators */

#define FIELD_SEPARATOR ':'     /* Used to separate fields              */
#define LIST_SEPARATOR  ','     /* Used to separate items in a list     */
                                /* in group and ALC files.              */

/*

Naming conventions

  Record                 is an entire line in file.
                         
  Field                  is an entity separated by colons and/or by end-of-line.
                         
  List                   is a field in which there are items separated by commas.
                         
Record-oriented Read Routines

   Password, group and ACL are internally read in by the following functions:
   
  HTAAFile_nextRec()      skips to the beginning of the next record (must be called even
                         after the last field of a record is read to proceed to the next
                         record).
                         
  HTAAFile_readField()    reads a field (separated by colons).
                         
  HTAAFile_readList()     reads a field containing a comma-separated list of items.
                         
 */

/* PUBLIC                                               HTAAFile_nextRec()
**                      GO TO THE BEGINNING OF THE NEXT RECORD
** ON ENTRY:
**      fp      is the file from which records are read from.
**
** ON EXIT:
**      returns nothing. File read pointer is located at the beginning
**              of the next record.
**
*/
PUBLIC void HTAAFile_nextRec PARAMS((FILE * fp));


/* PUBLIC                                               HTAAFile_readField()
**              READ A FIELD FROM A PASSWORD, GROUP
**              OR ACCESS CONTROL LIST FILE
**              i.e. an item terminated by colon,
**              end-of-line, or end-of-file.
** ON ENTRY:
**      fp              is the file to read the characters from
**      contents        is the character array to put the characters
**      max_len         is the maximum number of characters that may
**                      be read (i.e. the size of dest minus one for
**                      terminating null).
** ON EXIT:
**      returns         the terminating character
**                      (i.e. either separator or CR or LF or EOF).
**      contents        contains a null-terminated string representing
**                      the read field.
** NOTE 1:
**                      Ignores leading and trailing blanks and tabs.
** NOTE 2:
**                      If the field is more than max_len characters
**                      long, the rest of the characters in that item
**                      are ignored.  However, contents is always
**                      null-terminated!
*/
PUBLIC int HTAAFile_readField PARAMS((FILE * fp,
                                      char * contents,
                                      int    max_len));


/* PUBLIC                                               HTAAFile_readList()
**
**                      READ A LIST OF STRINGS SEPARATED BY COMMAS
**                      (FROM A GROUP OR ACCESS CONTROL LIST FILE)
** ON ENTRY:
**      fp              is a pointer to the input file.
**      result          is the list to which append the read items.
**      max_len         is the maximum number of characters in each
**                      list entry (extra characters are ignored).
** ON EXIT:
**      returns         the number of items read.
**
*/
PUBLIC int HTAAFile_readList PARAMS((FILE *     fp,
                                     HTList *   result,
                                     int        max_len));
/*

 */

#endif /* not HTAAFILE_H */
/*

   End of file HTAAFile.h.  */