Browse Source

Rework date header generation

master
Damien Goutte-Gattat 10 years ago
parent
commit
231d32d928
  1. 10
      src/fmail.c

10
src/fmail.c

@ -114,19 +114,19 @@ qp_encode_stream(FILE *in, FILE *out)
}
}
static void
make_date_header(string_buffer_t *headers)
static char *
rfc2822_date(void)
{
time_t timestamp;
struct tm *timestruct;
char buffer[32];
const char *rfc2822_format = "%a, %d %b %Y %H:%M:%S %z";
static char buffer[32];
timestamp = time(NULL);
timestruct = localtime(&timestamp);
strftime(buffer, sizeof(buffer), rfc2822_format, timestruct);
sb_addf(headers, "Date: %s\r\n", buffer);
return buffer;
}
static void
@ -191,7 +191,7 @@ main(int argc, char *argv[])
}
}
make_date_header(headers);
sb_addf(headers, "Date: %s\r\n", rfc2822_date());
read_headers(stdin, headers);
fprintf(stdout, "%s\r\n", sb_get(headers));
qp_encode_stream(stdin, stdout);

Loading…
Cancel
Save