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