1: /* $Header$ */
   2: 
   3: /*
   4:  * Author: Peter J. Nicklin
   5:  */
   6: 
   7: /*
   8:  * pgetent() loads next database entry into buffer pdbp->pbuf. Also resets
   9:  * buffer pointers and makes pdbp the current working database CURPDB.
  10:  * Returns length of entry or EOF.
  11:  */
  12: #include <stdio.h>
  13: #include "path.h"
  14: #include "pdb.h"
  15: 
  16: char *CURPBUF;              /* current database buffer */
  17: char *FP;               /* next non-key field */
  18: char *KP;               /* next key field */
  19: PDB *CURPDB;                /* current database stream */
  20: 
  21: pgetent(pdbp)
  22:     register PDB *pdbp;     /* database stream */
  23: {
  24:     register char *bp;      /* buffer pointer */
  25:     register int c;         /* next character */
  26: 
  27:     if ((pdbp->flag&_PREAD) == 0 || (pdbp->flag&(_PEOF|_PERR)) != 0)
  28:         return(EOF);
  29:     CURPDB = pdbp;
  30:     CURPBUF = FP = KP = bp = pdbp->pbuf;
  31:     while ((c = getc(pdbp->fp)) != EOF && c != '\n')
  32:         *bp++ = c;
  33:     *bp = '\0';
  34:     if (c == EOF)
  35:         {
  36:         pdbp->flag |= _PEOF;
  37:         return(EOF);
  38:         }
  39:     else
  40:         return(bp - pdbp->pbuf);
  41: }

Defined functions

Defined variables

Last modified: 1985-07-03
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 614
Valid CSS Valid XHTML 1.0 Strict