projects
/
mmh
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Replace lookup tables for obscure hashes with more readable code
[mmh]
/
uip
/
dropsbr.c
diff --git
a/uip/dropsbr.c
b/uip/dropsbr.c
index
f093c2f
..
e105884
100644
(file)
--- a/
uip/dropsbr.c
+++ b/
uip/dropsbr.c
@@
-6,18
+6,15
@@
** complete copyright information.
*/
** complete copyright information.
*/
-#include <h/nmh.h>
-#include <h/utils.h>
-
#include <h/mh.h>
#include <h/mh.h>
+#include <h/utils.h>
#include <h/dropsbr.h>
#include <h/tws.h>
#include <h/dropsbr.h>
#include <h/tws.h>
-
-#ifdef HAVE_ERRNO_H
-# include <errno.h>
-#endif
-
+#include <errno.h>
#include <fcntl.h>
#include <fcntl.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/stat.h>
/*
/*
@@
-25,7
+22,7
@@
** a file or maildrop.
*/
int
** a file or maildrop.
*/
int
-mbx_open(char *file, uid_t uid, gid_t gid, mode_t mode)
+mbox_open(char *file, uid_t uid, gid_t gid, mode_t mode)
{
int i, count, fd;
struct stat st;
{
int i, count, fd;
struct stat st;
@@
-47,8
+44,8
@@
mbx_open(char *file, uid_t uid, gid_t gid, mode_t mode)
#endif
case ETXTBSY:
i = errno;
#endif
case ETXTBSY:
i = errno;
- sleep(5);
- break;
+ sleep(1);
+ continue;
default:
/* just return error */
default:
/* just return error */
@@
-102,7
+99,7
@@
mbx_open(char *file, uid_t uid, gid_t gid, mode_t mode)
** Append message to end of mbox.
*/
int
** Append message to end of mbox.
*/
int
-mbx_copy(int to, int from)
+mbox_copy(int to, int from)
{
int i;
char buffer[BUFSIZ];
{
int i;
char buffer[BUFSIZ];
@@
-134,7
+131,7
@@
mbx_copy(int to, int from)
fp = strchr(ep + 1, '\n');
tp = dctime(dlocaltimenow());
snprintf(buffer, sizeof(buffer),
fp = strchr(ep + 1, '\n');
tp = dctime(dlocaltimenow());
snprintf(buffer, sizeof(buffer),
- "From %.*s %s",
+ "From %.*s %s",
(int)(fp-ep), ep, tp);
} else if (strncmp(buffer, "X-Envelope-From:",
16)==0) {
(int)(fp-ep), ep, tp);
} else if (strncmp(buffer, "X-Envelope-From:",
16)==0) {
@@
-161,7
+158,7
@@
mbx_copy(int to, int from)
ep = "nobody@nowhere";
tp = dctime(dlocaltimenow());
snprintf(buffer, sizeof(buffer),
ep = "nobody@nowhere";
tp = dctime(dlocaltimenow());
snprintf(buffer, sizeof(buffer),
- "From %s %s%s", ep, tp,
+ "From %s %s%s", ep, tp,
tmpbuffer);
}
}
tmpbuffer);
}
}
@@
-173,7
+170,7
@@
mbx_copy(int to, int from)
if (i != 0 && strncmp(buffer, "From ", 5) == 0) {
write(to, ">", 1);
}
if (i != 0 && strncmp(buffer, "From ", 5) == 0) {
write(to, ">", 1);
}
- if (write(to, buffer, strlen(buffer)) != strlen(buffer)) {
+ if (write(to, buffer, strlen(buffer)) != (int)strlen(buffer)) {
fclose(fp);
return NOTOK;
}
fclose(fp);
return NOTOK;
}
@@
-194,7
+191,7
@@
mbx_copy(int to, int from)
** Close and unlock file/maildrop.
*/
int
** Close and unlock file/maildrop.
*/
int
-mbx_close(char *mailbox, int md)
+mbox_close(char *mailbox, int md)
{
if (lkclose(md, mailbox) == 0)
return OK;
{
if (lkclose(md, mailbox) == 0)
return OK;