* complete copyright information.
*/
-#include <h/nmh.h>
-#include <h/utils.h>
-
-#include <h/mh.h>
-#include <h/dropsbr.h>
-#include <h/mts.h>
-#include <h/tws.h>
-#include "../sbr/lock_file.h"
-#include "../sbr/m_mktemp.h"
-
-#ifdef NTOHLSWAP
-# include <netinet/in.h>
-#else
-# undef ntohl
-# define ntohl(n) (n)
-#endif
-
+#include "h/nmh.h"
+#include "h/mh.h"
+#include "sbr/strindex.h"
+#include "sbr/error.h"
+#include "h/utils.h"
+#include "h/dropsbr.h"
+#include "h/mts.h"
+#include "h/tws.h"
+#include "sbr/lock_file.h"
+#include "sbr/m_mktemp.h"
#include <fcntl.h>
/*
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 */
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;
ssize_t count;
char ldelim[BUFSIZ];
- count = strlen (mmdlm2);
+ count = LEN(MMDF_DELIM);
if (lseek (fd, -count, SEEK_END) == (off_t) NOTOK)
return NOTOK;
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;
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) {
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);
+ return i == NOTOK ? NOTOK : OK;
case MBOX_FORMAT:
if ((j = dup (fd)) == NOTOK)
}
fclose (fp);
- lseek (fd, (off_t) 0, SEEK_END);
+ lseek(fd, 0, SEEK_END);
return OK;
}