#include "attach.h"
#include "reldate.h"
+#include "version.h"
#ifdef USE_IMAP
#include "imap.h"
* Renamed to mutt_adv_mktemp so I only have to change where it's
* called, and not all possible cases.
*/
-void mutt_adv_mktemp (char *s, size_t l)
+void mutt_adv_mktemp (const char* dir, char *s, size_t l)
{
char buf[_POSIX_PATH_MAX];
char tmp[_POSIX_PATH_MAX];
size_t sl;
struct stat sb;
- strfcpy (buf, NONULL (Tempdir), sizeof (buf));
+ strfcpy (buf, dir && *dir ? dir : NONULL (Tempdir), sizeof (buf));
mutt_expand_path (buf, sizeof (buf));
if (s[0] == '\0') {
snprintf (s, l, "%s/muttXXXXXX", buf);
tmp[0] = '\0';
}
- mutt_adv_mktemp (tmp, sizeof (tmp));
+ mutt_adv_mktemp (NULL, tmp, sizeof (tmp));
if (mutt_save_attachment (fp, src, tmp, 0, NULL) == -1)
return -1;
}
/* Decrease a file's modification time by 1 second */
-
time_t mutt_decrease_mtime (const char *f, struct stat *st)
{
struct utimbuf utim;
return mtime;
}
-const char *mutt_make_version (void)
+/* sets mtime of 'to' to mtime of 'from' */
+void mutt_set_mtime (const char* from, const char* to) {
+ struct utimbuf utim;
+ struct stat st;
+
+ if (stat (from, &st) != -1) {
+ utim.actime = st.st_mtime;
+ utim.modtime = st.st_mtime;
+ utime (to, &utim);
+ }
+}
+
+const char *mutt_make_version (int full)
{
static char vstring[STRING];
- snprintf (vstring, sizeof (vstring), "Mutt-ng %s (based on Mutt 1.5.10/%s)",
- MUTT_VERSION, ReleaseDate);
+ if (full)
+ snprintf (vstring, sizeof (vstring), "Mutt-ng %s-r%s (based "
+ "on Mutt 1.5.11/%s)", MUTT_VERSION, MUTT_REVISION,
+ ReleaseDate);
+ else
+ snprintf (vstring, sizeof (vstring), "mutt-ng/%s-r%s",
+ MUTT_VERSION, MUTT_REVISION);
return vstring;
}
for (p = l->template; *p;) {
if (*p == '%') {
n = atoi (++p); /* find pmatch index */
- while (isdigit (*p))
+ while (isdigit ((unsigned char) *p))
++p; /* skip subst token */
for (i = pmatch[n].rm_so; (i < pmatch[n].rm_eo) && (tlen < x); i++)
text[tlen++] = s[i];