diff options
| author | Paul Eggert | 2016-03-05 11:30:51 -0800 |
|---|---|---|
| committer | Paul Eggert | 2016-03-05 11:31:22 -0800 |
| commit | b1abce1a30c66a22766e3d4b8b4ff9ae852f150c (patch) | |
| tree | 33733dce482e31136e249708269e6d665412340d /lib-src | |
| parent | 98b8d4489241f79c200a8b68330ba4b2dbd16cdb (diff) | |
| download | emacs-b1abce1a30c66a22766e3d4b8b4ff9ae852f150c.tar.gz emacs-b1abce1a30c66a22766e3d4b8b4ff9ae852f150c.zip | |
Restore leading space in movemail pop output
* lib-src/movemail.c (movemail_strftime) [WINDOWSNT]: New function.
(strftime) [WINDOWSNT]: New macro.
(mbx_delimit_begin): Go back to previous version of this code,
now that there’s a special-purpose WINDOWSNT implementation
that should do the right thing. That way, the output continues
to use leading space rather than leading zero for day of month.
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/movemail.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/lib-src/movemail.c b/lib-src/movemail.c index efa0219e587..873d85dfd77 100644 --- a/lib-src/movemail.c +++ b/lib-src/movemail.c | |||
| @@ -799,6 +799,24 @@ mbx_write (char *line, int len, FILE *mbf) | |||
| 799 | return fwrite (line, 1, len, mbf) == len && 0 <= fputc ('\n', mbf); | 799 | return fwrite (line, 1, len, mbf) == len && 0 <= fputc ('\n', mbf); |
| 800 | } | 800 | } |
| 801 | 801 | ||
| 802 | #ifdef WINDOWSNT | ||
| 803 | /* Work around MS-Windows lack of support for %e or %T with a | ||
| 804 | special-purpose strftime that assumes the exact format that | ||
| 805 | movemail uses. */ | ||
| 806 | static size_t | ||
| 807 | movemail_strftime (char *s, size_t size, char const *format, | ||
| 808 | struct tm const *tm) | ||
| 809 | { | ||
| 810 | size_t n = strftime (s, size, "From movemail %a %b %d %H:%M:%S %Y\n", tm); | ||
| 811 | char *mday = s + sizeof "From movemail Sun Jan " - 1; | ||
| 812 | if (*mday == '0') | ||
| 813 | *mday = ' '; | ||
| 814 | return n; | ||
| 815 | } | ||
| 816 | # undef strftime | ||
| 817 | # define strftime movemail_strftime | ||
| 818 | #endif | ||
| 819 | |||
| 802 | static bool | 820 | static bool |
| 803 | mbx_delimit_begin (FILE *mbf) | 821 | mbx_delimit_begin (FILE *mbf) |
| 804 | { | 822 | { |
| @@ -809,7 +827,7 @@ mbx_delimit_begin (FILE *mbf) | |||
| 809 | 827 | ||
| 810 | char fromline[100]; | 828 | char fromline[100]; |
| 811 | if (! strftime (fromline, sizeof fromline, | 829 | if (! strftime (fromline, sizeof fromline, |
| 812 | "From movemail %a %b %d %H:%M:%S %Y\n", ltime)) | 830 | "From movemail %a %b %e %T %Y\n", ltime)) |
| 813 | { | 831 | { |
| 814 | errno = EOVERFLOW; | 832 | errno = EOVERFLOW; |
| 815 | return false; | 833 | return false; |