X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=init.c;h=a9b318e61b8c1f6b718dc04c452126a2b595c8a5;hp=1c3227054a23ab53f5da45b3bfbba24d608562b1;hb=dbacadf0ce81052365d7a43373ac7d4ac67ff91e;hpb=766fd6928123218aca635827248299ceeeb1d170 diff --git a/init.c b/init.c index 1c32270..a9b318e 100644 --- a/init.c +++ b/init.c @@ -21,19 +21,24 @@ #include #include #include +#include +#include + +#include + +#include #include "mutt.h" -#include "mutt_curses.h" #include "history.h" #include "keymap.h" #include "mbyte.h" #include "charset.h" #include "thread.h" -#include "mutt_crypt.h" +#include #include "mutt_idna.h" #if defined(USE_SSL) || defined(USE_GNUTLS) -#include "mutt_ssl.h" +#include #endif #if defined (USE_LIBESMTP) && (defined (USE_SSL) || defined (USE_GNUTLS)) @@ -43,9 +48,7 @@ #include "mx.h" #include "init.h" -#include "lib/rx.h" #include "lib/list.h" -#include "lib/debug.h" #include #include @@ -263,15 +266,15 @@ static void sys_to_string (char* dst, size_t dstlen, char *val = NULL, *t = NULL; int clean = 0; - /* get some $muttng_ values dynamically */ - if (ascii_strcmp ("muttng_pwd", option->option) == 0) { + /* get some $madmutt_ values dynamically */ + if (ascii_strcmp ("madmutt_pwd", option->option) == 0) { val = p_new(char, _POSIX_PATH_MAX); val = getcwd (val, _POSIX_PATH_MAX-1); clean = 1; - } else if (ascii_strcmp ("muttng_folder_path", option->option) == 0 && + } else if (ascii_strcmp ("madmutt_folder_path", option->option) == 0 && CurrentFolder && *CurrentFolder) { val = CurrentFolder; - } else if (ascii_strcmp ("muttng_folder_name", option->option) == 0 && + } else if (ascii_strcmp ("madmutt_folder_name", option->option) == 0 && CurrentFolder && *CurrentFolder) { ssize_t Maildirlength = m_strlen(Maildir); @@ -670,7 +673,7 @@ static int add_to_rx_list (list2_t** list, const char *s, int flags, i = rx_lookup ((*list), rx->pattern); if (i >= 0) - rx_free (&rx); + rx_delete(&rx); else list_push_back (list, rx); return 0; @@ -753,7 +756,7 @@ static int remove_from_spam_list (SPAM_LIST ** list, const char *pat) return 0; if (spam->rx && !m_strcmp(spam->rx->pattern, pat)) { *list = spam->next; - rx_free (&spam->rx); + rx_delete(&spam->rx); p_delete(&spam->template); p_delete(&spam); return 1; @@ -763,7 +766,7 @@ static int remove_from_spam_list (SPAM_LIST ** list, const char *pat) for (spam = prev->next; spam;) { if (!m_strcmp(spam->rx->pattern, pat)) { prev->next = spam->next; - rx_free (&spam->rx); + rx_delete(&spam->rx); p_delete(&spam->template); p_delete(&spam); spam = prev->next; @@ -808,14 +811,14 @@ static int remove_from_rx_list (list2_t** l, const char *str) int i = 0; if (m_strcmp("*", str) == 0) { - list_del (l, (list_del_t*) rx_free); + list_del (l, (list_del_t*) rx_delete); return (0); } else { i = rx_lookup ((*l), str); if (i >= 0) { rx_t* r = list_pop_idx ((*l), i); - rx_free (&r); + rx_delete(&r); return (0); } } @@ -1025,7 +1028,7 @@ static int parse_spam_list (BUFFER * buf, BUFFER * s, unsigned long data, /* "*" is a special case. */ if (!m_strcmp(buf->data, "*")) { mutt_free_spam_list (&SpamList); - list_del (&NoSpamList, (list_del_t*) rx_free); + list_del (&NoSpamList, (list_del_t*) rx_delete); return 0; } @@ -2006,7 +2009,7 @@ static int parse_set (BUFFER * tmp, BUFFER * s, unsigned long data, break; } - /* the $muttng_ variables are read-only */ + /* the $madmutt_ variables are read-only */ if (!FuncTable[DTYPE (option->type)].opt_from_string) { snprintf (err->data, err->dsize, _("$%s is read-only"), option->option); @@ -2232,7 +2235,7 @@ char User_typed[LONG_STRING] = { 0 }; int Num_matched = 0; /* Number of matches for completion */ char Completed[STRING] = { 0 }; /* completed string (command or variable) */ -const char *Matches[MAX (NUMVARS, NUMCOMMANDS) + 1]; /* all the matches + User_typed */ +char *Matches[MAX (NUMVARS, NUMCOMMANDS) + 1]; /* all the matches + User_typed */ /* helper function for completion. Changes the dest buffer if necessary/possible to aid completion. @@ -2274,8 +2277,8 @@ int mutt_command_complete (char *buffer, size_t len, int pos, int numtabs) if (numtabs == 1) { Num_matched = 0; m_strcpy(User_typed, sizeof(User_typed), pt); - p_clear(Matches, sizeof(Matches)); - p_clear(Completed, sizeof(Completed)); + p_clear(Matches, countof(Matches)); + p_clear(Completed, countof(Completed)); for (num = 0; Commands[num].name; num++) candidate (Completed, User_typed, Commands[num].name, sizeof(Completed)); @@ -2323,8 +2326,8 @@ int mutt_command_complete (char *buffer, size_t len, int pos, int numtabs) if (numtabs == 1) { Num_matched = 0; m_strcpy(User_typed, sizeof(User_typed), pt); - p_clear(Matches, sizeof(Matches)); - p_clear(Completed, sizeof(Completed)); + p_clear(Matches, countof(Matches)); + p_clear(Completed, countof(Completed)); for (num = 0; MuttVars[num].option; num++) candidate(Completed, User_typed, MuttVars[num].option, sizeof(Completed)); @@ -2361,8 +2364,8 @@ int mutt_command_complete (char *buffer, size_t len, int pos, int numtabs) if (numtabs == 1) { Num_matched = 0; m_strcpy(User_typed, sizeof(User_typed), pt); - p_clear(Matches, sizeof(Matches)); - p_clear(Completed, sizeof(Completed)); + p_clear(Matches, countof(Matches)); + p_clear(Completed, countof(Completed)); for (num = 0; menu[num].name; num++) candidate (Completed, User_typed, menu[num].name, sizeof(Completed)); /* try the generic menu */ @@ -2607,7 +2610,8 @@ void mutt_init (int skip_sys_rc, LIST * commands) if (!Homedir) Homedir = m_strdup(pw->pw_dir); - Realname = m_strdup(mutt_gecos_name (rnbuf, sizeof(rnbuf), pw)); + mutt_gecos_name(rnbuf, sizeof(rnbuf), pw, GecosMask.rx); + Realname = m_strdup(rnbuf); Shell = m_strdup(pw->pw_shell); endpwent (); } @@ -2702,7 +2706,6 @@ void mutt_init (int skip_sys_rc, LIST * commands) p = "vi"; } Editor = m_strdup(p); - Visual = m_strdup(p); if ((p = getenv ("REPLYTO")) != NULL) { BUFFER buf, token; @@ -2763,18 +2766,18 @@ void mutt_init (int skip_sys_rc, LIST * commands) if (!Muttrc) { #if 0 - snprintf (buffer, sizeof(buffer), "%s/.muttngrc-%s", NONULL (Homedir), + snprintf (buffer, sizeof(buffer), "%s/.madmuttrc-%s", NONULL (Homedir), MUTT_VERSION); if (access (buffer, F_OK) == -1) #endif - snprintf (buffer, sizeof(buffer), "%s/.muttngrc", NONULL (Homedir)); + snprintf (buffer, sizeof(buffer), "%s/.madmuttrc", NONULL (Homedir)); if (access (buffer, F_OK) == -1) #if 0 - snprintf (buffer, sizeof(buffer), "%s/.muttng/muttngrc-%s", + snprintf (buffer, sizeof(buffer), "%s/.madmutt/madmuttrc-%s", NONULL (Homedir), MUTT_VERSION); if (access (buffer, F_OK) == -1) #endif - snprintf (buffer, sizeof(buffer), "%s/.muttng/muttngrc", + snprintf (buffer, sizeof(buffer), "%s/.madmutt/madmuttrc", NONULL (Homedir)); default_rc = 1; @@ -2792,15 +2795,15 @@ void mutt_init (int skip_sys_rc, LIST * commands) /* Process the global rc file if it exists and the user hasn't explicity requested not to via "-n". */ if (!skip_sys_rc) { - snprintf (buffer, sizeof(buffer), "%s/Muttngrc-%s", SYSCONFDIR, + snprintf (buffer, sizeof(buffer), "%s/Madmuttrc-%s", SYSCONFDIR, MUTT_VERSION); if (access (buffer, F_OK) == -1) - snprintf (buffer, sizeof(buffer), "%s/Muttngrc", SYSCONFDIR); + snprintf (buffer, sizeof(buffer), "%s/Madmuttrc", SYSCONFDIR); if (access (buffer, F_OK) == -1) - snprintf (buffer, sizeof(buffer), "%s/Muttngrc-%s", PKGDATADIR, + snprintf (buffer, sizeof(buffer), "%s/Madmuttrc-%s", PKGDATADIR, MUTT_VERSION); if (access (buffer, F_OK) == -1) - snprintf (buffer, sizeof(buffer), "%s/Muttngrc", PKGDATADIR); + snprintf (buffer, sizeof(buffer), "%s/Madmuttrc", PKGDATADIR); if (access (buffer, F_OK) != -1) { if (source_rc (buffer, &err) != 0) { fputs (err.data, stderr);