|
|
@ -21,6 +21,14 @@ blaze822_home_file(char *basename)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
static char path[PATH_MAX];
|
|
|
|
static char path[PATH_MAX];
|
|
|
|
static char *homedir;
|
|
|
|
static char *homedir;
|
|
|
|
|
|
|
|
static char *profile;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!profile)
|
|
|
|
|
|
|
|
profile = getenv("MBLAZE");
|
|
|
|
|
|
|
|
if (profile) {
|
|
|
|
|
|
|
|
snprintf(path, sizeof path, "%s/%s", profile, basename);
|
|
|
|
|
|
|
|
return path;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!homedir)
|
|
|
|
if (!homedir)
|
|
|
|
homedir = getenv("HOME");
|
|
|
|
homedir = getenv("HOME");
|
|
|
@ -34,7 +42,7 @@ blaze822_home_file(char *basename)
|
|
|
|
if (!homedir)
|
|
|
|
if (!homedir)
|
|
|
|
return "/dev/null/homeless";
|
|
|
|
return "/dev/null/homeless";
|
|
|
|
|
|
|
|
|
|
|
|
snprintf(path, sizeof path, "%s/%s", homedir, basename);
|
|
|
|
snprintf(path, sizeof path, "%s/.mblaze/%s", homedir, basename);
|
|
|
|
|
|
|
|
|
|
|
|
return path;
|
|
|
|
return path;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -49,7 +57,7 @@ blaze822_seq_open(char *file)
|
|
|
|
if (!file)
|
|
|
|
if (!file)
|
|
|
|
file = getenv("MAILSEQ");
|
|
|
|
file = getenv("MAILSEQ");
|
|
|
|
if (!file)
|
|
|
|
if (!file)
|
|
|
|
file = blaze822_home_file(".mblaze/seq");
|
|
|
|
file = blaze822_home_file("seq");
|
|
|
|
fd = open(file, O_RDONLY);
|
|
|
|
fd = open(file, O_RDONLY);
|
|
|
|
if (!fd)
|
|
|
|
if (!fd)
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
@ -138,7 +146,7 @@ blaze822_seq_cur(void)
|
|
|
|
|
|
|
|
|
|
|
|
char *curlink = getenv("MAILCUR");
|
|
|
|
char *curlink = getenv("MAILCUR");
|
|
|
|
if (!curlink)
|
|
|
|
if (!curlink)
|
|
|
|
curlink = blaze822_home_file(".mblaze/cur");
|
|
|
|
curlink = blaze822_home_file("cur");
|
|
|
|
|
|
|
|
|
|
|
|
int r = readlink(curlink, b, sizeof b - 1);
|
|
|
|
int r = readlink(curlink, b, sizeof b - 1);
|
|
|
|
if (r < 0)
|
|
|
|
if (r < 0)
|
|
|
@ -157,7 +165,7 @@ blaze822_seq_setcur(char *s)
|
|
|
|
char curtmplink[PATH_MAX];
|
|
|
|
char curtmplink[PATH_MAX];
|
|
|
|
char *curlink = getenv("MAILCUR");
|
|
|
|
char *curlink = getenv("MAILCUR");
|
|
|
|
if (!curlink)
|
|
|
|
if (!curlink)
|
|
|
|
curlink = blaze822_home_file(".mblaze/cur");
|
|
|
|
curlink = blaze822_home_file("cur");
|
|
|
|
|
|
|
|
|
|
|
|
if (snprintf(curtmplink, sizeof curtmplink, "%s-", curlink) >= PATH_MAX)
|
|
|
|
if (snprintf(curtmplink, sizeof curtmplink, "%s-", curlink) >= PATH_MAX)
|
|
|
|
return -1; // truncation
|
|
|
|
return -1; // truncation
|
|
|
|