Support qmail if the QMAIL macro is defined. This entails exiting 111
on failure, not having to worry about dumbass /^From /, and handling
RPLINE and DTLINE.
Say EX_TEMPFAIL instead of MDELIVER_EXITCODE.
s/TMPNAMLEN/LEN_FILENAME/; it's not just used for the tmp file.
Random cleanup:
- drop some redundant comments
- s/statbuf/st/
- s/STDIN_FILENO/0/
- cleanup error messages
- other style nits
Drop <err.h> and implement custom err and errx, which doesn't need to
be passed an exit code.
Implement and use full_sleep to really sleep the specified time.
(get_filename): Don't break when gethostname truncates.
(strip_from): Don't even compile this for QMAIL.
(deliver): Take a new parameter, the subdirectory to deliver to,
instead of "new". #ifdef QMAIL, write RPLINE and DTLINE to tmp file
before copying stdin.
(deliver): Also had a huge problem: it was using the logic i came up
with for minc, to open an empty file for the target and then rename
onto that. That's fine for mh, which already loses mail this way
(once i switch refile to be like minc this will be fine), but since
other Maildir MDAs follow the official algorithm, this could clobber
mail. Switch to the official algorithm.
(run_processor): Use better error message format.
(main): If .mdeliver-processor exists, pass deliver "mdb" as the
subdirectory and then call run_processor, else pass "new".