Rename mymalloc() to safe_malloc(), use PATH_MAX.
Automatically zero-pad job number, check snprintf() for errors.
Rename fcreated, use a bool.
Move parts of writefile() out into their own functions.
Split writefile() out into separate source file.
Create common function file, pass env to writefile() explicitly.
Major refactoring of writefile().
Minor error condition cleanups.
Improved error handling in get_mail_name()
Further cleanup of main().