* Copyright (c) 1991 The Regents of the University of California.
* This code is derived from software contributed to Berkeley by
* %sccs.include.redist.c%
static char sccsid
[] = "@(#)mail.c 5.1 (Berkeley) %G%";
* Routines to check for mail. (Perhaps make part of main.c?)
#include "exec.h" /* defines padvance() */
STATIC
int nmboxes
; /* number of mailboxes */
STATIC
time_t mailtime
[MAXMBOXES
]; /* times of mailboxes */
* Print appropriate message(s) if mail has arrived. If the argument is
* nozero, then the value of MAIL has changed, so we just update the
mpath
= mpathset()? mpathval() : mailval();
for (i
= 0 ; i
< nmboxes
; i
++) {
p
= padvance(&mpath
, nullstr
);
q
[-1] = '\0'; /* delete trailing '/' */
#ifdef notdef /* this is what the System V shell claims to do (it lies) */
if (statb
.st_mtime
> mailtime
[i
] && ! silent
) {
out2str(pathopt
? pathopt
: "you have mail");
mailtime
[i
] = statb
.st_mtime
;
#else /* this is what it should do */
if (statb
.st_size
> mailtime
[i
] && ! silent
) {
out2str(pathopt
? pathopt
: "you have mail");
mailtime
[i
] = statb
.st_size
;