dnl ---------------------------------------------------------------------
dnl Programs ...
-AC_PATH_PROG(SENDMAIL, sendmail, , $PATH:/usr/lib:/usr/sbin )
+AC_PATH_PROG(FOUND_SENDMAIL, sendmail, , $PATH:/usr/lib:/usr/sbin )
+SENDMAIL=
USE_SENDMAIL=1
AC_MSG_CHECKING([actual sendmail to use])
AC_ARG_WITH(sendmail, [ --with-sendmail=PATH Path to sendmail.],
if test "$USE_SENDMAIL" != "1" ; then
AC_MSG_RESULT([disabled])
AC_MSG_WARN([Without sendmail you will not get the output of the jobs by mail])
-elif test -z "$SENDMAIL" ; then
+elif test -n "$SENDMAIL" ; then
+ dnl The user defined a sendmail program to use:
+ if test ! -x "$SENDMAIL" ; then
+ dnl ... but it is not an executable file!
+ AC_MSG_RESULT([$SENDMAIL])
+ AC_MSG_ERROR([File $SENDMAIL is not an executable file])
+ else
+ dnl ... and it is valid
+ AC_MSG_RESULT([$SENDMAIL])
+ fi
+elif test -z "$FOUND_SENDMAIL" ; then
+ dnl The user didn't defined a program to use, and we didn't find one automatically
AC_MSG_RESULT([not found])
AC_MSG_ERROR([Empty sendmail path or cannot determine path to sendmail: try option --with-sendmail=PATH])
-elif test ! -x "$SENDMAIL" ; then
- AC_MSG_RESULT([$SENDMAIL])
- AC_MSG_ERROR([File $SENDMAIL is not an executable file])
else
+ dnl Use the automatically found sendmail program:
+ SENDMAIL="$FOUND_SENDMAIL"
AC_MSG_RESULT([$SENDMAIL])
fi
AC_SUBST([SENDMAIL])
-if test x"$USE_SENDMAIL" != x ; then
+if test "$USE_SENDMAIL" = "1"; then
AC_DEFINE([USE_SENDMAIL])
fi
#ifndef USE_SENDMAIL
clear_mail(cl->cl_option);
- clear_forcemail(cl->cl_option);
+ clear_mailzerolength(cl->cl_option);
#endif
cl->cl_next = cf->cf_line_base;
#ifndef USE_SENDMAIL
clear_mail(cl->cl_option);
- clear_forcemail(cl->cl_option);
+ clear_mailzerolength(cl->cl_option);
#endif
cl->cl_next = cf->cf_line_base;
ok:
#ifndef USE_SENDMAIL
clear_mail(cl->cl_option);
- clear_forcemail(cl->cl_option);
+ clear_mailzerolength(cl->cl_option);
#endif
cl->cl_next = cf->cf_line_base;
/* if task have made some output, mail it to user */
{
- char mail_output;
- char *m;
-
- if (mailf != NULL && (is_mailzerolength(line->cl_option)
- || (is_mail(line->cl_option)
- && (
- /* job wrote some output and we wan't it in any case: */
- ((fseek(mailf, 0, SEEK_END) == 0
- && ftell(mailf) > mailpos)
- && !is_erroronlymail(line->cl_option))
- ||
- /* or we want an email only if the job returned an error: */
- !(WIFEXITED(status)
- && WEXITSTATUS(status) == 0)
- )
- )
- )
- )
+ char mail_output = 0;
+ char *m = NULL;
+
+#ifdef USE_SENDMAIL
+ if (mailf != NULL
+ && (is_mailzerolength(line->cl_option)
+ || (is_mail(line->cl_option)
+ && (
+ /* job wrote some output and we wan't it in any case: */
+ ((fseek(mailf, 0, SEEK_END) == 0
+ && ftell(mailf) > mailpos)
+ && !is_erroronlymail(line->cl_option))
+ ||
+ /* or we want an email only if the job returned an error: */
+ !(WIFEXITED(status)
+ && WEXITSTATUS(status) == 0)
+ )
+ )
+ )
+ ) {
/* an output exit : we will mail it */
mail_output = 1;
- else
- /* no output */
- mail_output = 0;
+ }
+ /* or else there is no output to email -- mail_output is already set to 0 */
+#endif /* USE_SENDMAIL */
m = (mail_output == 1) ? " (mailing output)" : "";
if (WIFEXITED(status) && WEXITSTATUS(status) == 0) {