1: /* $Header$ */
   2: 
   3: /*
   4:  * Author: Peter J. Nicklin
   5:  */
   6: 
   7: /*
   8:  * pfndent() loads a database entry corresponding to key into the current
   9:  * working buffer CURPBUF. Database must be open for reading only.
  10:  * Returns integer YES if key found, otherwise NO.
  11:  */
  12: #include <stdio.h>
  13: #include "null.h"
  14: #include "path.h"
  15: #include "pdb.h"
  16: #include "yesno.h"
  17: 
  18: pfndent(key, pdbp)
  19:     char *key;          /* key string */
  20:     PDB *pdbp;          /* database stream */
  21: {
  22:     char *pbfndkey();       /* find key */
  23:     char *sprintf();        /* print output to string */
  24:     int pgetent();          /* load next entry into buffer */
  25:     void rewindpdb();       /* rewind database */
  26: 
  27:     if ((pdbp->flag&_PERR) != 0)
  28:         return(NO);
  29:     if ((pdbp->flag&(_PWRITE|_PAPPEND)) != 0)
  30:         {
  31:         sprintf(pdbp->perr, "%s must be read access only", pdbp->path);
  32:         pdbp->flag |= _PERR;
  33:         return(NO);
  34:         }
  35:     rewindpdb(pdbp);
  36:     while (pgetent(pdbp) != EOF)
  37:         if (pbfndkey(key) != NULL)
  38:             return(YES);
  39:     return(NO);
  40: }

Defined functions

pfndent defined in line 18; never used
Last modified: 1985-07-03
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 668
Valid CSS Valid XHTML 1.0 Strict