projects
/
apps
/
madmutt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
make taht shorter
[apps/madmutt.git]
/
nntp
/
newsrc.c
diff --git
a/nntp/newsrc.c
b/nntp/newsrc.c
index
ff9df9e
..
29b427c
100644
(file)
--- a/
nntp/newsrc.c
+++ b/
nntp/newsrc.c
@@
-13,38
+13,37
@@
#include <config.h>
#endif
#include <config.h>
#endif
+#include <unistd.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <libgen.h>
+#include <sys/stat.h>
+
#include <lib-lib/mem.h>
#include <lib-lib/str.h>
#include <lib-lib/file.h>
#include <lib-lib/macros.h>
#include <lib-lib/mem.h>
#include <lib-lib/str.h>
#include <lib-lib/file.h>
#include <lib-lib/macros.h>
+#include <lib-lib/debug.h>
+
+#include <lib-mime/mime.h>
+
+#include <lib-ui/curses.h>
#include "mutt.h"
#include "mutt.h"
-#include "mutt_curses.h"
#include "sort.h"
#include "mx.h"
#include "sort.h"
#include "mx.h"
-#include "mime.h"
#include "nntp.h"
#include "nntp.h"
-#include "rfc822.h"
#include "rfc1524.h"
#include "rfc1524.h"
-#include "rfc2047.h"
-
-#include "lib/debug.h"
-
-#include <unistd.h>
-#include <string.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include <libgen.h>
-#include <sys/stat.h>
void nntp_add_to_list (NNTP_SERVER * s, NNTP_DATA * d)
{
void nntp_add_to_list (NNTP_SERVER * s, NNTP_DATA * d)
{
-
LIST
*l;
+
string_list_t
*l;
if (!s || !d)
return;
if (!s || !d)
return;
- l = p_new(
LIST
, 1);
+ l = p_new(
string_list_t
, 1);
if (s->list)
s->tail->next = l;
else
if (s->list)
s->tail->next = l;
else
@@
-74,7
+73,7
@@
static int nntp_parse_newsrc_line (NNTP_SERVER * news, char *line)
len = p + 1 - line;
if (len > sizeof (group))
len = sizeof (group);
len = p + 1 - line;
if (len > sizeof (group))
len = sizeof (group);
-
strfcpy (group, line, len
);
+
m_strcpy(group, len, line
);
if ((data = (NNTP_DATA *) hash_find (news->newsgroups, group)) == NULL) {
data = xmalloc(sizeof(NNTP_DATA) + m_strlen(group) + 1);
data->group = (char *) data + sizeof (NNTP_DATA);
if ((data = (NNTP_DATA *) hash_find (news->newsgroups, group)) == NULL) {
data = xmalloc(sizeof(NNTP_DATA) + m_strlen(group) + 1);
data->group = (char *) data + sizeof (NNTP_DATA);
@@
-184,7
+183,7
@@
static int nntp_parse_cacheindex (NNTP_SERVER * news)
if (!NewsCacheDir || !*NewsCacheDir)
return 0;
if (!NewsCacheDir || !*NewsCacheDir)
return 0;
-
strfcpy (dir, NewsCacheDir, sizeof (dir)
);
+
m_strcpy(dir, sizeof(dir), NewsCacheDir
);
mutt_expand_path (dir, sizeof (dir));
if (lstat (dir, &st) || (st.st_mode & S_IFDIR) == 0) {
mutt_expand_path (dir, sizeof (dir));
if (lstat (dir, &st) || (st.st_mode & S_IFDIR) == 0) {
@@
-208,8
+207,8
@@
static int nntp_parse_cacheindex (NNTP_SERVER * news)
rewind (index);
while (fgets (buf, sizeof (buf), index)) {
buf[m_strlen(buf) - 1] = 0; /* strip ending '\n' */
rewind (index);
while (fgets (buf, sizeof (buf), index)) {
buf[m_strlen(buf) - 1] = 0; /* strip ending '\n' */
- if (!
str_ncmp
(buf, "#: ", 3) &&
- !
str_casecmp
(buf + 3, news->conn->account.host))
+ if (!
m_strncmp
(buf, "#: ", 3) &&
+ !
m_strcasecmp
(buf + 3, news->conn->account.host))
break;
}
while (fgets (buf, sizeof (buf), index)) {
break;
}
while (fgets (buf, sizeof (buf), index)) {
@@
-266,7
+265,7
@@
const char *nntp_format_str (char *dest, size_t destlen, char op,
switch (op) {
case 's':
m_strcpy(fn, sizeof (fn), NewsServer);
switch (op) {
case 's':
m_strcpy(fn, sizeof (fn), NewsServer);
-
str_tolower
(fn);
+
m_strtolower
(fn);
snprintf (tmp, sizeof (tmp), "%%%ss", fmt);
snprintf (dest, destlen, tmp, fn);
break;
snprintf (tmp, sizeof (tmp), "%%%ss", fmt);
snprintf (dest, destlen, tmp, fn);
break;
@@
-299,7
+298,7
@@
int nntp_parse_url (const char *server, ACCOUNT * acct,
*group = '\0';
if (url.path)
*group = '\0';
if (url.path)
-
strfcpy (group, url.path, group_len
);
+
m_strcpy(group, group_len, url.path
);
ret = mutt_account_fromurl (acct, &url);
}
ret = mutt_account_fromurl (acct, &url);
}
@@
-332,7
+331,7
@@
NNTP_SERVER *mutt_select_newsserver (char *server)
{
char file[_POSIX_PATH_MAX];
char *buf, *p;
{
char file[_POSIX_PATH_MAX];
char *buf, *p;
-
LIST
*list;
+
string_list_t
*list;
ACCOUNT acct;
NNTP_SERVER *serv;
CONNECTION *conn;
ACCOUNT acct;
NNTP_SERVER *serv;
CONNECTION *conn;
@@
-407,7
+406,7
@@
NNTP_SERVER *mutt_select_newsserver (char *server)
hash_destroy (&serv->newsgroups, nntp_delete_data);
for (list = serv->list; list; list = list->next)
list->data = NULL;
hash_destroy (&serv->newsgroups, nntp_delete_data);
for (list = serv->list; list; list = list->next)
list->data = NULL;
-
mutt_free_list
(&serv->list);
+
string_list_wipe
(&serv->list);
p_delete(&serv->newsrc);
p_delete(&serv->cache);
p_delete(&serv);
p_delete(&serv->newsrc);
p_delete(&serv->cache);
p_delete(&serv);
@@
-672,7
+671,7
@@
static int mutt_update_list_file (char *filename, char *section,
c = buf;
while (*c && *c != '\n') c++;
c[0] = 0; /* strip EOL */
c = buf;
while (*c && *c != '\n') c++;
c[0] = 0; /* strip EOL */
- if (!strncmp (buf, "#: ", 3) && !
str_casecmp
(buf+3, section))
+ if (!strncmp (buf, "#: ", 3) && !
m_strcasecmp
(buf+3, section))
done++;
}
if (r != EOF && !done) {
done++;
}
if (r != EOF && !done) {
@@
-746,7
+745,7
@@
int mutt_newsrc_update (NNTP_SERVER * news)
{
char *buf, *line;
NNTP_DATA *data;
{
char *buf, *line;
NNTP_DATA *data;
-
LIST
*tmp;
+
string_list_t
*tmp;
int r = -1;
size_t len, llen;
int r = -1;
size_t len, llen;
@@
-810,7
+809,7
@@
static int nntp_update_cacheindex (NNTP_SERVER * serv, NNTP_DATA * data)
data->firstMessage, data->lastLoaded);
}
else {
data->firstMessage, data->lastLoaded);
}
else {
-
strfcpy (file, serv->cache, sizeof (file)
);
+
m_strcpy(file, sizeof(file), serv->cache
);
snprintf (buf, sizeof (buf), "ALL %s 0 %d", file,
(int) serv->newgroups_time);
}
snprintf (buf, sizeof (buf), "ALL %s 0 %d", file,
(int) serv->newgroups_time);
}
@@
-822,7
+821,7
@@
static int nntp_update_cacheindex (NNTP_SERVER * serv, NNTP_DATA * data)
void nntp_clear_cacheindex (NNTP_SERVER * news)
{
NNTP_DATA *data;
void nntp_clear_cacheindex (NNTP_SERVER * news)
{
NNTP_DATA *data;
-
LIST
*tmp;
+
string_list_t
*tmp;
if (option (OPTSAVEUNSUB) || !news)
return;
if (option (OPTSAVEUNSUB) || !news)
return;
@@
-843,7
+842,7
@@
int nntp_save_cache_index (NNTP_SERVER * news)
char file[_POSIX_PATH_MAX];
NNTP_DATA *d;
FILE *f;
char file[_POSIX_PATH_MAX];
NNTP_DATA *d;
FILE *f;
-
LIST
*l;
+
string_list_t
*l;
if (!news || !news->newsgroups)
return -1;
if (!news || !news->newsgroups)
return -1;
@@
-856,7
+855,7
@@
int nntp_save_cache_index (NNTP_SERVER * news)
f = safe_fopen (file, "w");
}
else {
f = safe_fopen (file, "w");
}
else {
-
strfcpy (buf, news->conn->account.host, sizeof (buf)
);
+
m_strcpy(buf, sizeof(buf), news->conn->account.host
);
f = mutt_mkname (buf);
news->cache = m_strdup(buf);
nntp_cache_expand (file, buf);
f = mutt_mkname (buf);
news->cache = m_strdup(buf);
nntp_cache_expand (file, buf);
@@
-1079,7
+1078,7
@@
NNTP_DATA *mutt_newsgroup_uncatchup (NNTP_SERVER * news, char *group)
/* this routine gives the first newsgroup with new messages */
void nntp_buffy (char* dst, size_t dstlen) {
/* this routine gives the first newsgroup with new messages */
void nntp_buffy (char* dst, size_t dstlen) {
-
LIST
*list;
+
string_list_t
*list;
int count = 0;
/* forward to current group */
int count = 0;
/* forward to current group */