{
const char *idx = luaL_checkstring(L, 2);
const char *val = luaL_checkstring(L, 3);
+ char buf[STRING];
switch (lua_which_token(idx, -1)) {
default:
luaL_error(L, "bad subscript to madmutt: %s", val);
return 0;
+ case LTK_DOTLOCK:
case LTK_SENDMAIL:
case LTK_SHELL:
+ _mutt_expand_path(buf, sizeof(buf), val, 0);
+ val = buf;
break;
}
** header chaching's database backend.\fP
*/
#endif
+
+ {"dotlock", BINDIR "/mutt_dotlock"},
+ /*
+ ** .pp
+ ** Contains the path of the \fTmadmutt_dotlock(1)\fP binary to be used by
+ ** Madmutt.
+ */
+ {"sendmail", SENDMAIL " -oem -oi"},
+ /*
+ ** .pp
+ ** Specifies the program and arguments used to deliver mail sent by Madmutt.
+ ** Madmutt expects that the specified program interprets additional
+ ** arguments as recipient addresses.
+ */
};
-static const char *madmutt_init_shell(void)
+static void madmutt_init_shell(char *buf, ssize_t len)
{
struct passwd *pw = getpwuid(getuid());
- if (pw)
- return pw->pw_shell;
- return getenv("SHELL") ?: "/bin/sh";
+ if (pw) {
+ m_strcpy(buf, len, pw->pw_shell);
+ _mutt_expand_path(buf, len, pw->pw_shell, 0);
+ } else {
+ m_strcpy(buf, len, getenv("SHELL") ?: "/bin/sh");
+ }
}
static const struct {
- const char *k;
- const char *(*f)(void);
+ const char *key;
+ void (*fun)(char *buf, ssize_t len);
} madmutt_module_vars2[] = {
{ "shell", madmutt_init_shell },
/*
}
for (i = 0; i < countof(madmutt_module_vars2); i++) {
- lua_pushstring(L, madmutt_module_vars2[i].f());
- lua_setfield(L, -2, madmutt_module_vars2[i].k);
+ char buf[STRING];
+ (madmutt_module_vars2[i].fun)(buf, sizeof(buf));
+ lua_pushstring(L, buf);
+ lua_setfield(L, -2, madmutt_module_vars2[i].key);
}
lua_pushstring(L, "__index");