windows support
This commit is contained in:
parent
35213ac652
commit
ad6df6e3fd
6 changed files with 52 additions and 54 deletions
13
mbiff/mail.c
13
mbiff/mail.c
|
|
@ -4,16 +4,17 @@ static time_t last = 0;
|
|||
static char* mailpath;
|
||||
|
||||
void init_mail(void) {
|
||||
struct stat s;
|
||||
struct passwd* pwd = getpwuid(getuid());
|
||||
struct stat s;
|
||||
char* name = MDEUsersGetUsername();
|
||||
|
||||
if(getenv("MAIL") != NULL) {
|
||||
mailpath = malloc(strlen(getenv("MAIL")) + strlen(pwd->pw_name) + 1);
|
||||
sprintf(mailpath, getenv("MAIL"), pwd->pw_name);
|
||||
mailpath = malloc(strlen(getenv("MAIL")) + strlen(name) + 1);
|
||||
sprintf(mailpath, getenv("MAIL"), name);
|
||||
} else {
|
||||
mailpath = malloc(strlen(_PATH_MAILDIR) + 1 + strlen(pwd->pw_name) + 1);
|
||||
sprintf(mailpath, _PATH_MAILDIR "/%s", pwd->pw_name);
|
||||
mailpath = malloc(strlen(_PATH_MAILDIR) + 1 + strlen(name) + 1);
|
||||
sprintf(mailpath, _PATH_MAILDIR "/%s", name);
|
||||
}
|
||||
free(name);
|
||||
|
||||
if(stat(mailpath, &s) == 0) {
|
||||
last = s.st_mtime;
|
||||
|
|
|
|||
|
|
@ -11,8 +11,6 @@
|
|||
|
||||
/* Standard */
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <pwd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue