1: /* $Header$ */ 2: 3: /* 4: * Author: Peter J. Nicklin 5: */ 6: 7: /* 8: * pbgetstring() loads the string identified by id into string. Returns 9: * string or null character if id not found. 10: */ 11: #include "pdbuf.h" 12: 13: extern char *CURPBUF; /* current database buffer */ 14: 15: char * 16: pbgetstring(id, string) 17: register char *id; /* string identifier */ 18: char *string; /* string argument */ 19: { 20: register char *bp; /* buffer pointer */ 21: char *pbcpyfield(); /* copy non-key field */ 22: 23: #ifdef OPTIMIZE 24: for (bp = CURPBUF; *bp != '\0'; bp++) 25: if (*bp == _PBFS) 26: if (bp[1] == id[0] && bp[2] == id[1] && bp[3] == '=') 27: { 28: bp += 4; 29: break; 30: } 31: #else 32: char *pbskipfield(); /* skip to next non-key field */ 33: 34: bp = CURPBUF; 35: while (*(bp = pbskipfield(bp)) != '\0') 36: if (bp[0] == id[0] && bp[1] == id[1] && bp[2] == '=') 37: { 38: bp += 3; 39: break; 40: } 41: #endif 42: return(pbcpyfield(string, bp)); 43: }