New 2006 DPL
[infodrom/calendar] / mail-calendar
index c0fd827..e394b1f 100755 (executable)
 #  
 #   $Id$
 
+#
+#   Important note: this program requires the FreeBSD version of
+#   calendar.  The OpenBSD version uses incompatible commandline
+#   options and doesn't provide features used by this program.
+#
+
 opt_subject="Calendar for"
 opt_dateform="%B %d"
 opt_to=$LOGNAME
@@ -74,19 +80,22 @@ esac
 
 secs=$[ $opt_advance * 86400 ]
 
-c_date=`date -d now+${secs}seconds +%m%d`
+c_date=`date -d now+${secs}seconds +%d.%m`
 s_date=`LANG=$opt_lang date -d now+${secs}seconds "+$opt_dateform"`
 
 tmp=`tempfile`
 trap 'rm -f $tmp' INT EXIT
 
-calendar -A 0 -t $c_date > $tmp
+calendar -l 0 -w 0 -t $c_date > $tmp
 
 if [ -s $tmp ]
 then
     (
        echo "Subject: $opt_subject $s_date"
        echo "To: $opt_to"
+       echo "Content-Type: text/plain; charset=iso-8859-1"
+       echo "Content-Disposition: inline"
+       echo "Content-Transfer-Encoding: 8bit"
        echo
        cat $tmp
     ) | /usr/sbin/sendmail "$opt_to"