1: /* $Header$ */ 2: 3: /* 4: * Author: Peter J. Nicklin 5: */ 6: 7: /* 8: * chproject() changes the name of the project root directory pathname. 9: * Returns integer YES if successful, otherwise NO. 10: */ 11: #include "null.h" 12: #include "path.h" 13: #include "yesno.h" 14: 15: chproject(ppathname) 16: char *ppathname; /* new project pathname */ 17: { 18: extern char *_PROJECT; /* project root directory pathname */ 19: char *strsav(); /* save a string somewhere */ 20: PATH pathbuf; /* pathname buffer */ 21: 22: if (xppath(ppathname, &pathbuf) == -1) 23: { 24: patherr(ppathname); 25: return(NO); 26: } 27: else { 28: switch (pathbuf.p_mode & P_IFMT) 29: { 30: case P_IFNEW: 31: case P_IFREG: 32: case P_IFPDIR: 33: warn("%s: no such project", ppathname); 34: return(NO); 35: case P_IFHOME: 36: case P_IFPROOT: 37: if (_PROJECT != NULL) 38: free(_PROJECT); 39: if ((_PROJECT = strsav(pathbuf.p_path)) == NULL) 40: { 41: warn("out of memory"); 42: return(NO); 43: } 44: break; 45: } 46: } 47: return(YES); 48: }