* Run programs submitted by at.
# define DIR "/usr/spool/at"
# define LASTF "/usr/spool/at/lasttimedone"
if ((dirf
= fopen(".", "r")) == NULL
) {
fprintf(stderr
, "Cannot read at directory\n");
while (fread((char *)&dirent
, sizeof(dirent
), 1, dirf
) == 1) {
if (sscanf(dirent
.d_name
, "%2d.%3d.%4d.%2d", &year
, &day
, &tt
, &uniq
) != 4)
if (nowyear
==year
&& nowdate
< day
)
if (nowyear
==year
&& nowdate
==day
&& nowtime
< tt
)
nowtime
= tp
->tm_hour
*100 + tp
->tm_min
;
tfile
= fopen(LASTF
, "w");
fprintf(stderr
, "can't write lastfile\n");
fprintf(tfile
, "%04d\n", t
);
dup(dup(open("/dev/null", 0)));
sprintf(sbuf
, "/bin/mv %.14s %s", file
, PDIR
);
if (stat(file
, &stbuf
) == -1)
execl("/bin/sh", "sh", file
, 0);
execl("/usr/bin/sh", "sh", file
, 0);
fprintf(stderr
, "Can't execl shell\n");