1: /* $Header$ */ 2: 3: /* 4: * Author: Peter J. Nicklin 5: */ 6: 7: /* 8: * readpld() reads next project link directory entry. Returns a pointer 9: * to a PATH struct, or NULL at EOF. 10: */ 11: #include <stdio.h> 12: #include "null.h" 13: #include "path.h" 14: #include "pdb.h" 15: #include "pdbuf.h" 16: #include "pld.h" 17: #include "yesno.h" 18: 19: PATH * 20: readpld(pldp) 21: PDB *pldp; /* database stream */ 22: { 23: static PATH pathbuf; /* project directory struct */ 24: char *optpath(); /* pathname optimization */ 25: char pathname[PATHSIZE]; /* pathname buffer */ 26: char *pathcat(); /* pathname concatenation */ 27: char *pbgetkey(); /* get next key */ 28: char *pbgetstring(); /* get specified string field */ 29: char *strcpy(); /* string copy */ 30: int pbfndflag(); /* find flag field */ 31: int pgetent(); /* load next entry into buffer */ 32: int strlen(); /* string length */ 33: 34: if (pgetent(pldp) == EOF) 35: return(NULL); 36: if (pbfndflag(PROOTDIR) == YES) 37: pathbuf.p_mode = P_IFPROOT; 38: else 39: pathbuf.p_mode = P_IFPDIR; 40: pathbuf.p_alias = pathbuf.p_buf; 41: pbgetkey(pathbuf.p_alias); 42: pathbuf.p_path = pathbuf.p_alias + strlen(pathbuf.p_alias) + 1; 43: pbgetstring(PDIRPATH, pathname); 44: if (*pathname == _RDIRC) 45: strcpy(pathbuf.p_path, pathname); 46: else 47: pathcat(pathbuf.p_path, pldp->root, pathname); 48: optpath(pathbuf.p_path); 49: pathbuf.p_type = pathbuf.p_path + strlen(pathbuf.p_path) + 1; 50: pbgetstring(PDIRTYPE, pathbuf.p_type); 51: pathbuf.p_desc = pathbuf.p_type + strlen(pathbuf.p_type) + 1; 52: pbgetstring(PDIRDESC, pathbuf.p_desc); 53: return(&pathbuf); 54: }