#include #include ulong themecolor(char *prof, char *key, ulong defval) { int fd; char buf[64]; ulong val; char *rptr; val = defval; snprint(buf, sizeof(buf), "/mnt/theme/%s/%s", prof, key); fd = open(buf, OREAD); if(fd >= 0){ if(read(fd, buf, sizeof(buf)) > 0){ rptr = nil; val = strtoul(buf, &rptr, 0); if(rptr == buf) val = defval; } close(fd); } return val; }