/* load entropy from egd sockets */
#ifdef HAVE_RAND_EGD
- add_entropy(getenv("EGDSOCKET"));
+ add_entropy(mutt_str_getenv("EGDSOCKET"));
snprintf(path, sizeof(path), "%s/.entropy", NONULL(HomeDir));
add_entropy(path);
add_entropy("/tmp/entropy");
*/
bool mutt_ts_capability(void)
{
- char *term = getenv("TERM");
+ const char *term = mutt_str_getenv("TERM");
char *tcaps = NULL;
#ifdef HAVE_USE_EXTENDED_NAMES
int tcapi;
*/
static int is_mmnoask(const char *buf)
{
- char tmp[LONG_STRING], *p = NULL, *q = NULL;
+ char *p = NULL;
+ const char *val = NULL;
+ char tmp[LONG_STRING], *q = NULL;
int lng;
- p = getenv("MM_NOASK");
- if (p && *p)
+ val = mutt_str_getenv("MM_NOASK");
+ if (val)
{
- if (mutt_str_strcmp(p, "1") == 0)
+ if (mutt_str_strcmp(val, "1") == 0)
return 1;
- mutt_str_strfcpy(tmp, p, sizeof(tmp));
+ mutt_str_strfcpy(tmp, val, sizeof(tmp));
p = tmp;
while ((p = strtok(p, ",")) != NULL)
}
if (var)
{
- if ((env = getenv(var)) || (env = myvar_get(var)))
+ if ((env = mutt_str_getenv(var)) || (env = myvar_get(var)))
mutt_buffer_addstr(dest, env);
else if ((idx = mutt_option_index(var)) != -1)
{
{
struct passwd *pw = NULL;
struct utsname utsname;
- char *p, buffer[STRING];
+ const char *p = NULL;
+ char buffer[STRING];
int need_pause = 0;
struct Buffer err;
/* on one of the systems I use, getcwd() does not return the same prefix
as is listed in the passwd file */
- p = getenv("HOME");
+ p = mutt_str_getenv("HOME");
if (p)
HomeDir = mutt_str_strdup(p);
fputs(_("unable to determine home directory"), stderr);
exit(1);
}
- p = getenv("USER");
+ p = mutt_str_getenv("USER");
if (p)
Username = mutt_str_strdup(p);
else
fputs(_("unable to determine username"), stderr);
exit(1);
}
- Shell = mutt_str_strdup((p = getenv("SHELL")) ? p : "/bin/sh");
+ Shell = mutt_str_strdup((p = mutt_str_getenv("SHELL")) ? p : "/bin/sh");
}
/* Start up debugging mode if requested from cmdline */
#endif
#ifdef USE_NNTP
- p = getenv("NNTPSERVER");
+ p = mutt_str_getenv("NNTPSERVER");
if (p)
{
FREE(&NewsServer);
}
#endif
- p = getenv("MAIL");
+ p = mutt_str_getenv("MAIL");
if (p)
SpoolFile = mutt_str_strdup(p);
- else if ((p = getenv("MAILDIR")))
+ else if ((p = mutt_str_getenv("MAILDIR")))
SpoolFile = mutt_str_strdup(p);
else
{
SpoolFile = mutt_str_strdup(buffer);
}
- p = getenv("MAILCAPS");
+ p = mutt_str_getenv("MAILCAPS");
if (p)
MailcapPath = mutt_str_strdup(p);
else
"/mailcap:/etc/mailcap:/usr/etc/mailcap:/usr/local/etc/mailcap");
}
- Tmpdir = mutt_str_strdup((p = getenv("TMPDIR")) ? p : "/tmp");
+ Tmpdir = mutt_str_strdup((p = mutt_str_getenv("TMPDIR")) ? p : "/tmp");
- p = getenv("VISUAL");
+ p = mutt_str_getenv("VISUAL");
if (!p)
{
- p = getenv("EDITOR");
+ p = mutt_str_getenv("EDITOR");
if (!p)
p = "vi";
}
Editor = mutt_str_strdup(p);
Visual = mutt_str_strdup(p);
- p = getenv("REPLYTO");
+ p = mutt_str_getenv("REPLYTO");
if (p)
{
struct Buffer buf, token;
FREE(&token.data);
}
- p = getenv("EMAIL");
+ p = mutt_str_getenv("EMAIL");
if (p)
From = mutt_addr_parse_list(NULL, p);
#ifndef LOCALES_HACK
/* Do we have a locale definition? */
- if (((p = getenv("LC_ALL")) != NULL && p[0]) || ((p = getenv("LANG")) != NULL && p[0]) ||
- ((p = getenv("LC_CTYPE")) != NULL && p[0]))
+ if (((p = mutt_str_getenv("LC_ALL")) != NULL && p[0]) || ((p = mutt_str_getenv("LANG")) != NULL && p[0]) ||
+ ((p = mutt_str_getenv("LC_CTYPE")) != NULL && p[0]))
{
OPT_LOCALES = true;
}
if (STAILQ_EMPTY(&Muttrc))
{
- char *xdg_cfg_home = getenv("XDG_CONFIG_HOME");
+ const char *xdg_cfg_home = mutt_str_getenv("XDG_CONFIG_HOME");
if (!xdg_cfg_home && HomeDir)
{
#ifdef ENABLE_NLS
/* FIXME what about the LOCALES_HACK in mutt_init() [init.c] ? */
{
- char *domdir = getenv("TEXTDOMAINDIR");
- if (domdir && domdir[0])
+ const char *domdir = mutt_str_getenv("TEXTDOMAINDIR");
+ if (domdir)
bindtextdomain(PACKAGE, domdir);
else
bindtextdomain(PACKAGE, MUTTLOCALEDIR);
*/
int mutt_set_xdg_path(enum XdgType type, char *buf, size_t bufsize)
{
- char *xdg_env = getenv(xdg_env_vars[type]);
+ const char *xdg_env = mutt_str_getenv(xdg_env_vars[type]);
char *xdg = (xdg_env && *xdg_env) ? mutt_str_strdup(xdg_env) :
mutt_str_strdup(xdg_defaults[type]);
char *x = xdg; /* strsep() changes xdg, so free x instead later */
short secring = 0;
const char *tmp_kring = NULL;
- char *env_pgppath = NULL, *env_home = NULL;
+ const char *env_pgppath = NULL;
+ const char *env_home = NULL;
char pgppath[_POSIX_PATH_MAX];
char kring[_POSIX_PATH_MAX];
mutt_str_strfcpy(kring, tmp_kring, sizeof(kring));
else
{
- env_pgppath = getenv("PGPPATH");
+ env_pgppath = mutt_str_getenv("PGPPATH");
if (env_pgppath)
mutt_str_strfcpy(pgppath, env_pgppath, sizeof(pgppath));
- else if ((env_home = getenv("HOME")))
+ else if ((env_home = mutt_str_getenv("HOME")))
snprintf(pgppath, sizeof(pgppath), "%s/.pgp", env_home);
else
{
*/
void mutt_resize_screen(void)
{
- char *cp = NULL;
+ const char *cp = NULL;
int fd;
struct winsize w;
#ifdef HAVE_RESIZETERM
}
if (SLtt_Screen_Rows <= 0)
{
- cp = getenv("LINES");
+ cp = mutt_str_getenv("LINES");
if (cp && (mutt_str_atoi(cp, &SLtt_Screen_Rows) < 0))
SLtt_Screen_Rows = 24;
}
if (SLtt_Screen_Cols <= 0)
{
- cp = getenv("COLUMNS");
+ cp = mutt_str_getenv("COLUMNS");
if (cp && (mutt_str_atoi(cp, &SLtt_Screen_Cols) < 0))
SLtt_Screen_Cols = 80;
}