emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-25 b1abce1: Restore leading space in movemail pop ou


From: Paul Eggert
Subject: [Emacs-diffs] emacs-25 b1abce1: Restore leading space in movemail pop output
Date: Sat, 05 Mar 2016 19:31:26 +0000

branch: emacs-25
commit b1abce1a30c66a22766e3d4b8b4ff9ae852f150c
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    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.
---
 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 efa0219..873d85d 100644
--- a/lib-src/movemail.c
+++ b/lib-src/movemail.c
@@ -799,6 +799,24 @@ mbx_write (char *line, int len, FILE *mbf)
   return fwrite (line, 1, len, mbf) == len && 0 <= fputc ('\n', mbf);
 }
 
+#ifdef WINDOWSNT
+/* Work around MS-Windows lack of support for %e or %T with a
+   special-purpose strftime that assumes the exact format that
+   movemail uses.  */
+static size_t
+movemail_strftime (char *s, size_t size, char const *format,
+                  struct tm const *tm)
+{
+  size_t n = strftime (s, size, "From movemail %a %b %d %H:%M:%S %Y\n", tm);
+  char *mday = s + sizeof "From movemail Sun Jan " - 1;
+  if (*mday == '0')
+    *mday = ' ';
+  return n;
+}
+# undef strftime
+# define strftime movemail_strftime
+#endif
+
 static bool
 mbx_delimit_begin (FILE *mbf)
 {
@@ -809,7 +827,7 @@ mbx_delimit_begin (FILE *mbf)
 
   char fromline[100];
   if (! strftime (fromline, sizeof fromline,
-                 "From movemail %a %b %d %H:%M:%S %Y\n", ltime))
+                 "From movemail %a %b %e %T %Y\n", ltime))
     {
       errno = EOVERFLOW;
       return false;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]