SCCS-vsn: usr.bin/calendar/calendar.c 4.2
SCCS-vsn: usr.bin/calendar/calendar.sh 4.2
-static char *sccsid = "@(#)calendar.c 4.1 (Berkeley) 81/02/28";
+static char *sccsid = "@(#)calendar.c 4.2 (Berkeley) 81/02/28";
/* /usr/lib/calendar produces an egrep -f file
that will select today's and tomorrow's
calendar entries, with special weekend provisions
/* /usr/lib/calendar produces an egrep -f file
that will select today's and tomorrow's
calendar entries, with special weekend provisions
tm = localtime(&t);
printf("(^|[ (,;])((%s[^ ]* *|%d/)0*%d)([^0123456789]|$)\n",
month[tm->tm_mon], tm->tm_mon + 1, tm->tm_mday);
tm = localtime(&t);
printf("(^|[ (,;])((%s[^ ]* *|%d/)0*%d)([^0123456789]|$)\n",
month[tm->tm_mon], tm->tm_mon + 1, tm->tm_mday);
+ printf("(^|[ (,;])((\\* *)0*%d)([^0123456789]|$)\n",
+ tm->tm_mday);
-: calendar.sh 4.1 81/02/28
-PATH=/bin:/usr/bin
+: calendar.sh 4.2 81/02/28
+PATH=/bin:/usr/bin:
-trap "rm $tmp; exit" 0 1 2 13 15
+trap "rm -f $tmp /tmp/cal2$$"
+trap exit 1 2 13 15
/usr/lib/calendar >$tmp
case $# in
0)
/usr/lib/calendar >$tmp
case $# in
0)
+ trap "rm $tmp ; exit" 0 1 2 13 15
egrep -f $tmp calendar;;
*)
egrep -f $tmp calendar;;
*)
+ trap "rm $tmp /tmp/cal2$$; exit" 0 1 2 13 15
sed '
s/\([^:]*\):.*:\(.*\):[^:]*$/y=\2 z=\1/
' /etc/passwd \
| while read x
do
eval $x
sed '
s/\([^:]*\):.*:\(.*\):[^:]*$/y=\2 z=\1/
' /etc/passwd \
| while read x
do
eval $x
- if test -r $y/calendar; then
- egrep -f $tmp $y/calendar 2>/dev/null | mail $z
+ if test -r $y/calendar
+ then
+ egrep -f $tmp $y/calendar 2>/dev/null > /tmp/cal2$$
+ if test -s /tmp/cal2$$
+ then
+ < /tmp/cal2$$ mail $z
+ fi