1: /* $Header$ */
   2: 
   3: /*
   4:  * Author: Peter J. Nicklin
   5:  */
   6: 
   7: /*
   8:  * readpath() loads a PATH struct, given a regular or project pathname.
   9:  * Returns -1 if bad pathname, otherwise 0.
  10:  */
  11: #include <stdio.h>
  12: #include <sys/types.h>
  13: #include <sys/stat.h>
  14: #include "null.h"
  15: #include "path.h"
  16: #include "pdb.h"
  17: #include "pdbuf.h"
  18: #include "pld.h"
  19: #include "spms.h"
  20: #include "yesno.h"
  21: 
  22: extern char *PATHERR;           /* current pathname error condition */
  23: extern char PDBERR[];           /* project database error message */
  24: 
  25: readpath(pathname, pb)
  26:     char *pathname;         /* regular or project pathname */
  27:     PATH *pb;           /* project directory struct buffer */
  28: {
  29:     char *pbgetstring();        /* get specified string field */
  30:     int closepdb();         /* close database */
  31:     int errpdb();           /* print database error message */
  32:     int pfndent();          /* find and load database entry */
  33:     int strlen();           /* string length */
  34:     int xppath();           /* expand project pathname */
  35:     PDB *openpdb();         /* open database */
  36:     PDB *pldp;          /* project link directory stream */
  37: 
  38:     if (xppath(pathname, pb) == -1)
  39:         return(-1);
  40:     switch (pb->p_mode & P_IFMT)
  41:         {
  42:         case P_IFNEW:
  43:         case P_IFREG:
  44:             return(0);
  45:             break;
  46:         case P_IFPDIR:
  47:             if ((pldp = openpdb(PLDNAME, pb->p_project, "r")) == NULL)
  48:                 {
  49:                 PATHERR = PDBERR;
  50:                 return(-1);
  51:                 }
  52:             pfndent(pb->p_alias, pldp);
  53:             break;
  54:         case P_IFHOME:
  55:         case P_IFPROOT:
  56:             if ((pldp = openpdb(PLDNAME, pb->p_project, "r")) == NULL)
  57:                 {
  58:                 PATHERR = PDBERR;
  59:                 return(-1);
  60:                 }
  61:             pfndent(CURPROJECT, pldp);
  62:             break;
  63:         }
  64:     pbgetstring(PDIRTYPE, pb->p_type);
  65:     pb->p_desc = pb->p_type + strlen(pb->p_type) + 1;
  66:     pbgetstring(PDIRDESC, pb->p_desc);
  67:     closepdb(pldp);
  68:     return(0);
  69: }

Defined functions

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