anno: Undid the ``preserve argument hack''.
[mmh] / uip / annosbr.c
index 99422e6..d1e39b0 100644 (file)
 */
 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;
@@ -51,7 +43,7 @@ annotate(char *file, char *comp, char *text, int datesw,
 
        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;
@@ -59,7 +51,7 @@ annotate(char *file, char *comp, char *text, int datesw,
 
        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);
@@ -150,17 +142,6 @@ annolist(char *file, char *comp, char *text, int number)
        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)