URI: 
       tbye bye - plan9port - [fork] Plan 9 from user space
  HTML git clone git://src.adamsgaard.dk/plan9port
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit 5ad51f0cffbdd5fc0570d6ceba993c2aa073d54b
   DIR parent bfaea4f33b3251ef3147566a010536dd0f7907d2
  HTML Author: rsc <devnull@localhost>
       Date:   Thu,  8 Apr 2004 19:57:05 +0000
       
       bye bye
       
       Diffstat:
         D src/lib9/stat2dir.c                 |     116 ------------------------------
       
       1 file changed, 0 insertions(+), 116 deletions(-)
       ---
   DIR diff --git a/src/lib9/stat2dir.c b/src/lib9/stat2dir.c
       t@@ -1,116 +0,0 @@
       -#include <u.h>
       -#include <libc.h>
       -
       -#include <sys/stat.h>
       -#include <sys/disklabel.h>
       -#include <dirent.h>
       -#include <pwd.h>
       -#include <grp.h>
       -
       -int
       -_p9dir(struct stat *st, char *name, Dir *d, char **str, char *estr)
       -{
       -        char *s;
       -        char tmp[20];
       -        struct group *g;
       -        struct pwd *p;
       -        int sz;
       -
       -        sz = 0;
       -
       -        /* name */
       -        s = strrchr(name, '/');
       -        if(s && s[1])
       -                s++;
       -        else
       -                s = "/";
       -        if(d){
       -                if(*str + strlen(s)+1 > estr)
       -                        d->name = "oops";
       -                else{
       -                        strcpy(*str, s);
       -                        d->name = *str;
       -                        *str += strlen(*str)+1;
       -                }
       -        }
       -        sz += strlen(s)+1;
       -
       -        /* user */
       -        p = getpwuid(st->st_uid);
       -        if(p == nil){
       -                snprint(tmp, sizeof tmp, "%d", (int)st->st_uid);
       -                s = tmp;
       -        }else
       -                s = p->pw_name;
       -        sz += strlen(s)+1;
       -        if(d){
       -                if(*str+strlen(s)+1 > estr)
       -                        d->uid = "oops";        
       -                else{
       -                        strcpy(*str, s);
       -                        d->uid = *str;
       -                        *str += strlen(*str)+1;
       -                }
       -        }
       -
       -        /* group */
       -        g = getgrgid(st->st_gid);
       -        if(g == nil){
       -                snprint(tmp, sizeof tmp, "%d", (int)st->st_gid);
       -                s = tmp;
       -        }else
       -                s = g->gr_name;
       -        sz += strlen(s)+1;
       -        if(d){
       -                if(*str + strlen(s)+1 > estr){
       -                        d->gid = "oops";        
       -                else{
       -                        strcpy(*str, s);
       -                        d->gid = *str;
       -                        *str += strlen(*str)+1;
       -                }
       -        }
       -
       -        if(d){
       -                d->muid = "";
       -                d->qid.path = ((uvlong)st->st_dev<<32) | st->st_ino;
       -                d->qid.vers = st->st_gen;
       -                d->mode = st->st_mode&0777;
       -                if(S_ISDIR(st->st_mode)){
       -                        d->mode |= DMDIR;
       -                        d->qid.type = QTDIR;
       -                }
       -                d->atime = st->st_atime;
       -                d->mtime = st->st_mtime;
       -                d->length = st->st_size;
       -
       -                /* fetch real size for disks */
       -                if(S_ISCHR(st->st_mode)){
       -                        int fd, n;
       -                        struct disklabel lab;
       -
       -                        if((fd = open(name, O_RDONLY)) < 0)
       -                                goto nosize;
       -                        if(ioctl(fd, DIOCGDINFO, &lab) < 0)
       -                                goto nosize;
       -                        n = minor(st->st_rdev)&0xFFFF;
       -                        if(n >= lab.d_npartitions)
       -                                goto nosize;
       -                        d->length = (vlong)lab.d_npartitions[n].p_size * lab.d_secsize;
       -                nosize:
       -                        if(fd >= 0)
       -                                close(fd);
       -                }
       -        }
       -
       -        return sz;
       -}
       -
       -Dir*
       -_dirfstat(char *name, int fd)
       -{
       -        Dir *d;
       -        int size;
       -
       -        
       -}