X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=lib-lua%2Fmadmutt.cpkg;h=270e198c48a28181c68442b16ba19f3a3f8ed02a;hp=89ff6f2153b7e86b6558d01d51c6cc34d187af5e;hb=bb89a1ca75e867edbe281dc848720a95650c24ce;hpb=558b0bd9de90a9dc28f409d8f46679bf48c72ded diff --git a/lib-lua/madmutt.cpkg b/lib-lua/madmutt.cpkg index 89ff6f2..270e198 100644 --- a/lib-lua/madmutt.cpkg +++ b/lib-lua/madmutt.cpkg @@ -25,22 +25,22 @@ #include "../mutt.h" -static const char *madmutt_init_shell(void) +static char *madmutt_init_shell(void) { struct passwd *pw = getpwuid(getuid()); - return pw ? pw->pw_shell : (getenv("SHELL") ?: "/bin/sh"); + return m_strdup(pw ? pw->pw_shell : (getenv("SHELL") ?: "/bin/sh")); } -static const char *madmutt_init_username(void) +static char *madmutt_init_username(void) { struct passwd *pw = getpwuid(getuid()); - return pw ? pw->pw_name : (getenv("USER") ?: "john_doe"); + return m_strdup(pw ? pw->pw_name : (getenv("USER") ?: "john_doe")); } -static const char *madmutt_init_homedir(void) +static char *madmutt_init_homedir(void) { struct passwd *pw = getpwuid(getuid()); - return pw ? pw->pw_dir : (getenv("HOME") ?: "/"); + return m_strdup(pw ? pw->pw_dir : (getenv("HOME") ?: "/")); } static const char *madmutt_pwd(void) @@ -63,14 +63,18 @@ static const char *luaM_path_post(const char *val) }; @type string_t = { - .kind = 's'; - .ctype = const char *; + .kind = 's'; + .ctype = char *; + .dtor = p_delete($$); + .ctor = m_strdup($$); }; @type path_t = { .push = luaM_path_post($$); .kind = 's'; .ctype = char *; + .dtor = p_delete($$); + .ctor = m_strdup($$); }; @type quadopt_t = { @@ -96,12 +100,12 @@ static const char *luaM_path_post(const char *val) const string_t docdir = PKGDOCDIR; const string_t hcache_backend = HCACHE_BACKEND; - path_t dotlock = BINDIR "/mutt_dotlock"; - path_t editor = getenv("VISUAL") ?: getenv("EDITOR") ?: "vi"; + path_t dotlock = m_strdup(BINDIR "/mutt_dotlock"); + path_t editor = m_strdup(getenv("VISUAL") ?: getenv("EDITOR") ?: "vi"); path_t shell = madmutt_init_shell(); path_t username = madmutt_init_username(); path_t homedir = madmutt_init_homedir(); - path_t tmpdir = getenv("TMPDIR") ?: "/tmp"; + path_t tmpdir = m_strdup(getenv("TMPDIR") ?: "/tmp"); quadopt_t quit = M_YES; bool beep = 1; @@ -111,7 +115,7 @@ static const char *luaM_path_post(const char *val) } MCore; @package MTransport { - path_t sendmail = SENDMAIL " -eom -oi"; + path_t sendmail = m_strdup(SENDMAIL " -eom -oi"); string_t dsn_notify = NULL; string_t dsn_return = NULL;