tmove faces - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit a5ba8a59263e49be566823bbbca05ebee6c79bd2
 (DIR) parent 16c1defa3dbd8a4388da65e96f53cd767dceb2f3
 (HTM) Author: rsc <devnull@localhost>
       Date:   Sat, 12 Nov 2005 16:40:15 +0000
       
       move faces
       
       Diffstat:
         M src/cmd/faces/facedb.c              |      21 ++++++++++++++-------
       
       1 file changed, 14 insertions(+), 7 deletions(-)
       ---
 (DIR) diff --git a/src/cmd/faces/facedb.c b/src/cmd/faces/facedb.c
       t@@ -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) {
       t@@ -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;
        
       t@@ -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);
       t@@ -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;
        
       t@@ -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);