File: checkmail.c

package info (click to toggle)
f-irc 1.36-1
  • links: PTS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, stretch
  • size: 632 kB
  • ctags: 904
  • sloc: ansic: 12,538; makefile: 61
file content (34 lines) | stat: -rw-r--r-- 764 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* GPLv2 applies
 * SVN revision: $Revision: 671 $
 * (C) 2006-2014 by folkert@vanheusden.com
 */
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>

#include "gen.h"
#include "config.h"

char *mail_spool_file = NULL;
struct stat msf_info;
off_t msf_prev_size = 0;
time_t msf_last_check = 0;

void init_check_mail(void)
{
	mail_spool_file = getenv("MAIL");

        if (check_for_mail > 0 && mail_spool_file != NULL)
        {
                if (stat(mail_spool_file, &msf_info) == -1)
                        check_for_mail = 0;
                else
                {
                        msf_prev_size = msf_info.st_size;

                        msf_last_check = time(NULL);
                }
        }
}