X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/e6c917710e4318949cb4174cabca51a8d1822dbd..63621a81d16ab743de6b57d47578a9a2c670ad22:/uip/dropsbr.c diff --git a/uip/dropsbr.c b/uip/dropsbr.c index 7c8fe246..40ec9b80 100644 --- a/uip/dropsbr.c +++ b/uip/dropsbr.c @@ -6,22 +6,13 @@ */ #include -#include - #include +#include #include #include #include -#include "../sbr/lock_file.h" -#include "../sbr/m_mktemp.h" - -#ifdef NTOHLSWAP -# include -#else -# undef ntohl -# define ntohl(n) (n) -#endif - +#include "sbr/lock_file.h" +#include "sbr/m_mktemp.h" #include /* @@ -82,7 +73,7 @@ mbx_open (char *file, int mbx_style, uid_t uid, gid_t gid, mode_t mode) if (chmod (file, mode) < 0) { advise (file, "chmod"); } - } else if (st.st_size > (off_t) 0) { + } else if (st.st_size > 0) { int status; /* check the maildrop */ @@ -116,7 +107,7 @@ static int mbx_chk_mbox (int fd) { /* just seek to the end */ - if (lseek (fd, (off_t) 0, SEEK_END) == (off_t) NOTOK) + if (lseek(fd, 0, SEEK_END) == (off_t) NOTOK) return NOTOK; return OK; @@ -133,7 +124,7 @@ mbx_chk_mmdf (int fd) ssize_t count; char ldelim[BUFSIZ]; - count = strlen (mmdlm2); + count = LEN(MMDF_DELIM); if (lseek (fd, -count, SEEK_END) == (off_t) NOTOK) return NOTOK; @@ -142,9 +133,9 @@ mbx_chk_mmdf (int fd) ldelim[count] = 0; - if (strcmp (ldelim, mmdlm2) + if (strcmp (ldelim, MMDF_DELIM) && write (fd, "\n", 1) != 1 - && write (fd, mmdlm2, count) != count) + && write (fd, MMDF_DELIM, count) != count) return NOTOK; return OK; @@ -168,8 +159,8 @@ mbx_copy (char *mailbox, int mbx_style, int md, int fd, switch (mbx_style) { case MMDF_FORMAT: default: - j = strlen (mmdlm1); - if (write (md, mmdlm1, j) != j) + j = LEN(MMDF_DELIM); + if (write (md, MMDF_DELIM, j) != j) return NOTOK; if (text) { @@ -184,16 +175,16 @@ mbx_copy (char *mailbox, int mbx_style, int md, int fd, while ((i = read (fd, buffer, sizeof buffer - 1)) > 0) { buffer[i] = '\0'; /* Terminate for stringdex(). */ - for ( ; (j = stringdex (mmdlm1, buffer)) >= 0; buffer[j]++) + for ( ; (j = stringdex (MMDF_DELIM, buffer)) >= 0; buffer[j]++) continue; - for ( ; (j = stringdex (mmdlm2, buffer)) >= 0; buffer[j]++) + for ( ; (j = stringdex (MMDF_DELIM, buffer)) >= 0; buffer[j]++) continue; if (write (md, buffer, i) != i) return NOTOK; } - j = strlen (mmdlm2); - if (write (md, mmdlm2, j) != j) + j = LEN(MMDF_DELIM); + if (write (md, MMDF_DELIM, j) != j) return NOTOK; return (i != NOTOK ? OK : NOTOK); @@ -285,7 +276,7 @@ mbx_copy (char *mailbox, int mbx_style, int md, int fd, } fclose (fp); - lseek (fd, (off_t) 0, SEEK_END); + lseek(fd, 0, SEEK_END); return OK; }