From: thib Date: Mon, 4 Dec 2000 20:18:27 +0000 (+0000) Subject: added hostname to the addresses of mail sent X-Git-Tag: ver1564~412 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=445e888801a916bad3dd6559e0b91f52027ac327;p=fcron added hostname to the addresses of mail sent --- diff --git a/job.c b/job.c index a6f5d66..a2fd542 100644 --- a/job.c +++ b/job.c @@ -22,7 +22,7 @@ * `LICENSE' that comes with the fcron source distribution. */ - /* $Id: job.c,v 1.25 2000-11-10 17:37:29 thib Exp $ */ + /* $Id: job.c,v 1.26 2000-12-04 20:18:27 thib Exp $ */ #include "fcron.h" @@ -148,6 +148,18 @@ run_job(struct exe *exeent) /* write mail header */ xwrite(mailfd,"To: "); xwrite(mailfd, line->cl_file->cf_user); +#ifdef HAVE_GETHOSTNAME + { + char hostname[USER_NAME_LEN]; + memset(hostname, 0, sizeof(hostname)); + if (gethostname(hostname, sizeof(hostname)) != 0) + error_e("Could not get hostname"); + else { + xwrite(mailfd, "@"); + xwrite(mailfd, hostname); + } + } +#endif /* HAVE_GETHOSTNAME */ xwrite(mailfd, "\nSubject: Output of fcron job: '"); xwrite(mailfd, line->cl_shell); xwrite(mailfd,"'\n\n");