18 #include "auto_qmail.h"
20 #define OSSIFIED 129600 /* see qmail-send.c */
34 while (d
= readdir(dir
))
36 if (str_equal(d
->d_name
,".")) continue;
37 if (str_equal(d
->d_name
,"..")) continue;
38 if (!stralloc_copys(&line
,"pid/")) continue;
39 if (!stralloc_cats(&line
,d
->d_name
)) continue;
40 if (!stralloc_0(&line
)) continue;
41 if (stat(line
.s
,&st
) == -1) continue;
42 if (time
< st
.st_atime
+ OSSIFIED
) continue;
50 void respond(s
) char *s
; { if (substdio_putflush(subfdoutsmall
,s
,1) == -1) _exit(100); }
59 if (chdir(auto_qmail
) == -1) _exit(111);
60 if (chdir("queue") == -1) _exit(111);
64 if (!stralloc_ready(&line
,200)) _exit(111);
70 if (cleanuploop
) --cleanuploop
; else { cleanuppid(); cleanuploop
= 30; }
71 if (getln(subfdinsmall
,&line
,&match
,'\0') == -1) break;
73 if (line
.len
< 7) { respond("x"); continue; }
74 if (line
.len
> 100) { respond("x"); continue; }
75 if (line
.s
[line
.len
- 1]) { respond("x"); continue; } /* impossible */
76 for (i
= 5;i
< line
.len
- 1;++i
)
77 if ((unsigned char) (line
.s
[i
] - '0') > 9)
78 { respond("x"); continue; }
79 if (!scan_ulong(line
.s
+ 5,&id
)) { respond("x"); continue; }
80 if (byte_equal(line
.s
,5,"foop/"))
82 #define U(prefix,flag) fmtqfn(fnbuf,prefix,id,flag); \
83 if (unlink(fnbuf) == -1) if (errno != error_noent) { respond("!"); continue; }
88 else if (byte_equal(line
.s
,4,"todo/"))