Title says it all. It found some other "bugs", but they're harder to
verify (and some of them don't look right at first look).
diff --git a/c_ksh.c b/c_ksh.c
index e653975..1cdf150 100644
--- a/c_ksh.c
+++ b/c_ksh.c
@@ -534,7 +534,7 @@ c_command(char **wp)
int
c_typeset(char **wp)
{
- struct block *l = e->loc;
+ struct block *l;
struct tbl *vp, **p;
Tflag fset = 0, fclr = 0;
int thing = 0, func = 0, local = 0;
diff --git a/emacs.c b/emacs.c
index 3b2d083..17145d5 100644
--- a/emacs.c
+++ b/emacs.c
@@ -1021,7 +1021,6 @@ x_redraw(int limit)
x_displen = xx_cols - 2;
}
xlp_valid = false;
- cp = x_lastcp();
x_zots(xbp);
if (xbp != xbuf || xep > xlp)
limit = xx_cols;
diff --git a/eval.c b/eval.c
index 1918751..303a953 100644
--- a/eval.c
+++ b/eval.c
@@ -709,17 +709,14 @@ varsub(Expand *xp, char *sp, char *word,
/* Check for size of array */
if ((p=strchr(sp,'[')) && (p[1]=='*'||p[1]=='@') && p[2]==']') {
int n = 0;
- int max = 0;
vp = global(arrayname(sp));
if (vp->flag & (ISSET|ARRAY))
zero_ok = 1;
for (; vp; vp = vp->u.array)
- if (vp->flag & ISSET) {
- max = vp->index + 1;
+ if (vp->flag & ISSET)
n++;
- }
- c = n; /* ksh88/ksh93 go for number, not max index */
+ c = n;
} else if (c == '*' || c == '@')
c = e->loc->argc;
else {
diff --git a/io.c b/io.c
index ea2925c..0fb2f41 100644
--- a/io.c
+++ b/io.c
@@ -295,7 +295,7 @@ check_fd(char *name, int mode, const char **emsgp)
if (isdigit(name[0]) && !name[1]) {
fd = name[0] - '0';
- if ((fl = fcntl(fd = name[0] - '0', F_GETFL, 0)) < 0) {
+ if ((fl = fcntl(fd, F_GETFL, 0)) < 0) {
if (emsgp)
*emsgp = "bad file descriptor";
return -1;
diff --git a/var.c b/var.c
index 77d3969..d3a0554 100644
--- a/var.c
+++ b/var.c
@@ -830,7 +830,7 @@ is_wdvarassign(const char *s)
char **
makenv(void)
{
- struct block *l = e->loc;
+ struct block *l;
XPtrV env;
struct tbl *vp, **vpp;
int i;
--
Alexander Polakov | plhk.ru