1: /* $Header$ */
   2: 
   3: /*
   4:  * Author: Peter J. Nicklin
   5:  */
   6: 
   7: /*
   8:  * pbchgkey() substitutes newkey for oldkey. Returns integer NO if buffer
   9:  * space exceeded, otherwise YES.
  10:  */
  11: #include "null.h"
  12: #include "pdbuf.h"
  13: #include "yesno.h"
  14: 
  15: pbchgkey(oldkey, newkey)
  16:     char *oldkey;           /* old key string */
  17:     char *newkey;           /* new key string */
  18: {
  19:     register char *bp;      /* buffer pointer */
  20:     char *pbfndkey();       /* find key */
  21:     char *strncpy();        /* copy n characters */
  22:     int chgklen;            /* incremental key string length */
  23:     int newklen;            /* new key string length */
  24:     int pbstretch();        /* stretch buffer */
  25:     int strlen();           /* string length */
  26: 
  27:     if ((bp = pbfndkey(newkey)) != NULL)
  28:         pbrmkey(oldkey);
  29:     else if ((bp = pbfndkey(oldkey)) != NULL)
  30:         {
  31:         newklen = strlen(newkey);
  32:         chgklen = newklen - strlen(oldkey);
  33:         if (pbstretch(bp, chgklen) == NO)
  34:             return(NO);
  35:         strncpy(bp, newkey, newklen);
  36:         }
  37:     return(YES);
  38: }

Defined functions

pbchgkey defined in line 15; used 2 times
Last modified: 1985-07-03
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 619
Valid CSS Valid XHTML 1.0 Strict