head	2.2;
access;
symbols
	3_0_1:2.2
	3_0_0:2.0;
locks;
comment	@# @;


2.2
date	96.10.08.00.45.00;	author hzoli;	state Exp;
branches;
next	2.1;

2.1
date	96.08.25.23.06.43;	author hzoli;	state Exp;
branches;
next	2.0;

2.0
date	96.08.25.22.07.21;	author hzoli;	state Exp;
branches;
next	;


desc
@Zsh function to check for new mails in mail folders
@


2.2
log
@spelling fixes
@
text
@#! /usr/local/bin/zsh
#
# This autoloadable function checks the folders specified as arguments
# for new mails.  The arguments are interpeted in exactly the same way
# as the mailpath special zsh parameter (see zshparam(1)).
#
# If no arguments are given mailpath is used.  If mailpath is empty, $MAIL
# is used and if that is also empty, /var/spool/mail/$LOGNAME is used.
# This function requires zsh-3.0.1 or newer.
#
# Zoltn Hidvgi <hzoli@@cs.elte.hu>
#

local file message

for file in "${@@:-${mailpath[@@]:-${MAIL:-/var/spool/mail/$LOGNAME}}}"
do
	message="${${(M)file%%\?*}#\?}"
	file="${file%%\?*}"
	if [[ -d "$file" ]] then
		file=( "$file"/**/*(.ND) )
		if (($#file)) then
			checkmail "${^file}\?$message"
		fi
	elif test -N "$file"; then  # this also sets $_ to $file
		print -r -- "${(e)message:-You have new mail.}"
	fi
done
@


2.1
log
@new -N contitional test to check if the access time of a file is
not newer than its modification time.  A new checkmail function is also
included to check mailpath or the given forlers for new mails.
@
text
@d3 3
a5 3
# This autoloadable function checks the folres specified as arguments
# for new mails.  The arguments are interpeted inexactly the same way
# as the mailpath zsh special parameters (see zshparam(1)).
d7 3
a9 3
# If no arguments are given mailpath is used.  If mailpath is empty,
# $MAIL is used and if that is also empty /var/spool/mail/$LOGNAME is used.
# It requires zsh-3.0.1 or newer.
@


2.0
log
@*** empty log message ***
@
text
@d1 28
@
