format
This commit is contained in:
parent
1b9bac2611
commit
1c4e999ebe
7 changed files with 65 additions and 32 deletions
22
mbiff/mail.c
22
mbiff/mail.c
|
|
@ -1,33 +1,33 @@
|
|||
#include "mbiff.h"
|
||||
|
||||
static time_t last = 0;
|
||||
static char* mailpath;
|
||||
static char* mailpath;
|
||||
|
||||
void init_mail(void){
|
||||
struct stat s;
|
||||
void init_mail(void) {
|
||||
struct stat s;
|
||||
struct passwd* pwd = getpwuid(getuid());
|
||||
|
||||
if(getenv("MAIL") != NULL){
|
||||
if(getenv("MAIL") != NULL) {
|
||||
mailpath = malloc(strlen(getenv("MAIL")) + strlen(pwd->pw_name) + 1);
|
||||
sprintf(mailpath, getenv("MAIL"), pwd->pw_name);
|
||||
}else{
|
||||
} else {
|
||||
mailpath = malloc(strlen(_PATH_MAILDIR) + 1 + strlen(pwd->pw_name) + 1);
|
||||
sprintf(mailpath, _PATH_MAILDIR "/%s", pwd->pw_name);
|
||||
}
|
||||
|
||||
if(stat(mailpath, &s) == 0){
|
||||
if(stat(mailpath, &s) == 0) {
|
||||
last = s.st_mtime;
|
||||
}
|
||||
}
|
||||
|
||||
void check_mail(void){
|
||||
void check_mail(void) {
|
||||
struct stat s;
|
||||
s.st_mtime = 0;
|
||||
if(stat(mailpath, &s) == 0 || last != 0){
|
||||
if((s.st_mtime == 0 && last != 0) || s.st_mtime > last){
|
||||
if(stat(mailpath, &s) == 0 || last != 0) {
|
||||
if((s.st_mtime == 0 && last != 0) || s.st_mtime > last) {
|
||||
MwVaApply(image,
|
||||
MwNpixmap, full,
|
||||
NULL);
|
||||
MwNpixmap, full,
|
||||
NULL);
|
||||
}
|
||||
|
||||
last = s.st_mtime;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue