** prototypes
*/
int mbx_open(char *, uid_t, gid_t, mode_t);
-int mbx_copy(char *, int, int, char *, int);
+int mbx_copy(char *, int, int, int);
int mbx_close(char *, int);
** Append message to end of file or maildrop.
*/
int
-mbx_copy(char *mailbox, int md, int fd, char *text, int noisy)
+mbx_copy(char *mailbox, int md, int fd, int noisy)
{
int i, j;
off_t start, stop;
}
start = lseek(md, (off_t) 0, SEEK_CUR);
- /* If text is given, we add it to top of message */
- if (text) {
- i = strlen(text);
- if (write(md, text, i) != i)
- return NOTOK;
- }
-
for (j = 0; fgets(buffer, sizeof(buffer), fp) != NULL; j++) {
/*
** Check the first line, and make some changes.
*/
- if (j == 0 && !text) {
+ if (j == 0) {
/*
** Change the "Return-Path:" field
** (if in first line) back to "From ".
break;
}
- if (mbx_copy(file, md, fd, NULL, 1)
- == NOTOK)
+ if (mbx_copy(file, md, fd, 1) == NOTOK)
adios(file, "error writing to file");
close(fd);
done(RCV_MBX);
/* append the message */
- if (mbx_copy(file, md, fileno(stdin), NULL, 0) == NOTOK) {
+ if (mbx_copy(file, md, fileno(stdin), 0) == NOTOK) {
mbx_close(file, md);
done(RCV_MBX);
}
lseek(fd, (off_t) 0, SEEK_SET);
/* append message to file */
- if (mbx_copy(mailbox, md, fd, NULL, verbose)
- == -1) {
+ if (mbx_copy(mailbox, md, fd, verbose) == -1) {
if (verbose)
adorn("", "error writing to:");
return -1;