1: /* $Header$ */
   2: 
   3: /*
   4:  * Author: Peter J. Nicklin
   5:  */
   6: 
   7: /*
   8:  * pbaddflag() adds a flag to the tail of the buffer. The buffer is not
   9:  * changed if flag already exists. Returns integer NO if buffer space
  10:  * exceeded, otherwise YES.
  11:  */
  12: #include "pdbuf.h"
  13: #include "yesno.h"
  14: 
  15: extern char *CURPBUF;           /* current database buffer */
  16: 
  17: pbaddflag(flag)
  18:     register char *flag;        /* flag string */
  19: {
  20:     register char *bp;      /* buffer pointer */
  21:     char *pbskipfield();        /* skip to next non-key field */
  22:     char *strcpy();         /* string copy */
  23:     int pbstretch();        /* stretch buffer */
  24: 
  25:     bp = CURPBUF;
  26:     while (*(bp = pbskipfield(bp)) != '\0')
  27:         if (bp[0] == flag[0] && bp[1] == flag[1] &&
  28:             (bp[2] == _PBFS || bp[2] == '\0'))
  29:             return(YES);    /* flag already exists */
  30:     if (bp == CURPBUF)
  31:         {
  32:         *bp++ = _PBFS;      /* prepare virgin buffer */
  33:         *bp = '\0';
  34:         }
  35:     if (pbstretch(bp, 3) == NO)
  36:         return(NO);
  37:     bp[0] = flag[0];        /* add flag */
  38:     bp[1] = flag[1];
  39:     bp[2] = _PBFS;          /* add field separator */
  40:     return(YES);
  41: }

Defined functions

pbaddflag defined in line 17; used 3 times
Last modified: 1985-07-03
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 667
Valid CSS Valid XHTML 1.0 Strict