I'm slowly trimming down some of the -Wshadow warnings in bin and one big
offender is ksh. Namely, it has a local variable e that shadows a global e.
-struct env *e;
+struct env *genv;
Normally I rename the local, but in this case I think the global deserves a
better name. Note that this variable is also used as part of a macro ATEMP.
Accidentally using this macro with a local of the same in scope would be
ungood.
Index: c_ksh.c
===================================================================
RCS file: /cvs/src/bin/ksh/c_ksh.c,v
retrieving revision 1.47
diff -u -p -r1.47 c_ksh.c
--- c_ksh.c 14 Dec 2015 13:59:42 -0000 1.47
+++ c_ksh.c 29 Dec 2015 14:58:28 -0000
@@ -710,7 +710,7 @@ c_typeset(char **wp)
/* list variables and attributes */
flag = fset | fclr; /* no difference at this point.. */
if (func) {
- for (l = e->loc; l; l = l->next) {
+ for (l = genv->loc; l; l = l->next) {
for (p = ktsort(&l->funs); (vp = *p++); ) {
if (flag && (vp->flag & flag) == 0)
continue;
@@ -723,7 +723,7 @@ c_typeset(char **wp)
}
}
} else {
- for (l = e->loc; l; l = l->next) {
+ for (l = genv->loc; l; l = l->next) {
for (p = ktsort(&l->vars); (vp = *p++); ) {
struct tbl *tvp;
int any_set = 0;
@@ -1271,15 +1271,15 @@ c_getopts(char **wp)
return 1;
}
- if (e->loc->next == NULL) {
+ if (genv->loc->next == NULL) {
internal_errorf(0, "c_getopts: no argv");
return 1;
}
/* Which arguments are we parsing... */
if (*wp == NULL)
- wp = e->loc->next->argv;
+ wp = genv->loc->next->argv;
else
- *--wp = e->loc->next->argv[0];
+ *--wp = genv->loc->next->argv[0];
/* Check that our saved state won't cause a core dump... */
for (argc = 0; wp[argc]; argc++)
Index: c_sh.c
===================================================================
RCS file: /cvs/src/bin/ksh/c_sh.c,v
retrieving revision 1.57
diff -u -p -r1.57 c_sh.c
--- c_sh.c 14 Dec 2015 13:59:42 -0000 1.57
+++ c_sh.c 29 Dec 2015 15:01:42 -0000
@@ -30,7 +30,7 @@ c_label(char **wp)
int
c_shift(char **wp)
{
- struct block *l = e->loc;
+ struct block *l = genv->loc;
int n;
long val;
char *arg;
@@ -208,7 +208,7 @@ c_dot(char **wp)
/* Set positional parameters? */
if (wp[builtin_opt.optind + 1]) {
argv = wp + builtin_opt.optind;
- argv[0] = e->loc->argv[0]; /* preserve $0 */
+ argv[0] = genv->loc->argv[0]; /* preserve $0 */
for (argc = 0; argv[argc + 1]; argc++)
;
} else {
@@ -529,7 +529,7 @@ c_exitreturn(char **wp)
/* need to tell if this is exit or return so trap exit will
* work right (POSIX)
*/
- for (ep = e; ep; ep = ep->oenv)
+ for (ep = genv; ep; ep = ep->oenv)
if (STOP_RETURN(ep->type)) {
how = LRETURN;
break;
@@ -570,7 +570,7 @@ c_brkcont(char **wp)
}
/* Stop at E_NONE, E_PARSE, E_FUNC, or E_INCL */
- for (ep = e; ep && !STOP_BRKCONT(ep->type); ep = ep->oenv)
+ for (ep = genv; ep && !STOP_BRKCONT(ep->type); ep = ep->oenv)
if (ep->type == E_LOOP) {
if (--quit == 0)
break;
@@ -605,7 +605,7 @@ int
c_set(char **wp)
{
int argi, setargs;
- struct block *l = e->loc;
+ struct block *l = genv->loc;
char **owp = wp;
if (wp[1] == NULL) {
@@ -808,20 +808,20 @@ c_exec(char **wp)
int i;
/* make sure redirects stay in place */
- if (e->savefd != NULL) {
+ if (genv->savefd != NULL) {
for (i = 0; i < NUFILE; i++) {
- if (e->savefd[i] > 0)
- close(e->savefd[i]);
+ if (genv->savefd[i] > 0)
+ close(genv->savefd[i]);
/*
* For ksh keep anything > 2 private,
* for sh, let them be (POSIX says what
* happens is unspecified and the bourne shell
* keeps them open).
*/
- if (!Flag(FSH) && i > 2 && e->savefd[i])
+ if (!Flag(FSH) && i > 2 && genv->savefd[i])
fcntl(i, F_SETFD, FD_CLOEXEC);
}
- e->savefd = NULL;
+ genv->savefd = NULL;
}
return 0;
}
Index: edit.c
===================================================================
RCS file: /cvs/src/bin/ksh/edit.c,v
retrieving revision 1.51
diff -u -p -r1.51 edit.c
--- edit.c 14 Dec 2015 13:59:42 -0000 1.51
+++ edit.c 29 Dec 2015 15:01:55 -0000
@@ -454,7 +454,7 @@ x_command_glob(int flags, const char *st
glob_table(pat, &w, &keywords);
glob_table(pat, &w, &aliases);
glob_table(pat, &w, &builtins);
- for (l = e->loc; l; l = l->next)
+ for (l = genv->loc; l; l = l->next)
glob_table(pat, &w, &l->funs);
glob_path(flags, pat, &w, path);
Index: emacs.c
===================================================================
RCS file: /cvs/src/bin/ksh/emacs.c,v
retrieving revision 1.62
diff -u -p -r1.62 emacs.c
--- emacs.c 14 Dec 2015 13:59:42 -0000 1.62
+++ emacs.c 29 Dec 2015 10:41:45 -0000
@@ -1576,6 +1576,8 @@ x_init_emacs(void)
kb_add(x_mv_end, NULL, CTRL('['), '[', 'F', 0); /* end */
kb_add(x_mv_begin, NULL, CTRL('['), 'O', 'H', 0); /* home
*/
kb_add(x_mv_end, NULL, CTRL('['), 'O', 'F', 0); /* end */
+ kb_add(x_mv_begin, NULL, CTRL('['), '[', '1', '~', 0); /*
home */
+ kb_add(x_mv_end, NULL, CTRL('['), '[', '4', '~', 0); /*
end */
/* can't be bound */
kb_add(x_set_arg, NULL, CTRL('['), '0', 0);
Index: eval.c
===================================================================
RCS file: /cvs/src/bin/ksh/eval.c,v
retrieving revision 1.48
diff -u -p -r1.48 eval.c
--- eval.c 14 Dec 2015 13:59:42 -0000 1.48
+++ eval.c 29 Dec 2015 15:02:28 -0000
@@ -733,7 +733,7 @@ varsub(Expand *xp, char *sp, char *word,
n++;
c = n; /* ksh88/ksh93 go for number, not max index */
} else if (c == '*' || c == '@')
- c = e->loc->argc;
+ c = genv->loc->argc;
else {
p = str_val(global(sp));
zero_ok = p != null;
@@ -779,12 +779,12 @@ varsub(Expand *xp, char *sp, char *word,
case '#':
return -1;
}
- if (e->loc->argc == 0) {
+ if (genv->loc->argc == 0) {
xp->str = null;
xp->var = global(sp);
state = c == '@' ? XNULLSUB : XSUB;
} else {
- xp->u.strv = (const char **) e->loc->argv + 1;
+ xp->u.strv = (const char **) genv->loc->argv + 1;
xp->str = *xp->u.strv++;
xp->split = c == '@'; /* $@ */
state = XARG;
Index: exec.c
===================================================================
RCS file: /cvs/src/bin/ksh/exec.c,v
retrieving revision 1.63
diff -u -p -r1.63 exec.c
--- exec.c 14 Dec 2015 13:59:42 -0000 1.63
+++ exec.c 29 Dec 2015 16:06:52 -0000
@@ -101,9 +101,9 @@ execute(struct op *volatile t,
flags &= ~XTIME;
if (t->ioact != NULL || t->type == TPIPE || t->type == TCOPROC) {
- e->savefd = areallocarray(NULL, NUFILE, sizeof(short), ATEMP);
+ genv->savefd = areallocarray(NULL, NUFILE, sizeof(short),
ATEMP);
/* initialize to not redirected */
- memset(e->savefd, 0, NUFILE * sizeof(short));
+ memset(genv->savefd, 0, NUFILE * sizeof(short));
}
/* do redirection, to be restored in quitenv() */
@@ -134,8 +134,8 @@ execute(struct op *volatile t,
case TPIPE:
flags |= XFORK;
flags &= ~XEXEC;
- e->savefd[0] = savefd(0);
- e->savefd[1] = savefd(1);
+ genv->savefd[0] = savefd(0);
+ genv->savefd[1] = savefd(1);
while (t->type == TPIPE) {
openpipe(pv);
(void) ksh_dup2(pv[1], 1, false); /* stdout of curr */
@@ -150,8 +150,8 @@ execute(struct op *volatile t,
flags |= XPIPEI;
t = t->right;
}
- restfd(1, e->savefd[1]); /* stdout of last */
- e->savefd[1] = 0; /* no need to re-restore this */
+ restfd(1, genv->savefd[1]); /* stdout of last */
+ genv->savefd[1] = 0; /* no need to re-restore this */
/* Let exchild() close 0 in parent, after fork, before wait */
i = exchild(t, flags|XPCLOSE, xerrok, 0);
if (!(flags&XBGND) && !(flags&XXCOM))
@@ -174,8 +174,8 @@ execute(struct op *volatile t,
* signal handler
*/
sigprocmask(SIG_BLOCK, &sm_sigchld, &omask);
- e->type = E_ERRH;
- i = sigsetjmp(e->jbuf, 0);
+ genv->type = E_ERRH;
+ i = sigsetjmp(genv->jbuf, 0);
if (i) {
sigprocmask(SIG_SETMASK, &omask, NULL);
quitenv(NULL);
@@ -190,8 +190,8 @@ execute(struct op *volatile t,
coproc_cleanup(true);
/* do this before opening pipes, in case these fail */
- e->savefd[0] = savefd(0);
- e->savefd[1] = savefd(1);
+ genv->savefd[0] = savefd(0);
+ genv->savefd[1] = savefd(1);
openpipe(pv);
if (pv[0] != 0) {
@@ -213,7 +213,7 @@ execute(struct op *volatile t,
++coproc.id;
}
sigprocmask(SIG_SETMASK, &omask, NULL);
- e->type = E_EXEC; /* no more need for error handler */
+ genv->type = E_EXEC; /* no more need for error handler */
/* exchild() closes coproc.* in child after fork,
* will also increment coproc.njobs when the
@@ -272,13 +272,13 @@ execute(struct op *volatile t,
{
volatile bool is_first = true;
ap = (t->vars != NULL) ? eval(t->vars, DOBLANK|DOGLOB|DOTILDE) :
- e->loc->argv + 1;
- e->type = E_LOOP;
+ genv->loc->argv + 1;
+ genv->type = E_LOOP;
while (1) {
- i = sigsetjmp(e->jbuf, 0);
+ i = sigsetjmp(genv->jbuf, 0);
if (!i)
break;
- if ((e->flags&EF_BRKCONT_PASS) ||
+ if ((genv->flags&EF_BRKCONT_PASS) ||
(i != LBREAK && i != LCONTIN)) {
quitenv(NULL);
unwind(i);
@@ -309,12 +309,12 @@ execute(struct op *volatile t,
case TWHILE:
case TUNTIL:
- e->type = E_LOOP;
+ genv->type = E_LOOP;
while (1) {
- i = sigsetjmp(e->jbuf, 0);
+ i = sigsetjmp(genv->jbuf, 0);
if (!i)
break;
- if ((e->flags&EF_BRKCONT_PASS) ||
+ if ((genv->flags&EF_BRKCONT_PASS) ||
(i != LBREAK && i != LCONTIN)) {
quitenv(NULL);
unwind(i);
@@ -583,16 +583,16 @@ comexec(struct op *t, struct tbl *volati
kshname = ap[0];
else
ap[0] = (char *) kshname;
- e->loc->argv = ap;
+ genv->loc->argv = ap;
for (i = 0; *ap++ != NULL; i++)
;
- e->loc->argc = i - 1;
+ genv->loc->argc = i - 1;
/* ksh-style functions handle getopts sanely,
* bourne/posix functions are insane...
*/
if (tp->flag & FKSH) {
- e->loc->flags |= BF_DOGETOPTS;
- e->loc->getopts_state = user_opt;
+ genv->loc->flags |= BF_DOGETOPTS;
+ genv->loc->getopts_state = user_opt;
getopts_reset(1);
}
@@ -602,8 +602,8 @@ comexec(struct op *t, struct tbl *volati
old_inuse = tp->flag & FINUSE;
tp->flag |= FINUSE;
- e->type = E_FUNC;
- i = sigsetjmp(e->jbuf, 0);
+ genv->type = E_FUNC;
+ i = sigsetjmp(genv->jbuf, 0);
if (i == 0) {
/* seems odd to pass XERROK here, but at&t ksh does */
exstat = execute(tp->val.t, flags & XERROK, xerrok);
@@ -733,7 +733,7 @@ findfunc(const char *name, unsigned int
struct block *l;
struct tbl *tp = NULL;
- for (l = e->loc; l; l = l->next) {
+ for (l = genv->loc; l; l = l->next) {
tp = ktsearch(&l->funs, name, h);
if (tp)
break;
@@ -1123,10 +1123,10 @@ iosetup(struct ioword *iop, struct tbl *
return -1;
}
/* Do not save if it has already been redirected (i.e. "cat >x >y"). */
- if (e->savefd[iop->unit] == 0) {
+ if (genv->savefd[iop->unit] == 0) {
/* If these are the same, it means unit was previously closed */
if (u == iop->unit)
- e->savefd[iop->unit] = -1;
+ genv->savefd[iop->unit] = -1;
else
/* c_exec() assumes e->savefd[fd] set for any
* redirections. Ask savefd() not to close iop->unit;
@@ -1134,7 +1134,7 @@ iosetup(struct ioword *iop, struct tbl *
* is 2; also means we can't lose the fd (eg, both
* dup2 below and dup2 in restfd() failing).
*/
- e->savefd[iop->unit] = savefd(iop->unit);
+ genv->savefd[iop->unit] = savefd(iop->unit);
}
if (do_close)
@@ -1188,7 +1188,7 @@ herein(const char *content, int sub)
/* Create temp file to hold content (done before newenv so temp
* doesn't get removed too soon).
*/
- h = maketemp(ATEMP, TT_HEREDOC_EXP, &e->temps);
+ h = maketemp(ATEMP, TT_HEREDOC_EXP, &genv->temps);
if (!(shf = h->shf) || (fd = open(h->name, O_RDONLY, 0)) < 0) {
warningf(true, "can't %s temporary file %s: %s",
!shf ? "create" : "open",
@@ -1200,7 +1200,7 @@ herein(const char *content, int sub)
osource = source;
newenv(E_ERRH);
- i = sigsetjmp(e->jbuf, 0);
+ i = sigsetjmp(genv->jbuf, 0);
if (i) {
source = osource;
quitenv(shf);
Index: expr.c
===================================================================
RCS file: /cvs/src/bin/ksh/expr.c,v
retrieving revision 1.31
diff -u -p -r1.31 expr.c
--- expr.c 19 Oct 2015 14:42:16 -0000 1.31
+++ expr.c 29 Dec 2015 16:07:06 -0000
@@ -180,7 +180,7 @@ v_evaluate(struct tbl *vp, const char *e
curstate.val = NULL;
newenv(E_ERRH);
- i = sigsetjmp(e->jbuf, 0);
+ i = sigsetjmp(genv->jbuf, 0);
if (i) {
/* Clear EXPRINEVAL in of any variables we were playing with */
if (curstate.evaling)
Index: history.c
===================================================================
RCS file: /cvs/src/bin/ksh/history.c,v
retrieving revision 1.55
diff -u -p -r1.55 history.c
--- history.c 14 Dec 2015 13:59:42 -0000 1.55
+++ history.c 29 Dec 2015 16:07:21 -0000
@@ -209,7 +209,7 @@ c_fc(char **wp)
/* Run editor on selected lines, then run resulting commands */
- tf = maketemp(ATEMP, TT_HIST_EDIT, &e->temps);
+ tf = maketemp(ATEMP, TT_HIST_EDIT, &genv->temps);
if (!(shf = tf->shf)) {
bi_errorf("cannot create temp file %s - %s",
tf->name, strerror(errno));
Index: jobs.c
===================================================================
RCS file: /cvs/src/bin/ksh/jobs.c,v
retrieving revision 1.53
diff -u -p -r1.53 jobs.c
--- jobs.c 14 Dec 2015 13:59:42 -0000 1.53
+++ jobs.c 29 Dec 2015 16:07:46 -0000
@@ -1293,7 +1293,7 @@ check_job(Job *j)
struct env *ep;
int fd = 2;
- for (ep = e; ep; ep = ep->oenv)
+ for (ep = genv; ep; ep = ep->oenv)
if (ep->savefd && ep->savefd[2])
fd = ep->savefd[2];
shf_reopen(fd, SHF_WR, shl_j);
Index: lex.c
===================================================================
RCS file: /cvs/src/bin/ksh/lex.c,v
retrieving revision 1.66
diff -u -p -r1.66 lex.c
--- lex.c 14 Dec 2015 13:59:42 -0000 1.66
+++ lex.c 29 Dec 2015 16:07:56 -0000
@@ -1201,7 +1201,7 @@ set_prompt(int to, Source *s)
ps1 = str_save(str_val(global("PS1")), ATEMP);
saved_atemp = ATEMP; /* ps1 is freed by substitute() */
newenv(E_ERRH);
- if (sigsetjmp(e->jbuf, 0)) {
+ if (sigsetjmp(genv->jbuf, 0)) {
prompt = safe_prompt;
/* Don't print an error - assume it has already
* been printed. Reason is we may have forked
Index: main.c
===================================================================
RCS file: /cvs/src/bin/ksh/main.c,v
retrieving revision 1.75
diff -u -p -r1.75 main.c
--- main.c 14 Dec 2015 13:59:42 -0000 1.75
+++ main.c 29 Dec 2015 16:09:26 -0000
@@ -38,7 +38,7 @@ const char *safe_prompt;
Area aperm;
-struct env *e;
+struct env *genv;
char shell_flags[FNFLAGS];
@@ -168,7 +168,7 @@ main(int argc, char *argv[])
memset(&env, 0, sizeof(env));
env.type = E_NONE;
ainit(&env.area);
- e = &env;
+ genv = &env;
newblock(); /* set up global l->vars and l->funs */
/* Do this first so output routines (eg, errorf, shellf) can work */
@@ -384,7 +384,7 @@ main(int argc, char *argv[])
x_init();
#endif
- l = e->loc;
+ l = genv->loc;
l->argv = make_argv(argc - (argi - 1), &argv[argi - 1]);
l->argc = argc - argi;
getopts_reset(1);
@@ -478,19 +478,19 @@ include(const char *name, int argc, char
return -1;
if (argv) {
- old_argv = e->loc->argv;
- old_argc = e->loc->argc;
+ old_argv = genv->loc->argv;
+ old_argc = genv->loc->argc;
} else {
old_argv = NULL;
old_argc = 0;
}
newenv(E_INCL);
- i = sigsetjmp(e->jbuf, 0);
+ i = sigsetjmp(genv->jbuf, 0);
if (i) {
quitenv(s ? s->u.shf : NULL);
if (old_argv) {
- e->loc->argv = old_argv;
- e->loc->argc = old_argc;
+ genv->loc->argv = old_argv;
+ genv->loc->argc = old_argc;
}
switch (i) {
case LRETURN:
@@ -514,8 +514,8 @@ include(const char *name, int argc, char
}
}
if (argv) {
- e->loc->argv = argv;
- e->loc->argc = argc;
+ genv->loc->argv = argv;
+ genv->loc->argc = argc;
}
s = pushs(SFILE, ATEMP);
s->u.shf = shf;
@@ -523,8 +523,8 @@ include(const char *name, int argc, char
i = shell(s, false);
quitenv(s->u.shf);
if (old_argv) {
- e->loc->argv = old_argv;
- e->loc->argc = old_argc;
+ genv->loc->argv = old_argv;
+ genv->loc->argc = old_argc;
}
return i & 0xff; /* & 0xff to ensure value not -1 */
}
@@ -560,7 +560,7 @@ shell(Source *volatile s, volatile int t
newenv(E_PARSE);
if (interactive)
really_exit = 0;
- i = sigsetjmp(e->jbuf, 0);
+ i = sigsetjmp(genv->jbuf, 0);
if (i) {
switch (i) {
case LINTR: /* we get here if SIGINT not caught or ignored */
@@ -671,18 +671,18 @@ unwind(int i)
i = LLEAVE;
}
while (1) {
- switch (e->type) {
+ switch (genv->type) {
case E_PARSE:
case E_FUNC:
case E_INCL:
case E_LOOP:
case E_ERRH:
- siglongjmp(e->jbuf, i);
+ siglongjmp(genv->jbuf, i);
/* NOTREACHED */
case E_NONE:
if (i == LINTR)
- e->flags |= EF_FAKE_SIGDIE;
+ genv->flags |= EF_FAKE_SIGDIE;
/* FALLTHROUGH */
default:
@@ -707,17 +707,17 @@ newenv(int type)
ep->type = type;
ep->flags = 0;
ainit(&ep->area);
- ep->loc = e->loc;
+ ep->loc = genv->loc;
ep->savefd = NULL;
- ep->oenv = e;
+ ep->oenv = genv;
ep->temps = NULL;
- e = ep;
+ genv = ep;
}
void
quitenv(struct shf *shf)
{
- struct env *ep = e;
+ struct env *ep = genv;
int fd;
if (ep->oenv && ep->oenv->loc != ep->loc)
@@ -764,7 +764,7 @@ quitenv(struct shf *shf)
shf_close(shf);
reclaim();
- e = e->oenv;
+ genv = genv->oenv;
afree(ep, ATEMP);
}
@@ -781,7 +781,7 @@ cleanup_parents_env(void)
*/
/* close all file descriptors hiding in savefd */
- for (ep = e; ep; ep = ep->oenv) {
+ for (ep = genv; ep; ep = ep->oenv) {
if (ep->savefd) {
for (fd = 0; fd < NUFILE; fd++)
if (ep->savefd[fd] > 0)
@@ -790,7 +790,7 @@ cleanup_parents_env(void)
ep->savefd = NULL;
}
}
- e->oenv = NULL;
+ genv->oenv = NULL;
}
/* Called just before an execve cleanup stuff temporary files */
@@ -799,7 +799,7 @@ cleanup_proc_env(void)
{
struct env *ep;
- for (ep = e; ep; ep = ep->oenv)
+ for (ep = genv; ep; ep = ep->oenv)
remove_temps(ep->temps);
}
@@ -807,9 +807,9 @@ cleanup_proc_env(void)
static void
reclaim(void)
{
- remove_temps(e->temps);
- e->temps = NULL;
- afreeall(&e->area);
+ remove_temps(genv->temps);
+ genv->temps = NULL;
+ afreeall(&genv->area);
}
static void
Index: sh.h
===================================================================
RCS file: /cvs/src/bin/ksh/sh.h,v
retrieving revision 1.55
diff -u -p -r1.55 sh.h
--- sh.h 14 Dec 2015 13:59:42 -0000 1.55
+++ sh.h 29 Dec 2015 14:57:16 -0000
@@ -53,7 +53,7 @@ typedef struct Area {
extern Area aperm; /* permanent object space */
#define APERM &aperm
-#define ATEMP &e->area
+#define ATEMP &genv->area
#ifdef KSH_DEBUG
# define kshdebug_init() kshdebug_init_()
@@ -78,7 +78,7 @@ struct env {
sigjmp_buf jbuf; /* long jump back to env creator */
struct temp *temps; /* temp files */
};
-extern struct env *e;
+extern struct env *genv;
/* struct env.type values */
#define E_NONE 0 /* dummy environment */
Index: syn.c
===================================================================
RCS file: /cvs/src/bin/ksh/syn.c,v
retrieving revision 1.37
diff -u -p -r1.37 syn.c
--- syn.c 1 Nov 2015 15:38:53 -0000 1.37
+++ syn.c 29 Dec 2015 16:09:45 -0000
@@ -555,8 +555,8 @@ function_body(char *name,
reject = true;
}
- old_func_parse = e->flags & EF_FUNC_PARSE;
- e->flags |= EF_FUNC_PARSE;
+ old_func_parse = genv->flags & EF_FUNC_PARSE;
+ genv->flags |= EF_FUNC_PARSE;
if ((t->left = get_command(CONTIN)) == NULL) {
/*
* Probably something like foo() followed by eof or ;.
@@ -576,7 +576,7 @@ function_body(char *name,
t->left->lineno = 1;
}
if (!old_func_parse)
- e->flags &= ~EF_FUNC_PARSE;
+ genv->flags &= ~EF_FUNC_PARSE;
return t;
}
Index: var.c
===================================================================
RCS file: /cvs/src/bin/ksh/var.c,v
retrieving revision 1.54
diff -u -p -r1.54 var.c
--- var.c 14 Dec 2015 13:59:42 -0000 1.54
+++ var.c 29 Dec 2015 16:14:36 -0000
@@ -34,7 +34,7 @@ static struct tbl *arraysearch(struct tb
/*
* create a new block for function calls and simple commands
- * assume caller has allocated and set up e->loc
+ * assume caller has allocated and set up genv->loc
*/
void
newblock(void)
@@ -44,19 +44,19 @@ newblock(void)
l = alloc(sizeof(struct block), ATEMP);
l->flags = 0;
- ainit(&l->area); /* todo: could use e->area (l->area => l->areap) */
- if (!e->loc) {
+ ainit(&l->area); /* todo: could use genv->area (l->area => l->areap) */
+ if (!genv->loc) {
l->argc = 0;
l->argv = (char **) empty;
} else {
- l->argc = e->loc->argc;
- l->argv = e->loc->argv;
+ l->argc = genv->loc->argc;
+ l->argv = genv->loc->argv;
}
l->exit = l->error = NULL;
ktinit(&l->vars, &l->area, 0);
ktinit(&l->funs, &l->area, 0);
- l->next = e->loc;
- e->loc = l;
+ l->next = genv->loc;
+ genv->loc = l;
}
/*
@@ -65,11 +65,11 @@ newblock(void)
void
popblock(void)
{
- struct block *l = e->loc;
+ struct block *l = genv->loc;
struct tbl *vp, **vpp = l->vars.tbls, *vq;
int i;
- e->loc = l->next; /* pop block */
+ genv->loc = l->next; /* pop block */
for (i = l->vars.size; --i >= 0; )
if ((vp = *vpp++) != NULL && (vp->flag&SPECIAL)) {
if ((vq = global(vp->name))->flag & ISSET)
@@ -162,7 +162,7 @@ array_index_calc(const char *n, bool *ar
struct tbl *
global(const char *n)
{
- struct block *l = e->loc;
+ struct block *l = genv->loc;
struct tbl *vp;
long num;
int c;
@@ -219,7 +219,7 @@ global(const char *n)
}
return vp;
}
- for (l = e->loc; ; l = l->next) {
+ for (l = genv->loc; ; l = l->next) {
vp = ktsearch(&l->vars, n, h);
if (vp != NULL) {
if (array)
@@ -245,7 +245,7 @@ global(const char *n)
struct tbl *
local(const char *n, bool copy)
{
- struct block *l = e->loc;
+ struct block *l = genv->loc;
struct tbl *vp;
unsigned int h;
bool array;
@@ -841,7 +841,7 @@ makenv(void)
int i;
XPinit(env, 64);
- for (l = e->loc; l != NULL; l = l->next)
+ for (l = genv->loc; l != NULL; l = l->next)
for (vpp = l->vars.tbls, i = l->vars.size; --i >= 0; )
if ((vp = *vpp++) != NULL &&
(vp->flag&(ISSET|EXPORT)) == (ISSET|EXPORT)) {
Index: vi.c
===================================================================
RCS file: /cvs/src/bin/ksh/vi.c,v
retrieving revision 1.39
diff -u -p -r1.39 vi.c
--- vi.c 22 Dec 2015 08:39:26 -0000 1.39
+++ vi.c 29 Dec 2015 14:52:29 -0000
@@ -1896,7 +1896,7 @@ ed_mov_opt(int col, char *wb)
/* replace word with all expansions (ie, expand word*) */
static int
-expand_word(int command)
+expand_word(int cmd)
{
static struct edstate *buf;
int rval = 0;
@@ -1906,7 +1906,7 @@ expand_word(int command)
int i;
/* Undo previous expansion */
- if (command == 0 && expanded == EXPAND && buf) {
+ if (cmd == 0 && expanded == EXPAND && buf) {
restore_edstate(es, buf);
buf = NULL;
expanded = NONE;
@@ -1950,7 +1950,7 @@ expand_word(int command)
}
static int
-complete_word(int command, int count)
+complete_word(int cmd, int count)
{
static struct edstate *buf;
int rval = 0;
@@ -1963,12 +1963,12 @@ complete_word(int command, int count)
int is_command;
/* Undo previous completion */
- if (command == 0 && expanded == COMPLETE && buf) {
+ if (cmd == 0 && expanded == COMPLETE && buf) {
print_expansions(buf, 0);
expanded = PRINT;
return 0;
}
- if (command == 0 && expanded == PRINT && buf) {
+ if (cmd == 0 && expanded == PRINT && buf) {
restore_edstate(es, buf);
buf = NULL;
expanded = NONE;
@@ -2055,7 +2055,7 @@ complete_word(int command, int count)
}
static int
-print_expansions(struct edstate *e, int command)
+print_expansions(struct edstate *e, int cmd)
{
int nwords;
int start, end;