+#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
+#include <lib-lib/file.h>
+#include <lib-lib/macros.h>
+
+#include <lib-mime/mime.h>
+
data->group = (char *) data + sizeof (NNTP_DATA);
strcpy (data->group, group);
data->nserv = news;
data->group = (char *) data + sizeof (NNTP_DATA);
strcpy (data->group, group);
data->nserv = news;
while (fgets (buf, sb.st_size + 1, fp))
nntp_parse_newsrc_line (news, buf);
while (fgets (buf, sb.st_size + 1, fp))
nntp_parse_newsrc_line (news, buf);
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) {
snprintf (buf, sizeof (buf), "%s/.index", dir);
if (!(index = safe_fopen (buf, "a+")))
return 0;
rewind (index);
while (fgets (buf, sizeof (buf), index)) {
snprintf (buf, sizeof (buf), "%s/.index", dir);
if (!(index = safe_fopen (buf, "a+")))
return 0;
rewind (index);
while (fgets (buf, sizeof (buf), index)) {
- buf[str_len (buf) - 1] = 0; /* strip ending '\n' */
- if (!str_ncmp (buf, "#: ", 3) &&
- !str_casecmp (buf + 3, news->conn->account.host))
+ buf[m_strlen(buf) - 1] = 0; /* strip ending '\n' */
+ if (!m_strncmp(buf, "#: ", 3) &&
+ !m_strcasecmp(buf + 3, news->conn->account.host))
break;
sscanf (cp + 1, "%s %d %d", file, &l, &m);
break;
sscanf (cp + 1, "%s %d %d", file, &l, &m);
- if (!str_cmp (buf, "ALL")) {
- news->cache = str_dup (file);
+ if (!m_strcmp(buf, "ALL")) {
+ news->cache = m_strdup(file);
news->newgroups_time = m;
}
else if (news->newsgroups) {
if ((data = (NNTP_DATA *) hash_find (news->newsgroups, buf)) == NULL) {
news->newgroups_time = m;
}
else if (news->newsgroups) {
if ((data = (NNTP_DATA *) hash_find (news->newsgroups, buf)) == NULL) {
data->group = (char *) data + sizeof (NNTP_DATA);
strcpy (data->group, buf);
data->nserv = news;
data->group = (char *) data + sizeof (NNTP_DATA);
strcpy (data->group, buf);
data->nserv = news;
hash_insert (news->newsgroups, data->group, data, 0);
nntp_add_to_list (news, data);
}
hash_insert (news->newsgroups, data->group, data, 0);
nntp_add_to_list (news, data);
}
snprintf (tmp, sizeof (tmp), "%%%ss", fmt);
snprintf (dest, destlen, tmp, fn);
break;
snprintf (tmp, sizeof (tmp), "%%%ss", fmt);
snprintf (dest, destlen, tmp, fn);
break;
url_parse_ciss (&url, c);
if (url.scheme == U_NNTP || url.scheme == U_NNTPS) {
url_parse_ciss (&url, c);
if (url.scheme == U_NNTP || url.scheme == U_NNTPS) {
mutt_account_tourl (acct, &url);
url_ciss_tostring (&url, line, len, 0);
mutt_account_tourl (acct, &url);
url_ciss_tostring (&url, line, len, 0);
strcpy (p, server);
if ((nntp_parse_url (buf, &acct, file, sizeof (file))) < 0 || *file) {
strcpy (p, server);
if ((nntp_parse_url (buf, &acct, file, sizeof (file))) < 0 || *file) {
serv->newsgroups = hash_create (1009);
slurp_newsrc (serv); /* load .newsrc */
nntp_parse_cacheindex (serv); /* load .index */
serv->newsgroups = hash_create (1009);
slurp_newsrc (serv); /* load .newsrc */
nntp_parse_cacheindex (serv); /* load .index */
line = *buf + (*pline - line);
}
strcpy (line, data->group);
line = *buf + (*pline - line);
}
strcpy (line, data->group);
if (series && first <= data->lastLoaded) {
if (data->num >= data->max) {
data->max = data->max * 2;
if (series && first <= data->lastLoaded) {
if (data->num >= data->max) {
data->max = data->max * 2;
* via rename(2); as dirname(2) may modify its argument,
* temporarily use buf as copy of it
*/
* via rename(2); as dirname(2) may modify its argument,
* temporarily use buf as copy of it
*/
- strncpy (buf, filename, sizeof (buf));
- strncpy (tmpfile, basename (filename), sizeof (tmpfile));
+ m_strcpy(buf, sizeof(buf), filename);
+ m_strcpy(tmpfile, sizeof(tmpfile), basename(filename));
mutt_adv_mktemp ((const char*) dirname (buf), tmpfile, sizeof (tmpfile));
debug_print (1, ("Opening %s\n", tmpfile));
if (!(ofp = fopen (tmpfile, "w"))) {
mutt_adv_mktemp ((const char*) dirname (buf), tmpfile, sizeof (tmpfile));
debug_print (1, ("Opening %s\n", tmpfile));
if (!(ofp = fopen (tmpfile, "w"))) {
- if (!strncmp (buf, "#: ", 3) && !str_casecmp (buf+3, section))
+ if (!strncmp (buf, "#: ", 3) && !m_strcasecmp(buf+3, section))
/* we will generate full newsrc here */
for (tmp = news->list; tmp; tmp = tmp->next) {
data = (NNTP_DATA *) tmp->data;
/* we will generate full newsrc here */
for (tmp = news->list; tmp; tmp = tmp->next) {
data = (NNTP_DATA *) tmp->data;
continue;
nntp_create_newsrc_line (data, &buf, &line, &llen);
debug_print (2, ("Added to newsrc: %s\n", line));
continue;
nntp_create_newsrc_line (data, &buf, &line, &llen);
debug_print (2, ("Added to newsrc: %s\n", line));
- (r = mutt_update_list_file (news->newsrc, NULL, "", buf)) == 0) {
+ (r = mutt_update_list_file(news->newsrc, NULL, "", buf)) == 0) {
struct stat st;
stat (news->newsrc, &st);
news->size = st.st_size;
news->mtime = st.st_mtime;
}
struct stat st;
stat (news->newsrc, &st);
news->size = st.st_size;
news->mtime = st.st_mtime;
}
if ((fd = mkstemp (buf)) == -1)
return NULL;
strcpy (s, pc); /* generated name */
if ((fd = mkstemp (buf)) == -1)
return NULL;
strcpy (s, pc); /* generated name */
/* Updates info into .index file: ALL or about selected newsgroup */
static int nntp_update_cacheindex (NNTP_SERVER * serv, NNTP_DATA * data)
{
/* Updates info into .index file: ALL or about selected newsgroup */
static int nntp_update_cacheindex (NNTP_SERVER * serv, NNTP_DATA * data)
{
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);
}
((NNTP_DATA *) ctx->data)->nserv->conn->account.host,
((NNTP_DATA *) ctx->data)->group);
f = mutt_mkname (buf);
((NNTP_DATA *) ctx->data)->nserv->conn->account.host,
((NNTP_DATA *) ctx->data)->group);
f = mutt_mkname (buf);
- snprintf (buf, sizeof (buf), "\t%ld\t%d\tXref: %s\n",
+ snprintf (buf, sizeof (buf), "\t%zd\t%d\tXref: %s\n",
h->content->length, h->lines, NONULL (h->env->xref));
if (fputs (buf, f) == EOF) {
fclose (f);
h->content->length, h->lines, NONULL (h->env->xref));
if (fputs (buf, f) == EOF) {
fclose (f);
data->lastCached = 0;
nntp_cache_expand (buf, ".index");
mutt_update_list_file (buf, data->nserv->conn->account.host, data->group,
data->lastCached = 0;
nntp_cache_expand (buf, ".index");
mutt_update_list_file (buf, data->nserv->conn->account.host, data->group,
if (!news || !news->newsgroups || !group || !*group)
return NULL;
if (!(data = (NNTP_DATA *) hash_find (news->newsgroups, group))) {
if (!news || !news->newsgroups || !group || !*group)
return NULL;
if (!(data = (NNTP_DATA *) hash_find (news->newsgroups, group))) {
data->group = (char *) data + sizeof (NNTP_DATA);
strcpy (data->group, group);
data->nserv = news;
data->group = (char *) data + sizeof (NNTP_DATA);
strcpy (data->group, group);
data->nserv = news;
NNTP_DATA *data = (NNTP_DATA *) list->data;
if (data && data->subscribed && data->unread &&
Context && Context->magic == M_NNTP &&
NNTP_DATA *data = (NNTP_DATA *) list->data;
if (data && data->subscribed && data->unread &&
Context && Context->magic == M_NNTP &&
unsigned int i, unread = 0;
for (i = 0; i < Context->msgcount; i++)
unsigned int i, unread = 0;
for (i = 0; i < Context->msgcount; i++)