/*
** prototypes for some routines in uip
*/
-int annotate(char *, char *, char *, int, int, int);
+int annotate(char *, char *, char *, int, int, int, int);
void annolist(char *, char *, char *, int);
void annopreserve(int);
int distout(char *, char *, char *);
main(int argc, char **argv)
{
int datesw = 1;
+ int preserve = 0;
int msgnum;
char *cp, *maildir;
unsigned char *comp = NULL;
continue;
case PRESERVESW: /* preserve access and modification times on annotated message */
- annopreserve(1);
+ preserve = 1;
continue;
case NOPRESERVESW: /* don't preserve access and modification times on annotated message (default) */
- annopreserve(0);
+ preserve = 0;
continue;
}
}
if (list)
annolist(m_name(msgnum), comp, text, number);
else
- annotate(m_name(msgnum), comp, text, datesw, delete, append);
+ annotate(m_name(msgnum), comp, text, datesw, delete, append, preserve);
}
}
*/
static int annosbr(int, char *, char *, char *, int, int, int);
-/*
-** This "local" global and the annopreserve() function are a hack that
-** allows additional functionality to be added to anno without piling
-** on yet another annotate() argument.
-*/
-
-/* set to preserve access and modification times on annotated message */
-static int preserve_actime_and_modtime = 0;
int
annotate(char *file, char *comp, char *text, int datesw,
- int delete, int append)
+ int delete, int append, int preserve)
{
int i, fd;
struct utimbuf b;
if (stat(file, &s) == -1) {
advise("can't get access and modification times for %s", file);
- preserve_actime_and_modtime = 0;
+ preserve = 0;
}
b.actime = s.st_atime;
i = annosbr(fd, file, comp, text, datesw, delete, append);
- if (preserve_actime_and_modtime && utime(file, &b) == -1)
+ if (preserve && utime(file, &b) == -1)
advise("can't set access and modification times for %s", file);
lkclose(fd, file);
return;
}
-/*
-** Set the preserve-times flag. This hack eliminates the need for an
-** additional argument to annotate().
-*/
-void
-annopreserve(int preserve)
-{
- preserve_actime_and_modtime = preserve;
- return;
-}
-
static int
annosbr(int fd, char *file, char *comp, char *text, int datesw, int delete,
int append)
strncat(buffer, m_name(msgnum),
sizeof(buffer)-strlen(buffer)-1);
}
- annotate(draft, attach_hdr, buffer, 0, -2, 1);
+ annotate(draft, attach_hdr, buffer, 0, -2, 1, 0);
}
snprintf(buffer, sizeof buffer, "+%s %s",
mp->foldpath, m_name(mp->lowsel));
- annotate(drft, attach_hdr, buffer, 0, -2, 1);
+ annotate(drft, attach_hdr, buffer, 0, -2, 1, 0);
}
/* return dynamically allocated buffers */
if (*shell == '/')
annotate(drft, attach_hdr,
shell, 0,
- -2, 1);
+ -2, 1, 0);
else {
sprintf(file, "%s/%s", cwd,
shell);
annotate(drft, attach_hdr,
file, 0,
- -2, 1);
+ -2, 1, 0);
}
}
n = atoi(*arguments);
annotate(drft, attach_hdr,
NULL, 0,
- n, 1);
+ n, 1, 0);
for (argp = arguments + 1; *argp != NULL; argp++) {
if (atoi(*argp) > n) {
!= NULL) {
*(strchr(shell, '\n')) = '\0';
annotate(drft, attach_hdr, shell,
- 0, 0, 1);
+ 0, 0, 1, 0);
}
pclose(f);
} else {