Index: tc.const.c =================================================================== RCS file: /p/tcsh/cvsroot/tcsh/tc.const.c,v retrieving revision 3.101 diff -u -p -u -r3.101 tc.const.c --- tc.const.c 8 Dec 2013 22:53:09 -0000 3.101 +++ tc.const.c 11 Oct 2014 21:51:05 -0000 @@ -85,6 +85,7 @@ Char STRVENDOR[] = { 'V', 'E', 'N', 'D', Char STRMACHTYPE[] = { 'M', 'A', 'C', 'H', 'T', 'Y', 'P', 'E', '\0' }; Char STROSTYPE[] = { 'O', 'S', 'T', 'Y', 'P', 'E', '\0' }; Char STRedit[] = { 'e', 'd', 'i', 't', '\0' }; +Char STReditors[] = { 'e', 'd', 'i', 't', 'o', 'r', 's', '\0' }; Char STRaddsuffix[] = { 'a', 'd', 'd', 's', 'u', 'f', 'f', 'i', 'x', '\0' }; Char STRcsubstnonl[] = { 'c', 's', 'u', 'b', 's', 't', 'n', 'o', 'n', 'l', Index: tc.func.c =================================================================== RCS file: /p/tcsh/cvsroot/tcsh/tc.func.c,v retrieving revision 3.152 diff -u -p -u -r3.152 tc.func.c --- tc.func.c 18 Jul 2014 19:30:14 -0000 3.152 +++ tc.func.c 11 Oct 2014 21:51:07 -0000 @@ -486,6 +486,19 @@ dowhich(Char **v, struct command *c) setcopy(STRstatus, STR1, VAR_READWRITE); } +static int +findvv(Char **vv, const char *cp) +{ + for (; vv && *vv; vv++) { + size_t i; + for (i = 0; (*vv)[i] && (*vv)[i] == cp[i]; i++) + continue; + if ((*vv)[i] == '\0' && cp[i] == '\0') + return 1; + } + return 0; +} + /* PWP: a hack to start up your stopped editor on a single keystroke */ /* jbs - fixed hack so it worked :-) 3/28/89 */ @@ -497,6 +510,8 @@ find_stop_ed(void) char *cp, *p; size_t epl, vpl; int pstatus; + struct varent *varp; + Char **vv; if ((ep = getenv("EDITOR")) != NULL) { /* if we have a value */ if ((p = strrchr(ep, '/')) != NULL) /* if it has a path */ @@ -520,6 +535,11 @@ find_stop_ed(void) if (pcurrent == NULL) /* see if we have any jobs */ return NULL; /* nope */ + if ((varp = adrof(STReditors)) != NULL) + vv = varp->vec; + else + vv = NULL; + retp = NULL; for (pp = proclist.p_next; pp; pp = pp->p_next) if (pp->p_procid == pp->p_jobid) { @@ -547,7 +567,7 @@ find_stop_ed(void) /* if we find either in the current name, fg it */ if (strncmp(ep, cp, epl) == 0 || - strncmp(vp, cp, vpl) == 0) { + strncmp(vp, cp, vpl) == 0 || findvv(vv, cp)) { /* * If there is a choice, then choose the current process if