On Thu, Feb 11, 1999 at 06:52:07 -0500, David Thorburn-Gundlach wrote:
> David, et al --
> 
> ...and then David DeSimone said...
> % 
> % Mutt looks at the timestamp on the file to determine if your editor has
> % modified the file.  However, your macro executes so fast, that the
> 
> Now, this is interesting...  I always thought that it would use diff
> to tell if something actually differed.  IMHO, this isn't a feature.
> 
> Any chance, you developer types, of either artificially setting the time
> stamp of a new file to "one minute ago" or even "the epoch" to validate
> the current check, or just moving to diff?

Please try the attached patch to 0.95.1. It sets the time stamp of
a new file to `one second ago'.

Regards,
- Byrial
--- send.c-org  Thu Jan 14 09:56:57 1999
+++ send.c      Thu Feb 11 16:12:06 1999
@@ -34,6 +34,9 @@ static const char rcsid[]="$Id: send.c,v
 #include <sys/stat.h>
 #include <sys/wait.h>
 #include <dirent.h>
+#include <time.h>
+#include <sys/types.h>
+#include <utime.h>
 
 #ifdef _PGPPATH
 #include "pgp.h"
@@ -1071,9 +1074,19 @@ ci_send_message (int flags,              /* send mod
   {
     struct stat st;
     time_t mtime;
+    struct utimbuf utim;
 
     stat (msg->content->filename, &st);
     mtime = st.st_mtime;
+    if (mtime == time (NULL))
+    {
+      /* Decrease the file's modification time by 1 second so we are sure
+       * to find out if the `editor' program changes it in less than 1 second.
+       */
+      utim.actime = mtime - 1;
+      utim.modtime = mtime - 1;
+      utime (msg->content->filename, &utim);
+    }
 
     mutt_update_encoding (msg->content);
 

Reply via email to