Lines Matching refs:cfile
207 static void parse_line(char *line, CRONFILE *cfile)
229 if (TT.flagd) loginfo(LOG_LEVEL5, "user:%s entry:%s", cfile->username, line);
280 dlist_add_nomalloc((struct double_list **)&cfile->job, (struct double_list *)j);
287 if (!strcmp(name, "MAILTO")) cfile->mailto = xstrdup(val);
292 dlist_add_nomalloc((struct double_list **)&cfile->var, (struct double_list *)v);
376 CRONFILE *cfile;
389 cfile = xzalloc(sizeof(CRONFILE));
390 cfile->username = xstrdup(entry->d_name);
393 parse_line(line, cfile);
396 if (!cfile->job) {
397 VAR *v, *vnode = (VAR *)cfile->var;
399 free(cfile->username);
400 if (cfile->mailto) free(cfile->mailto);
407 free(cfile);
409 if (!cfile->mailto) cfile->mailto = cfile->username;
411 (struct double_list *)cfile);
423 static void do_fork(CRONFILE *cfile, JOB *job, int fd, char *prog)
428 VAR *v, *vstart = (VAR *)cfile->var;
429 struct passwd *pwd = getpwnam(cfile->username);
431 if (!pwd) loginfo(LOG_LEVEL9, "can't get uid for %s", cfile->username);
460 loginfo(LOG_ERROR, "can't execute '%s' for user %s", file, cfile->username);
475 static void sendmail(CRONFILE *cfile, JOB *job)
488 cfile->username, (int)pid);
500 do_fork(cfile, job, mailfd, "sendmail");
506 CRONFILE *cfile = gclist;
510 while (cfile) {
511 job = jstart = (JOB *)cfile->job;
519 sendmail(cfile, job);
531 if ((cfile = cfile->next) == gclist) break;
539 CRONFILE *cfile = gclist;
542 while (cfile) {
543 job = jstart = (JOB *)cfile->job;
552 cfile->username, getpid());
556 "discarding output", toybuf, cfile->username);
558 dprintf(mailfd, "To: %s\nSubject: cron: %s\n\n", cfile->mailto, job->cmd);
561 do_fork(cfile, job, mailfd, NULL);
566 cfile->username, (int)job->pid);
572 cfile->username, job->pid, job->cmd);
579 if ((cfile = cfile->next) == gclist) break;
590 CRONFILE *cfile = gclist;
596 while (cfile) {
597 if (TT.flagd) loginfo(LOG_LEVEL5, "file %s:", cfile->username);
598 if (cfile->invalid) goto NEXT_CRONFILE;
599 job = jstart = (JOB *)cfile->job;
611 cfile->username, job->cmd);
621 if ((cfile = cfile->next) == gclist) break;