home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / security / shadow-3.1.4 / mail.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-11-26  |  1.0 KB  |  50 lines

  1. /*
  2.  * Copyright 1989, 1990, 1991, John F. Haugh II
  3.  * All rights reserved.
  4.  *
  5.  * Permission is granted to copy and create derivative works for any
  6.  * non-commercial purpose, provided this copyright notice is preserved
  7.  * in all copies of source code, or included in human readable form
  8.  * and conspicuously displayed on all copies of object code or
  9.  * distribution media.
  10.  */
  11.  
  12. #include <sys/types.h>
  13. #include <sys/stat.h>
  14.  
  15. #ifndef    BSD
  16. #include <string.h>
  17. #include <memory.h>
  18. #else
  19. #include <strings.h>
  20. #define    strchr    index
  21. #define    strrchr    rindex
  22. #endif
  23.  
  24. #include "config.h"
  25.  
  26. #ifndef    lint
  27. static    char    sccsid[] = "@(#)mail.c    3.3    07:43:42    9/17/91";
  28. #endif
  29.  
  30. extern    char    *getenv();
  31. extern    int    getdef_bool();
  32.  
  33. void    mailcheck ()
  34. {
  35.     struct    stat    statbuf;
  36.     char    *mailbox;
  37.  
  38.     if (! getdef_bool("MAIL_CHECK_ENAB"))
  39.         return;
  40.     if (! (mailbox = getenv ("MAIL")))
  41.         return;
  42.  
  43.     if (stat (mailbox, &statbuf) == -1 || statbuf.st_size == 0)
  44.         puts ("No mail.");
  45.     else if (statbuf.st_atime > statbuf.st_mtime)
  46.         puts ("You have mail.");
  47.     else
  48.         puts ("You have new mail.");
  49. }
  50.