]> diplodocus.org Git - nmh/blobdiff - uip/annosbr.c
fmtdump.c, fmttest.c: Remove tests for FT_LIT_FORCE.
[nmh] / uip / annosbr.c
index 9d73a0945be720c0d80d2d7a961111d28a8872a1..cf5ea55acc752b97863b21921281ec16198eeb90 100644 (file)
@@ -1,6 +1,4 @@
-
-/*
- * annosbr.c -- prepend annotation to messages
+/* annosbr.c -- prepend annotation to messages
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -10,6 +8,8 @@
 #include <h/mh.h>
 #include <h/tws.h>
 #include <h/utils.h>
+#include "../sbr/lock_file.h"
+#include "../sbr/m_mktemp.h"
 #include <fcntl.h>
 #include <utime.h>
 
@@ -52,7 +52,7 @@ annotate (char *file, char *comp, char *text, int inplace, int datesw, int delet
     }
 
     if (stat(file, &s) == -1) {
-       advise("can't get access and modification times for %s", file);
+        inform("can't get access and modification times for %s", file);
        preserve_actime_and_modtime = 0;
     }
 
@@ -62,7 +62,7 @@ annotate (char *file, char *comp, char *text, int inplace, int datesw, int delet
     i = annosbr (fd, file, comp, text, inplace, datesw, delete, append);
 
     if (preserve_actime_and_modtime && utime(file, &b) == -1)
-       advise("can't set access and modification times for %s", file);
+        inform("can't set access and modification times for %s", file);
 
     lkclosedata (fd, file);
     return i;
@@ -70,7 +70,7 @@ annotate (char *file, char *comp, char *text, int inplace, int datesw, int delet
 
 /*
  *  Produce a listing of all header fields (annotations) whose field name matches
- *  comp.  Number the listing if number is set.  Treate the field bodies as path
+ *  comp.  Number the listing if number is set.  Treat the field bodies as path
  *  names and just output the last component unless text is non-NULL.  We don't
  *  care what text is set to.
  */
@@ -143,7 +143,7 @@ annolist(char *file, char *comp, char *text, int number)
            if (text == NULL && (sp = strrchr(cp, '/')) != (char *)0)
                cp = sp + 1;
 
-           (void)printf("%s\n", cp);
+            puts(cp);
        }
 
     } while (*field != '\0' && *field != '-');
@@ -155,8 +155,6 @@ annolist(char *file, char *comp, char *text, int number)
     free(field);
 
     (void)fclose(fp);
-
-    return;
 }
 
 /*
@@ -167,7 +165,6 @@ void
 annopreserve(int preserve)
 {
        preserve_actime_and_modtime = preserve;
-       return;
 }
 
 static int
@@ -405,7 +402,7 @@ annosbr (int fd, char *file, char *comp, char *text, int inplace, int datesw, in
        if ((tmpfd = open (tmpfil, O_RDONLY)) == NOTOK)
            adios (tmpfil, "unable to open for re-reading");
 
-       lseek (fd, (off_t) 0, SEEK_SET);
+       lseek(fd, 0, SEEK_SET);
 
        /*
         *  We're making the file shorter if we're deleting a header field