#include "attach.h"
#include "reldate.h"
-#include "svnrev.h"
+#include "version.h"
#ifdef USE_IMAP
#include "imap.h"
#include <sys/types.h>
#include <utime.h>
+#define SW (option(OPTMBOXPANE)?SidebarWidth:0)
+
BODY *mutt_new_body (void)
{
BODY *p = (BODY *) mem_calloc (1, sizeof (BODY));
return 0;
}
-/* prepend the path part of *path to *link */
-void mutt_expand_link (char *newpath, const char *path, const char *link)
+/* prepend the path part of *path to *lnk */
+void mutt_expand_link (char *newpath, const char *path, const char *lnk)
{
const char *lb = NULL;
size_t len;
- /* link is full path */
- if (*link == '/') {
- strfcpy (newpath, link, _POSIX_PATH_MAX);
+ /* lnk is full path */
+ if (*lnk == '/') {
+ strfcpy (newpath, lnk, _POSIX_PATH_MAX);
return;
}
if ((lb = strrchr (path, '/')) == NULL) {
- /* no path in link */
- strfcpy (newpath, link, _POSIX_PATH_MAX);
+ /* no path in lnk */
+ strfcpy (newpath, lnk, _POSIX_PATH_MAX);
return;
}
len = lb - path + 1;
memcpy (newpath, path, len);
- strfcpy (newpath + len, link, _POSIX_PATH_MAX - len);
+ strfcpy (newpath + len, lnk, _POSIX_PATH_MAX - len);
}
char *mutt_expand_path (char *s, size_t slen)
char tmp[_POSIX_PATH_MAX];
char *t;
- char *tail = "";
+ const char *tail = "";
int recurse = 0;
if (DrawFullLine || option (OPTSTATUSONTOP))
count = (COLS < destlen ? COLS : destlen);
else
- count =
- ((COLS - SidebarWidth) <
- destlen ? (COLS - SidebarWidth) : destlen);
+ count = ((COLS - SW) < destlen ? (COLS - SW) : destlen);
if (count > col) {
count -= col; /* how many columns left on this line */
mutt_FormatString (buf, sizeof (buf), src, callback, data, flags);
break; /* skip rest of input */
}
else {
- short tolower = 0;
+ short lower = 0;
short nodots = 0;
while (ch == '_' || ch == ':') {
if (ch == '_')
- tolower = 1;
+ lower = 1;
else if (ch == ':')
nodots = 1;
callback (buf, sizeof (buf), ch, src, prefix, ifstring, elsestring,
data, flags);
- if (tolower)
+ if (lower)
str_tolower (buf);
if (nodots) {
char *p = buf;
then we assume it is a commmand to run instead of a normal file. */
FILE *mutt_open_read (const char *path, pid_t * thepid)
{
- FILE *f;
- struct stat s;
-
- int len = str_len (path);
-
- if (path[len - 1] == '|') {
- /* read from a pipe */
-
- char *s = str_dup (path);
-
- s[len - 1] = 0;
- mutt_endwin (NULL);
- *thepid = mutt_create_filter (s, NULL, &f, NULL);
- mem_free (&s);
- }
- else {
- if (stat (path, &s) < 0)
- return (NULL);
- if (S_ISDIR (s.st_mode)) {
- errno = EINVAL;
- return (NULL);
+ int len = str_len (path);
+ FILE *f;
+
+ if (path[len - 1] == '|') {
+ char *s = str_dup (path);
+
+ /* read from a pipe */
+
+ s[len - 1] = 0;
+ mutt_endwin (NULL);
+ *thepid = mutt_create_filter (s, NULL, &f, NULL);
+ mem_free (&s);
+ } else {
+ f = fopen (path, "r");
+ if (!f)
+ return NULL;
+ *thepid = -1;
}
- f = fopen (path, "r");
- *thepid = -1;
- }
- return (f);
+
+ return (f);
}
/* returns 0 if OK to proceed, -1 to abort, 1 to retry */
}
/* 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-%s (based on Mutt 1.5.10/%s)",
- MUTT_VERSION, MUTTNG_SVNREV, 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];