diff options
author | rsc <devnull@localhost> | 2005-11-12 16:40:15 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2005-11-12 16:40:15 +0000 |
commit | a5ba8a59263e49be566823bbbca05ebee6c79bd2 (patch) | |
tree | 304301e29c8bba448086c5f83e718468abfc17ba /src/cmd/faces | |
parent | 16c1defa3dbd8a4388da65e96f53cd767dceb2f3 (diff) | |
download | plan9port-a5ba8a59263e49be566823bbbca05ebee6c79bd2.tar.gz plan9port-a5ba8a59263e49be566823bbbca05ebee6c79bd2.tar.bz2 plan9port-a5ba8a59263e49be566823bbbca05ebee6c79bd2.zip |
move faces
Diffstat (limited to 'src/cmd/faces')
-rw-r--r-- | src/cmd/faces/facedb.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/cmd/faces/facedb.c b/src/cmd/faces/facedb.c index 0c4f2d79..eecaf26d 100644 --- a/src/cmd/faces/facedb.c +++ b/src/cmd/faces/facedb.c @@ -160,7 +160,7 @@ translatedomain(char *dom) if(dom == nil || *dom == 0) return nil; - if((file = readfile(unsharp("#9/lib/face/.machinelist"))) == nil) + if((file = readfile(unsharp("#9/face/.machinelist"))) == nil) return dom; for(p=file; p; p=nextp) { @@ -213,10 +213,17 @@ static char* tryfindpicture_user(char *dom, char *user, int depth) { static char buf[200]; - char *p, *q, *nextp, *file, *usr; - usr = getuser(); + char *p, *q, *nextp, *file; + static char *home; + + if(home == nil) + home = getenv("home"); + if(home == nil) + home = getenv("HOME"); + if(home == nil) + return nil; - sprint(buf, "/usr/%s/lib/face/48x48x%d/.dict", usr, depth); + sprint(buf, "%s/lib/face/48x48x%d/.dict", home, depth); if((file = readfile(buf)) == nil) return nil; @@ -232,7 +239,7 @@ tryfindpicture_user(char *dom, char *user, int depth) if(strcmp(buf, p) == 0) { q += strspn(q, " \t"); - q = buf+snprint(buf, sizeof buf, "/usr/%s/lib/face/48x48x%d/%s", usr, depth, q); + q = buf+snprint(buf, sizeof buf, "%s/lib/face/48x48x%d/%s", home, depth, q); while(q > buf && (q[-1] == ' ' || q[-1] == '\t')) *--q = 0; free(file); @@ -249,7 +256,7 @@ tryfindpicture_global(char *dom, char *user, int depth) static char buf[200]; char *p, *q, *nextp, *file; - sprint(buf, "#9/lib/face/48x48x%d/.dict", depth); + sprint(buf, "#9/face/48x48x%d/.dict", depth); if((file = readfile(unsharp(buf))) == nil) return nil; @@ -265,7 +272,7 @@ tryfindpicture_global(char *dom, char *user, int depth) if(strcmp(buf, p) == 0) { q += strspn(q, " \t"); - q = buf+snprint(buf, sizeof buf, "#9/lib/face/48x48x%d/%s", depth, q); + q = buf+snprint(buf, sizeof buf, "#9/face/48x48x%d/%s", depth, q); while(q > buf && (q[-1] == ' ' || q[-1] == '\t')) *--q = 0; free(file); |