sync with OpenBSD: remove unused code and vars; name clash with libc
compiles under MirBSD
This commit is contained in:
28
var.c
28
var.c
@ -1,8 +1,8 @@
|
||||
/* $OpenBSD: var.c,v 1.27 2005/10/08 18:02:59 otto Exp $ */
|
||||
/* $OpenBSD: var.c,v 1.28 2005/12/11 20:31:21 otto Exp $ */
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.12 2005/11/22 18:40:44 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.13 2006/01/29 20:04:54 tg Exp $");
|
||||
|
||||
/*
|
||||
* Variables
|
||||
@ -45,8 +45,8 @@ newblock(void)
|
||||
l->argv = e->loc->argv;
|
||||
}
|
||||
l->exit = l->error = NULL;
|
||||
tinit(&l->vars, &l->area, 0);
|
||||
tinit(&l->funs, &l->area, 0);
|
||||
ktinit(&l->vars, &l->area, 0);
|
||||
ktinit(&l->funs, &l->area, 0);
|
||||
l->next = e->loc;
|
||||
e->loc = l;
|
||||
}
|
||||
@ -99,9 +99,9 @@ initvar(void)
|
||||
int i;
|
||||
struct tbl *tp;
|
||||
|
||||
tinit(&specials, APERM, 32); /* must be 2^n (currently 17 specials) */
|
||||
ktinit(&specials, APERM, 32); /* must be 2^n (currently 17 specials) */
|
||||
for (i = 0; names[i].name; i++) {
|
||||
tp = tenter(&specials, names[i].name, hash(names[i].name));
|
||||
tp = ktenter(&specials, names[i].name, hash(names[i].name));
|
||||
tp->flag = DEFINED|ISSET;
|
||||
tp->type = names[i].v;
|
||||
}
|
||||
@ -201,7 +201,7 @@ global(const char *n)
|
||||
return vp;
|
||||
}
|
||||
for (l = e->loc; ; l = l->next) {
|
||||
vp = tsearch(&l->vars, n, h);
|
||||
vp = ktsearch(&l->vars, n, h);
|
||||
if (vp != NULL) {
|
||||
if (array)
|
||||
return arraysearch(vp, val);
|
||||
@ -211,7 +211,7 @@ global(const char *n)
|
||||
if (l->next == NULL)
|
||||
break;
|
||||
}
|
||||
vp = tenter(&l->vars, n, h);
|
||||
vp = ktenter(&l->vars, n, h);
|
||||
if (array)
|
||||
vp = arraysearch(vp, val);
|
||||
vp->flag |= DEFINED;
|
||||
@ -242,12 +242,12 @@ local(const char *n, bool copy)
|
||||
vp->areap = ATEMP;
|
||||
return vp;
|
||||
}
|
||||
vp = tenter(&l->vars, n, h);
|
||||
vp = ktenter(&l->vars, n, h);
|
||||
if (copy && !(vp->flag & DEFINED)) {
|
||||
struct block *ll = l;
|
||||
struct tbl *vq = NULL;
|
||||
|
||||
while ((ll = ll->next) && !(vq = tsearch(&ll->vars, n, h)))
|
||||
while ((ll = ll->next) && !(vq = ktsearch(&ll->vars, n, h)))
|
||||
;
|
||||
if (vq) {
|
||||
vp->flag |= vq->flag &
|
||||
@ -826,7 +826,7 @@ makenv(void)
|
||||
|
||||
/* unexport any redefined instances */
|
||||
for (l2 = l->next; l2 != NULL; l2 = l2->next) {
|
||||
vp2 = tsearch(&l2->vars, vp->name, h);
|
||||
vp2 = ktsearch(&l2->vars, vp->name, h);
|
||||
if (vp2 != NULL)
|
||||
vp2->flag &= ~EXPORT;
|
||||
}
|
||||
@ -872,7 +872,7 @@ special(const char *name)
|
||||
{
|
||||
struct tbl *tp;
|
||||
|
||||
tp = tsearch(&specials, name, hash(name));
|
||||
tp = ktsearch(&specials, name, hash(name));
|
||||
return tp && (tp->flag & ISSET) ? tp->type : V_NONE;
|
||||
}
|
||||
|
||||
@ -882,9 +882,9 @@ unspecial(const char *name)
|
||||
{
|
||||
struct tbl *tp;
|
||||
|
||||
tp = tsearch(&specials, name, hash(name));
|
||||
tp = ktsearch(&specials, name, hash(name));
|
||||
if (tp)
|
||||
tdelete(tp);
|
||||
ktdelete(tp);
|
||||
}
|
||||
|
||||
static time_t seconds; /* time SECONDS last set */
|
||||
|
Reference in New Issue
Block a user