Lines Matching refs:pe

235     struct pelem *pe, *pathend;  in initpaths()  local
248 pe = xmalloc(sizeof(struct pelem)); in initpaths()
249 setzero(pe, sizeof(struct pelem)); in initpaths()
251 pathhead = pathend = pe; in initpaths()
253 pathend->pnext = pe; in initpaths()
254 pathend = pe; in initpaths()
257 pe->pname = p; in initpaths()
258 pe->psuf = ""; in initpaths()
259 pe->pdef = ""; in initpaths()
261 if (strcmp(pe->pname, syspath[i].name) == 0) { in initpaths()
262 pe->psuf = syspath[i].suffix; in initpaths()
263 pe->pdef = syspath[i].defalt; in initpaths()
273 pe->pdir[pe->pdirs] = p; in initpaths()
274 pe->pdirs++; in initpaths()
287 struct pelem *pe; in savepaths() local
289 for (npath = 0, pe = pathhead; pe; npath++, pe = pe->pnext) { in savepaths()
290 len = strlen(pe->pname) + 1; in savepaths()
291 if (pe->pdirs == 0) in savepaths()
293 else for (i = 0; i < pe->pdirs; i++) in savepaths()
294 len += strlen(pe->pdir[i]) + 1; in savepaths()
297 for (q = pe->pname; *p = *q; p++, q++); in savepaths()
299 if (pe->pdirs != 0) { in savepaths()
300 for (i = 0; i < pe->pdirs; i++) { in savepaths()
301 for (q = pe->pdir[i]; *p = *q; p++, q++); in savepaths()
315 struct pelem *pe; in freepaths() local
319 while (pe = pathhead) { in freepaths()
320 if (pe->pname) { in freepaths()
321 for (i = 0; i < pe->pdirs; i++) { in freepaths()
322 if (pe->pdir[i] == NULL) in freepaths()
324 p = pe->pdir[i]; in freepaths()
325 pe->pdir[i] = NULL; in freepaths()
328 pe->pdirs = 0; in freepaths()
329 p = pe->pname; in freepaths()
330 pe->pname = NULL; in freepaths()
333 pathhead = pe->pnext; in freepaths()
334 xfree((ptr_t) pe); in freepaths()
348 struct pelem *pe; in tcsh_rcmd() local
351 for (pe = pathhead; pe; pe = pe->pnext) { in tcsh_rcmd()
357 (void) strcat(new, pe->psuf); in tcsh_rcmd()
359 (void) strcat(new, pe->pdef); in tcsh_rcmd()
360 for (n = 0; n < pe->pdirs; n++) { in tcsh_rcmd()
361 if (pe->pdir[n] == NULL) in tcsh_rcmd()
363 p = pe->pdir[n]; in tcsh_rcmd()
364 pe->pdir[n] = NULL; in tcsh_rcmd()
367 pe->pdirs = 0; in tcsh_rcmd()
374 pe->pdir[pe->pdirs] = p; in tcsh_rcmd()
375 pe->pdirs++; in tcsh_rcmd()
391 struct pelem *pe; in icmd() local
394 for (pe = pathhead; pe; pe = pe->pnext) { in icmd()
400 (void) strcat(new, pe->psuf); in icmd()
402 n = locate(pe, new); in icmd()
404 insert(pe, n, path); in icmd()
406 insert(pe, 0, path); in icmd()
414 struct pelem *pe; in iacmd() local
416 for (pe = pathhead; pe; pe = pe->pnext) { in iacmd()
417 n = locate(pe, inpath); in iacmd()
419 insert(pe, n + 1, path); in iacmd()
422 inpath, pe->pname); in iacmd()
430 struct pelem *pe; in ibcmd() local
432 for (pe = pathhead; pe; pe = pe->pnext) { in ibcmd()
433 n = locate(pe, inpath); in ibcmd()
435 insert(pe, n, path); in ibcmd()
438 inpath, pe->pname); in ibcmd()
445 struct pelem *pe; in incmd() local
447 for (pe = pathhead; pe; pe = pe->pnext) in incmd()
448 insert(pe, n, path); in incmd()
452 insert(struct pelem *pe, int loc, char *key) in insert() argument
461 (void) strcat(new, pe->psuf); in insert()
465 for (i = pe->pdirs; i > loc; --i) in insert()
466 pe->pdir[i] = pe->pdir[i-1]; in insert()
467 if (loc > pe->pdirs) in insert()
468 loc = pe->pdirs; in insert()
469 pe->pdir[loc] = new; in insert()
470 pe->pdirs++; in insert()
481 struct pelem *pe; in dcmd() local
483 for (pe = pathhead; pe; pe = pe->pnext) { in dcmd()
484 n = locate(pe, path); in dcmd()
486 delete(pe, n); in dcmd()
489 path, pe->pname); in dcmd()
496 struct pelem *pe; in dncmd() local
498 for (pe = pathhead; pe; pe = pe->pnext) { in dncmd()
499 if (n < pe->pdirs) in dncmd()
500 delete(pe, n); in dncmd()
504 n, pe->pname); in dncmd()
509 delete(struct pelem *pe, int n) in delete() argument
513 xfree((ptr_t) (pe->pdir[n])); in delete()
514 for (d = n; d < pe->pdirs - 1; d++) in delete()
515 pe->pdir[d] = pe->pdir[d+1]; in delete()
516 --pe->pdirs; in delete()
527 struct pelem *pe; in ccmd() local
529 for (pe = pathhead; pe; pe = pe->pnext) { in ccmd()
530 n = locate(pe, inpath); in ccmd()
532 change(pe, n, path); in ccmd()
535 inpath, pe->pname); in ccmd()
542 struct pelem *pe; in cncmd() local
544 for (pe = pathhead; pe; pe = pe->pnext) { in cncmd()
545 if (n < pe->pdirs) in cncmd()
546 change(pe, n, path); in cncmd()
550 n, pe->pname); in cncmd()
555 change(struct pelem *pe, int loc, char *key) in change() argument
563 (void) strcat(new, pe->psuf); in change()
567 xfree((ptr_t) (pe->pdir[loc])); in change()
568 pe->pdir[loc] = new; in change()
576 locate(struct pelem *pe, char *key) in locate() argument
585 (void) strcat(realkey, pe->psuf); in locate()
588 for (i = 0; i < pe->pdirs; i++) in locate()
589 if (strcmp(pe->pdir[i], realkey) == 0) in locate()
591 return((i < pe->pdirs) ? i : -1); in locate()