p++;
if (!*p)
return -1;
- len = p + 1 - line;
- if (len > sizeof (group))
- len = sizeof (group);
+ len = MIN(p + 1 - line, ssizeof(group));
m_strcpy(group, len, line);
if ((data = (NNTP_DATA *) hash_find (news->newsgroups, group)) == NULL) {
data = xmalloc(sizeof(NNTP_DATA) + m_strlen(group) + 1);
return 0;
}
-const char *nntp_format_str (char *dest, ssize_t destlen, char op,
- const char *src, const char *fmt,
- const char *ifstring, const char *elsestring,
- unsigned long data, format_flag flags)
+const char *nntp_format_str(char *dest, ssize_t destlen, char op,
+ const char *src, const char *fmt,
+ const char *ifstr __attribute__((unused)),
+ const char *elstr __attribute__((unused)),
+ anytype data __attribute__((unused)),
+ format_flag flags __attribute__((unused)))
{
- char fn[SHORT_STRING], tmp[SHORT_STRING];
+ char fn[STRING], tmp[STRING];
switch (op) {
case 's':
if (!conn)
return NULL;
- mutt_FormatString (file, sizeof (file), NONULL (NewsRc), nntp_format_str, 0,
- 0);
- mutt_expand_path (file, sizeof (file));
+ m_strformat(file, sizeof(file), 0, NewsRc, nntp_format_str, NULL, 0);
+ mutt_expand_path(file, sizeof(file));
serv = (NNTP_SERVER *) conn->data;
if (serv) {
len--;
}
-#if 0
- if (data->entries[x].first == data->entries[x].last)
- snprintf (line, len, "%d%n", data->entries[x].first, &i);
- else
- snprintf (line, len, "%d-%d%n",
- data->entries[x].first, data->entries[x].last, &i);
- len -= i;
- line += i;
-#else
i = puti (line, data->entries[x].first);
line += i;
len -= i;
line += i;
len -= i;
}
-#endif
}
*line++ = '\n';
*line = '\0';
FILE *ifp;
FILE *ofp;
char buf[HUGE_STRING];
- char tmpfile[_POSIX_PATH_MAX], link[_POSIX_PATH_MAX];
+ char tmpf[_POSIX_PATH_MAX], lnk[_POSIX_PATH_MAX];
char *c;
int ext = 0, done = 0, r = 0, l = 0;
mutt_error (_("Unable to lock %s"), filename);
return -1;
}
- /* use mutt_adv_mktemp() to get a tempfile in the same
+
+ /* use m_tempfile() to get a tempfile in the same
* directory as filename is so that we can follow symlinks
* via rename(2); as dirname(2) may modify its argument,
* temporarily use buf as copy of it
*/
m_strcpy(buf, sizeof(buf), filename);
- m_strcpy(tmpfile, sizeof(tmpfile), basename(filename));
- mutt_adv_mktemp ((const char*) dirname (buf), tmpfile, sizeof (tmpfile));
- if (!(ofp = fopen (tmpfile, "w"))) {
+ ofp = m_tempfile(tmpf, sizeof(tmpf), dirname(buf), filename);
+ if (!ofp) {
m_fclose(&ifp);
- mutt_error (_("Unable to open %s for writing"), tmpfile);
+ mutt_error (_("Unable to open %s for writing"), tmpf);
return -1;
}
m_fclose(&ofp);
m_fclose(&ifp);
if (r == EOF) {
- unlink (tmpfile);
- mutt_error (_("Can't write %s"), tmpfile);
+ unlink (tmpf);
+ mutt_error (_("Can't write %s"), tmpf);
return -1;
}
- link[0] = '\0';
- if ((l = readlink (filename, link, sizeof (link)-1)) > 0)
- link[l] = '\0';
- if (rename (tmpfile, l > 0 ? link : filename) < 0) {
- unlink (tmpfile);
- mutt_error (_("Can't rename %s to %s"), tmpfile, l > 0 ? link : filename);
+ lnk[0] = '\0';
+ if ((l = readlink (filename, lnk, sizeof(lnk)-1)) > 0)
+ lnk[l] = '\0';
+ if (rename (tmpf, l > 0 ? lnk : filename) < 0) {
+ unlink (tmpf);
+ mutt_error (_("Can't rename %s to %s"), tmpf, l > 0 ? lnk : filename);
return -1;
}
return 0;
if (!ctx->hdrs[i]->deleted && ctx->hdrs[i]->article_num != prev) {
h = ctx->hdrs[i];
addr[0] = 0;
- rfc822_write_address (addr, sizeof (addr), h->env->from, 0);
+ rfc822_addrcat(addr, sizeof(addr), h->env->from, 0);
tm = gmtime (&h->date_sent);
snprintf (buf, sizeof (buf),
"%d\t%s\t%s\t%d %s %d %02d:%02d:%02d GMT\t%s\t",