- char *x;
- unsigned int xlen;
- unsigned int i;
- char *type;
- char *uidstr;
- char *gidstr;
- char *modestr;
- char *mid;
- char *name;
- unsigned long uid;
- unsigned long gid;
- unsigned long mode;
- int ftype;
-
- x = line->s; xlen = line->len;
-
- type = x;
- i = byte_chr(x,xlen,':'); if (i == xlen) return;
- x[i++] = 0; x += i; xlen -= i;
-
- uidstr = x;
- i = byte_chr(x,xlen,':'); if (i == xlen) return;
- x[i++] = 0; x += i; xlen -= i;
-
- gidstr = x;
- i = byte_chr(x,xlen,':'); if (i == xlen) return;
- x[i++] = 0; x += i; xlen -= i;
-
- modestr = x;
- i = byte_chr(x,xlen,':'); if (i == xlen) return;
- x[i++] = 0; x += i; xlen -= i;
-
- mid = x;
- i = byte_chr(x,xlen,':'); if (i == xlen) return;
- x[i++] = 0; x += i; xlen -= i;
-
- name = x;
- i = byte_chr(x,xlen,':'); if (i == xlen) return;
- x[i++] = 0; x += i; xlen -= i;
-
- if (!stralloc_copys(&target,to)) nomem();
- if (!stralloc_cats(&target,mid)) nomem();
- if (!stralloc_cats(&target,name)) nomem();
- if (!stralloc_0(&target)) nomem();
-
- uid = -1; if (*uidstr) scan_ulong(uidstr,&uid);
- gid = -1; if (*gidstr) scan_ulong(gidstr,&gid);
- scan_8long(modestr,&mode);
-
- switch(*type) {
- case 'd': ftype = S_IFDIR; break;
- case 'c': ftype = S_IFREG; break;
- case 'z': ftype = S_IFREG; break;
- case 'p': ftype = S_IFIFO; break;
- default: return;
- }