static char sccsid
[] = "@(#)uuclean.c 4.1 (Berkeley) 9/11/82";
* uuclean - this program will search through the spool
* directory (Spool) and delete all files with a requested
* prefix which are older than (nomtime) seconds.
* If the -m option is set, the program will try to
* send mail to the usid of the file.
* -m - send mail for deleted file
* -d - directory to clean
* -n - time to age files before delete (in hours)
* -x - turn on debug outputs
* 1 - can not read directory
#define NOMTIME 72 /* hours to age files before deletion */
register struct direct
*dirp
;
nomtime
= NOMTIME
* 3600L;
while (argc
>1 && argv
[1][0] == '-') {
nomtime
= atoi(&argv
[1][2]) * 3600L;
Debug
= atoi(&argv
[1][2]);
printf("unknown flag %s\n", argv
[1]); break;
DEBUG(4, "DEBUG# %s\n", "START");
if ((pdirf
= opendir(Spool
, "r")) == NULL
) {
printf("%s directory unreadable\n", Spool
);
while ((dirp
= readdir(pdirf
)) != NULL
) {
if (!chkpre(dirp
->d_name
))
if (stat(dirp
->d_name
, &stbuf
) == -1) {
DEBUG(4, "stat on %s failed\n", dirp
->d_name
);
if ((stbuf
.st_mode
& S_IFMT
) == S_IFDIR
)
if ((ptime
- stbuf
.st_ctime
) < nomtime
)
DEBUG(4, "unlink file %s\n", dirp
->d_name
);
if (mflg
) sdmail(dirp
->d_name
, stbuf
.st_uid
);
char Pre
[MAXPRE
][MAXNAMLEN
];
* chkpre(file) check for prefix
for (i
= 0; i
< Npre
; i
++) {
if (prefix(Pre
[i
], file
))