X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/f2753d64be0a74a22018e03ec9c04cc9ca45d3ab..63621a81d16ab743de6b57d47578a9a2c670ad22:/uip/annosbr.c diff --git a/uip/annosbr.c b/uip/annosbr.c index 778e2ab2..20719804 100644 --- a/uip/annosbr.c +++ b/uip/annosbr.c @@ -8,7 +8,8 @@ #include #include #include -#include "../sbr/m_mktemp.h" +#include "sbr/lock_file.h" +#include "sbr/m_mktemp.h" #include #include @@ -16,7 +17,7 @@ /* * static prototypes */ -static int annosbr (int, char *, char *, char *, int, int, int, int); +static int annosbr (int, char *, char *, char *, bool, bool, int, bool); /* * This "local" global and the annopreserve() function are a hack that allows additional @@ -26,7 +27,7 @@ static int annosbr (int, char *, char *, char *, int, int, int, int); static int preserve_actime_and_modtime = 0; /* set to preserve access and modification times on annotated message */ int -annotate (char *file, char *comp, char *text, int inplace, int datesw, int delete, int append) +annotate (char *file, char *comp, char *text, bool inplace, bool datesw, int delete, bool append) { int i, fd; struct utimbuf b; @@ -51,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; } @@ -61,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; @@ -139,7 +140,7 @@ annolist(char *file, char *comp, char *text, int number) if (number) (void)printf("%d\t", ++count); - if (text == NULL && (sp = strrchr(cp, '/')) != (char *)0) + if (text == NULL && (sp = strrchr(cp, '/'))) cp = sp + 1; puts(cp); @@ -167,7 +168,7 @@ annopreserve(int preserve) } static int -annosbr (int fd, char *file, char *comp, char *text, int inplace, int datesw, int delete, int append) +annosbr (int fd, char *file, char *comp, char *text, bool inplace, bool datesw, int delete, bool append) { int mode, tmpfd; char *cp, *sp; @@ -198,7 +199,7 @@ annosbr (int fd, char *file, char *comp, char *text, int inplace, int datesw, in * as they're read in. This buffer is grown as needed later. */ - if (delete >= -1 || append != 0) { + if (delete >= -1 || append) { if ((fp = fdopen(fd, "r")) == NULL) adios(NULL, "unable to fdopen file."); @@ -401,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