X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=nntp.c;h=92e0baee2232dd26bd44005cff0a05f984cd128e;hp=4e79ffc2a0f8449261270391b08834d5ffc9a47e;hb=5fed0f809d78ea5b4aea7681ad314843e554b090;hpb=8db79e60e71671e49920599664a3e155ce32797e diff --git a/nntp.c b/nntp.c index 4e79ffc..92e0bae 100644 --- a/nntp.c +++ b/nntp.c @@ -14,7 +14,7 @@ #include #include -#include +#include #include #include @@ -801,7 +801,6 @@ static int nntp_save_cache_group (CONTEXT * ctx) char file[_POSIX_PATH_MAX]; FILE *f; HEADER *h; - struct tm *tm; int i = 0, save = SORT_ORDER; int prev = 0; @@ -839,21 +838,22 @@ static int nntp_save_cache_group (CONTEXT * ctx) i = ctx->msgcount - NntpContext; for (; i < ctx->msgcount; i++) { if (!ctx->hdrs[i]->deleted && ctx->hdrs[i]->article_num != prev) { + char *loc; h = ctx->hdrs[i]; addr[0] = 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", - h->article_num, h->env->subject, addr, tm->tm_mday, - Months[tm->tm_mon], tm->tm_year + 1900, tm->tm_hour, - tm->tm_min, tm->tm_sec, h->env->message_id); - fputs (buf, f); + + loc = setlocale(LC_TIME, "C"); + strftime(buf, sizeof(buf), "%d %b %Y %H:%M:%S GMT", gmtime(&h->date_sent)); + setlocale(LC_TIME, loc); + + fprintf(f, "%d\t%s\t%s\t%s\t%s\t\n", h->article_num, h->env->subject, + addr, buf, h->env->message_id); if (h->env->references) mutt_write_references (h->env->references, f); - 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) { + if (fprintf(f, "\t%zd\t%d\tXref: %s\n", h->content->length, h->lines, + NONULL(h->env->xref)) == EOF) + { m_fclose(&f); unlink (file); return -1;