re-implemented tempfilename() and tempfile(): using mkstemp() if available