Annotation of 43BSDTahoe/usr.bin/calendar/calendar.sh, revision 1.1.1.1

1.1       root        1: #!/bin/sh -
                      2: #
                      3: # Copyright (c) 1988 Regents of the University of California.
                      4: # All rights reserved.  The Berkeley software License Agreement
                      5: # specifies the terms and conditions for redistribution.
                      6: #
                      7: #      @(#)calendar.sh 4.7 (Berkeley) 3/27/88
                      8: #
                      9: PATH=/usr/lib:/bin:/usr/bin:/usr/ucb:/lib      # order important
                     10: 
                     11: tmp=/tmp/cal0$$
                     12: trap "rm -f $tmp /tmp/cal1$$ /tmp/cal2$$"
                     13: trap exit 1 2 13 15
                     14: calendar >$tmp
                     15: 
                     16: if [ $# = 0 ]; then
                     17:        trap "rm -f $tmp ; exit" 0 1 2 13 15
                     18:        (cpp calendar | egrep -f $tmp)
                     19:        exit 0
                     20: fi
                     21: 
                     22: if [ $# = 1 ] && [ $1 = "-" ]; then
                     23:        trap "rm -f $tmp /tmp/cal1$$ /tmp/cal2$$; exit" 0 1 2 13 15
                     24:        echo -n "Subject: Calendar for " > /tmp/cal1$$
                     25:        date | sed -e "s/ [0-9]*:.*//" >> /tmp/cal1$$
                     26:        sed '
                     27:                s/\([^:]*\):.*:\(.*\):[^:]*$/y=\2 z=\1/
                     28:        ' /etc/passwd \
                     29:        | while read x
                     30:        do
                     31:                eval $x
                     32:                if test -r $y/calendar
                     33:                then
                     34:                        (cpp $y/calendar | egrep -f $tmp) 2>/dev/null > /tmp/cal2$$
                     35:                        if test -s /tmp/cal2$$
                     36:                        then
                     37:                                cat /tmp/cal1$$ /tmp/cal2$$ | mail $z
                     38:                        fi
                     39:                fi
                     40:        done
                     41:        exit 0
                     42: fi
                     43: 
                     44: echo "usage: calendar [-]"
                     45: exit 1

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.