--- /n/contrib.9front.org/contrib/mischief/sys/src/libtheme/theme.c Fri Apr 22 16:20:26 2016 +++ theme.c Thu Oct 11 22:01:14 2018 @@ -51,12 +51,18 @@ static Ndb *themedb; static QLock themelock; +static char *themeName; void -themeinit(void) +themeinit(char *theme) { char *home, *db; + themeName = strdup(theme); + if(themeName == nil){ + sysfatal("failed to allocate memory for themeName"); + } + home = getenv("home"); assert(home != nil); @@ -81,6 +87,7 @@ void themeend(void) { + free(themeName); qlock(&themelock); if(themedb != nil) ndbclose(themedb); @@ -102,7 +109,7 @@ } ulong -themeget(char *theme, char *color, ulong def) +themeget(char *color, ulong def) { ulong r; Ndbs s; @@ -117,7 +124,7 @@ goto done; /* first try with theme */ - val = ndbgetvalue(themedb, &s, "theme", theme, color, nil); + val = ndbgetvalue(themedb, &s, "theme", themeName, color, nil); if(val != nil){ r = convcolor(val); if(r == DNotacolor) --- /n/contrib.9front.org/contrib/mischief/sys/src/libtheme/theme.h Thu Apr 21 20:13:55 2016 +++ theme.h Thu Oct 11 13:58:06 2018 @@ -1,4 +1,6 @@ -void themeinit(void); +#pragma lib "libtheme.a" + +void themeinit(char *name); void themeend(void); -ulong themeget(char *theme, char *color, ulong def); +ulong themeget(char *color, ulong def);