summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bin/ksh/c_ksh.c20
-rw-r--r--bin/ksh/edit.c4
-rw-r--r--bin/ksh/eval.c4
-rw-r--r--bin/ksh/exec.c20
-rw-r--r--bin/ksh/lex.c6
-rw-r--r--bin/ksh/main.c10
-rw-r--r--bin/ksh/proto.h16
-rw-r--r--bin/ksh/syn.c6
-rw-r--r--bin/ksh/table.c22
-rw-r--r--bin/ksh/table.h4
-rw-r--r--bin/ksh/var.c26
-rw-r--r--bin/ksh/vi.c4
12 files changed, 71 insertions, 71 deletions
diff --git a/bin/ksh/c_ksh.c b/bin/ksh/c_ksh.c
index 0abd380fd11..8d46460e67f 100644
--- a/bin/ksh/c_ksh.c
+++ b/bin/ksh/c_ksh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: c_ksh.c,v 1.27 2005/03/30 17:16:37 deraadt Exp $ */
+/* $OpenBSD: c_ksh.c,v 1.28 2005/12/11 20:31:21 otto Exp $ */
/*
* built-in Korn commands: c_*
@@ -432,9 +432,9 @@ c_whence(char **wp)
while ((vflag || ret == 0) && (id = *wp++) != NULL) {
tp = NULL;
if ((iam_whence || vflag) && !pflag)
- tp = tsearch(&keywords, id, hash(id));
+ tp = ktsearch(&keywords, id, hash(id));
if (!tp && !pflag) {
- tp = tsearch(&aliases, id, hash(id));
+ tp = ktsearch(&aliases, id, hash(id));
if (tp && !(tp->flag & ISSET))
tp = NULL;
}
@@ -700,7 +700,7 @@ c_typeset(char **wp)
flag = fset | fclr; /* no difference at this point.. */
if (func) {
for (l = e->loc; l; l = l->next) {
- for (p = tsort(&l->funs); (vp = *p++); ) {
+ for (p = ktsort(&l->funs); (vp = *p++); ) {
if (flag && (vp->flag & flag) == 0)
continue;
if (thing == '-')
@@ -713,7 +713,7 @@ c_typeset(char **wp)
}
} else {
for (l = e->loc; l; l = l->next) {
- for (p = tsort(&l->vars); (vp = *p++); ) {
+ for (p = ktsort(&l->vars); (vp = *p++); ) {
struct tbl *tvp;
int any_set = 0;
/*
@@ -882,7 +882,7 @@ c_alias(char **wp)
if (*wp == NULL) {
struct tbl *ap, **p;
- for (p = tsort(t); (ap = *p++) != NULL; )
+ for (p = ktsort(t); (ap = *p++) != NULL; )
if ((ap->flag & (ISSET|xflag)) == (ISSET|xflag)) {
if (pflag)
shf_puts("alias ", shl_stdout);
@@ -906,7 +906,7 @@ c_alias(char **wp)
alias = str_nsave(alias, val++ - alias, ATEMP);
h = hash(alias);
if (val == NULL && !tflag && !xflag) {
- ap = tsearch(t, alias, h);
+ ap = ktsearch(t, alias, h);
if (ap != NULL && (ap->flag&ISSET)) {
if (pflag)
shf_puts("alias ", shl_stdout);
@@ -922,7 +922,7 @@ c_alias(char **wp)
}
continue;
}
- ap = tenter(t, alias, h);
+ ap = ktenter(t, alias, h);
ap->type = tflag ? CTALIAS : CALIAS;
/* Are we setting the value or just some flags? */
if ((val && !tflag) || (!val && tflag && !Uflag)) {
@@ -976,7 +976,7 @@ c_unalias(char **wp)
wp += builtin_opt.optind;
for (; *wp != NULL; wp++) {
- ap = tsearch(t, *wp, hash(*wp));
+ ap = ktsearch(t, *wp, hash(*wp));
if (ap == NULL) {
rv = 1; /* POSIX */
continue;
@@ -991,7 +991,7 @@ c_unalias(char **wp)
if (all) {
struct tstate ts;
- for (twalk(&ts, t); (ap = tnext(&ts)); ) {
+ for (ktwalk(&ts, t); (ap = ktnext(&ts)); ) {
if (ap->flag&ALLOC) {
ap->flag &= ~(ALLOC|ISSET);
afree((void*)ap->val.s, APERM);
diff --git a/bin/ksh/edit.c b/bin/ksh/edit.c
index 5604f01cc7b..2c06c6aeef2 100644
--- a/bin/ksh/edit.c
+++ b/bin/ksh/edit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: edit.c,v 1.30 2005/09/11 18:08:47 otto Exp $ */
+/* $OpenBSD: edit.c,v 1.31 2005/12/11 20:31:21 otto Exp $ */
/*
* Command line editing - common code
@@ -757,7 +757,7 @@ glob_table(const char *pat, XPtrV *wp, struct table *tp)
struct tstate ts;
struct tbl *te;
- for (twalk(&ts, tp); (te = tnext(&ts)); ) {
+ for (ktwalk(&ts, tp); (te = ktnext(&ts)); ) {
if (gmatch(te->name, pat, false))
XPput(*wp, str_save(te->name, ATEMP));
}
diff --git a/bin/ksh/eval.c b/bin/ksh/eval.c
index e30a5ad9546..393363f6dde 100644
--- a/bin/ksh/eval.c
+++ b/bin/ksh/eval.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: eval.c,v 1.27 2005/03/30 17:16:37 deraadt Exp $ */
+/* $OpenBSD: eval.c,v 1.28 2005/12/11 20:31:21 otto Exp $ */
/*
* Expansion - quoting, separation, substitution, globbing
@@ -1232,7 +1232,7 @@ homedir(char *name)
{
struct tbl *ap;
- ap = tenter(&homedirs, name, hash(name));
+ ap = ktenter(&homedirs, name, hash(name));
if (!(ap->flag & ISSET)) {
struct passwd *pw;
diff --git a/bin/ksh/exec.c b/bin/ksh/exec.c
index 9f33d13f291..f96781ce66f 100644
--- a/bin/ksh/exec.c
+++ b/bin/ksh/exec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec.c,v 1.43 2005/12/11 18:53:51 deraadt Exp $ */
+/* $OpenBSD: exec.c,v 1.44 2005/12/11 20:31:21 otto Exp $ */
/*
* execute command tree
@@ -698,7 +698,7 @@ shcomexec(char **wp)
{
struct tbl *tp;
- tp = tsearch(&builtins, *wp, hash(*wp));
+ tp = ktsearch(&builtins, *wp, hash(*wp));
if (tp == NULL)
internal_errorf(1, "shcomexec: %s", *wp);
return call_builtin(tp, wp);
@@ -715,11 +715,11 @@ findfunc(const char *name, unsigned int h, int create)
struct tbl *tp = (struct tbl *) 0;
for (l = e->loc; l; l = l->next) {
- tp = tsearch(&l->funs, name, h);
+ tp = ktsearch(&l->funs, name, h);
if (tp)
break;
if (!l->next && create) {
- tp = tenter(&l->funs, name, h);
+ tp = ktenter(&l->funs, name, h);
tp->flag = DEFINED;
tp->type = CFUNC;
tp->val.t = (struct op *) 0;
@@ -761,7 +761,7 @@ define(const char *name, struct op *t)
}
if (t == NULL) { /* undefine */
- tdelete(tp);
+ ktdelete(tp);
return was_set ? 0 : 1;
}
@@ -794,7 +794,7 @@ builtin(const char *name, int (*func) (char **))
break;
}
- tp = tenter(&builtins, name, hash(name));
+ tp = ktenter(&builtins, name, hash(name));
tp->flag = DEFINED | flag;
tp->type = CSHELL;
tp->val.f = func;
@@ -820,7 +820,7 @@ findcom(const char *name, int flags)
flags &= ~FC_FUNC;
goto Search;
}
- tbi = (flags & FC_BI) ? tsearch(&builtins, name, h) : NULL;
+ tbi = (flags & FC_BI) ? ktsearch(&builtins, name, h) : NULL;
/* POSIX says special builtins first, then functions, then
* POSIX regular builtins, then search path...
*/
@@ -850,7 +850,7 @@ findcom(const char *name, int flags)
if (!tp && (flags & FC_UNREGBI) && tbi)
tp = tbi;
if (!tp && (flags & FC_PATH) && !(flags & FC_DEFPATH)) {
- tp = tsearch(&taliases, name, h);
+ tp = ktsearch(&taliases, name, h);
if (tp && (tp->flag & ISSET) && access(tp->val.s, X_OK) != 0) {
if (tp->flag & ALLOC) {
tp->flag &= ~ALLOC;
@@ -865,7 +865,7 @@ findcom(const char *name, int flags)
(flags & FC_PATH)) {
if (!tp) {
if (insert && !(flags & FC_DEFPATH)) {
- tp = tenter(&taliases, name, h);
+ tp = ktenter(&taliases, name, h);
tp->type = CTALIAS;
} else {
tp = &temp;
@@ -905,7 +905,7 @@ flushcom(int all) /* just relative or all */
struct tbl *tp;
struct tstate ts;
- for (twalk(&ts, &taliases); (tp = tnext(&ts)) != NULL; )
+ for (ktwalk(&ts, &taliases); (tp = ktnext(&ts)) != NULL; )
if ((tp->flag&ISSET) && (all || tp->val.s[0] != '/')) {
if (tp->flag&ALLOC) {
tp->flag &= ~(ALLOC|ISSET);
diff --git a/bin/ksh/lex.c b/bin/ksh/lex.c
index 5a5345a1903..416d8584795 100644
--- a/bin/ksh/lex.c
+++ b/bin/ksh/lex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lex.c,v 1.37 2005/09/11 18:02:27 otto Exp $ */
+/* $OpenBSD: lex.c,v 1.38 2005/12/11 20:31:21 otto Exp $ */
/*
* lexical analysis and source input
@@ -780,12 +780,12 @@ Done:
int h = hash(ident);
/* { */
- if ((cf & KEYWORD) && (p = tsearch(&keywords, ident, h)) &&
+ if ((cf & KEYWORD) && (p = ktsearch(&keywords, ident, h)) &&
(!(cf & ESACONLY) || p->val.i == ESAC || p->val.i == '}')) {
afree(yylval.cp, ATEMP);
return p->val.i;
}
- if ((cf & ALIAS) && (p = tsearch(&aliases, ident, h)) &&
+ if ((cf & ALIAS) && (p = ktsearch(&aliases, ident, h)) &&
(p->flag & ISSET)) {
Source *s;
diff --git a/bin/ksh/main.c b/bin/ksh/main.c
index 08cdf121084..07014658ed3 100644
--- a/bin/ksh/main.c
+++ b/bin/ksh/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.39 2005/12/11 18:53:51 deraadt Exp $ */
+/* $OpenBSD: main.c,v 1.40 2005/12/11 20:31:21 otto Exp $ */
/*
* startup, main loop, environments and error handling
@@ -111,15 +111,15 @@ main(int argc, char *argv[])
coproc_init();
/* set up variable and command dictionaries */
- tinit(&taliases, APERM, 0);
- tinit(&aliases, APERM, 0);
- tinit(&homedirs, APERM, 0);
+ ktinit(&taliases, APERM, 0);
+ ktinit(&aliases, APERM, 0);
+ ktinit(&homedirs, APERM, 0);
/* define shell keywords */
initkeywords();
/* define built-in commands */
- tinit(&builtins, APERM, 64); /* must be 2^n (currently 40 builtins) */
+ ktinit(&builtins, APERM, 64); /* must be 2^n (currently 40 builtins) */
for (i = 0; shbuiltins[i].name != NULL; i++)
builtin(shbuiltins[i].name, shbuiltins[i].func);
for (i = 0; kshbuiltins[i].name != NULL; i++)
diff --git a/bin/ksh/proto.h b/bin/ksh/proto.h
index 67b3b1bfbd6..26f59f5e520 100644
--- a/bin/ksh/proto.h
+++ b/bin/ksh/proto.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: proto.h,v 1.28 2005/12/11 18:53:51 deraadt Exp $ */
+/* $OpenBSD: proto.h,v 1.29 2005/12/11 20:31:21 otto Exp $ */
/*
* prototypes for PD-KSH
@@ -206,13 +206,13 @@ void initkeywords(void);
struct op * compile(Source *);
/* table.c */
unsigned int hash(const char *);
-void tinit(struct table *, Area *, int);
-struct tbl * tsearch(struct table *, const char *, unsigned int);
-struct tbl * tenter(struct table *, const char *, unsigned int);
-void tdelete(struct tbl *);
-void twalk(struct tstate *, struct table *);
-struct tbl * tnext(struct tstate *);
-struct tbl ** tsort(struct table *);
+void ktinit(struct table *, Area *, int);
+struct tbl * ktsearch(struct table *, const char *, unsigned int);
+struct tbl * ktenter(struct table *, const char *, unsigned int);
+void ktdelete(struct tbl *);
+void ktwalk(struct tstate *, struct table *);
+struct tbl * ktnext(struct tstate *);
+struct tbl ** ktsort(struct table *);
/* trace.c */
/* trap.c */
void inittraps(void);
diff --git a/bin/ksh/syn.c b/bin/ksh/syn.c
index 9c77331eefd..07f2e51c520 100644
--- a/bin/ksh/syn.c
+++ b/bin/ksh/syn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: syn.c,v 1.22 2005/03/30 17:16:37 deraadt Exp $ */
+/* $OpenBSD: syn.c,v 1.23 2005/12/11 20:31:21 otto Exp $ */
/*
* shell parser (C version)
@@ -661,10 +661,10 @@ initkeywords(void)
struct tokeninfo const *tt;
struct tbl *p;
- tinit(&keywords, APERM, 32); /* must be 2^n (currently 20 keywords) */
+ ktinit(&keywords, APERM, 32); /* must be 2^n (currently 20 keywords) */
for (tt = tokentab; tt->name; tt++) {
if (tt->reserved) {
- p = tenter(&keywords, tt->name, hash(tt->name));
+ p = ktenter(&keywords, tt->name, hash(tt->name));
p->flag |= DEFINED|ISSET;
p->type = CKEYWD;
p->val.i = tt->val;
diff --git a/bin/ksh/table.c b/bin/ksh/table.c
index bf7ff59c8de..7de3091feba 100644
--- a/bin/ksh/table.c
+++ b/bin/ksh/table.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: table.c,v 1.11 2005/03/30 17:16:37 deraadt Exp $ */
+/* $OpenBSD: table.c,v 1.12 2005/12/11 20:31:21 otto Exp $ */
/*
* dynamic hashed associative table for commands and variables
@@ -23,7 +23,7 @@ hash(const char *n)
}
void
-tinit(struct table *tp, Area *ap, int tsize)
+ktinit(struct table *tp, Area *ap, int tsize)
{
tp->areap = ap;
tp->tbls = NULL;
@@ -68,7 +68,7 @@ texpand(struct table *tp, int nsize)
/* name to enter */
/* hash(n) */
struct tbl *
-tsearch(struct table *tp, const char *n, unsigned int h)
+ktsearch(struct table *tp, const char *n, unsigned int h)
{
struct tbl **pp, *p;
@@ -91,7 +91,7 @@ tsearch(struct table *tp, const char *n, unsigned int h)
/* name to enter */
/* hash(n) */
struct tbl *
-tenter(struct table *tp, const char *n, unsigned int h)
+ktenter(struct table *tp, const char *n, unsigned int h)
{
struct tbl **pp, *p;
int len;
@@ -130,20 +130,20 @@ tenter(struct table *tp, const char *n, unsigned int h)
}
void
-tdelete(struct tbl *p)
+ktdelete(struct tbl *p)
{
p->flag = 0;
}
void
-twalk(struct tstate *ts, struct table *tp)
+ktwalk(struct tstate *ts, struct table *tp)
{
ts->left = tp->size;
ts->next = tp->tbls;
}
struct tbl *
-tnext(struct tstate *ts)
+ktnext(struct tstate *ts)
{
while (--ts->left >= 0) {
struct tbl *p = *ts->next++;
@@ -160,7 +160,7 @@ tnamecmp(void *p1, void *p2)
}
struct tbl **
-tsort(struct table *tp)
+ktsort(struct table *tp)
{
int i;
struct tbl **p, **sp, **dp;
@@ -195,14 +195,14 @@ tprintinfo(struct table *tp)
shellf("table size %d, nfree %d\n", tp->size, tp->nfree);
shellf(" Ncmp name\n");
- twalk(&ts, tp);
- while ((te = tnext(&ts))) {
+ ktwalk(&ts, tp);
+ while ((te = ktnext(&ts))) {
struct tbl **pp, *p;
h = hash(n = te->name);
ncmp = 0;
- /* taken from tsearch() and added counter */
+ /* taken from ktsearch() and added counter */
for (pp = &tp->tbls[h & (tp->size-1)]; (p = *pp); pp--) {
ncmp++;
if (*p->name == *n && strcmp(p->name, n) == 0 &&
diff --git a/bin/ksh/table.h b/bin/ksh/table.h
index af46f0fd921..af080ad837a 100644
--- a/bin/ksh/table.h
+++ b/bin/ksh/table.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: table.h,v 1.6 2004/12/18 20:55:52 millert Exp $ */
+/* $OpenBSD: table.h,v 1.7 2005/12/11 20:31:21 otto Exp $ */
/* $From: table.h,v 1.3 1994/05/31 13:34:34 michael Exp $ */
@@ -129,7 +129,7 @@ struct block {
#define BF_DOGETOPTS BIT(0) /* save/restore getopts state */
/*
- * Used by twalk() and tnext() routines.
+ * Used by ktwalk() and ktnext() routines.
*/
struct tstate {
int left;
diff --git a/bin/ksh/var.c b/bin/ksh/var.c
index 733f82f2967..52d6e3a7a45 100644
--- a/bin/ksh/var.c
+++ b/bin/ksh/var.c
@@ -1,4 +1,4 @@
-/* $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"
#include <time.h>
@@ -47,8 +47,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;
}
@@ -111,9 +111,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;
}
@@ -213,7 +213,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);
@@ -223,7 +223,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;
@@ -254,12 +254,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 = (struct tbl *) 0;
- 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 &
@@ -838,7 +838,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;
}
@@ -884,7 +884,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;
}
@@ -894,9 +894,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 */
diff --git a/bin/ksh/vi.c b/bin/ksh/vi.c
index 2fcde68eea6..9ce4acaf341 100644
--- a/bin/ksh/vi.c
+++ b/bin/ksh/vi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vi.c,v 1.21 2005/03/30 17:16:37 deraadt Exp $ */
+/* $OpenBSD: vi.c,v 1.22 2005/12/11 20:31:21 otto Exp $ */
/*
* vi command editing
@@ -722,7 +722,7 @@ vi_cmd(int argcnt, const char *cmd)
/* lookup letter in alias list... */
alias[1] = cmd[1];
- ap = tsearch(&aliases, alias, hash(alias));
+ ap = ktsearch(&aliases, alias, hash(alias));
if (!cmd[1] || !ap || !(ap->flag & ISSET))
return -1;
/* check if this is a recursive call... */