void SubmitFile::MessageStart() { bytecount=0; sizelimit=config_sizelimit(); addrlist_map.clear(); addrlist_gdbm.Close(); if (ctlfile.fd() < 0) openctl(); unlink(namefile("D", 1).c_str()); // Might be the GDBM file int nfd=open(namefile("D",0).c_str(), O_RDWR | O_CREAT | O_TRUNC, PERMISSION); if (nfd < 0) { clog_msg_start_err(); clog_msg_str(namefile("D",0).c_str()); clog_msg_str(": "); clog_msg_errno(); } datfile.fd(nfd); rwrfcptr=rfc2045_alloc_ac(); if (rwrfcptr == NULL) clog_msg_errno(); diskfull=checkfreespace(&diskspacecheck); }
struct rfc2045 *read_message() { char buf[BUFSIZ]; struct rfc2045 *p=rfc2045_alloc_ac(); FILE *tempfp=0; if (fseek(stdin, 0L, SEEK_END) < 0 || fseek(stdin, 0L, SEEK_SET) < 0) /* Pipe, save to temp file */ { tempfp=tmpfile(); } while (fgets(buf, sizeof(buf), stdin)) { int l=strlen(buf); rfc2045_parse(p, buf, l); if (tempfp && fwrite(buf, l, 1, tempfp) != 1) { perror("fwrite"); exit(1); } } if (tempfp) /* Replace stdin */ { close(0); dup(fileno(tempfp)); fclose(tempfp); } return (p); }