Initial revision
This commit is contained in:
parent
ed7c8e8d02
commit
76193d7cb0
223 changed files with 32479 additions and 0 deletions
41
src/cmd/mk/var.c
Normal file
41
src/cmd/mk/var.c
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
#include "mk.h"
|
||||
|
||||
void
|
||||
setvar(char *name, void *value)
|
||||
{
|
||||
symlook(name, S_VAR, value)->value = value;
|
||||
symlook(name, S_MAKEVAR, (void*)"");
|
||||
}
|
||||
|
||||
static void
|
||||
print1(Symtab *s)
|
||||
{
|
||||
Word *w;
|
||||
|
||||
Bprint(&bout, "\t%s=", s->name);
|
||||
for (w = (Word *) s->value; w; w = w->next)
|
||||
Bprint(&bout, "'%s'", w->s);
|
||||
Bprint(&bout, "\n");
|
||||
}
|
||||
|
||||
void
|
||||
dumpv(char *s)
|
||||
{
|
||||
Bprint(&bout, "%s:\n", s);
|
||||
symtraverse(S_VAR, print1);
|
||||
}
|
||||
|
||||
char *
|
||||
shname(char *a)
|
||||
{
|
||||
Rune r;
|
||||
int n;
|
||||
|
||||
while (*a) {
|
||||
n = chartorune(&r, a);
|
||||
if (!WORDCHR(r))
|
||||
break;
|
||||
a += n;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue