projects
/
apps
/
madmutt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
not having wide chars is soooo 90, please, I *really* don't care with
[apps/madmutt.git]
/
init.c
diff --git
a/init.c
b/init.c
index
d7eef24
..
8bd2854
100644
(file)
--- a/
init.c
+++ b/
init.c
@@
-22,20
+22,22
@@
#include <lib-lib/buffer.h>
#include <lib-lib/mapping.h>
#include <lib-lib/debug.h>
#include <lib-lib/buffer.h>
#include <lib-lib/mapping.h>
#include <lib-lib/debug.h>
+#include <lib-lib/rx.h>
+
+#include <lib-sys/unix.h>
#include <lib-ui/curses.h>
#include <lib-ui/curses.h>
+#include <lib-ui/history.h>
#include "mutt.h"
#include "mutt.h"
-#include "history.h"
#include "keymap.h"
#include "keymap.h"
-#include "mbyte.h"
#include "charset.h"
#include "thread.h"
#include <lib-crypt/crypt.h>
#include "mutt_idna.h"
#if defined(USE_SSL) || defined(USE_GNUTLS)
#include "charset.h"
#include "thread.h"
#include <lib-crypt/crypt.h>
#include "mutt_idna.h"
#if defined(USE_SSL) || defined(USE_GNUTLS)
-#include <lib-
network
/mutt_ssl.h>
+#include <lib-
sys
/mutt_ssl.h>
#endif
#if defined (USE_LIBESMTP) && (defined (USE_SSL) || defined (USE_GNUTLS))
#endif
#if defined (USE_LIBESMTP) && (defined (USE_SSL) || defined (USE_GNUTLS))
@@
-45,7
+47,6
@@
#include "mx.h"
#include "init.h"
#include "mx.h"
#include "init.h"
-#include "lib/rx.h"
#include "lib/list.h"
#include <ctype.h>
#include "lib/list.h"
#include <ctype.h>
@@
-527,7
+528,7
@@
static int addr_from_string (struct option_t* dst, const char* val,
char* errbuf __attribute__ ((unused)), size_t errlen __attribute__ ((unused))) {
if (!dst)
return (0);
char* errbuf __attribute__ ((unused)), size_t errlen __attribute__ ((unused))) {
if (!dst)
return (0);
- address_
delete
((address_t**) dst->data);
+ address_
list_wipe
((address_t**) dst->data);
if (val && *val)
*((address_t**) dst->data) = rfc822_parse_adrlist (NULL, val);
return (1);
if (val && *val)
*((address_t**) dst->data) = rfc822_parse_adrlist (NULL, val);
return (1);
@@
-624,9
+625,9
@@
int query_quadoption (int opt, const char *prompt)
/* not reached */
}
/* not reached */
}
-static void add_to_list (
LIST
** list, const char *str)
+static void add_to_list (
string_list_t
** list, const char *str)
{
{
-
LIST
*t, *last = NULL;
+
string_list_t
*t, *last = NULL;
/* don't add a NULL or empty string to the list */
if (!str || *str == '\0')
/* don't add a NULL or empty string to the list */
if (!str || *str == '\0')
@@
-644,7
+645,7
@@
static void add_to_list (LIST ** list, const char *str)
}
if (!*list || last) {
}
if (!*list || last) {
- t = p_new(
LIST
, 1);
+ t = p_new(
string_list_t
, 1);
t->data = m_strdup(str);
if (last) {
last->next = t;
t->data = m_strdup(str);
if (last) {
last->next = t;
@@
-671,7
+672,7
@@
static int add_to_rx_list (list2_t** list, const char *s, int flags,
i = rx_lookup ((*list), rx->pattern);
if (i >= 0)
i = rx_lookup ((*list), rx->pattern);
if (i >= 0)
- rx_
free
(&rx);
+ rx_
delete
(&rx);
else
list_push_back (list, rx);
return 0;
else
list_push_back (list, rx);
return 0;
@@
-754,7
+755,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;
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;
p_delete(&spam->template);
p_delete(&spam);
return 1;
@@
-764,7
+765,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;
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;
p_delete(&spam->template);
p_delete(&spam);
spam = prev->next;
@@
-778,12
+779,12
@@
static int remove_from_spam_list (SPAM_LIST ** list, const char *pat)
}
}
-static void remove_from_list (
LIST
** l, const char *str)
+static void remove_from_list (
string_list_t
** l, const char *str)
{
{
-
LIST
*p, *last = NULL;
+
string_list_t
*p, *last = NULL;
if (m_strcmp("*", str) == 0)
if (m_strcmp("*", str) == 0)
-
mutt_free_list
(l); /* ``unCMD *'' means delete all current entries */
+
string_list_wipe
(l); /* ``unCMD *'' means delete all current entries */
else {
p = *l;
last = NULL;
else {
p = *l;
last = NULL;
@@
-809,14
+810,14
@@
static int remove_from_rx_list (list2_t** l, const char *str)
int i = 0;
if (m_strcmp("*", str) == 0) {
int i = 0;
if (m_strcmp("*", str) == 0) {
- list_del (l, (list_del_t*) rx_
fre
e);
+ list_del (l, (list_del_t*) rx_
delet
e);
return (0);
}
else {
i = rx_lookup ((*l), str);
if (i >= 0) {
rx_t* r = list_pop_idx ((*l), i);
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);
}
}
return (0);
}
}
@@
-925,7
+926,7
@@
static int parse_list (BUFFER * buf, BUFFER * s,
{
do {
mutt_extract_token (buf, s, 0);
{
do {
mutt_extract_token (buf, s, 0);
- add_to_list ((
LIST
**) data, buf->data);
+ add_to_list ((
string_list_t
**) data, buf->data);
}
while (MoreArgs (s));
}
while (MoreArgs (s));
@@
-1026,7
+1027,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);
/* "*" is a special case. */
if (!m_strcmp(buf->data, "*")) {
mutt_free_spam_list (&SpamList);
- list_del (&NoSpamList, (list_del_t*) rx_
fre
e);
+ list_del (&NoSpamList, (list_del_t*) rx_
delet
e);
return 0;
}
return 0;
}
@@
-1055,10
+1056,10
@@
static int parse_unlist (BUFFER * buf, BUFFER * s, unsigned long data,
* Check for deletion of entire list
*/
if (m_strcmp(buf->data, "*") == 0) {
* Check for deletion of entire list
*/
if (m_strcmp(buf->data, "*") == 0) {
-
mutt_free_list ((LIST
**) data);
+
string_list_wipe((string_list_t
**) data);
break;
}
break;
}
- remove_from_list ((
LIST
**) data, buf->data);
+ remove_from_list ((
string_list_t
**) data, buf->data);
}
while (MoreArgs (s));
}
while (MoreArgs (s));
@@
-1090,10
+1091,10
@@
static void _attachments_clean (void) {
}
}
}
}
-static int parse_attach_list (BUFFER *buf, BUFFER *s,
LIST
**ldata,
+static int parse_attach_list (BUFFER *buf, BUFFER *s,
string_list_t
**ldata,
BUFFER *err __attribute__ ((unused))) {
ATTACH_MATCH *a;
BUFFER *err __attribute__ ((unused))) {
ATTACH_MATCH *a;
-
LIST
*listp, *lastp;
+
string_list_t
*listp, *lastp;
char *p;
char *tmpminor;
int len;
char *p;
char *tmpminor;
int len;
@@
-1147,7
+1148,7
@@
static int parse_attach_list (BUFFER *buf, BUFFER *s, LIST **ldata,
debug_print (5, ("parse_attach_list: added %s/%s [%d]\n",
a->major, a->minor, a->major_int));
debug_print (5, ("parse_attach_list: added %s/%s [%d]\n",
a->major, a->minor, a->major_int));
- listp = p_new(
LIST
, 1);
+ listp = p_new(
string_list_t
, 1);
listp->data = (char *)a;
listp->next = NULL;
if (lastp) {
listp->data = (char *)a;
listp->next = NULL;
if (lastp) {
@@
-1163,10
+1164,10
@@
static int parse_attach_list (BUFFER *buf, BUFFER *s, LIST **ldata,
return 0;
}
return 0;
}
-static int parse_unattach_list (BUFFER *buf, BUFFER *s,
LIST
**ldata,
+static int parse_unattach_list (BUFFER *buf, BUFFER *s,
string_list_t
**ldata,
BUFFER *err __attribute__ ((unused))) {
ATTACH_MATCH *a;
BUFFER *err __attribute__ ((unused))) {
ATTACH_MATCH *a;
-
LIST
*lp, *lastp, *newlp;
+
string_list_t
*lp, *lastp, *newlp;
char *tmp;
int major;
char *minor;
char *tmp;
int major;
char *minor;
@@
-1190,7
+1191,7
@@
static int parse_unattach_list (BUFFER *buf, BUFFER *s, LIST **ldata,
major = mutt_check_mime_type(tmp);
/* We must do our own walk here because remove_from_list() will only
major = mutt_check_mime_type(tmp);
/* We must do our own walk here because remove_from_list() will only
- * remove the
LIST->data, not anything pointed to by the LIST
->data. */
+ * remove the
string_list_t->data, not anything pointed to by the string_list_t
->data. */
lastp = NULL;
for(lp = *ldata; lp; ) {
a = (ATTACH_MATCH *)lp->data;
lastp = NULL;
for(lp = *ldata; lp; ) {
a = (ATTACH_MATCH *)lp->data;
@@
-1226,7
+1227,7
@@
static int parse_unattach_list (BUFFER *buf, BUFFER *s, LIST **ldata,
return 0;
}
return 0;
}
-static int print_attach_list (
LIST
*lp, char op, const char *name) {
+static int print_attach_list (
string_list_t
*lp, char op, const char *name) {
while (lp) {
printf("attachments %c%s %s/%s\n", op, name,
((ATTACH_MATCH *)lp->data)->major,
while (lp) {
printf("attachments %c%s %s/%s\n", op, name,
((ATTACH_MATCH *)lp->data)->major,
@@
-1241,7
+1242,7
@@
static int parse_attachments (BUFFER *buf, BUFFER *s,
unsigned long data __attribute__ ((unused)),
BUFFER *err) {
char op, *category;
unsigned long data __attribute__ ((unused)),
BUFFER *err) {
char op, *category;
-
LIST
**listp;
+
string_list_t
**listp;
mutt_extract_token(buf, s, 0);
if (!buf->data || *buf->data == '\0') {
mutt_extract_token(buf, s, 0);
if (!buf->data || *buf->data == '\0') {
@@
-1291,7
+1292,7
@@
static int parse_attachments (BUFFER *buf, BUFFER *s,
static int parse_unattachments (BUFFER *buf, BUFFER *s, unsigned long data __attribute__ ((unused)), BUFFER *err) {
char op, *p;
static int parse_unattachments (BUFFER *buf, BUFFER *s, unsigned long data __attribute__ ((unused)), BUFFER *err) {
char op, *p;
-
LIST
**listp;
+
string_list_t
**listp;
mutt_extract_token(buf, s, 0);
if (!buf->data || *buf->data == '\0') {
mutt_extract_token(buf, s, 0);
if (!buf->data || *buf->data == '\0') {
@@
-1382,7
+1383,7
@@
static int parse_unalias (BUFFER * buf, BUFFER * s,
unsigned long data __attribute__ ((unused)),
BUFFER * err __attribute__ ((unused)))
{
unsigned long data __attribute__ ((unused)),
BUFFER * err __attribute__ ((unused)))
{
-
ALIAS
*tmp, *last = NULL;
+
alias_t
*tmp, *last = NULL;
do {
mutt_extract_token (buf, s, 0);
do {
mutt_extract_token (buf, s, 0);
@@
-1394,7
+1395,7
@@
static int parse_unalias (BUFFER * buf, BUFFER * s,
set_option (OPTFORCEREDRAWINDEX);
}
else
set_option (OPTFORCEREDRAWINDEX);
}
else
-
mutt_free_alias
(&Aliases);
+
alias_list_wipe
(&Aliases);
break;
}
else
break;
}
else
@@
-1411,7
+1412,7
@@
static int parse_unalias (BUFFER * buf, BUFFER * s,
else
Aliases = tmp->next;
tmp->next = NULL;
else
Aliases = tmp->next;
tmp->next = NULL;
-
mutt_free_alias
(&tmp);
+
alias_list_wipe
(&tmp);
break;
}
last = tmp;
break;
}
last = tmp;
@@
-1425,8
+1426,8
@@
static int parse_alias (BUFFER * buf, BUFFER * s,
unsigned long data __attribute__ ((unused)),
BUFFER * err)
{
unsigned long data __attribute__ ((unused)),
BUFFER * err)
{
-
ALIAS
*tmp = Aliases;
-
ALIAS
*last = NULL;
+
alias_t
*tmp = Aliases;
+
alias_t
*last = NULL;
char *estr = NULL;
if (!MoreArgs (s)) {
char *estr = NULL;
if (!MoreArgs (s)) {
@@
-1447,8
+1448,7
@@
static int parse_alias (BUFFER * buf, BUFFER * s,
if (!tmp) {
/* create a new alias */
if (!tmp) {
/* create a new alias */
- tmp = p_new(ALIAS, 1);
- tmp->self = tmp;
+ tmp = alias_new();
tmp->name = m_strdup(buf->data);
/* give the main addressbook code a chance */
if (CurrentMenu == MENU_ALIAS)
tmp->name = m_strdup(buf->data);
/* give the main addressbook code a chance */
if (CurrentMenu == MENU_ALIAS)
@@
-1456,7
+1456,7
@@
static int parse_alias (BUFFER * buf, BUFFER * s,
}
else {
/* override the previous value */
}
else {
/* override the previous value */
- address_
delete
(&tmp->addr);
+ address_
list_wipe
(&tmp->addr);
if (CurrentMenu == MENU_ALIAS)
set_option (OPTFORCEREDRAWINDEX);
}
if (CurrentMenu == MENU_ALIAS)
set_option (OPTFORCEREDRAWINDEX);
}
@@
-1495,15
+1495,15
@@
parse_unmy_hdr (BUFFER * buf, BUFFER * s,
unsigned long data __attribute__ ((unused)),
BUFFER * err __attribute__ ((unused)))
{
unsigned long data __attribute__ ((unused)),
BUFFER * err __attribute__ ((unused)))
{
-
LIST
*last = NULL;
-
LIST
*tmp = UserHeader;
-
LIST
*ptr;
+
string_list_t
*last = NULL;
+
string_list_t
*tmp = UserHeader;
+
string_list_t
*ptr;
size_t l;
do {
mutt_extract_token (buf, s, 0);
if (m_strcmp("*", buf->data) == 0)
size_t l;
do {
mutt_extract_token (buf, s, 0);
if (m_strcmp("*", buf->data) == 0)
-
mutt_free_list
(&UserHeader);
+
string_list_wipe
(&UserHeader);
else {
tmp = UserHeader;
last = NULL;
else {
tmp = UserHeader;
last = NULL;
@@
-1522,7
+1522,7
@@
parse_unmy_hdr (BUFFER * buf, BUFFER * s,
UserHeader = tmp->next;
tmp = tmp->next;
ptr->next = NULL;
UserHeader = tmp->next;
tmp = tmp->next;
ptr->next = NULL;
-
mutt_free_list
(&ptr);
+
string_list_wipe
(&ptr);
}
else {
last = tmp;
}
else {
last = tmp;
@@
-1538,7
+1538,7
@@
parse_unmy_hdr (BUFFER * buf, BUFFER * s,
static int parse_my_hdr (BUFFER * buf, BUFFER * s, unsigned long data __attribute__ ((unused)),
BUFFER * err)
{
static int parse_my_hdr (BUFFER * buf, BUFFER * s, unsigned long data __attribute__ ((unused)),
BUFFER * err)
{
-
LIST
*tmp;
+
string_list_t
*tmp;
size_t keylen;
char *p;
size_t keylen;
char *p;
@@
-1562,11
+1562,11
@@
static int parse_my_hdr (BUFFER * buf, BUFFER * s, unsigned long data __attribut
if (!tmp->next)
break;
}
if (!tmp->next)
break;
}
- tmp->next =
mutt_new_list
();
+ tmp->next =
string_item_new
();
tmp = tmp->next;
}
else {
tmp = tmp->next;
}
else {
- tmp =
mutt_new_list
();
+ tmp =
string_item_new
();
UserHeader = tmp;
}
tmp->data = buf->data;
UserHeader = tmp;
}
tmp->data = buf->data;
@@
-1990,7
+1990,7
@@
static int parse_set (BUFFER * tmp, BUFFER * s, unsigned long data,
r = -1;
break;
} else if (DTYPE (option->type) == DT_ADDR)
r = -1;
break;
} else if (DTYPE (option->type) == DT_ADDR)
- address_
delete
((address_t **) option->data);
+ address_
list_wipe
((address_t **) option->data);
else if (DTYPE (option->type) == DT_USER)
/* to unset $user_ means remove */
hash_delete (ConfigOptions, option->option,
else if (DTYPE (option->type) == DT_USER)
/* to unset $user_ means remove */
hash_delete (ConfigOptions, option->option,
@@
-2514,9
+2514,9
@@
int mutt_var_value_complete (char *buffer, size_t len, int pos)
}
/* Implement the -Q command line flag */
}
/* Implement the -Q command line flag */
-int mutt_query_variables (
LIST
* queries)
+int mutt_query_variables (
string_list_t
* queries)
{
{
-
LIST
*p;
+
string_list_t
*p;
char errbuff[STRING];
char command[STRING];
char errbuff[STRING];
char command[STRING];
@@
-2543,7
+2543,7
@@
int mutt_query_variables (LIST * queries)
return 0;
}
return 0;
}
-static int mutt_execute_commands (
LIST
* p)
+static int mutt_execute_commands (
string_list_t
* p)
{
BUFFER err, token;
char errstr[SHORT_STRING];
{
BUFFER err, token;
char errstr[SHORT_STRING];
@@
-2563,7
+2563,7
@@
static int mutt_execute_commands (LIST * p)
return 0;
}
return 0;
}
-void mutt_init (int skip_sys_rc,
LIST
* commands)
+void mutt_init (int skip_sys_rc,
string_list_t
* commands)
{
struct passwd *pw;
struct utsname utsname;
{
struct passwd *pw;
struct utsname utsname;
@@
-2608,7
+2608,8
@@
void mutt_init (int skip_sys_rc, LIST * commands)
if (!Homedir)
Homedir = m_strdup(pw->pw_dir);
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 ();
}
Shell = m_strdup(pw->pw_shell);
endpwent ();
}
@@
-2641,7
+2642,7
@@
void mutt_init (int skip_sys_rc, LIST * commands)
else
Hostname = m_strdup(utsname.nodename);
else
Hostname = m_strdup(utsname.nodename);
- if (!p && getdnsdomainname
(buffer, sizeof(buffer)) == -1)
+ if (!p && getdnsdomainname(buffer, sizeof(buffer)) == -1)
Fqdn = m_strdup("@");
else
if (*buffer != '@') {
Fqdn = m_strdup("@");
else
if (*buffer != '@') {