43 x = line->s; xlen = line->len;
46 i = byte_chr(x,xlen,
':');
if (i == xlen)
return;
47 x[i++] = 0; x += i; xlen -= i;
50 i = byte_chr(x,xlen,
':');
if (i == xlen)
return;
51 x[i++] = 0; x += i; xlen -= i;
54 i = byte_chr(x,xlen,
':');
if (i == xlen)
return;
55 x[i++] = 0; x += i; xlen -= i;
58 i = byte_chr(x,xlen,
':');
if (i == xlen)
return;
59 x[i++] = 0; x += i; xlen -= i;
62 i = byte_chr(x,xlen,
':');
if (i == xlen)
return;
63 x[i++] = 0; x += i; xlen -= i;
66 i = byte_chr(x,xlen,
':');
if (i == xlen)
return;
67 x[i++] = 0; x += i; xlen -= i;
69 if (!stralloc_copys(&target,
to))
nomem();
70 if (!stralloc_cats(&target,mid))
nomem();
71 if (!stralloc_cats(&target,
name))
nomem();
72 if (!stralloc_0(&target))
nomem();
74 uid = -1;
if (*uidstr) scan_ulong(uidstr,&
uid);
75 gid = -1;
if (*gidstr) scan_ulong(gidstr,&gid);
76 scan_8long(modestr,&mode);
79 case 'd':
if (mkdir(target.s,0700) == -1)
81 logmsg(
WHO,111,FATAL,B(
"unable to mkdir :",target.s));
87 fdout = open_trunc(target.s);
89 logmsg(
WHO,111,FATAL,B(
"unable to write :",target.s));
92 switch (buffer_copy(&
bo,&
bi)) {
94 case -3:
logmsg(
WHO,111,FATAL,B(
"unable to write :",target.s));
98 if (buffer_flush(&
bo) == -1)
99 logmsg(
WHO,111,FATAL,B(
"unable to write :",target.s));
100 if (fsync(
fdout) == -1)
101 logmsg(
WHO,111,FATAL,B(
"unable to write :",target.s));
107 if (chown(target.s,
uid,gid) == -1)
108 logmsg(
WHO,111,FATAL,B(
"unable to chown :",target.s));
109 if (chmod(target.s,mode) == -1)
110 logmsg(
WHO,111,FATAL,B(
"unable to chmod :",target.s));
const char * logmsg(const char *dir, unsigned long num, unsigned long listno, unsigned long subs, int done)