var.c (524B)
1 #include "mk.h" 2 3 void 4 setvar(char *name, void *ptr) 5 { 6 symlook(name, S_VAR, ptr)->u.ptr = ptr; 7 symlook(name, S_MAKEVAR, (void*)""); 8 } 9 10 static void 11 print1(Symtab *s) 12 { 13 Word *w; 14 15 Bprint(&bout, "\t%s=", s->name); 16 for (w = s->u.ptr; w; w = w->next) 17 Bprint(&bout, "'%s'", w->s); 18 Bprint(&bout, "\n"); 19 } 20 21 void 22 dumpv(char *s) 23 { 24 Bprint(&bout, "%s:\n", s); 25 symtraverse(S_VAR, print1); 26 } 27 28 char * 29 shname(char *a) 30 { 31 Rune r; 32 int n; 33 34 while (*a) { 35 n = chartorune(&r, a); 36 if (!WORDCHR(r)) 37 break; 38 a += n; 39 } 40 return a; 41 }