# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
+# http://cvs.infodrom.org/calendar/mail-calendar?cvsroot=infodrom
+# :pserver:anonymous@cvs.infodrom.org:/var/cvs/infodrom co calendar/mail-calendar
+#
+# $Id$
+
opt_subject="Calendar for"
opt_dateform="%B %d"
opt_to=$LOGNAME
c_date=`date -d now+${secs}seconds +%d.%m`
s_date=`LANG=$opt_lang date -d now+${secs}seconds "+$opt_dateform"`
-(
- echo "Subject: $opt_subject $s_date"
- echo "To: $opt_to"
- echo
- calendar -l 0 -w 0 -t $c_date
-) | /usr/sbin/sendmail "$opt_to"
+tmp=`tempfile`
+trap 'rm -f $tmp' INT EXIT
+
+calendar -l 0 -w 0 -t $c_date > $tmp
+
+if [ -s $tmp ]
+then
+ (
+ echo "Subject: $opt_subject $s_date"
+ echo "To: $opt_to"
+ echo
+ calendar -l 0 -w 0 -t $c_date
+ ) | /usr/sbin/sendmail "$opt_to"
+fi